From d416ea57a255d4a3ed14a5df86c200fa47ea3530 Mon Sep 17 00:00:00 2001 From: nixel2007 Date: Wed, 30 Oct 2024 03:36:40 +0000 Subject: [PATCH] deploy: 810c04ade64b5948b7509a3183a868c4126104be --- .../results/descriptions/Code_Inspection.json | 1632 +- qodana/results/metaInformation.json | 4 +- .../results/projectStructure/qodana.spdx.json | 8 +- .../thirdPartySoftwareList.json | 8 +- qodana/results/promo.json | 33 +- qodana/results/qodana.sarif.json | 21204 ++++++++-------- qodana/results/sanity.json | 40 +- 7 files changed, 11420 insertions(+), 11509 deletions(-) diff --git a/qodana/results/descriptions/Code_Inspection.json b/qodana/results/descriptions/Code_Inspection.json index b7f19a62df1..0d51879d0bc 100644 --- a/qodana/results/descriptions/Code_Inspection.json +++ b/qodana/results/descriptions/Code_Inspection.json @@ -24,137 +24,6 @@ } ] }, - { - "name": "JVM languages", - "inspections": [ - { - "shortName": "OverrideOnly", - "displayName": "Method can only be overridden", - "enabled": true, - "description": "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." - }, - { - "shortName": "SerializableHasSerialVersionUIDField", - "displayName": "Serializable class without 'serialVersionUID'", - "enabled": false, - "description": "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." - }, - { - "shortName": "SystemGetProperty", - "displayName": "Call to 'System.getProperty(str)' could be simplified", - "enabled": true, - "description": "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)." - }, - { - "shortName": "EmptyMethod", - "displayName": "Empty method", - "enabled": false, - "description": "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." - }, - { - "shortName": "SuppressionAnnotation", - "displayName": "Inspection suppression annotation", - "enabled": false, - "description": "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 stringProvider() {\n return Stream.of(\"foo\", \"bar\");\n }\n" - }, - { - "shortName": "BlockingMethodInNonBlockingContext", - "displayName": "Possibly blocking call in non-blocking context", - "enabled": true, - "description": "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 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)" - }, - { - "shortName": "MissingDeprecatedAnnotationOnScheduledForRemovalApi", - "displayName": "Missing '@Deprecated' annotation on scheduled for removal API", - "enabled": true, - "description": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` without `@Deprecated`.\n\nExample:\n\n\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n\nAfter the quick-fix is applied the result looks like:\n\n\n @Deprecated\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n" - }, - { - "shortName": "SourceToSinkFlow", - "displayName": "Non-safe string is passed to safe method", - "enabled": true, - "description": "Reports cases when a non-safe object is passed to a method with a parameter marked with `@Untainted` annotations, returned from annotated methods or assigned to annotated fields, parameters, or local variables. Kotlin `set` and `get` methods for fields are not supported as entry points.\n\n\nA safe object (in the same class) is:\n\n* a string literal, interface instance, or enum object\n* a result of a call of a method that is marked as `@Untainted`\n* a private field, which is assigned only with a string literal and has a safe initializer\n* a final field, which has a safe initializer\n* local variable or parameter that are marked as `@Untainted` and are not assigned from non-safe objects\nThis field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable.\n\nAlso static final fields are considered as safe.\n\n\nThe analysis is performed only inside one file. To process dependencies from other classes, use options.\nThe analysis extends to private or static methods and has a limit of depth propagation.\n\n\nExample:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n if (b) s1 = s;\n sink(s);\n }\n\n String sink(@Untainted String s) {}\n\n\nHere we do not have non-safe string assignments to `s` so a warning is not produced. On the other hand:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n s1 = foo();\n if (b) s = s1;\n sink(s); // warning here\n }\n\n String foo();\n\n String sink(@Untainted String s) {}\n\n\nHere we have a warning since `s1` has an unknown state after `foo` call result assignment.\n\nNew in 2021.2" - }, - { - "shortName": "Dependency", - "displayName": "Illegal package dependencies", - "enabled": true, - "description": "Reports illegal dependencies between scopes according to the dependency rules given. Dependency rules can be used to prohibit usage from a scope to another scope.\n\nUse the **Configure dependency rules** button below to customize validation rules." - }, - { - "shortName": "ThreadRun", - "displayName": "Call to 'Thread.run()'", - "enabled": true, - "description": "Reports calls to `run()` on `java.lang.Thread` or any of its subclasses.\n\n\nWhile occasionally intended, this is usually a mistake, because `run()` doesn't start a new thread.\nTo execute the code in a separate thread, `start()` should be used." - }, - { - "shortName": "UnstableApiUsage", - "displayName": "Unstable API Usage", - "enabled": true, - "description": "Reports usages of an API marked with one of the annotations as unstable. Such an API may be changed or removed in future versions, breaking the code that uses it.\n\nThe annotations which are used to mark unstable APIs are shown in the list below.\n\nBy default, the inspection ignores usages of unstable APIs\nif their declarations are located in sources of the same project. In such cases it'll be possible to update the usages when you change APIs.\nHowever, it may be inconvenient if the project is big, so one can switch off the **Ignore API declared in this project** option to report\nthe usages of unstable APIs declared in both the project sources and libraries." - }, - { - "shortName": "Since15", - "displayName": "Usages of API which isn't available at the configured language level", - "enabled": false, - "description": "Reports usages of the API that is unavailable at the configured language level. This inspection does 3 things:\n\n* Highlight usage of generified classes when the language level is below Java 7.\n* Highlight when default methods are not overridden and the language level is below Java 8.\n* Highlight usage of API when the language level is lower than marked using the `@since` tag in the documentation.\n\n\nUse the **Forbid API usages** option to forbid usages of the API in respect to the project or custom language level." - }, - { - "shortName": "MustAlreadyBeRemovedApi", - "displayName": "API must already be removed", - "enabled": true, - "description": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` that should have been removed in the current version of the declaring library.\n\nIt compares the specified scheduled removal version with the version that you can set below.\n\n\nSpecify the version as a string separated with dots and optionally postfixed with\n`alpha`, `beta`, `snapshot`, or `eap`.\n\nExamples of valid versions: `1.0`, `2.3.1`, `2018.1`, `7.5-snapshot`, `3.0-eap`.\n\n\nVersion comparison is intuitive: `1.0 < 2.0`, `1.0-eap < 1.0`, `2.3-snapshot < 2.3` and so on.\nFor detailed comparison logic, refer to the implementation of [VersionComparatorUtil](https://github.com/JetBrains/intellij-community/blob/master/platform/util-rt/src/com/intellij/util/text/VersionComparatorUtil.java)." - }, - { - "shortName": "UnstableTypeUsedInSignature", - "displayName": "Unstable type is used in signature", - "enabled": false, - "description": "Reports declarations of classes, methods, and fields that reference an unstable API type in the signature, but are not marked with the same unstable annotation.\n\n\nThis inspection ensures that the signatures of a public API do not expose any *unstable* (internal, experimental) types.\nFor example, if a method returns an *experimental* class, the method itself is considered *experimental*\nbecause incompatible changes of the type (deletion or move to another package) lead to incompatible method signature changes.\n\nUse the list below to specify which annotations mark an unstable API." - }, - { - "shortName": "UrlHashCode", - "displayName": "Call to 'equals()' or 'hashCode()' on 'URL' object", - "enabled": true, - "description": "Reports `hashCode()` and `equals()` calls on `java.net.URL` objects and calls that add `URL` objects to maps and sets.\n\n\n`URL`'s `equals()` and `hashCode()` methods can perform a DNS lookup to resolve the host name.\nThis may cause significant delays, depending on the availability and speed of the network and the DNS server.\nUsing `java.net.URI` instead of `java.net.URL` will avoid the DNS lookup.\n\n**Example:**\n\n\n boolean urlEquals(URL url1, URL url2) {\n return url1.equals(url2);\n }\n" - }, - { - "shortName": "NonExtendableApiUsage", - "displayName": "Class, interface, or method should not be extended", - "enabled": true, - "description": "Reports classes, interfaces and methods that extend, implement, or override API elements marked with `@ApiStatus.NonExtendable`.\n\n\nThe `@ApiStatus.NonExtendable` annotation indicates that the class, interface, or method **must not be extended,\nimplemented, or overridden** .\nSince casting such interfaces and classes to the internal library implementation is rather common,\nif a client provides a different implementation, you will get `ClassCastException`.\nAdding new abstract methods to such classes and interfaces will break the compatibility with the client's implementations." - }, - { - "shortName": "IllegalDependencyOnInternalPackage", - "displayName": "Illegal dependency on internal package", - "enabled": false, - "description": "Reports references in modules without `module-info.java` on packages which are not exported from named modules.\n\nSuch configuration may occur when some modules in the project are already migrated to Java modules but others are still non-modular.\nBy analogy to the JDK, such non-modular code should not get access to the code in named modules which is not explicitly exported." - }, - { - "shortName": "UsagesOfObsoleteApi", - "displayName": "Usages of ApiStatus.@Obsolete", - "enabled": false, - "description": "Reports declarations (classes, methods, fields) annotated as `@ApiStatus.Obsolete`.\n\n\nSometimes it's impossible to delete the current API, though it might not work correctly, there is a newer, or better, or more generic API.\nThis way, it's a weaker variant of `@Deprecated` annotation.\nThe annotated API is not supposed to be used in the new code, but it's permitted to postpone the migration of the existing code,\ntherefore the usage is not considered a warning." - }, - { - "shortName": "SqlSourceToSinkFlow", - "displayName": "Non-safe string is used as SQL", - "enabled": true, - "description": "Reports cases for Java and Kotlin languages when a non-safe string is passed to a method as a SQL query. It can be a cause of SQL injections. The list of methods is taken from **Settings** - **Language Injections** for `SQL`, `JPA QL`, `Hibernate QL` and `PostgreSQL`\n\n\nA safe object is:\n\n* a string literal, interface instance, or enum object, int and its wrapper, boolean and its wrapper, class object\n* a result of a call of a method, whose receiver and arguments are safe\n* a private field in the same file, which is assigned only with a string literal and has a safe initializer\n* a final field in the same file, which has a safe initializer\n* a local variable which is assigned from safe-objects\nThis field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable.\n\nStatic final fields are considered as safe.\n\n\nThe analysis is performed only inside one file.\nExample:\n\n\n public void save(String sql) {\n JdbcTemplate jdbcTemplate = new JdbcTemplate();\n jdbcTemplate.queryForList(sql);\n }\n\nNew in 2023.2" - }, - { - "shortName": "UastIncorrectMimeTypeInspection", - "displayName": "Incorrect MIME Type declaration", - "enabled": true, - "description": "Reports incorrect MIME types (for example, in `Content-Type` strings) for HTTP servers and clients." - }, - { - "shortName": "UastIncorrectHttpHeaderInspection", - "displayName": "Unknown HTTP header", - "enabled": true, - "description": "Reports unknown HTTP headers that do not match any [publicly\nknown headers](https://www.iana.org/assignments/message-headers/message-headers.xml). The quick fix suggests adding the header to the list of custom headers to avoid triggering this inspection in the\nfuture.\n\nCustom HTTP headers are listed for the inspection with the same name in the HTTP Client group." - } - ] - }, { "name": "Kotlin", "inspections": [ @@ -766,109 +635,240 @@ ] }, { - "name": "Redundant constructs", + "name": "JVM languages", "inspections": [ { - "shortName": "SimpleRedundantLet", - "displayName": "Redundant receiver-based 'let' call", - "enabled": false, - "description": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + "shortName": "OverrideOnly", + "displayName": "Method can only be overridden", + "enabled": true, + "description": "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." }, { - "shortName": "RemoveSingleExpressionStringTemplate", - "displayName": "Redundant string template", + "shortName": "SerializableHasSerialVersionUIDField", + "displayName": "Serializable class without 'serialVersionUID'", "enabled": false, - "description": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + "description": "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." }, { - "shortName": "RedundantRequireNotNullCall", - "displayName": "Redundant 'requireNotNull' or 'checkNotNull' call", - "enabled": false, - "description": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + "shortName": "SystemGetProperty", + "displayName": "Call to 'System.getProperty(str)' could be simplified", + "enabled": true, + "description": "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)." }, { - "shortName": "RedundantEnumConstructorInvocation", - "displayName": "Redundant enum constructor invocation", + "shortName": "EmptyMethod", + "displayName": "Empty method", "enabled": false, - "description": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + "description": "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." }, { - "shortName": "WhenWithOnlyElse", - "displayName": "'when' has only 'else' branch and can be simplified", + "shortName": "SuppressionAnnotation", + "displayName": "Inspection suppression annotation", "enabled": false, - "description": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, the quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + "description": "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 stringProvider() {\n return Stream.of(\"foo\", \"bar\");\n }\n" }, { - "shortName": "UnnecessaryOptInAnnotation", - "displayName": "Unnecessary '@OptIn' annotation", - "enabled": false, - "description": "Reports unnecessary opt-in annotations that can be safely removed.\n\n`@OptIn` annotation is required for the code using experimental APIs that can change\nany time in the future. This annotation becomes useless and possibly misleading if no such API is used\n(e.g., when the experimental API becomes stable and does not require opting in its usage anymore).\n\n\n**Remove annotation** quick-fix can be used to remove the unnecessary `@OptIn` annotation.\n\nExample:\n\n\n @OptIn(ExperimentalApi::class)\n fun foo(x: Bar) {\n x.baz()\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Bar) {\n x.baz()\n }\n" + "shortName": "BlockingMethodInNonBlockingContext", + "displayName": "Possibly blocking call in non-blocking context", + "enabled": true, + "description": "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 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)" }, { - "shortName": "UnusedSymbol", - "displayName": "Unused symbol", - "enabled": false, - "description": "Reports symbols that are not used or not reachable from entry points." + "shortName": "MissingDeprecatedAnnotationOnScheduledForRemovalApi", + "displayName": "Missing '@Deprecated' annotation on scheduled for removal API", + "enabled": true, + "description": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` without `@Deprecated`.\n\nExample:\n\n\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n\nAfter the quick-fix is applied the result looks like:\n\n\n @Deprecated\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n" }, { - "shortName": "RedundantInnerClassModifier", - "displayName": "Redundant 'inner' modifier", - "enabled": false, - "description": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + "shortName": "SourceToSinkFlow", + "displayName": "Non-safe string is passed to safe method", + "enabled": true, + "description": "Reports cases when a non-safe object is passed to a method with a parameter marked with `@Untainted` annotations, returned from annotated methods or assigned to annotated fields, parameters, or local variables. Kotlin `set` and `get` methods for fields are not supported as entry points.\n\n\nA safe object (in the same class) is:\n\n* a string literal, interface instance, or enum object\n* a result of a call of a method that is marked as `@Untainted`\n* a private field, which is assigned only with a string literal and has a safe initializer\n* a final field, which has a safe initializer\n* local variable or parameter that are marked as `@Untainted` and are not assigned from non-safe objects\nThis field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable.\n\nAlso static final fields are considered as safe.\n\n\nThe analysis is performed only inside one file. To process dependencies from other classes, use options.\nThe analysis extends to private or static methods and has a limit of depth propagation.\n\n\nExample:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n if (b) s1 = s;\n sink(s);\n }\n\n String sink(@Untainted String s) {}\n\n\nHere we do not have non-safe string assignments to `s` so a warning is not produced. On the other hand:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n s1 = foo();\n if (b) s = s1;\n sink(s); // warning here\n }\n\n String foo();\n\n String sink(@Untainted String s) {}\n\n\nHere we have a warning since `s1` has an unknown state after `foo` call result assignment.\n\nNew in 2021.2" }, { - "shortName": "UnnecessaryVariable", - "displayName": "Unnecessary local variable", - "enabled": false, - "description": "Reports local variables that are used only in the very next `return` statement or are exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int): Int {\n val c = a + b\n return c\n }\n\nAfter the quick-fix is applied:\n\n\n fun sum(a: Int, b: Int): Int {\n return a + b\n }\n\nConfigure the inspection:\n\nUse the **Report immediately returned variables** option to report immediately returned variables.\nWhen given descriptive names, such variables may improve the code readability in some cases, that's why this option is disabled by default." + "shortName": "Dependency", + "displayName": "Illegal package dependencies", + "enabled": true, + "description": "Reports illegal dependencies between scopes according to the dependency rules given. Dependency rules can be used to prohibit usage from a scope to another scope.\n\nUse the **Configure dependency rules** button below to customize validation rules." }, { - "shortName": "RedundantLabeledReturnOnLastExpressionInLambda", - "displayName": "Redundant labeled return on the last expression in a lambda", - "enabled": false, - "description": "Reports labeled returns used on the last expressions in lambdas.\n\nSuch returns are redundant and can be safely removed.\n\n**Example:**\n\n\n fun foo() {\n listOf(1,2,3).find {\n return@find true\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1,2,3).find {\n true\n }\n }\n" + "shortName": "ThreadRun", + "displayName": "Call to 'Thread.run()'", + "enabled": true, + "description": "Reports calls to `run()` on `java.lang.Thread` or any of its subclasses.\n\n\nWhile occasionally intended, this is usually a mistake, because `run()` doesn't start a new thread.\nTo execute the code in a separate thread, `start()` should be used." }, { - "shortName": "RedundantWith", - "displayName": "Redundant 'with' call", - "enabled": false, - "description": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + "shortName": "UnstableApiUsage", + "displayName": "Unstable API Usage", + "enabled": true, + "description": "Reports usages of an API marked with one of the annotations as unstable. Such an API may be changed or removed in future versions, breaking the code that uses it.\n\nThe annotations which are used to mark unstable APIs are shown in the list below.\n\nBy default, the inspection ignores usages of unstable APIs\nif their declarations are located in sources of the same project. In such cases it'll be possible to update the usages when you change APIs.\nHowever, it may be inconvenient if the project is big, so one can switch off the **Ignore API declared in this project** option to report\nthe usages of unstable APIs declared in both the project sources and libraries." }, { - "shortName": "KotlinRedundantDiagnosticSuppress", - "displayName": "Redundant diagnostic suppression", + "shortName": "Since15", + "displayName": "Usages of API which isn't available at the configured language level", "enabled": false, - "description": "Reports usages of `@Suppress` annotations that can be safely removed because the compiler diagnostic they affect is no longer applicable in this context.\n\n**Example:**\n\n\n fun doSmth(@Suppress(\"UNUSED_PARAMETER\") used: Int) {\n println(used)\n }\n\nAfter the quick-fix is applied:\n\n\n fun doSmth(used: Int) {\n println(used)\n }\n" + "description": "Reports usages of the API that is unavailable at the configured language level. This inspection does 3 things:\n\n* Highlight usage of generified classes when the language level is below Java 7.\n* Highlight when default methods are not overridden and the language level is below Java 8.\n* Highlight usage of API when the language level is lower than marked using the `@since` tag in the documentation.\n\n\nUse the **Forbid API usages** option to forbid usages of the API in respect to the project or custom language level." }, { - "shortName": "ConstantConditionIf", - "displayName": "Condition of 'if' expression is constant", - "enabled": false, - "description": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nThe quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + "shortName": "MustAlreadyBeRemovedApi", + "displayName": "API must already be removed", + "enabled": true, + "description": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` that should have been removed in the current version of the declaring library.\n\nIt compares the specified scheduled removal version with the version that you can set below.\n\n\nSpecify the version as a string separated with dots and optionally postfixed with\n`alpha`, `beta`, `snapshot`, or `eap`.\n\nExamples of valid versions: `1.0`, `2.3.1`, `2018.1`, `7.5-snapshot`, `3.0-eap`.\n\n\nVersion comparison is intuitive: `1.0 < 2.0`, `1.0-eap < 1.0`, `2.3-snapshot < 2.3` and so on.\nFor detailed comparison logic, refer to the implementation of [VersionComparatorUtil](https://github.com/JetBrains/intellij-community/blob/master/platform/util-rt/src/com/intellij/util/text/VersionComparatorUtil.java)." }, { - "shortName": "RedundantLambdaArrow", - "displayName": "Redundant lambda arrow", + "shortName": "UnstableTypeUsedInSignature", + "displayName": "Unstable type is used in signature", "enabled": false, - "description": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + "description": "Reports declarations of classes, methods, and fields that reference an unstable API type in the signature, but are not marked with the same unstable annotation.\n\n\nThis inspection ensures that the signatures of a public API do not expose any *unstable* (internal, experimental) types.\nFor example, if a method returns an *experimental* class, the method itself is considered *experimental*\nbecause incompatible changes of the type (deletion or move to another package) lead to incompatible method signature changes.\n\nUse the list below to specify which annotations mark an unstable API." }, { - "shortName": "RedundantValueArgument", - "displayName": "Redundant value argument", - "enabled": false, - "description": "Reports arguments that are equal to the default values of the corresponding parameters.\n\n**Example:**\n\n\n fun foo(x: Int, y: Int = 2) {}\n\n fun bar() {\n foo(1, 2)\n }\n\nAfter the quick-fix is applied:\n\n\n fun bar() {\n foo(1)\n }\n" + "shortName": "UrlHashCode", + "displayName": "Call to 'equals()' or 'hashCode()' on 'URL' object", + "enabled": true, + "description": "Reports `hashCode()` and `equals()` calls on `java.net.URL` objects and calls that add `URL` objects to maps and sets.\n\n\n`URL`'s `equals()` and `hashCode()` methods can perform a DNS lookup to resolve the host name.\nThis may cause significant delays, depending on the availability and speed of the network and the DNS server.\nUsing `java.net.URI` instead of `java.net.URL` will avoid the DNS lookup.\n\n**Example:**\n\n\n boolean urlEquals(URL url1, URL url2) {\n return url1.equals(url2);\n }\n" }, { - "shortName": "ReplaceWithIgnoreCaseEquals", - "displayName": "Should be replaced with 'equals(..., ignoreCase = true)'", - "enabled": false, - "description": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + "shortName": "NonExtendableApiUsage", + "displayName": "Class, interface, or method should not be extended", + "enabled": true, + "description": "Reports classes, interfaces and methods that extend, implement, or override API elements marked with `@ApiStatus.NonExtendable`.\n\n\nThe `@ApiStatus.NonExtendable` annotation indicates that the class, interface, or method **must not be extended,\nimplemented, or overridden** .\nSince casting such interfaces and classes to the internal library implementation is rather common,\nif a client provides a different implementation, you will get `ClassCastException`.\nAdding new abstract methods to such classes and interfaces will break the compatibility with the client's implementations." }, { - "shortName": "RedundantCompanionReference", - "displayName": "Redundant 'Companion' reference", + "shortName": "IllegalDependencyOnInternalPackage", + "displayName": "Illegal dependency on internal package", "enabled": false, - "description": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" + "description": "Reports references in modules without `module-info.java` on packages which are not exported from named modules.\n\nSuch configuration may occur when some modules in the project are already migrated to Java modules but others are still non-modular.\nBy analogy to the JDK, such non-modular code should not get access to the code in named modules which is not explicitly exported." + }, + { + "shortName": "UsagesOfObsoleteApi", + "displayName": "Usages of ApiStatus.@Obsolete", + "enabled": false, + "description": "Reports declarations (classes, methods, fields) annotated as `@ApiStatus.Obsolete`.\n\n\nSometimes it's impossible to delete the current API, though it might not work correctly, there is a newer, or better, or more generic API.\nThis way, it's a weaker variant of `@Deprecated` annotation.\nThe annotated API is not supposed to be used in the new code, but it's permitted to postpone the migration of the existing code,\ntherefore the usage is not considered a warning." + }, + { + "shortName": "SqlSourceToSinkFlow", + "displayName": "Non-safe string is used as SQL", + "enabled": true, + "description": "Reports cases for Java and Kotlin languages when a non-safe string is passed to a method as a SQL query. It can be a cause of SQL injections. The list of methods is taken from **Settings** - **Language Injections** for `SQL`, `JPA QL`, `Hibernate QL` and `PostgreSQL`\n\n\nA safe object is:\n\n* a string literal, interface instance, or enum object, int and its wrapper, boolean and its wrapper, class object\n* a result of a call of a method, whose receiver and arguments are safe\n* a private field in the same file, which is assigned only with a string literal and has a safe initializer\n* a final field in the same file, which has a safe initializer\n* a local variable which is assigned from safe-objects\nThis field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable.\n\nStatic final fields are considered as safe.\n\n\nThe analysis is performed only inside one file.\nExample:\n\n\n public void save(String sql) {\n JdbcTemplate jdbcTemplate = new JdbcTemplate();\n jdbcTemplate.queryForList(sql);\n }\n\nNew in 2023.2" + }, + { + "shortName": "UastIncorrectMimeTypeInspection", + "displayName": "Incorrect MIME Type declaration", + "enabled": true, + "description": "Reports incorrect MIME types (for example, in `Content-Type` strings) for HTTP servers and clients." + }, + { + "shortName": "UastIncorrectHttpHeaderInspection", + "displayName": "Unknown HTTP header", + "enabled": true, + "description": "Reports unknown HTTP headers that do not match any [publicly\nknown headers](https://www.iana.org/assignments/message-headers/message-headers.xml). The quick fix suggests adding the header to the list of custom headers to avoid triggering this inspection in the\nfuture.\n\nCustom HTTP headers are listed for the inspection with the same name in the HTTP Client group." + } + ] + }, + { + "name": "Redundant constructs", + "inspections": [ + { + "shortName": "SimpleRedundantLet", + "displayName": "Redundant receiver-based 'let' call", + "enabled": false, + "description": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + }, + { + "shortName": "RemoveSingleExpressionStringTemplate", + "displayName": "Redundant string template", + "enabled": false, + "description": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + }, + { + "shortName": "RedundantRequireNotNullCall", + "displayName": "Redundant 'requireNotNull' or 'checkNotNull' call", + "enabled": false, + "description": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + }, + { + "shortName": "RedundantEnumConstructorInvocation", + "displayName": "Redundant enum constructor invocation", + "enabled": false, + "description": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + }, + { + "shortName": "WhenWithOnlyElse", + "displayName": "'when' has only 'else' branch and can be simplified", + "enabled": false, + "description": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, the quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + }, + { + "shortName": "UnnecessaryOptInAnnotation", + "displayName": "Unnecessary '@OptIn' annotation", + "enabled": false, + "description": "Reports unnecessary opt-in annotations that can be safely removed.\n\n`@OptIn` annotation is required for the code using experimental APIs that can change\nany time in the future. This annotation becomes useless and possibly misleading if no such API is used\n(e.g., when the experimental API becomes stable and does not require opting in its usage anymore).\n\n\n**Remove annotation** quick-fix can be used to remove the unnecessary `@OptIn` annotation.\n\nExample:\n\n\n @OptIn(ExperimentalApi::class)\n fun foo(x: Bar) {\n x.baz()\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Bar) {\n x.baz()\n }\n" + }, + { + "shortName": "UnusedSymbol", + "displayName": "Unused symbol", + "enabled": false, + "description": "Reports symbols that are not used or not reachable from entry points." + }, + { + "shortName": "RedundantInnerClassModifier", + "displayName": "Redundant 'inner' modifier", + "enabled": false, + "description": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + }, + { + "shortName": "UnnecessaryVariable", + "displayName": "Unnecessary local variable", + "enabled": false, + "description": "Reports local variables that are used only in the very next `return` statement or are exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int): Int {\n val c = a + b\n return c\n }\n\nAfter the quick-fix is applied:\n\n\n fun sum(a: Int, b: Int): Int {\n return a + b\n }\n\nConfigure the inspection:\n\nUse the **Report immediately returned variables** option to report immediately returned variables.\nWhen given descriptive names, such variables may improve the code readability in some cases, that's why this option is disabled by default." + }, + { + "shortName": "RedundantLabeledReturnOnLastExpressionInLambda", + "displayName": "Redundant labeled return on the last expression in a lambda", + "enabled": false, + "description": "Reports labeled returns used on the last expressions in lambdas.\n\nSuch returns are redundant and can be safely removed.\n\n**Example:**\n\n\n fun foo() {\n listOf(1,2,3).find {\n return@find true\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1,2,3).find {\n true\n }\n }\n" + }, + { + "shortName": "RedundantWith", + "displayName": "Redundant 'with' call", + "enabled": false, + "description": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + }, + { + "shortName": "KotlinRedundantDiagnosticSuppress", + "displayName": "Redundant diagnostic suppression", + "enabled": false, + "description": "Reports usages of `@Suppress` annotations that can be safely removed because the compiler diagnostic they affect is no longer applicable in this context.\n\n**Example:**\n\n\n fun doSmth(@Suppress(\"UNUSED_PARAMETER\") used: Int) {\n println(used)\n }\n\nAfter the quick-fix is applied:\n\n\n fun doSmth(used: Int) {\n println(used)\n }\n" + }, + { + "shortName": "ConstantConditionIf", + "displayName": "Condition of 'if' expression is constant", + "enabled": false, + "description": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nThe quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + }, + { + "shortName": "RedundantLambdaArrow", + "displayName": "Redundant lambda arrow", + "enabled": false, + "description": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + }, + { + "shortName": "RedundantValueArgument", + "displayName": "Redundant value argument", + "enabled": false, + "description": "Reports arguments that are equal to the default values of the corresponding parameters.\n\n**Example:**\n\n\n fun foo(x: Int, y: Int = 2) {}\n\n fun bar() {\n foo(1, 2)\n }\n\nAfter the quick-fix is applied:\n\n\n fun bar() {\n foo(1)\n }\n" + }, + { + "shortName": "ReplaceWithIgnoreCaseEquals", + "displayName": "Should be replaced with 'equals(..., ignoreCase = true)'", + "enabled": false, + "description": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + }, + { + "shortName": "RedundantCompanionReference", + "displayName": "Redundant 'Companion' reference", + "enabled": false, + "description": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" }, { "shortName": "RedundantSamConstructor", @@ -2326,330 +2326,115 @@ ] }, { - "name": "Error handling", + "name": "Declaration redundancy", "inspections": [ { - "shortName": "UncheckedExceptionClass", - "displayName": "Unchecked 'Exception' class", + "shortName": "UnusedReturnValue", + "displayName": "Method can be made 'void'", "enabled": false, - "description": "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" + "description": "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." }, { - "shortName": "CheckedExceptionClass", - "displayName": "Checked exception class", + "shortName": "UnusedLibrary", + "displayName": "Unused library", "enabled": false, - "description": "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" + "description": "Reports libraries attached to the specified inspection scope that are not used directly in code." }, { - "shortName": "NestedTryStatement", - "displayName": "Nested 'try' statement", + "shortName": "RedundantLambdaParameterType", + "displayName": "Redundant lambda parameter types", "enabled": false, - "description": "Reports nested `try` statements.\n\nNested `try` statements\nmay result in unclear code and should probably have their `catch` and `finally` sections\nmerged." + "description": "Reports lambda formal parameter types that are redundant because they can be inferred from the context.\n\n**Example:**\n\n\n Map 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 map = ...\n map.forEach((s, i) -> log.info(s + \"=\" + i));\n" }, { - "shortName": "BadExceptionThrown", - "displayName": "Prohibited exception thrown", + "shortName": "CanBeFinal", + "displayName": "Declaration can have 'final' modifier", "enabled": false, - "description": "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." + "description": "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." }, { - "shortName": "CaughtExceptionImmediatelyRethrown", - "displayName": "Caught exception is immediately rethrown", - "enabled": true, - "description": "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" + "shortName": "RedundantExplicitClose", + "displayName": "Redundant 'close()'", + "enabled": false, + "description": "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" }, { - "shortName": "ThrowFromFinallyBlock", - "displayName": "'throw' inside 'finally' block", - "enabled": true, - "description": "Reports `throw` statements inside `finally` blocks. While occasionally intended, such `throw` statements can hide exceptions thrown from the `try` and `catch` blocks, thereby complicating the debugging process.\n\n**Example:**\n\n\n class Fascinating {\n void doTask(Task t) {\n try {\n t.activity();\n } finally {\n if (!t.finish()) {\n throw new IllegalStateException();\n }\n }\n }\n }\n\nUse the **Warn everywhere declared exceptions may be thrown** option\nto warn on method calls to methods that declare exceptions as well." + "shortName": "UnusedLabel", + "displayName": "Unused label", + "enabled": false, + "description": "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" }, { - "shortName": "ContinueOrBreakFromFinallyBlock", - "displayName": "'continue' or 'break' inside 'finally' block", - "enabled": true, - "description": "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" + "shortName": "DefaultAnnotationParam", + "displayName": "Default annotation parameter value", + "enabled": false, + "description": "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" }, { - "shortName": "BadExceptionDeclared", - "displayName": "Prohibited exception declared", + "shortName": "WeakerAccess", + "displayName": "Declaration access can be weaker", "enabled": false, - "description": "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." + "description": "Reports fields, methods or classes that may have their access modifier narrowed down.\n\nExample:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n void bar(String x, String y) { } // can be private\n }\n\nAfter the quick-fix is applied:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n private void bar(String x, String y) { }\n }\n\nUse the inspection's options to define the rules for the modifier change suggestions." }, { - "shortName": "ReturnFromFinallyBlock", - "displayName": "'return' inside 'finally' block", - "enabled": true, - "description": "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" + "shortName": "Java9RedundantRequiresStatement", + "displayName": "Redundant 'requires' directive in module-info", + "enabled": false, + "description": "Reports redundant `requires` directives in Java Platform Module System `module-info.java` files. A `requires` directive is redundant when a module `A` requires a module `B`, but the code in module `A` doesn't import any packages or classes from `B`. Furthermore, all modules have an implicitly declared dependence on the `java.base` module, therefore a `requires java.base;` directive is always redundant.\n\n\nThe quick-fix deletes the redundant `requires` directive.\nIf the deleted dependency re-exported modules that are actually used, the fix adds a `requires` directives for these modules.\n\nThis inspection only reports if the language level of the project or module is 9 or higher.\n\nNew in 2017.1" }, { - "shortName": "TooBroadThrows", - "displayName": "Overly broad 'throws' clause", + "shortName": "FunctionalExpressionCanBeFolded", + "displayName": "Functional expression can be folded", "enabled": false, - "description": "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." + "description": "Reports method references or lambda expressions that point to a method of their own functional interface type and hence can be replaced with their qualifiers removing unnecessary object allocation.\n\nExample:\n\n\n SwingUtilities.invokeLater(r::run);\n SwingUtilities.invokeAndWait(() -> r.run());\n\nAfter the quick-fix is applied:\n\n\n SwingUtilities.invokeLater(r);\n SwingUtilities.invokeAndWait(r);\n\nThis inspection reports only if the language level of the project or module is 8 or higher." }, { - "shortName": "BadExceptionCaught", - "displayName": "Prohibited 'Exception' caught", + "shortName": "unused", + "displayName": "Unused declaration", "enabled": false, - "description": "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." + "description": "Reports classes, methods, or fields that are not used or unreachable from the entry points.\n\nAn entry point can be a main method, tests, classes from outside the specified scope, classes accessible from\n`module-info.java`, and so on. It is possible to configure custom entry points by using name patterns or annotations.\n\n**Example:**\n\n\n public class Department {\n private Organization myOrganization;\n }\n\nIn this example, `Department` explicitly references `Organization` but if `Department` class itself is unused, then inspection will report both classes.\n\n\nThe inspection also reports parameters that are not used by their methods and all method implementations and overriders, as well as local\nvariables that are declared but not used.\n\n\n**Note:** Some unused members may not be reported during in-editor code highlighting. For performance reasons, a non-private member is\nchecked only when its name rarely occurs in the project.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the visibility settings below to configure members to be reported. For example, configuring report `private` methods only means\nthat `public` methods of `private` inner class will be reported but `protected` methods of top level class\nwill be ignored.\n\n\nUse the **entry points** tab to configure entry points to be considered during the inspection run.\n\nYou can add entry points manually when inspection results are ready.\n\nIf your code uses unsupported frameworks, there are several options:\n\n* If the framework relies on annotations, use the **Annotations...** button to configure the framework's annotations.\n* If the framework doesn't rely on annotations, try to configure class name patterns that are expected by the framework.\n\nThis way the annotated code accessible by the framework internals will be treated as used." }, { - "shortName": "InstanceofCatchParameter", - "displayName": "'instanceof' on 'catch' parameter", + "shortName": "ProtectedMemberInFinalClass", + "displayName": "'protected' member in 'final' class", "enabled": false, - "description": "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" + "description": "Reports `protected` members in `final`classes.\n\nSince `final` classes cannot be inherited, marking the method as `protected`\nmay be confusing. It is better to declare such members as `private` or package-visible instead.\n\n**Example:**\n\n record Bar(int a, int b) {\n protected int sum() { \n return a + b;\n }\n }\n\nAfter the quick-fix is applied:\n\n record Bar(int a, int b) {\n int sum() { \n return a + b;\n }\n }\n\nAs shown in the example, a class can be marked as `final` explicitly or implicitly." }, { - "shortName": "FinallyBlockCannotCompleteNormally", - "displayName": "'finally' block which can not complete normally", - "enabled": true, - "description": "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" + "shortName": "EmptyInitializer", + "displayName": "Empty class initializer", + "enabled": false, + "description": "Reports empty class initializer blocks." }, { - "shortName": "EmptyFinallyBlock", - "displayName": "Empty 'finally' block", - "enabled": true, - "description": "Reports empty `finally` blocks.\n\nEmpty `finally` blocks usually indicate coding errors. They may also remain after code refactoring and can safely be removed.\n\nThis inspection doesn't report empty `finally` blocks found in JSP files.\n\n**Example:**\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n" + "shortName": "TrivialFunctionalExpressionUsage", + "displayName": "Trivial usage of functional expression", + "enabled": false, + "description": "Reports functional interface methods calls that are directly invoked on the definition of the lambda, method reference, or anonymous class. Such method calls can be replaced with the body of the functional interface implementation.\n\n**Example:**\n\n\n boolean contains(List names, String name) {\n return ((Predicate)x -> {\n return names.contains(x);\n }).test(name);\n }\n\nWhen the quick-fix is applied, the method call changes to:\n\n\n boolean contains(List names, String name) {\n return names.contains(name);\n }\n" }, { - "shortName": "ErrorRethrown", - "displayName": "'Error' not rethrown", + "shortName": "AccessStaticViaInstance", + "displayName": "Access static member via instance reference", "enabled": false, - "description": "Reports `try` statements that catch `java.lang.Error` or any of its subclasses and do not rethrow the error.\n\nStatements that catch `java.lang.ThreadDeath` are not\nreported.\n\n**Example:**\n\n\n try {\n executeTests(request);\n }\n catch (OutOfMemoryError ex) { // warning: Error 'ex' not rethrown\n return false;\n }\n" + "description": "Reports references to `static` methods and fields via a class instance rather than the class itself.\n\nEven though referring to static members via instance variables is allowed by The Java Language Specification,\nthis makes the code confusing as the reader may think that the result of the method depends on the instance.\n\nThe quick-fix replaces the instance variable with the class name.\n\nExample:\n\n\n String s1 = s.valueOf(0);\n\nAfter the quick-fix is applied:\n\n\n String s = String.valueOf(0);\n" }, { - "shortName": "NewExceptionWithoutArguments", - "displayName": "Exception constructor called without arguments", + "shortName": "UnnecessaryModuleDependencyInspection", + "displayName": "Unnecessary module dependency", "enabled": false, - "description": "Reports creation of a exception instance without any arguments specified.\n\nWhen an exception is constructed without any arguments, it contains no information about the problem that occurred, which makes\ndebugging needlessly hard.\n\n**Example:**\n\n\n throw new IOException(); // warning: exception without arguments\n" + "description": "Reports dependencies on modules that are not used. The quick-fix safely removes such unused dependencies." }, { - "shortName": "TooBroadCatch", - "displayName": "Overly broad 'catch' block", + "shortName": "RedundantThrows", + "displayName": "Redundant 'throws' clause", "enabled": false, - "description": "Reports `catch` blocks with parameters that are more generic than the exception thrown by the corresponding `try` block.\n\n**Example:**\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (Exception ex) { // warning: 'catch' of 'Exception' is too broad, masking exceptions 'RuntimeException'\n return defaultFilePath;\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (RuntimeException ex) {\n return defaultFilePath;\n }\n\nConfigure the inspection:\n\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 which hide others but are themselves thrown** option to ignore any exceptions that hide other exceptions but still may be thrown and thus are technically not overly broad." + "description": "Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods.\n\nThe inspection ignores methods related to serialization, for example the methods `readObject()` and `writeObject()`.\n\n**Example:**\n\n\n void method() throws InterruptedException {\n System.out.println();\n }\n\nThe quick-fix removes unnecessary exceptions from the declaration and normalizes redundant `try`-`catch` statements:\n\n\n void method() {\n System.out.println();\n }\n\n\n**Note:** Some exceptions may not be reported during in-editor highlighting for performance reasons.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the **Ignore exceptions thrown by entry point methods** option to not report exceptions thrown by\nfor example `main()` methods.\nEntry point methods can be configured in the settings of the\n[Java \\| Declaration redundancy \\| Unused declaration](settings://Errors?Unused%20Declaration%20entry%20point) inspection." }, { - "shortName": "UnnecessaryInitCause", - "displayName": "Unnecessary call to 'Throwable.initCause()'", - "enabled": true, - "description": "Reports calls to `Throwable.initCause()` where an exception constructor also takes a `Throwable cause` argument.\n\nIn this case, the `initCause()` call can be removed and its argument can be added to the call to the exception's constructor.\n\n**Example:**\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\");\n wrapper.initCause(ex); // Unnecessary call to 'Throwable.initCause()'\n throw wrapper;\n }\n\nA quick-fix is available to pass the cause argument to the constructor. After the quick-fix is applied:\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\", ex);\n throw wrapper;\n }\n \n" - }, - { - "shortName": "ExceptionFromCatchWhichDoesntWrap", - "displayName": "'throw' inside 'catch' block which ignores the caught exception", - "enabled": false, - "description": "Reports exceptions that are thrown from inside `catch` blocks but do not \"wrap\" the caught exception.\n\nWhen an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information,\nsuch as stack frames and line numbers.\n\n**Example:**\n\n\n ...\n catch (IOException e) {\n closeAllConnections();\n throw new ConnectException(\"Connection problem.\"); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'\n }\n\nConfigure the inspection:\n\n* Use the **Ignore if result of exception method call is used** option to indicate whether the inspection should ignore exceptions whose argument is the result of a method call on the original exception, such as `getMessage()`.\n* Use the **Ignore if thrown exception cannot wrap an exception** option to ignore `throw` statements that throw exceptions without a constructor that accepts a `Throwable` cause." - }, - { - "shortName": "NullThrown", - "displayName": "'null' thrown", - "enabled": false, - "description": "Reports `null` literals that are used as the argument of a `throw` statement.\n\nSuch constructs produce a `java.lang.NullPointerException` that usually should not be thrown programmatically." - }, - { - "shortName": "ExtendsThrowable", - "displayName": "Class directly extends 'Throwable'", - "enabled": false, - "description": "Reports classes that directly extend `java.lang.Throwable`.\n\nExtending `java.lang.Throwable` directly is generally considered bad practice.\nIt is usually enough to extend `java.lang.RuntimeException`, `java.lang.Exception`, or - in special\ncases - `java.lang.Error`.\n\n**Example:**\n\n\n class EnigmaThrowable extends Throwable {} // warning: Class 'EnigmaThrowable' directly extends 'java.lang.Throwable'\n" - }, - { - "shortName": "ThreadDeathRethrown", - "displayName": "'ThreadDeath' not rethrown", - "enabled": false, - "description": "Reports `try` statements that catch `java.lang.ThreadDeath` and do not rethrow the exception.\n\n**Example:**\n\n\n try {\n executeInParallel(request);\n } catch (ThreadDeath ex) { // warning: ThreadDeath 'ex' not rethrown\n return false;\n }\n" - }, - { - "shortName": "EmptyTryBlock", - "displayName": "Empty 'try' block", - "enabled": true, - "description": "Reports empty `try` blocks, including try-with-resources statements.\n\n`try` blocks with comments are considered empty.\n\n\nThis inspection doesn't report empty `try` blocks found in JSP files." - }, - { - "shortName": "ThrowableSupplierOnlyThrowException", - "displayName": "Throwable supplier never returns a value", - "enabled": true, - "description": "Reports `Supplier` lambdas in `Optional.orElseThrow()` calls that throw an exception, instead of returning it.\n\n**Example:**\n\n\n optional.orElseThrow(() -> {\n throw new RuntimeException();\n });\n\nAfter the quick-fix is applied:\n\n\n optional.orElseThrow(() -> new RuntimeException());\n\nNew in 2023.1" - }, - { - "shortName": "NonFinalFieldOfException", - "displayName": "Non-final field of 'Exception' class", - "enabled": false, - "description": "Reports fields in subclasses of `java.lang.Exception` that are not declared `final`.\n\nData on exception objects should not be modified\nbecause this may result in losing the error context for later debugging and logging.\n\n**Example:**\n\n\n public class EditorException extends Exception {\n private String message; // warning: Non-final field 'message' of exception class\n }\n" - }, - { - "shortName": "CatchMayIgnoreException", - "displayName": "Catch block may ignore exception", - "enabled": true, - "description": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\nFinally, the static code analyzer reports if it detects that a `catch` block may silently ignore important VM\nexceptions like `NullPointerException`. Ignoring such an exception\n(without logging or rethrowing it) may hide a bug.\n\n\nThe inspection won't report any `catch` parameters named `ignore` or `ignored`.\nConversely, the inspection will warn you about any `catch` parameters named `ignore` or `ignored` that are actually in use.\nAdditionally, the inspection won't report `catch` parameters inside test sources named `expected` or `ok`.\n\n\nYou can use a quick-fix to change the exception name to `ignored`.\nFor empty **catch** blocks, an additional quick-fix to generate the **catch** body is suggested.\nYou can modify the \"Catch Statement Body\" template on the Code tab in\n[Settings \\| Editor \\| File and Code Templates](settings://fileTemplates).\n\n**Example:**\n\n\n try {\n throwingMethod();\n } catch (IOException ex) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n System.out.println(System.in.read());\n } catch (IOException ignored) {\n\n }\n\nConfigure the inspection:\n\n* Use the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments.\n* Use the **Do not warn when 'catch' block is not empty** option to ignore `catch` blocks that contain statements or comments inside, while the variable itself is not used.\n* Use the **Do not warn when exception named 'ignore(d)' is not actually ignored** option to ignore variables named `ignored` if they are in use.\n\nNew in 2018.1" - }, - { - "shortName": "ThrowCaughtLocally", - "displayName": "'throw' caught by containing 'try' statement", - "enabled": false, - "description": "Reports `throw` statements whose exceptions are always caught by containing `try` statements.\n\nUsing `throw`\nstatements as a \"goto\" to change the local flow of control is confusing and results in poor performance.\n\n**Example:**\n\n\n try {\n if (!Files.isDirectory(PROJECTS)) {\n throw new IllegalStateException(\"Directory not found.\"); // warning: 'throw' caught by containing 'try' statement\n }\n ...\n } catch (Exception e) {\n LOG.error(\"run failed\");\n }\n\nUse the **Ignore rethrown exceptions** option to ignore exceptions that are rethrown." - }, - { - "shortName": "ThrowsRuntimeException", - "displayName": "Unchecked exception declared in 'throws' clause", - "enabled": false, - "description": "Reports declaration of an unchecked exception (`java.lang.RuntimeException` or one of its subclasses) in the `throws` clause of a method.\n\nDeclarations of unchecked exceptions are not required and may be deleted or moved to a Javadoc `@throws` tag.\n\n**Example:**\n\n\n public class InvalidDataException extends RuntimeException {}\n\n class TextEditor {\n void readSettings() throws InvalidDataException {} // warning: Unchecked exception 'InvalidDataException' declared in 'throws' clause\n }\n" - }, - { - "shortName": "GroovyThrowFromFinallyBlock", - "displayName": "'throw' inside 'finally' block", - "enabled": false, - "description": "Reports `throw` statements inside of `finally` blocks.\n\n\nWhile occasionally intended, such `throw` statements may mask exceptions thrown and\ntremendously complicate debugging." - }, - { - "shortName": "GroovyEmptyCatchBlock", - "displayName": "Empty 'catch' block", - "enabled": false, - "description": "Reports empty `catch` blocks. While occasionally intended, empty `catch` blocks can make debugging extremely difficult.\n\n**Example:**\n\n\n try {\n throw new Exception()\n }\n catch (Exception e) {\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throw new Exception()\n }\n catch (Exception ignored) {\n }\n\n" - }, - { - "shortName": "GroovyContinueOrBreakFromFinallyBlock", - "displayName": "'continue' or 'break' from 'finally' block", - "enabled": false, - "description": "Reports `break` and `continue` statements inside of `finally` blocks.\n\nWhile occasionally intended, such statements are very confusing, may mask thrown exceptions, and tremendously complicate debugging." - }, - { - "shortName": "GroovyUnusedCatchParameter", - "displayName": "Unused 'catch' parameter", - "enabled": false, - "description": "Reports **catch** parameters that are unused in their\ncorresponding blocks. This inspection will not report any **catch** parameters\nnamed \"ignore\" or \"ignored\".\n\n**Example:**\n\n\n try {\n def arr = new int[3]\n arr[5] = 5\n } catch(Exception ex) {\n println('Catching the exception')\n }\n\nHere the parameter **ex** is never used in **catch** block.\n\nAfter the quick-fix is applied:\n\n\n try {\n def arr = new int[3]\n arr[5] = 5\n } catch(Exception ignored) {\n println('Catching the exception')\n }\n" - }, - { - "shortName": "GroovyReturnFromFinallyBlock", - "displayName": "'return' inside 'finally' block", - "enabled": false, - "description": "Reports `return` statements inside of `finally` blocks.\n\n\nWhile occasionally intended, such `return` statements may mask exceptions thrown, and\ncomplicate debugging." - }, - { - "shortName": "GroovyEmptyTryBlock", - "displayName": "Empty 'try' block", - "enabled": false, - "description": "Reports empty `try` blocks. Empty `try` blocks usually indicate coding errors.\n\n**Example:**\n\n\n try {\n }\n finally {\n close()\n }\n\n" - }, - { - "shortName": "GroovyEmptyFinallyBlock", - "displayName": "Empty 'finally' block", - "enabled": false, - "description": "Reports empty `finally` blocks. Empty `finally` blocks usually indicate coding errors.\n\n**Example:**\n\n\n try {\n throw new Exception()\n }\n finally {\n }\n\n" - } - ] - }, - { - "name": "Declaration redundancy", - "inspections": [ - { - "shortName": "UnusedReturnValue", - "displayName": "Method can be made 'void'", - "enabled": false, - "description": "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." - }, - { - "shortName": "UnusedLibrary", - "displayName": "Unused library", - "enabled": false, - "description": "Reports libraries attached to the specified inspection scope that are not used directly in code." - }, - { - "shortName": "RedundantLambdaParameterType", - "displayName": "Redundant lambda parameter types", - "enabled": false, - "description": "Reports lambda formal parameter types that are redundant because they can be inferred from the context.\n\n**Example:**\n\n\n Map 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 map = ...\n map.forEach((s, i) -> log.info(s + \"=\" + i));\n" - }, - { - "shortName": "CanBeFinal", - "displayName": "Declaration can have 'final' modifier", - "enabled": false, - "description": "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." - }, - { - "shortName": "RedundantExplicitClose", - "displayName": "Redundant 'close()'", - "enabled": false, - "description": "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" - }, - { - "shortName": "UnusedLabel", - "displayName": "Unused label", - "enabled": false, - "description": "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" - }, - { - "shortName": "DefaultAnnotationParam", - "displayName": "Default annotation parameter value", - "enabled": false, - "description": "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" - }, - { - "shortName": "WeakerAccess", - "displayName": "Declaration access can be weaker", - "enabled": false, - "description": "Reports fields, methods or classes that may have their access modifier narrowed down.\n\nExample:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n void bar(String x, String y) { } // can be private\n }\n\nAfter the quick-fix is applied:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n private void bar(String x, String y) { }\n }\n\nUse the inspection's options to define the rules for the modifier change suggestions." - }, - { - "shortName": "Java9RedundantRequiresStatement", - "displayName": "Redundant 'requires' directive in module-info", - "enabled": false, - "description": "Reports redundant `requires` directives in Java Platform Module System `module-info.java` files. A `requires` directive is redundant when a module `A` requires a module `B`, but the code in module `A` doesn't import any packages or classes from `B`. Furthermore, all modules have an implicitly declared dependence on the `java.base` module, therefore a `requires java.base;` directive is always redundant.\n\n\nThe quick-fix deletes the redundant `requires` directive.\nIf the deleted dependency re-exported modules that are actually used, the fix adds a `requires` directives for these modules.\n\nThis inspection only reports if the language level of the project or module is 9 or higher.\n\nNew in 2017.1" - }, - { - "shortName": "FunctionalExpressionCanBeFolded", - "displayName": "Functional expression can be folded", - "enabled": false, - "description": "Reports method references or lambda expressions that point to a method of their own functional interface type and hence can be replaced with their qualifiers removing unnecessary object allocation.\n\nExample:\n\n\n SwingUtilities.invokeLater(r::run);\n SwingUtilities.invokeAndWait(() -> r.run());\n\nAfter the quick-fix is applied:\n\n\n SwingUtilities.invokeLater(r);\n SwingUtilities.invokeAndWait(r);\n\nThis inspection reports only if the language level of the project or module is 8 or higher." - }, - { - "shortName": "unused", - "displayName": "Unused declaration", - "enabled": false, - "description": "Reports classes, methods, or fields that are not used or unreachable from the entry points.\n\nAn entry point can be a main method, tests, classes from outside the specified scope, classes accessible from\n`module-info.java`, and so on. It is possible to configure custom entry points by using name patterns or annotations.\n\n**Example:**\n\n\n public class Department {\n private Organization myOrganization;\n }\n\nIn this example, `Department` explicitly references `Organization` but if `Department` class itself is unused, then inspection will report both classes.\n\n\nThe inspection also reports parameters that are not used by their methods and all method implementations and overriders, as well as local\nvariables that are declared but not used.\n\n\n**Note:** Some unused members may not be reported during in-editor code highlighting. For performance reasons, a non-private member is\nchecked only when its name rarely occurs in the project.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the visibility settings below to configure members to be reported. For example, configuring report `private` methods only means\nthat `public` methods of `private` inner class will be reported but `protected` methods of top level class\nwill be ignored.\n\n\nUse the **entry points** tab to configure entry points to be considered during the inspection run.\n\nYou can add entry points manually when inspection results are ready.\n\nIf your code uses unsupported frameworks, there are several options:\n\n* If the framework relies on annotations, use the **Annotations...** button to configure the framework's annotations.\n* If the framework doesn't rely on annotations, try to configure class name patterns that are expected by the framework.\n\nThis way the annotated code accessible by the framework internals will be treated as used." - }, - { - "shortName": "ProtectedMemberInFinalClass", - "displayName": "'protected' member in 'final' class", - "enabled": false, - "description": "Reports `protected` members in `final`classes.\n\nSince `final` classes cannot be inherited, marking the method as `protected`\nmay be confusing. It is better to declare such members as `private` or package-visible instead.\n\n**Example:**\n\n record Bar(int a, int b) {\n protected int sum() { \n return a + b;\n }\n }\n\nAfter the quick-fix is applied:\n\n record Bar(int a, int b) {\n int sum() { \n return a + b;\n }\n }\n\nAs shown in the example, a class can be marked as `final` explicitly or implicitly." - }, - { - "shortName": "EmptyInitializer", - "displayName": "Empty class initializer", - "enabled": false, - "description": "Reports empty class initializer blocks." - }, - { - "shortName": "TrivialFunctionalExpressionUsage", - "displayName": "Trivial usage of functional expression", - "enabled": false, - "description": "Reports functional interface methods calls that are directly invoked on the definition of the lambda, method reference, or anonymous class. Such method calls can be replaced with the body of the functional interface implementation.\n\n**Example:**\n\n\n boolean contains(List names, String name) {\n return ((Predicate)x -> {\n return names.contains(x);\n }).test(name);\n }\n\nWhen the quick-fix is applied, the method call changes to:\n\n\n boolean contains(List names, String name) {\n return names.contains(name);\n }\n" - }, - { - "shortName": "AccessStaticViaInstance", - "displayName": "Access static member via instance reference", - "enabled": false, - "description": "Reports references to `static` methods and fields via a class instance rather than the class itself.\n\nEven though referring to static members via instance variables is allowed by The Java Language Specification,\nthis makes the code confusing as the reader may think that the result of the method depends on the instance.\n\nThe quick-fix replaces the instance variable with the class name.\n\nExample:\n\n\n String s1 = s.valueOf(0);\n\nAfter the quick-fix is applied:\n\n\n String s = String.valueOf(0);\n" - }, - { - "shortName": "UnnecessaryModuleDependencyInspection", - "displayName": "Unnecessary module dependency", - "enabled": false, - "description": "Reports dependencies on modules that are not used. The quick-fix safely removes such unused dependencies." - }, - { - "shortName": "RedundantThrows", - "displayName": "Redundant 'throws' clause", - "enabled": false, - "description": "Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods.\n\nThe inspection ignores methods related to serialization, for example the methods `readObject()` and `writeObject()`.\n\n**Example:**\n\n\n void method() throws InterruptedException {\n System.out.println();\n }\n\nThe quick-fix removes unnecessary exceptions from the declaration and normalizes redundant `try`-`catch` statements:\n\n\n void method() {\n System.out.println();\n }\n\n\n**Note:** Some exceptions may not be reported during in-editor highlighting for performance reasons.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the **Ignore exceptions thrown by entry point methods** option to not report exceptions thrown by\nfor example `main()` methods.\nEntry point methods can be configured in the settings of the\n[Java \\| Declaration redundancy \\| Unused declaration](settings://Errors?Unused%20Declaration%20entry%20point) inspection." - }, - { - "shortName": "DuplicateThrows", - "displayName": "Duplicate throws", - "enabled": false, - "description": "Reports duplicate exceptions in a method `throws` list.\n\nExample:\n\n\n void f() throws Exception, Exception {}\n\nAfter the quick-fix is applied:\n\n\n void f() throws Exception {}\n\n\nUse the **Ignore exceptions subclassing others** option to ignore exceptions subclassing other exceptions." + "shortName": "DuplicateThrows", + "displayName": "Duplicate throws", + "enabled": false, + "description": "Reports duplicate exceptions in a method `throws` list.\n\nExample:\n\n\n void f() throws Exception, Exception {}\n\nAfter the quick-fix is applied:\n\n\n void f() throws Exception {}\n\n\nUse the **Ignore exceptions subclassing others** option to ignore exceptions subclassing other exceptions." }, { "shortName": "SameParameterValue", @@ -3163,40 +2948,255 @@ ] }, { - "name": "Probable bugs", + "name": "Error handling", "inspections": [ { - "shortName": "UnsupportedChronoFieldUnitCall", - "displayName": "Call methods with unsupported 'java.time.temporal.ChronoUnit' and 'java.time.temporal.ChronoField'", - "enabled": true, - "description": "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" + "shortName": "UncheckedExceptionClass", + "displayName": "Unchecked 'Exception' class", + "enabled": false, + "description": "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" }, { - "shortName": "NumberEquality", - "displayName": "Number comparison using '==', instead of 'equals()'", - "enabled": true, - "description": "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" + "shortName": "CheckedExceptionClass", + "displayName": "Checked exception class", + "enabled": false, + "description": "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" }, { - "shortName": "MathRandomCastToInt", - "displayName": "'Math.random()' cast to 'int'", - "enabled": true, - "description": "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" + "shortName": "NestedTryStatement", + "displayName": "Nested 'try' statement", + "enabled": false, + "description": "Reports nested `try` statements.\n\nNested `try` statements\nmay result in unclear code and should probably have their `catch` and `finally` sections\nmerged." }, { - "shortName": "InconsistentTextBlockIndent", - "displayName": "Inconsistent whitespace indentation in text block", - "enabled": true, - "description": "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 depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2021.1" + "shortName": "BadExceptionThrown", + "displayName": "Prohibited exception thrown", + "enabled": false, + "description": "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." }, { - "shortName": "NewStringBufferWithCharArgument", - "displayName": "StringBuilder constructor call with 'char' argument", + "shortName": "CaughtExceptionImmediatelyRethrown", + "displayName": "Caught exception is immediately rethrown", "enabled": true, - "description": "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" + "description": "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" }, { - "shortName": "ClassGetClass", + "shortName": "ThrowFromFinallyBlock", + "displayName": "'throw' inside 'finally' block", + "enabled": true, + "description": "Reports `throw` statements inside `finally` blocks. While occasionally intended, such `throw` statements can hide exceptions thrown from the `try` and `catch` blocks, thereby complicating the debugging process.\n\n**Example:**\n\n\n class Fascinating {\n void doTask(Task t) {\n try {\n t.activity();\n } finally {\n if (!t.finish()) {\n throw new IllegalStateException();\n }\n }\n }\n }\n\nUse the **Warn everywhere declared exceptions may be thrown** option\nto warn on method calls to methods that declare exceptions as well." + }, + { + "shortName": "ContinueOrBreakFromFinallyBlock", + "displayName": "'continue' or 'break' inside 'finally' block", + "enabled": true, + "description": "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" + }, + { + "shortName": "BadExceptionDeclared", + "displayName": "Prohibited exception declared", + "enabled": false, + "description": "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." + }, + { + "shortName": "ReturnFromFinallyBlock", + "displayName": "'return' inside 'finally' block", + "enabled": true, + "description": "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" + }, + { + "shortName": "TooBroadThrows", + "displayName": "Overly broad 'throws' clause", + "enabled": false, + "description": "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." + }, + { + "shortName": "BadExceptionCaught", + "displayName": "Prohibited 'Exception' caught", + "enabled": false, + "description": "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." + }, + { + "shortName": "InstanceofCatchParameter", + "displayName": "'instanceof' on 'catch' parameter", + "enabled": false, + "description": "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" + }, + { + "shortName": "FinallyBlockCannotCompleteNormally", + "displayName": "'finally' block which can not complete normally", + "enabled": true, + "description": "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" + }, + { + "shortName": "EmptyFinallyBlock", + "displayName": "Empty 'finally' block", + "enabled": true, + "description": "Reports empty `finally` blocks.\n\nEmpty `finally` blocks usually indicate coding errors. They may also remain after code refactoring and can safely be removed.\n\nThis inspection doesn't report empty `finally` blocks found in JSP files.\n\n**Example:**\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n" + }, + { + "shortName": "ErrorRethrown", + "displayName": "'Error' not rethrown", + "enabled": false, + "description": "Reports `try` statements that catch `java.lang.Error` or any of its subclasses and do not rethrow the error.\n\nStatements that catch `java.lang.ThreadDeath` are not\nreported.\n\n**Example:**\n\n\n try {\n executeTests(request);\n }\n catch (OutOfMemoryError ex) { // warning: Error 'ex' not rethrown\n return false;\n }\n" + }, + { + "shortName": "NewExceptionWithoutArguments", + "displayName": "Exception constructor called without arguments", + "enabled": false, + "description": "Reports creation of a exception instance without any arguments specified.\n\nWhen an exception is constructed without any arguments, it contains no information about the problem that occurred, which makes\ndebugging needlessly hard.\n\n**Example:**\n\n\n throw new IOException(); // warning: exception without arguments\n" + }, + { + "shortName": "TooBroadCatch", + "displayName": "Overly broad 'catch' block", + "enabled": false, + "description": "Reports `catch` blocks with parameters that are more generic than the exception thrown by the corresponding `try` block.\n\n**Example:**\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (Exception ex) { // warning: 'catch' of 'Exception' is too broad, masking exceptions 'RuntimeException'\n return defaultFilePath;\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (RuntimeException ex) {\n return defaultFilePath;\n }\n\nConfigure the inspection:\n\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 which hide others but are themselves thrown** option to ignore any exceptions that hide other exceptions but still may be thrown and thus are technically not overly broad." + }, + { + "shortName": "UnnecessaryInitCause", + "displayName": "Unnecessary call to 'Throwable.initCause()'", + "enabled": true, + "description": "Reports calls to `Throwable.initCause()` where an exception constructor also takes a `Throwable cause` argument.\n\nIn this case, the `initCause()` call can be removed and its argument can be added to the call to the exception's constructor.\n\n**Example:**\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\");\n wrapper.initCause(ex); // Unnecessary call to 'Throwable.initCause()'\n throw wrapper;\n }\n\nA quick-fix is available to pass the cause argument to the constructor. After the quick-fix is applied:\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\", ex);\n throw wrapper;\n }\n \n" + }, + { + "shortName": "ExceptionFromCatchWhichDoesntWrap", + "displayName": "'throw' inside 'catch' block which ignores the caught exception", + "enabled": false, + "description": "Reports exceptions that are thrown from inside `catch` blocks but do not \"wrap\" the caught exception.\n\nWhen an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information,\nsuch as stack frames and line numbers.\n\n**Example:**\n\n\n ...\n catch (IOException e) {\n closeAllConnections();\n throw new ConnectException(\"Connection problem.\"); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'\n }\n\nConfigure the inspection:\n\n* Use the **Ignore if result of exception method call is used** option to indicate whether the inspection should ignore exceptions whose argument is the result of a method call on the original exception, such as `getMessage()`.\n* Use the **Ignore if thrown exception cannot wrap an exception** option to ignore `throw` statements that throw exceptions without a constructor that accepts a `Throwable` cause." + }, + { + "shortName": "NullThrown", + "displayName": "'null' thrown", + "enabled": false, + "description": "Reports `null` literals that are used as the argument of a `throw` statement.\n\nSuch constructs produce a `java.lang.NullPointerException` that usually should not be thrown programmatically." + }, + { + "shortName": "ExtendsThrowable", + "displayName": "Class directly extends 'Throwable'", + "enabled": false, + "description": "Reports classes that directly extend `java.lang.Throwable`.\n\nExtending `java.lang.Throwable` directly is generally considered bad practice.\nIt is usually enough to extend `java.lang.RuntimeException`, `java.lang.Exception`, or - in special\ncases - `java.lang.Error`.\n\n**Example:**\n\n\n class EnigmaThrowable extends Throwable {} // warning: Class 'EnigmaThrowable' directly extends 'java.lang.Throwable'\n" + }, + { + "shortName": "ThreadDeathRethrown", + "displayName": "'ThreadDeath' not rethrown", + "enabled": false, + "description": "Reports `try` statements that catch `java.lang.ThreadDeath` and do not rethrow the exception.\n\n**Example:**\n\n\n try {\n executeInParallel(request);\n } catch (ThreadDeath ex) { // warning: ThreadDeath 'ex' not rethrown\n return false;\n }\n" + }, + { + "shortName": "EmptyTryBlock", + "displayName": "Empty 'try' block", + "enabled": true, + "description": "Reports empty `try` blocks, including try-with-resources statements.\n\n`try` blocks with comments are considered empty.\n\n\nThis inspection doesn't report empty `try` blocks found in JSP files." + }, + { + "shortName": "ThrowableSupplierOnlyThrowException", + "displayName": "Throwable supplier never returns a value", + "enabled": true, + "description": "Reports `Supplier` lambdas in `Optional.orElseThrow()` calls that throw an exception, instead of returning it.\n\n**Example:**\n\n\n optional.orElseThrow(() -> {\n throw new RuntimeException();\n });\n\nAfter the quick-fix is applied:\n\n\n optional.orElseThrow(() -> new RuntimeException());\n\nNew in 2023.1" + }, + { + "shortName": "NonFinalFieldOfException", + "displayName": "Non-final field of 'Exception' class", + "enabled": false, + "description": "Reports fields in subclasses of `java.lang.Exception` that are not declared `final`.\n\nData on exception objects should not be modified\nbecause this may result in losing the error context for later debugging and logging.\n\n**Example:**\n\n\n public class EditorException extends Exception {\n private String message; // warning: Non-final field 'message' of exception class\n }\n" + }, + { + "shortName": "CatchMayIgnoreException", + "displayName": "Catch block may ignore exception", + "enabled": true, + "description": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\nFinally, the static code analyzer reports if it detects that a `catch` block may silently ignore important VM\nexceptions like `NullPointerException`. Ignoring such an exception\n(without logging or rethrowing it) may hide a bug.\n\n\nThe inspection won't report any `catch` parameters named `ignore` or `ignored`.\nConversely, the inspection will warn you about any `catch` parameters named `ignore` or `ignored` that are actually in use.\nAdditionally, the inspection won't report `catch` parameters inside test sources named `expected` or `ok`.\n\n\nYou can use a quick-fix to change the exception name to `ignored`.\nFor empty **catch** blocks, an additional quick-fix to generate the **catch** body is suggested.\nYou can modify the \"Catch Statement Body\" template on the Code tab in\n[Settings \\| Editor \\| File and Code Templates](settings://fileTemplates).\n\n**Example:**\n\n\n try {\n throwingMethod();\n } catch (IOException ex) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n System.out.println(System.in.read());\n } catch (IOException ignored) {\n\n }\n\nConfigure the inspection:\n\n* Use the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments.\n* Use the **Do not warn when 'catch' block is not empty** option to ignore `catch` blocks that contain statements or comments inside, while the variable itself is not used.\n* Use the **Do not warn when exception named 'ignore(d)' is not actually ignored** option to ignore variables named `ignored` if they are in use.\n\nNew in 2018.1" + }, + { + "shortName": "ThrowCaughtLocally", + "displayName": "'throw' caught by containing 'try' statement", + "enabled": false, + "description": "Reports `throw` statements whose exceptions are always caught by containing `try` statements.\n\nUsing `throw`\nstatements as a \"goto\" to change the local flow of control is confusing and results in poor performance.\n\n**Example:**\n\n\n try {\n if (!Files.isDirectory(PROJECTS)) {\n throw new IllegalStateException(\"Directory not found.\"); // warning: 'throw' caught by containing 'try' statement\n }\n ...\n } catch (Exception e) {\n LOG.error(\"run failed\");\n }\n\nUse the **Ignore rethrown exceptions** option to ignore exceptions that are rethrown." + }, + { + "shortName": "ThrowsRuntimeException", + "displayName": "Unchecked exception declared in 'throws' clause", + "enabled": false, + "description": "Reports declaration of an unchecked exception (`java.lang.RuntimeException` or one of its subclasses) in the `throws` clause of a method.\n\nDeclarations of unchecked exceptions are not required and may be deleted or moved to a Javadoc `@throws` tag.\n\n**Example:**\n\n\n public class InvalidDataException extends RuntimeException {}\n\n class TextEditor {\n void readSettings() throws InvalidDataException {} // warning: Unchecked exception 'InvalidDataException' declared in 'throws' clause\n }\n" + }, + { + "shortName": "GroovyThrowFromFinallyBlock", + "displayName": "'throw' inside 'finally' block", + "enabled": false, + "description": "Reports `throw` statements inside of `finally` blocks.\n\n\nWhile occasionally intended, such `throw` statements may mask exceptions thrown and\ntremendously complicate debugging." + }, + { + "shortName": "GroovyEmptyCatchBlock", + "displayName": "Empty 'catch' block", + "enabled": false, + "description": "Reports empty `catch` blocks. While occasionally intended, empty `catch` blocks can make debugging extremely difficult.\n\n**Example:**\n\n\n try {\n throw new Exception()\n }\n catch (Exception e) {\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throw new Exception()\n }\n catch (Exception ignored) {\n }\n\n" + }, + { + "shortName": "GroovyContinueOrBreakFromFinallyBlock", + "displayName": "'continue' or 'break' from 'finally' block", + "enabled": false, + "description": "Reports `break` and `continue` statements inside of `finally` blocks.\n\nWhile occasionally intended, such statements are very confusing, may mask thrown exceptions, and tremendously complicate debugging." + }, + { + "shortName": "GroovyUnusedCatchParameter", + "displayName": "Unused 'catch' parameter", + "enabled": false, + "description": "Reports **catch** parameters that are unused in their\ncorresponding blocks. This inspection will not report any **catch** parameters\nnamed \"ignore\" or \"ignored\".\n\n**Example:**\n\n\n try {\n def arr = new int[3]\n arr[5] = 5\n } catch(Exception ex) {\n println('Catching the exception')\n }\n\nHere the parameter **ex** is never used in **catch** block.\n\nAfter the quick-fix is applied:\n\n\n try {\n def arr = new int[3]\n arr[5] = 5\n } catch(Exception ignored) {\n println('Catching the exception')\n }\n" + }, + { + "shortName": "GroovyReturnFromFinallyBlock", + "displayName": "'return' inside 'finally' block", + "enabled": false, + "description": "Reports `return` statements inside of `finally` blocks.\n\n\nWhile occasionally intended, such `return` statements may mask exceptions thrown, and\ncomplicate debugging." + }, + { + "shortName": "GroovyEmptyTryBlock", + "displayName": "Empty 'try' block", + "enabled": false, + "description": "Reports empty `try` blocks. Empty `try` blocks usually indicate coding errors.\n\n**Example:**\n\n\n try {\n }\n finally {\n close()\n }\n\n" + }, + { + "shortName": "GroovyEmptyFinallyBlock", + "displayName": "Empty 'finally' block", + "enabled": false, + "description": "Reports empty `finally` blocks. Empty `finally` blocks usually indicate coding errors.\n\n**Example:**\n\n\n try {\n throw new Exception()\n }\n finally {\n }\n\n" + } + ] + }, + { + "name": "Probable bugs", + "inspections": [ + { + "shortName": "UnsupportedChronoFieldUnitCall", + "displayName": "Call methods with unsupported 'java.time.temporal.ChronoUnit' and 'java.time.temporal.ChronoField'", + "enabled": true, + "description": "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" + }, + { + "shortName": "NumberEquality", + "displayName": "Number comparison using '==', instead of 'equals()'", + "enabled": true, + "description": "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" + }, + { + "shortName": "MathRandomCastToInt", + "displayName": "'Math.random()' cast to 'int'", + "enabled": true, + "description": "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" + }, + { + "shortName": "InconsistentTextBlockIndent", + "displayName": "Inconsistent whitespace indentation in text block", + "enabled": true, + "description": "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 depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2021.1" + }, + { + "shortName": "NewStringBufferWithCharArgument", + "displayName": "StringBuilder constructor call with 'char' argument", + "enabled": true, + "description": "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" + }, + { + "shortName": "ClassGetClass", "displayName": "Suspicious 'Class.getClass()' call", "enabled": true, "description": "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" @@ -3765,18 +3765,18 @@ "enabled": true, "description": "Reports expressions and conditions that always produce the same result, like true, false, null, or zero. Such expressions could be replaced with the corresponding constant value. Very often though they signal about a bug in the code.\n\nExamples:\n\n // always true\n // root cause: || is used instead of &&\n if (x > 0 || x < 10) {}\n\n System.out.println(str.trim());\n // always false\n // root cause: variable was dereferenced before null-check\n if (str == null) {}\n\n\nThe inspection behavior may be controlled by a number of annotations, such as\n[nullability](https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html) annotations,\n[@Contract](https://www.jetbrains.com/help/idea/contract-annotations.html) annotation,\n`@Range` annotation and so on.\n\nConfigure the inspection:\n\n* Use the **Don't report assertions with condition statically proven to be always true** option to avoid reporting assertions that were statically proven to be always true. This also includes conditions like `if (alwaysFalseCondition) throw new IllegalArgumentException();`.\n* Use the **Ignore assert statements** option to control how the inspection treats `assert` statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode).\n* Use the **Warn when constant is stored in variable** option to display warnings when variable is used, whose value is known to be a constant.\n\n\nBefore IntelliJ IDEA 2022.3, this inspection was part of \"Constant Conditions \\& Exceptions\" inspection. Now, it split into two inspections:\n\"Constant Values\" and \"Nullability and data flow problems\"." }, - { - "shortName": "IteratorHasNextCallsIteratorNext", - "displayName": "'Iterator.hasNext()' which calls 'next()'", - "enabled": true, - "description": "Reports implementations of `Iterator.hasNext()` or `ListIterator.hasPrevious()` that call `Iterator.next()` or `ListIterator.previous()` on the iterator instance. Such calls are almost certainly an error, as methods like `hasNext()` should not modify the iterators state, while `next()` should.\n\n**Example:**\n\n\n class MyIterator implements Iterator {\n public boolean hasNext() {\n return next() != null;\n }\n }\n" - }, { "shortName": "EqualsAndHashcode", "displayName": "'equals()' and 'hashCode()' not paired", "enabled": false, "description": "Reports classes that override the `equals()` method but do not override the `hashCode()` method or vice versa, which can potentially lead to problems when the class is added to a `Collection` or a `HashMap`.\n\nThe quick-fix generates the default implementation for an absent method.\n\nExample:\n\n\n class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (!(o instanceof StringHolder)) return false;\n\n StringHolder holder = (StringHolder)o;\n\n if (s != null ? !s.equals(holder.s) : holder.s != null) return false;\n\n return true;\n }\n }\n" }, + { + "shortName": "IteratorHasNextCallsIteratorNext", + "displayName": "'Iterator.hasNext()' which calls 'next()'", + "enabled": true, + "description": "Reports implementations of `Iterator.hasNext()` or `ListIterator.hasPrevious()` that call `Iterator.next()` or `ListIterator.previous()` on the iterator instance. Such calls are almost certainly an error, as methods like `hasNext()` should not modify the iterators state, while `next()` should.\n\n**Example:**\n\n\n class MyIterator implements Iterator {\n public boolean hasNext() {\n return next() != null;\n }\n }\n" + }, { "shortName": "MathRoundingWithIntArgument", "displayName": "Call math rounding with 'int' argument", @@ -5176,18 +5176,18 @@ "enabled": true, "description": "Reports classes that refer to their subclasses in static initializers or static fields.\n\nSuch references can cause JVM-level deadlocks in multithreaded environment, when one thread tries to load the superclass\nand another thread tries to load the subclass at the same time.\n\n**Example:**\n\n\n class Parent {\n static final Child field = new Child();\n }\n class Child extends Parent { }\n" }, - { - "shortName": "NonSynchronizedMethodOverridesSynchronizedMethod", - "displayName": "Unsynchronized method overrides 'synchronized' method", - "enabled": false, - "description": "Reports non-`synchronized` methods overriding `synchronized` methods.\n\n\nThe overridden method will not be automatically synchronized if the superclass method\nis declared as `synchronized`. This may result in unexpected race conditions when using the subclass.\n\n**Example:**\n\n\n class Super {\n synchronized void process() {}\n }\n class Sub extends Super {\n // Unsynchronized method 'process()' overrides synchronized method\n void process() {}\n } \n" - }, { "shortName": "WaitCalledOnCondition", "displayName": "'wait()' called on 'java.util.concurrent.locks.Condition' object", "enabled": false, "description": "Reports calls to `wait()` made on a `java.util.concurrent.locks.Condition` object. This is probably a programming error, and some variant of the `await()` method was intended instead.\n\n**Example:**\n\n\n void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.wait();\n }\n }\n\nGood code would look like this:\n\n\n void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.await();\n }\n }\n" }, + { + "shortName": "NonSynchronizedMethodOverridesSynchronizedMethod", + "displayName": "Unsynchronized method overrides 'synchronized' method", + "enabled": false, + "description": "Reports non-`synchronized` methods overriding `synchronized` methods.\n\n\nThe overridden method will not be automatically synchronized if the superclass method\nis declared as `synchronized`. This may result in unexpected race conditions when using the subclass.\n\n**Example:**\n\n\n class Super {\n synchronized void process() {}\n }\n class Sub extends Super {\n // Unsynchronized method 'process()' overrides synchronized method\n void process() {}\n } \n" + }, { "shortName": "WaitNotifyNotInSynchronizedContext", "displayName": "'wait()' or 'notify()' is not in synchronized context", @@ -5449,26 +5449,199 @@ ] }, { - "name": "Control flow issues", + "name": "Numeric issues", "inspections": [ { - "shortName": "NegatedEqualityExpression", - "displayName": "Negated equality expression", + "shortName": "RemoveLiteralUnderscores", + "displayName": "Underscores in numeric literal", "enabled": false, - "description": "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" + "description": "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" }, { - "shortName": "AssertionCanBeIf", - "displayName": "Assertion can be replaced with 'if' statement", + "shortName": "BadOddness", + "displayName": "Suspicious oddness check", "enabled": false, - "description": "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\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + "description": "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." }, { - "shortName": "DoubleNegation", - "displayName": "Double negation", + "shortName": "InsertLiteralUnderscores", + "displayName": "Unreadable numeric literal", + "enabled": false, + "description": "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" + }, + { + "shortName": "ConfusingFloatingPointLiteral", + "displayName": "Confusing floating-point literal", + "enabled": false, + "description": "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." + }, + { + "shortName": "OctalAndDecimalIntegersMixed", + "displayName": "Octal and decimal integers in same array", + "enabled": false, + "description": "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};`" + }, + { + "shortName": "UnnecessaryUnaryMinus", + "displayName": "Unnecessary unary minus", + "enabled": true, + "description": "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" + }, + { + "shortName": "LossyConversionCompoundAssignment", + "displayName": "Possibly lossy implicit cast in compound assignment", + "enabled": true, + "description": "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" + }, + { + "shortName": "NegativeIntConstantInLongContext", + "displayName": "Negative int hexadecimal constant in long context", + "enabled": true, + "description": "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" + }, + { + "shortName": "ImplicitNumericConversion", + "displayName": "Implicit numeric conversion", + "enabled": false, + "description": "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." + }, + { + "shortName": "OctalLiteral", + "displayName": "Octal integer", + "enabled": true, + "description": "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" + }, + { + "shortName": "NumericOverflow", + "displayName": "Numeric overflow", + "enabled": true, + "description": "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" + }, + { + "shortName": "SuspiciousLiteralUnderscore", + "displayName": "Suspicious underscore in number literal", + "enabled": false, + "description": "Reports decimal number literals that use the underscore numeric separator with groups where the number of digits is not three. Such literals may contain a typo.\n\nThis inspection will not warn on literals containing two consecutive underscores.\nIt is also allowed to omit underscores in the fractional part of `double` and `float` literals.\n\n**Example:** `int oneMillion = 1_000_0000;`" + }, + { + "shortName": "ComparisonOfShortAndChar", + "displayName": "Comparison of 'short' and 'char' values", + "enabled": true, + "description": "Reports equality comparisons between `short` and `char` values.\n\nSuch comparisons may cause subtle bugs because while both values are 2-byte long, `short` values are\nsigned, and `char` values are unsigned.\n\n**Example:**\n\n\n if (Character.MAX_VALUE == shortValue()) {} //never can be true\n" + }, + { + "shortName": "DivideByZero", + "displayName": "Division by zero", + "enabled": true, + "description": "Reports division by zero or remainder by zero. Such expressions will produce an `Infinity`, `-Infinity` or `NaN` result for doubles or floats, and will throw an `ArithmeticException` for integers.\n\nWhen the expression has a `NaN` result, the fix suggests replacing the division expression with the `NaN` constant." + }, + { + "shortName": "ComparisonToNaN", + "displayName": "Comparison to 'Double.NaN' or 'Float.NaN'", + "enabled": true, + "description": "Reports any comparisons to `Double.NaN` or `Float.NaN`. Such comparisons are never meaningful, as NaN is not equal to anything, including itself. Use the `Double.isNaN()` or `Float.isNaN()` methods instead.\n\n**Example:**\n\n\n if (x == Double.NaN) {...}\n\nAfter the quick-fix is applied:\n\n\n if (Double.isNaN(x)) {...}\n" + }, + { + "shortName": "UnaryPlus", + "displayName": "Unary plus", + "enabled": true, + "description": "Reports usages of the `+` unary operator. The unary plus is usually a null operation, and its presence might represent a coding error. For example, in a combination with the increment operator (like in `+++`) or with the equal operator (like in `=+`).\n\n**Example:**\n\n\n void unaryPlus(int i) {\n int x = + +i;\n }\n\nThe following quick fixes are suggested:\n\n* Remove `+` operators before the `i` variable:\n\n\n void unaryPlus(int i) {\n int x = i;\n }\n\n* Replace `+` operators with the prefix increment operator:\n\n\n void unaryPlus(int i) {\n int x = ++i;\n }\n\n\nUse the checkbox below to report unary pluses that are used together with a binary or another unary expression.\nIt means the inspection will not report situations when a unary plus expression is used in array\ninitializer expressions or as a method argument." + }, + { + "shortName": "CachedNumberConstructorCall", + "displayName": "Number constructor call with primitive argument", + "enabled": true, + "description": "Reports instantiations of new `Long`, `Integer`, `Short`, or `Byte` objects that have a primitive `long`, `integer`, `short`, or `byte` argument.\n\nIt is recommended that you use the static method `valueOf()`\nintroduced in Java 5. By default, this method caches objects for values between -128 and\n127 inclusive.\n\n**Example:**\n\n\n Integer i = new Integer(1);\n Long l = new Long(1L);\n\nAfter the quick-fix is applied, the code changes to:\n\n\n Integer i = Integer.valueOf(1);\n Long l = Long.valueOf(1L);\n\nThis inspection only reports if the language level of the project or module is 5 or higher\n\n\nUse the **Ignore new number expressions with a String argument** option to ignore calls to number constructors with a `String` argument.\n\n\nUse the **Report only when constructor is @Deprecated** option to only report calls to deprecated constructors.\n`Long`, `Integer`, `Short` and `Byte` constructors are deprecated since JDK 9." + }, + { + "shortName": "PointlessArithmeticExpression", + "displayName": "Pointless arithmetic expression", + "enabled": true, + "description": "Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying by zero or one, and division by one.\n\nSuch expressions may be the result of automated refactorings and they are unlikely to be what the developer intended to do.\n\nThe quick-fix simplifies such expressions.\n\n**Example:**\n\n\n void f(int a) {\n int x = a - a;\n int y = a + 0;\n int res = x / x;\n }\n\nAfter the quick-fix is applied:\n\n\n void f(int a) {\n int x = 0;\n int y = a;\n int res = 1;\n }\n\n\nNote that in rare cases, the suggested replacement might not be completely equivalent to the original code\nfor all possible inputs. For example, the inspection suggests replacing `x / x` with `1`.\nHowever, if `x` is zero, the original code throws `ArithmeticException` or results in `NaN`.\nAlso, if `x` is `NaN`, then the result is also `NaN`. It's very unlikely that such behavior is intended." + }, + { + "shortName": "CharUsedInArithmeticContext", + "displayName": "'char' expression used in arithmetic context", + "enabled": false, + "description": "Reports expressions of the `char` type used in addition or subtraction expressions.\n\nSuch code is not necessarily an issue but may result in bugs (for example,\nif a string is expected).\n\n**Example:** `int a = 'a' + 42;`\n\nAfter the quick-fix is applied: `int a = (int) 'a' + 42;`\n\nFor the `String` context:\n\n int i1 = 1;\n int i2 = 2;\n System.out.println(i2 + '-' + i1 + \" = \" + (i2 - i1));\n\nAfter the quick-fix is applied:\n`System.out.println(i2 + \"-\" + i1 + \" = \" + (i2 - i1));`" + }, + { + "shortName": "UnpredictableBigDecimalConstructorCall", + "displayName": "Unpredictable 'BigDecimal' constructor call", + "enabled": true, + "description": "Reports calls to `BigDecimal` constructors that accept a `double` value. These constructors produce `BigDecimal` that is exactly equal to the supplied `double` value. However, because doubles are encoded in the IEEE 754 64-bit double-precision binary floating-point format, the exact value can be unexpected.\n\nFor example, `new BigDecimal(0.1)` yields a `BigDecimal` object. Its value is\n`0.1000000000000000055511151231257827021181583404541015625`\nwhich is the nearest number to 0.1 representable as a double.\nTo get `BigDecimal` that stores the same value as written in the source code,\nuse either `new BigDecimal(\"0.1\")` or `BigDecimal.valueOf(0.1)`.\n\n**Example:**\n\n\n class Constructor {\n void foo() {\n new BigDecimal(0.1);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Constructor {\n void foo() {\n new BigDecimal(\"0.1\");\n }\n }\n" + }, + { + "shortName": "IntegerDivisionInFloatingPointContext", + "displayName": "Integer division in floating-point context", + "enabled": true, + "description": "Reports integer divisions where the result is used as a floating-point number. Such division is often an error and may have unexpected results due to the truncation that happens in integer division.\n\n**Example:**\n\n\n float x = 3.0F + 3 * 2 / 5;\n\nAfter the quick-fix is applied:\n\n\n float x = 3.0F + ((float) (3 * 2)) /5;\n" + }, + { + "shortName": "BigDecimalEquals", + "displayName": "'equals()' called on 'BigDecimal'", + "enabled": false, + "description": "Reports `equals()` calls that compare two `java.math.BigDecimal` numbers. This is normally a mistake, as two `java.math.BigDecimal` numbers are only equal if they are equal in both value and scale.\n\n**Example:**\n\n\n if (new BigDecimal(\"2.0\").equals(\n new BigDecimal(\"2.00\"))) {} // false\n\nAfter the quick-fix is applied:\n\n\n if (new BigDecimal(\"2.0\").compareTo(\n new BigDecimal(\"2.00\")) == 0) {} // true\n" + }, + { + "shortName": "ConstantMathCall", + "displayName": "Constant call to 'Math'", + "enabled": false, + "description": "Reports calls to `java.lang.Math` or `java.lang.StrictMath` methods that can be replaced with simple compile-time constants.\n\n**Example:**\n\n double v = Math.sin(0.0);\n\nAfter the quick-fix is applied:\n\n double v = 0.0;\n" + }, + { + "shortName": "NonReproducibleMathCall", + "displayName": "Non-reproducible call to 'Math'", + "enabled": false, + "description": "Reports calls to `java.lang.Math` methods, which results are not guaranteed to be reproduced precisely.\n\nIn environments where reproducibility of results is required, `java.lang.StrictMath`\nshould be used instead." + }, + { + "shortName": "FloatingPointEquality", + "displayName": "Floating-point equality comparison", + "enabled": false, + "description": "Reports floating-point values that are being compared using the `==` or `!=` operator.\n\nFloating-point values are inherently inaccurate, and comparing them for exact equality is seldom the desired semantics.\n\nThis inspection ignores comparisons with zero and infinity literals.\n\n**Example:**\n\n\n void m(double d1, double d2) {\n if (d1 == d2) {}\n }\n" + }, + { + "shortName": "LongLiteralsEndingWithLowercaseL", + "displayName": "'long' literal ending with 'l' instead of 'L'", + "enabled": true, + "description": "Reports `long` literals ending with lowercase 'l'. These literals may be confusing, as the lowercase 'l' looks very similar to a literal '1' (one).\n\n**Example:**\n\n\n long nights = 100l;\n\nAfter the quick-fix is applied:\n\n\n long nights = 100L;\n" + }, + { + "shortName": "BigDecimalMethodWithoutRoundingCalled", + "displayName": "Call to 'BigDecimal' method without a rounding mode argument", + "enabled": true, + "description": "Reports calls to `divide()` or `setScale()` without a rounding mode argument.\n\nSuch calls can lead to an `ArithmeticException` when the exact value cannot be represented in the result\n(for example, because it has a non-terminating decimal expansion).\n\nSpecifying a rounding mode prevents the `ArithmeticException`.\n\n**Example:**\n\n\n BigDecimal.valueOf(1).divide(BigDecimal.valueOf(3));\n" + }, + { + "shortName": "OverlyComplexArithmeticExpression", + "displayName": "Overly complex arithmetic expression", + "enabled": false, + "description": "Reports arithmetic expressions with the excessive number of terms. Such expressions might be hard to understand and might contain errors.\n\nParameters, field references, and other primary expressions are counted as a term.\n\n**Example:**\n\n int calc(int a, int b) {\n return a + a + a + b + b + b + b; // The line contains 7 terms and will be reported.\n }\n\nUse the field below to specify a number of terms allowed in arithmetic expressions." + } + ] + }, + { + "name": "Control flow issues", + "inspections": [ + { + "shortName": "NegatedEqualityExpression", + "displayName": "Negated equality expression", + "enabled": false, + "description": "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" + }, + { + "shortName": "DoubleNegation", + "displayName": "Double negation", "enabled": true, "description": "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" }, + { + "shortName": "AssertionCanBeIf", + "displayName": "Assertion can be replaced with 'if' statement", + "enabled": false, + "description": "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\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + }, { "shortName": "BreakStatement", "displayName": "'break' statement", @@ -5920,231 +6093,58 @@ "description": "Reports a labeled `break` statement whose labels may be removed without changing the flow of control." }, { - "shortName": "SuspiciousTypeOfGuard", - "displayName": "Unsound type guard check", - "enabled": false, - "description": "Reports a `typeof` or `instanceof` unsound type guard check. The `typeof x` type guard can be unsound in one of the following two cases:\n\n* `typeof x` never corresponds to the specified value (for example, `typeof x === 'number'` when `x` is of the type 'string \\| boolean')\n* `typeof x` always corresponds to the specified value (for example, `typeof x === 'string'` when `x` is of the type 'string')\n\nThe `x instanceof A` type guard can be unsound in one of the following two cases:\n\n* The type of `x` is not related to `A`\n* The type of `x` is `A` or a subtype of `A`" - }, - { - "shortName": "LoopStatementThatDoesntLoopJS", - "displayName": "Loop statement that doesn't loop", - "enabled": false, - "description": "Reports a `for`, `while`, or `do` statement whose bodies are guaranteed to execute at most once. Normally, this indicates an error." - }, - { - "shortName": "TailRecursionJS", - "displayName": "Tail recursion", - "enabled": false, - "description": "Reports a tail recursion, that is, when a function calls itself as its last action before returning. A tail recursion can always be replaced by looping, which will be considerably faster. Some JavaScript engines perform this optimization, while others do not. Thus, tail recursive solutions may have considerably different performance characteristics in different environments." - }, - { - "shortName": "DuplicateConditionJS", - "displayName": "Duplicate condition in 'if' statement", - "enabled": false, - "description": "Reports duplicate conditions in different branches of an `if` statement. Duplicate conditions usually represent programmer oversight.\n\nExample:\n\n\n if (a) {\n ...\n } else if (a) {\n ...\n }\n\n" - }, - { - "shortName": "UnnecessaryLabelJS", - "displayName": "Unnecessary label", - "enabled": false, - "description": "Reports an unused label." - }, - { - "shortName": "ForLoopReplaceableByWhileJS", - "displayName": "'for' loop may be replaced by 'while' loop", - "enabled": false, - "description": "Reports a `for` loop that contains neither initialization nor an update component. Suggests replacing the loop with a simpler `while` statement.\n\nExample:\n\n\n for(; exitCondition(); ) {\n process();\n }\n\nAfter the quick-fix is applied the result looks like:\n\n\n while(exitCondition()) {\n process();\n }\n\nUse the checkbox below if you wish this inspection to ignore **for** loops with trivial or non-existent conditions." - }, - { - "shortName": "ConstantConditionalExpressionJS", - "displayName": "Constant conditional expression", - "enabled": false, - "description": "Reports a conditional expression in the format `true? result1: result2` or `false? result1: result2``.\nSuggests simplifying the expression.\n`" - }, - { - "shortName": "JSObjectNullOrUndefined", - "displayName": "Object is 'null' or 'undefined'", - "enabled": false, - "description": "Reports an error caused by invoking a method, accessing a property, or calling a function on an object that is `undefined` or `null`." - }, - { - "shortName": "UnreachableCodeJS", - "displayName": "Unreachable code", - "enabled": false, - "description": "Reports code that can never be executed, which almost certainly indicates an error" - } - ] - }, - { - "name": "Numeric issues", - "inspections": [ - { - "shortName": "RemoveLiteralUnderscores", - "displayName": "Underscores in numeric literal", - "enabled": false, - "description": "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" - }, - { - "shortName": "BadOddness", - "displayName": "Suspicious oddness check", - "enabled": false, - "description": "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." - }, - { - "shortName": "InsertLiteralUnderscores", - "displayName": "Unreadable numeric literal", - "enabled": false, - "description": "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" - }, - { - "shortName": "ConfusingFloatingPointLiteral", - "displayName": "Confusing floating-point literal", - "enabled": false, - "description": "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." - }, - { - "shortName": "OctalAndDecimalIntegersMixed", - "displayName": "Octal and decimal integers in same array", - "enabled": false, - "description": "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};`" - }, - { - "shortName": "UnnecessaryUnaryMinus", - "displayName": "Unnecessary unary minus", - "enabled": true, - "description": "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" - }, - { - "shortName": "LossyConversionCompoundAssignment", - "displayName": "Possibly lossy implicit cast in compound assignment", - "enabled": true, - "description": "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" - }, - { - "shortName": "NegativeIntConstantInLongContext", - "displayName": "Negative int hexadecimal constant in long context", - "enabled": true, - "description": "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" - }, - { - "shortName": "ImplicitNumericConversion", - "displayName": "Implicit numeric conversion", - "enabled": false, - "description": "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." - }, - { - "shortName": "OctalLiteral", - "displayName": "Octal integer", - "enabled": true, - "description": "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" - }, - { - "shortName": "NumericOverflow", - "displayName": "Numeric overflow", - "enabled": true, - "description": "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" - }, - { - "shortName": "SuspiciousLiteralUnderscore", - "displayName": "Suspicious underscore in number literal", - "enabled": false, - "description": "Reports decimal number literals that use the underscore numeric separator with groups where the number of digits is not three. Such literals may contain a typo.\n\nThis inspection will not warn on literals containing two consecutive underscores.\nIt is also allowed to omit underscores in the fractional part of `double` and `float` literals.\n\n**Example:** `int oneMillion = 1_000_0000;`" - }, - { - "shortName": "ComparisonOfShortAndChar", - "displayName": "Comparison of 'short' and 'char' values", - "enabled": true, - "description": "Reports equality comparisons between `short` and `char` values.\n\nSuch comparisons may cause subtle bugs because while both values are 2-byte long, `short` values are\nsigned, and `char` values are unsigned.\n\n**Example:**\n\n\n if (Character.MAX_VALUE == shortValue()) {} //never can be true\n" - }, - { - "shortName": "DivideByZero", - "displayName": "Division by zero", - "enabled": true, - "description": "Reports division by zero or remainder by zero. Such expressions will produce an `Infinity`, `-Infinity` or `NaN` result for doubles or floats, and will throw an `ArithmeticException` for integers.\n\nWhen the expression has a `NaN` result, the fix suggests replacing the division expression with the `NaN` constant." - }, - { - "shortName": "ComparisonToNaN", - "displayName": "Comparison to 'Double.NaN' or 'Float.NaN'", - "enabled": true, - "description": "Reports any comparisons to `Double.NaN` or `Float.NaN`. Such comparisons are never meaningful, as NaN is not equal to anything, including itself. Use the `Double.isNaN()` or `Float.isNaN()` methods instead.\n\n**Example:**\n\n\n if (x == Double.NaN) {...}\n\nAfter the quick-fix is applied:\n\n\n if (Double.isNaN(x)) {...}\n" - }, - { - "shortName": "UnaryPlus", - "displayName": "Unary plus", - "enabled": true, - "description": "Reports usages of the `+` unary operator. The unary plus is usually a null operation, and its presence might represent a coding error. For example, in a combination with the increment operator (like in `+++`) or with the equal operator (like in `=+`).\n\n**Example:**\n\n\n void unaryPlus(int i) {\n int x = + +i;\n }\n\nThe following quick fixes are suggested:\n\n* Remove `+` operators before the `i` variable:\n\n\n void unaryPlus(int i) {\n int x = i;\n }\n\n* Replace `+` operators with the prefix increment operator:\n\n\n void unaryPlus(int i) {\n int x = ++i;\n }\n\n\nUse the checkbox below to report unary pluses that are used together with a binary or another unary expression.\nIt means the inspection will not report situations when a unary plus expression is used in array\ninitializer expressions or as a method argument." - }, - { - "shortName": "CachedNumberConstructorCall", - "displayName": "Number constructor call with primitive argument", - "enabled": true, - "description": "Reports instantiations of new `Long`, `Integer`, `Short`, or `Byte` objects that have a primitive `long`, `integer`, `short`, or `byte` argument.\n\nIt is recommended that you use the static method `valueOf()`\nintroduced in Java 5. By default, this method caches objects for values between -128 and\n127 inclusive.\n\n**Example:**\n\n\n Integer i = new Integer(1);\n Long l = new Long(1L);\n\nAfter the quick-fix is applied, the code changes to:\n\n\n Integer i = Integer.valueOf(1);\n Long l = Long.valueOf(1L);\n\nThis inspection only reports if the language level of the project or module is 5 or higher\n\n\nUse the **Ignore new number expressions with a String argument** option to ignore calls to number constructors with a `String` argument.\n\n\nUse the **Report only when constructor is @Deprecated** option to only report calls to deprecated constructors.\n`Long`, `Integer`, `Short` and `Byte` constructors are deprecated since JDK 9." - }, - { - "shortName": "PointlessArithmeticExpression", - "displayName": "Pointless arithmetic expression", - "enabled": true, - "description": "Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying by zero or one, and division by one.\n\nSuch expressions may be the result of automated refactorings and they are unlikely to be what the developer intended to do.\n\nThe quick-fix simplifies such expressions.\n\n**Example:**\n\n\n void f(int a) {\n int x = a - a;\n int y = a + 0;\n int res = x / x;\n }\n\nAfter the quick-fix is applied:\n\n\n void f(int a) {\n int x = 0;\n int y = a;\n int res = 1;\n }\n\n\nNote that in rare cases, the suggested replacement might not be completely equivalent to the original code\nfor all possible inputs. For example, the inspection suggests replacing `x / x` with `1`.\nHowever, if `x` is zero, the original code throws `ArithmeticException` or results in `NaN`.\nAlso, if `x` is `NaN`, then the result is also `NaN`. It's very unlikely that such behavior is intended." - }, - { - "shortName": "CharUsedInArithmeticContext", - "displayName": "'char' expression used in arithmetic context", - "enabled": false, - "description": "Reports expressions of the `char` type used in addition or subtraction expressions.\n\nSuch code is not necessarily an issue but may result in bugs (for example,\nif a string is expected).\n\n**Example:** `int a = 'a' + 42;`\n\nAfter the quick-fix is applied: `int a = (int) 'a' + 42;`\n\nFor the `String` context:\n\n int i1 = 1;\n int i2 = 2;\n System.out.println(i2 + '-' + i1 + \" = \" + (i2 - i1));\n\nAfter the quick-fix is applied:\n`System.out.println(i2 + \"-\" + i1 + \" = \" + (i2 - i1));`" - }, - { - "shortName": "UnpredictableBigDecimalConstructorCall", - "displayName": "Unpredictable 'BigDecimal' constructor call", - "enabled": true, - "description": "Reports calls to `BigDecimal` constructors that accept a `double` value. These constructors produce `BigDecimal` that is exactly equal to the supplied `double` value. However, because doubles are encoded in the IEEE 754 64-bit double-precision binary floating-point format, the exact value can be unexpected.\n\nFor example, `new BigDecimal(0.1)` yields a `BigDecimal` object. Its value is\n`0.1000000000000000055511151231257827021181583404541015625`\nwhich is the nearest number to 0.1 representable as a double.\nTo get `BigDecimal` that stores the same value as written in the source code,\nuse either `new BigDecimal(\"0.1\")` or `BigDecimal.valueOf(0.1)`.\n\n**Example:**\n\n\n class Constructor {\n void foo() {\n new BigDecimal(0.1);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Constructor {\n void foo() {\n new BigDecimal(\"0.1\");\n }\n }\n" + "shortName": "SuspiciousTypeOfGuard", + "displayName": "Unsound type guard check", + "enabled": false, + "description": "Reports a `typeof` or `instanceof` unsound type guard check. The `typeof x` type guard can be unsound in one of the following two cases:\n\n* `typeof x` never corresponds to the specified value (for example, `typeof x === 'number'` when `x` is of the type 'string \\| boolean')\n* `typeof x` always corresponds to the specified value (for example, `typeof x === 'string'` when `x` is of the type 'string')\n\nThe `x instanceof A` type guard can be unsound in one of the following two cases:\n\n* The type of `x` is not related to `A`\n* The type of `x` is `A` or a subtype of `A`" }, { - "shortName": "IntegerDivisionInFloatingPointContext", - "displayName": "Integer division in floating-point context", - "enabled": true, - "description": "Reports integer divisions where the result is used as a floating-point number. Such division is often an error and may have unexpected results due to the truncation that happens in integer division.\n\n**Example:**\n\n\n float x = 3.0F + 3 * 2 / 5;\n\nAfter the quick-fix is applied:\n\n\n float x = 3.0F + ((float) (3 * 2)) /5;\n" + "shortName": "LoopStatementThatDoesntLoopJS", + "displayName": "Loop statement that doesn't loop", + "enabled": false, + "description": "Reports a `for`, `while`, or `do` statement whose bodies are guaranteed to execute at most once. Normally, this indicates an error." }, { - "shortName": "BigDecimalEquals", - "displayName": "'equals()' called on 'BigDecimal'", + "shortName": "TailRecursionJS", + "displayName": "Tail recursion", "enabled": false, - "description": "Reports `equals()` calls that compare two `java.math.BigDecimal` numbers. This is normally a mistake, as two `java.math.BigDecimal` numbers are only equal if they are equal in both value and scale.\n\n**Example:**\n\n\n if (new BigDecimal(\"2.0\").equals(\n new BigDecimal(\"2.00\"))) {} // false\n\nAfter the quick-fix is applied:\n\n\n if (new BigDecimal(\"2.0\").compareTo(\n new BigDecimal(\"2.00\")) == 0) {} // true\n" + "description": "Reports a tail recursion, that is, when a function calls itself as its last action before returning. A tail recursion can always be replaced by looping, which will be considerably faster. Some JavaScript engines perform this optimization, while others do not. Thus, tail recursive solutions may have considerably different performance characteristics in different environments." }, { - "shortName": "ConstantMathCall", - "displayName": "Constant call to 'Math'", + "shortName": "DuplicateConditionJS", + "displayName": "Duplicate condition in 'if' statement", "enabled": false, - "description": "Reports calls to `java.lang.Math` or `java.lang.StrictMath` methods that can be replaced with simple compile-time constants.\n\n**Example:**\n\n double v = Math.sin(0.0);\n\nAfter the quick-fix is applied:\n\n double v = 0.0;\n" + "description": "Reports duplicate conditions in different branches of an `if` statement. Duplicate conditions usually represent programmer oversight.\n\nExample:\n\n\n if (a) {\n ...\n } else if (a) {\n ...\n }\n\n" }, { - "shortName": "NonReproducibleMathCall", - "displayName": "Non-reproducible call to 'Math'", + "shortName": "UnnecessaryLabelJS", + "displayName": "Unnecessary label", "enabled": false, - "description": "Reports calls to `java.lang.Math` methods, which results are not guaranteed to be reproduced precisely.\n\nIn environments where reproducibility of results is required, `java.lang.StrictMath`\nshould be used instead." + "description": "Reports an unused label." }, { - "shortName": "FloatingPointEquality", - "displayName": "Floating-point equality comparison", + "shortName": "ForLoopReplaceableByWhileJS", + "displayName": "'for' loop may be replaced by 'while' loop", "enabled": false, - "description": "Reports floating-point values that are being compared using the `==` or `!=` operator.\n\nFloating-point values are inherently inaccurate, and comparing them for exact equality is seldom the desired semantics.\n\nThis inspection ignores comparisons with zero and infinity literals.\n\n**Example:**\n\n\n void m(double d1, double d2) {\n if (d1 == d2) {}\n }\n" + "description": "Reports a `for` loop that contains neither initialization nor an update component. Suggests replacing the loop with a simpler `while` statement.\n\nExample:\n\n\n for(; exitCondition(); ) {\n process();\n }\n\nAfter the quick-fix is applied the result looks like:\n\n\n while(exitCondition()) {\n process();\n }\n\nUse the checkbox below if you wish this inspection to ignore **for** loops with trivial or non-existent conditions." }, { - "shortName": "LongLiteralsEndingWithLowercaseL", - "displayName": "'long' literal ending with 'l' instead of 'L'", - "enabled": true, - "description": "Reports `long` literals ending with lowercase 'l'. These literals may be confusing, as the lowercase 'l' looks very similar to a literal '1' (one).\n\n**Example:**\n\n\n long nights = 100l;\n\nAfter the quick-fix is applied:\n\n\n long nights = 100L;\n" + "shortName": "ConstantConditionalExpressionJS", + "displayName": "Constant conditional expression", + "enabled": false, + "description": "Reports a conditional expression in the format `true? result1: result2` or `false? result1: result2``.\nSuggests simplifying the expression.\n`" }, { - "shortName": "BigDecimalMethodWithoutRoundingCalled", - "displayName": "Call to 'BigDecimal' method without a rounding mode argument", - "enabled": true, - "description": "Reports calls to `divide()` or `setScale()` without a rounding mode argument.\n\nSuch calls can lead to an `ArithmeticException` when the exact value cannot be represented in the result\n(for example, because it has a non-terminating decimal expansion).\n\nSpecifying a rounding mode prevents the `ArithmeticException`.\n\n**Example:**\n\n\n BigDecimal.valueOf(1).divide(BigDecimal.valueOf(3));\n" + "shortName": "JSObjectNullOrUndefined", + "displayName": "Object is 'null' or 'undefined'", + "enabled": false, + "description": "Reports an error caused by invoking a method, accessing a property, or calling a function on an object that is `undefined` or `null`." }, { - "shortName": "OverlyComplexArithmeticExpression", - "displayName": "Overly complex arithmetic expression", + "shortName": "UnreachableCodeJS", + "displayName": "Unreachable code", "enabled": false, - "description": "Reports arithmetic expressions with the excessive number of terms. Such expressions might be hard to understand and might contain errors.\n\nParameters, field references, and other primary expressions are counted as a term.\n\n**Example:**\n\n int calc(int a, int b) {\n return a + a + a + b + b + b + b; // The line contains 7 terms and will be reported.\n }\n\nUse the field below to specify a number of terms allowed in arithmetic expressions." + "description": "Reports code that can never be executed, which almost certainly indicates an error" } ] }, @@ -7354,6 +7354,47 @@ } ] }, + { + "name": "Common", + "inspections": [ + { + "shortName": "ReactiveStreamsUnusedPublisher", + "displayName": "Unused publisher", + "enabled": true, + "description": "Reports unused `Publisher` instances.\n\n\nTo use an operator (a method of Mono/Flux/Flowable object that returns a Mono/Flux/Flowable) that produces a new `Publisher`\ninstance,\nyou must subscribe to the created `Publisher` via `subscribe()`.\n\n\nUsing a factory (for example, `Mono.just()`) without subscribing to the returned `Publisher`,\ncreates an object that is never used and is treated as unnecessary memory allocation.\n\n\nFor example, `Mono.just(1, 2, 3).map(i -> i + 3)` won't be executed unless you subscribe to this `Publisher`,\nor unless you produce a new `Publisher` by applying operators and subscribe to it.\n\n**Example:**\n\nUnused `Flux` instance:\n\n\n Flux.just(1, 2, 3);\n\nA `Flux` instance used by consumer:\n\n\n Flux.just(1, 2, 3).subscribe(System.out::println);\n\nCalls to methods annotated with Error Prone's or AssertJ's `@CanIgnoreReturnValue` annotation are not reported.\n\nNew in 2019.3" + }, + { + "shortName": "ReactiveStreamsThrowInOperator", + "displayName": "Throw statement in Reactive operator", + "enabled": true, + "description": "Reports `throw` expressions in the Reactor/RxJava operator code.\n\nThrowing exceptions from a Reactor/RxJava operator indicates a possible problem, because you can return a \"Reactive-like\" error:\n`Mono.error()` or `Flowable.error()` from `flatMap()`,\nor call `sink.error()` from the Reactor's `handle()` operator.\n\n\nAlso, Reactor factory methods allow returning checked exceptions without any errors, while throwing such exceptions without\nthe `Exceptions` class leads to a compilation error.\n\n**Example:**\n\n\n Flux.just(1, 2, 3).flatMap(i -> {\n throw new RuntimeException();\n })\n\nAfter the quick-fix is applied:\n\n\n Flux.just(1, 2, 3).flatMap(i -> {\n return Flux.error(new RuntimeException());\n })\n\nNew in 2019.3" + }, + { + "shortName": "ReactiveStreamsPublisherImplementation", + "displayName": "Class implements Publisher", + "enabled": true, + "description": "Reports classes that directly implement the `Publisher` interface.\n\nConsider using static generators from RxJava, Reactor or Mutiny, for example:\n\n* `Flux.just()`, `Flux.create()`, `Flux.generate()`, `Flux.from()`\n* `Mono.create()`, `Mono.from()`, `Mono.just()`\n* `Flowable.just()`, `Flowable.from()`\n* `Maybe.just()`, `Maybe.from()`\n* `Multi.createFrom()`, `Multi.createBy()`\n* `Uni.createFrom()`" + }, + { + "shortName": "ReactiveStreamsNullableInLambdaInTransform", + "displayName": "Return null or something nullable from a lambda in transformation method", + "enabled": true, + "description": "Reports transform operations that may return `null` inside a Reactive Stream chain.\n\n\nReactive Streams don't support nullable values, which causes such code to fail.\nThe quick-fix suggests replacing `map()` with `mapNotNull`, which omits exceptions.\n\n**Example:**\n\n repository.findWithTailableCursorBy()\n .map(e -> (Person)null)\n .doOnNext(System.out::println)\n\nAfter the quick-fix is applied:\n\n repository.findWithTailableCursorBy()\n .mapNotNull(e -> (Person)null)\n .doOnNext(System.out::println)\n\nNew in 2019.3" + }, + { + "shortName": "ReactiveStreamsTooLongSameOperatorsChain", + "displayName": "Too long same methods chain", + "enabled": true, + "description": "Reports long Reactive Streams transformation chains.\n\nEach operator method call, such as `map()` or `filter()`, creates some objects for those operators.\nCalling a long chain of operators on each subscription, for each stream element, may cause performance overhead.\nTo avoid it, combine a long chain of calls into one operator call wherever possible.\n\n**Example:**\n\n\n Flux.just(1, 2, 3)\n .map(it -> it + 1)\n .map(it -> it + 2)\n .map(it -> it + 3)\n\nAfter the quick-fix is applied:\n\n\n Flux.just(1, 2, 3)\n .map(it -> it + 1 + 2 + 3)\n\nNew in 2019.3" + }, + { + "shortName": "ReactiveStreamsSubscriberImplementation", + "displayName": "Class implements Subscriber", + "enabled": true, + "description": "Reports classes that directly implement the `Subscriber` interface.\n\nConsider using static generators from RxJava, Reactor or Mutiny, for example:\n\n* `Flux.just()`, `Flux.create()`, `Flux.generate()`, `Flux.from()`\n* `Mono.create()`, `Mono.from()`, `Mono.just()`\n* `Flowable.just()`, `Flowable.from()`\n* `Maybe.just()`, `Maybe.from()`\n* `Multi.createFrom()`, `Multi.createBy()`\n* `Uni.createFrom()`" + } + ] + }, { "name": "Packaging issues", "inspections": [ @@ -7401,47 +7442,6 @@ } ] }, - { - "name": "Common", - "inspections": [ - { - "shortName": "ReactiveStreamsUnusedPublisher", - "displayName": "Unused publisher", - "enabled": true, - "description": "Reports unused `Publisher` instances.\n\n\nTo use an operator (a method of Mono/Flux/Flowable object that returns a Mono/Flux/Flowable) that produces a new `Publisher`\ninstance,\nyou must subscribe to the created `Publisher` via `subscribe()`.\n\n\nUsing a factory (for example, `Mono.just()`) without subscribing to the returned `Publisher`,\ncreates an object that is never used and is treated as unnecessary memory allocation.\n\n\nFor example, `Mono.just(1, 2, 3).map(i -> i + 3)` won't be executed unless you subscribe to this `Publisher`,\nor unless you produce a new `Publisher` by applying operators and subscribe to it.\n\n**Example:**\n\nUnused `Flux` instance:\n\n\n Flux.just(1, 2, 3);\n\nA `Flux` instance used by consumer:\n\n\n Flux.just(1, 2, 3).subscribe(System.out::println);\n\nCalls to methods annotated with Error Prone's or AssertJ's `@CanIgnoreReturnValue` annotation are not reported.\n\nNew in 2019.3" - }, - { - "shortName": "ReactiveStreamsThrowInOperator", - "displayName": "Throw statement in Reactive operator", - "enabled": true, - "description": "Reports `throw` expressions in the Reactor/RxJava operator code.\n\nThrowing exceptions from a Reactor/RxJava operator indicates a possible problem, because you can return a \"Reactive-like\" error:\n`Mono.error()` or `Flowable.error()` from `flatMap()`,\nor call `sink.error()` from the Reactor's `handle()` operator.\n\n\nAlso, Reactor factory methods allow returning checked exceptions without any errors, while throwing such exceptions without\nthe `Exceptions` class leads to a compilation error.\n\n**Example:**\n\n\n Flux.just(1, 2, 3).flatMap(i -> {\n throw new RuntimeException();\n })\n\nAfter the quick-fix is applied:\n\n\n Flux.just(1, 2, 3).flatMap(i -> {\n return Flux.error(new RuntimeException());\n })\n\nNew in 2019.3" - }, - { - "shortName": "ReactiveStreamsPublisherImplementation", - "displayName": "Class implements Publisher", - "enabled": true, - "description": "Reports classes that directly implement the `Publisher` interface.\n\nConsider using static generators from RxJava, Reactor or Mutiny, for example:\n\n* `Flux.just()`, `Flux.create()`, `Flux.generate()`, `Flux.from()`\n* `Mono.create()`, `Mono.from()`, `Mono.just()`\n* `Flowable.just()`, `Flowable.from()`\n* `Maybe.just()`, `Maybe.from()`\n* `Multi.createFrom()`, `Multi.createBy()`\n* `Uni.createFrom()`" - }, - { - "shortName": "ReactiveStreamsNullableInLambdaInTransform", - "displayName": "Return null or something nullable from a lambda in transformation method", - "enabled": true, - "description": "Reports transform operations that may return `null` inside a Reactive Stream chain.\n\n\nReactive Streams don't support nullable values, which causes such code to fail.\nThe quick-fix suggests replacing `map()` with `mapNotNull`, which omits exceptions.\n\n**Example:**\n\n repository.findWithTailableCursorBy()\n .map(e -> (Person)null)\n .doOnNext(System.out::println)\n\nAfter the quick-fix is applied:\n\n repository.findWithTailableCursorBy()\n .mapNotNull(e -> (Person)null)\n .doOnNext(System.out::println)\n\nNew in 2019.3" - }, - { - "shortName": "ReactiveStreamsTooLongSameOperatorsChain", - "displayName": "Too long same methods chain", - "enabled": true, - "description": "Reports long Reactive Streams transformation chains.\n\nEach operator method call, such as `map()` or `filter()`, creates some objects for those operators.\nCalling a long chain of operators on each subscription, for each stream element, may cause performance overhead.\nTo avoid it, combine a long chain of calls into one operator call wherever possible.\n\n**Example:**\n\n\n Flux.just(1, 2, 3)\n .map(it -> it + 1)\n .map(it -> it + 2)\n .map(it -> it + 3)\n\nAfter the quick-fix is applied:\n\n\n Flux.just(1, 2, 3)\n .map(it -> it + 1 + 2 + 3)\n\nNew in 2019.3" - }, - { - "shortName": "ReactiveStreamsSubscriberImplementation", - "displayName": "Class implements Subscriber", - "enabled": true, - "description": "Reports classes that directly implement the `Subscriber` interface.\n\nConsider using static generators from RxJava, Reactor or Mutiny, for example:\n\n* `Flux.just()`, `Flux.create()`, `Flux.generate()`, `Flux.from()`\n* `Mono.create()`, `Mono.from()`, `Mono.just()`\n* `Flowable.just()`, `Flowable.from()`\n* `Maybe.just()`, `Maybe.from()`\n* `Multi.createFrom()`, `Multi.createBy()`\n* `Uni.createFrom()`" - } - ] - }, { "name": "Verbose or redundant code constructs", "inspections": [ @@ -8035,6 +8035,18 @@ { "name": "Validity issues", "inspections": [ + { + "shortName": "IncorrectPluginDslStructure", + "displayName": "Plugin DSL structure", + "enabled": false, + "description": "Detects disallowed statements before 'plugins {}' block.\nDue to the limitations of Gradle Plugin DSL, only a restricted set of Groovy statements is available before '`plugins {}`' block. The only options are '`buildscript {}`', '`pluginManagement {}`' and other '`plugins {}`'. \n[See Gradle documentation](https://docs.gradle.org/current/userguide/plugins.html#plugins_dsl_limitations)\n\n**Example:**\n\n\n import foo.bar.Baz\n plugins {} // reports 'plugins'\n plugins {\n foo() // reports 'foo'\n id 'java'\n }\n" + }, + { + "shortName": "DeprecatedConfigurations", + "displayName": "Deprecated configurations", + "enabled": false, + "description": "Detects usage of configuration methods that were deprecated.\nConfiguration methods may be deprecated because of two possible reasons:\n\n* The Gradle API has evolved, so old method choices should be avoided;\n* Some plugin provides a better version of the deprecated configuration method.\n\nMost likely there will be an alternative for the deprecated method.\n\n**Example:**\n\n\n plugins {\n id 'java'\n }\n\n dependencies {\n archive 'org.gradle.api:gradle:1.0' // reports 'archive'\n }\n" + }, { "shortName": "BadExpressionStatementJS", "displayName": "Expression statement which is not assignment or call", @@ -8077,18 +8089,6 @@ "enabled": false, "description": "Reports reassigning a value to a constant or a readonly variable." }, - { - "shortName": "IncorrectPluginDslStructure", - "displayName": "Plugin DSL structure", - "enabled": false, - "description": "Detects disallowed statements before 'plugins {}' block.\nDue to the limitations of Gradle Plugin DSL, only a restricted set of Groovy statements is available before '`plugins {}`' block. The only options are '`buildscript {}`', '`pluginManagement {}`' and other '`plugins {}`'. \n[See Gradle documentation](https://docs.gradle.org/current/userguide/plugins.html#plugins_dsl_limitations)\n\n**Example:**\n\n\n import foo.bar.Baz\n plugins {} // reports 'plugins'\n plugins {\n foo() // reports 'foo'\n id 'java'\n }\n" - }, - { - "shortName": "DeprecatedConfigurations", - "displayName": "Deprecated configurations", - "enabled": false, - "description": "Detects usage of configuration methods that were deprecated.\nConfiguration methods may be deprecated because of two possible reasons:\n\n* The Gradle API has evolved, so old method choices should be avoided;\n* Some plugin provides a better version of the deprecated configuration method.\n\nMost likely there will be an alternative for the deprecated method.\n\n**Example:**\n\n\n plugins {\n id 'java'\n }\n\n dependencies {\n archive 'org.gradle.api:gradle:1.0' // reports 'archive'\n }\n" - }, { "shortName": "GroovyDuplicateSwitchBranch", "displayName": "Duplicate switch case", @@ -11957,18 +11957,18 @@ "enabled": false, "description": "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." }, - { - "shortName": "ParametersPerMethod", - "displayName": "Method with too many parameters", - "enabled": false, - "description": "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." - }, { "shortName": "OverlyLongLambda", "displayName": "Overly long lambda expression", "enabled": false, "description": "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." }, + { + "shortName": "ParametersPerMethod", + "displayName": "Method with too many parameters", + "enabled": false, + "description": "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." + }, { "shortName": "MethodCoupling", "displayName": "Overly coupled method", @@ -13190,43 +13190,25 @@ ] }, { - "name": "Imports and dependencies", + "name": "Nullability problems", "inspections": [ { - "shortName": "JSUrlImportUsage", - "displayName": "URL import is used", - "enabled": false, - "description": "Checks used URL imports in the JavaScript language. Suggests downloading the module for the specified remote URL. Such association enables the IDE to provide proper code completion and navigation. \n\nURLs in import specifiers are supported only for ECMAScript modules in the JavaScript language." - }, - { - "shortName": "JSXNamespaceValidation", - "displayName": "Missing JSX namespace", - "enabled": false, - "description": "Reports a usage of a JSX construction without importing namespace. Having the namespace in the file scope ensures proper code compilation." - }, - { - "shortName": "ES6UnusedImports", - "displayName": "Unused import", - "enabled": false, - "description": "Reports a redundant `import` statement. This is usually the case if the imported symbols are not used in the source file. To avoid side-effects, consider using bare import `import 'packageName'` instead of the regular one." - }, - { - "shortName": "NpmUsedModulesInstalled", - "displayName": "Missing module dependency", + "shortName": "NotNullFieldNotInitialized", + "displayName": "@NotNull field is not initialized", "enabled": false, - "description": "Reports a module from a `require()` call or an `import` statement that is not installed or is not listed in package.json dependencies.\n\nSuggests installing the module and/or including it into package.json.\n\nFor `require()` calls, works only in the files from the scope of *Node.js Core* JavaScript library." + "description": "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." }, { - "shortName": "PackageJsonMismatchedDependency", - "displayName": "Mismatched dependencies in package.json", - "enabled": false, - "description": "Reports a dependency from package.json that is not installed or doesn't match the specified [version range](https://docs.npmjs.com/about-semantic-versioning)." + "shortName": "NullableProblems", + "displayName": "@NotNull/@Nullable problems", + "enabled": true, + "description": "Reports problems related to nullability annotations.\n\n**Examples:**\n\n* Overriding methods are not annotated:\n\n\n abstract class A {\n @NotNull abstract String m();\n }\n class B extends A {\n String m() { return \"empty string\"; }\n }\n \n* Annotated primitive types: `@NotNull int myFoo;`\n* Both `@Nullable` and `@NotNull` are present on the same member: `@Nullable @NotNull String myFooString;`\n* Collection of nullable elements is assigned into a collection of non-null elements:\n\n\n void testList(List<@Nullable String> nullableList) {\n List<@NotNull String> list2 = nullableList;\n }\n \nUse the **Configure Annotations** button to specify nullability annotations and the checkboxes to fine-tune where the inspection should provide warnings.\n\nThis inspection only reports if the language level of the project or module is 5 or higher,\nand nullability annotations are available on the classpath." }, { - "shortName": "UpdateDependencyToLatestVersion", - "displayName": "Update package.json dependencies to latest versions", + "shortName": "ReturnNull", + "displayName": "Return of 'null'", "enabled": false, - "description": "Suggests to upgrade your package.json dependencies to the latest versions, ignoring specified versions." + "description": "Reports `return` statements with `null` return values. While occasionally useful, this construct may make the code more prone to failing with a `NullPointerException`.\n\n\nIf a method is designed to return `null`, it is suggested to mark it with the\n`@Nullable` annotation - such methods will be ignored by this inspection.\n\n**Example:**\n\n\n class Person {\n public String getName () {\n return null;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Person {\n public @Nullable String getName () {\n return null;\n }\n }\n\n\nIf the return type is `java.util.Optional`, an additional quick-fix to convert\n`null` to `Optional.empty()` is suggested.\n\n\nUse the following options to configure the inspection:\n\n* Whether to ignore `private` methods. This will also ignore return of `null` from anonymous classes and lambdas.\n* Whether `null` values on array returns, collection object returns, plain object returns, or a combination of the three should be reported. Return of `null` in methods with return type `java.util.Optional` are always reported.\n* Click **Configure annotations** to specify which annotations should be considered 'nullable'." } ] }, @@ -13272,25 +13254,43 @@ ] }, { - "name": "Nullability problems", + "name": "Imports and dependencies", "inspections": [ { - "shortName": "NotNullFieldNotInitialized", - "displayName": "@NotNull field is not initialized", + "shortName": "JSUrlImportUsage", + "displayName": "URL import is used", "enabled": false, - "description": "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." + "description": "Checks used URL imports in the JavaScript language. Suggests downloading the module for the specified remote URL. Such association enables the IDE to provide proper code completion and navigation. \n\nURLs in import specifiers are supported only for ECMAScript modules in the JavaScript language." }, { - "shortName": "NullableProblems", - "displayName": "@NotNull/@Nullable problems", - "enabled": true, - "description": "Reports problems related to nullability annotations.\n\n**Examples:**\n\n* Overriding methods are not annotated:\n\n\n abstract class A {\n @NotNull abstract String m();\n }\n class B extends A {\n String m() { return \"empty string\"; }\n }\n \n* Annotated primitive types: `@NotNull int myFoo;`\n* Both `@Nullable` and `@NotNull` are present on the same member: `@Nullable @NotNull String myFooString;`\n* Collection of nullable elements is assigned into a collection of non-null elements:\n\n\n void testList(List<@Nullable String> nullableList) {\n List<@NotNull String> list2 = nullableList;\n }\n \nUse the **Configure Annotations** button to specify nullability annotations and the checkboxes to fine-tune where the inspection should provide warnings.\n\nThis inspection only reports if the language level of the project or module is 5 or higher,\nand nullability annotations are available on the classpath." + "shortName": "JSXNamespaceValidation", + "displayName": "Missing JSX namespace", + "enabled": false, + "description": "Reports a usage of a JSX construction without importing namespace. Having the namespace in the file scope ensures proper code compilation." }, { - "shortName": "ReturnNull", - "displayName": "Return of 'null'", + "shortName": "ES6UnusedImports", + "displayName": "Unused import", "enabled": false, - "description": "Reports `return` statements with `null` return values. While occasionally useful, this construct may make the code more prone to failing with a `NullPointerException`.\n\n\nIf a method is designed to return `null`, it is suggested to mark it with the\n`@Nullable` annotation - such methods will be ignored by this inspection.\n\n**Example:**\n\n\n class Person {\n public String getName () {\n return null;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Person {\n public @Nullable String getName () {\n return null;\n }\n }\n\n\nIf the return type is `java.util.Optional`, an additional quick-fix to convert\n`null` to `Optional.empty()` is suggested.\n\n\nUse the following options to configure the inspection:\n\n* Whether to ignore `private` methods. This will also ignore return of `null` from anonymous classes and lambdas.\n* Whether `null` values on array returns, collection object returns, plain object returns, or a combination of the three should be reported. Return of `null` in methods with return type `java.util.Optional` are always reported.\n* Click **Configure annotations** to specify which annotations should be considered 'nullable'." + "description": "Reports a redundant `import` statement. This is usually the case if the imported symbols are not used in the source file. To avoid side-effects, consider using bare import `import 'packageName'` instead of the regular one." + }, + { + "shortName": "NpmUsedModulesInstalled", + "displayName": "Missing module dependency", + "enabled": false, + "description": "Reports a module from a `require()` call or an `import` statement that is not installed or is not listed in package.json dependencies.\n\nSuggests installing the module and/or including it into package.json.\n\nFor `require()` calls, works only in the files from the scope of *Node.js Core* JavaScript library." + }, + { + "shortName": "PackageJsonMismatchedDependency", + "displayName": "Mismatched dependencies in package.json", + "enabled": false, + "description": "Reports a dependency from package.json that is not installed or doesn't match the specified [version range](https://docs.npmjs.com/about-semantic-versioning)." + }, + { + "shortName": "UpdateDependencyToLatestVersion", + "displayName": "Update package.json dependencies to latest versions", + "enabled": false, + "description": "Suggests to upgrade your package.json dependencies to the latest versions, ignoring specified versions." } ] }, diff --git a/qodana/results/metaInformation.json b/qodana/results/metaInformation.json index 0d9bbccb910..acc1cf44514 100644 --- a/qodana/results/metaInformation.json +++ b/qodana/results/metaInformation.json @@ -7,11 +7,11 @@ "linter": "QDJVM", "attributes": { "deviceId": "200820300000000-b1a5-d275-f8e7-faf9fd093ee8", - "jobUrl": "https://github.com/1c-syntax/bsl-language-server/actions/runs/11543657849", + "jobUrl": "https://github.com/1c-syntax/bsl-language-server/actions/runs/11586482616", "vcs": { "sarifIdea": { "repositoryUri": "https://github.com/1c-syntax/bsl-language-server.git", - "revisionId": "fe793156ab9bbc0f5496e4959880329d88e9f9ba", + "revisionId": "810c04ade64b5948b7509a3183a868c4126104be", "branch": "develop" } }, diff --git a/qodana/results/projectStructure/qodana.spdx.json b/qodana/results/projectStructure/qodana.spdx.json index ea13a53549f..c67a3809f80 100644 --- a/qodana/results/projectStructure/qodana.spdx.json +++ b/qodana/results/projectStructure/qodana.spdx.json @@ -9,7 +9,7 @@ "Tool: Qodana", "Organization: JetBrains s.r.o." ], - "created": "2024-10-27T20:47:00Z" + "created": "2024-10-30T03:35:48Z" }, "packages": [ { @@ -27,7 +27,7 @@ "checksums": [ { "algorithm": "SHA1", - "checksumValue": "fe793156ab9bbc0f5496e4959880329d88e9f9ba" + "checksumValue": "810c04ade64b5948b7509a3183a868c4126104be" } ], "primaryPackagePurpose": "SOURCE" @@ -48,7 +48,7 @@ "checksums": [ { "algorithm": "SHA1", - "checksumValue": "fe793156ab9bbc0f5496e4959880329d88e9f9ba" + "checksumValue": "810c04ade64b5948b7509a3183a868c4126104be" } ], "primaryPackagePurpose": "SOURCE" @@ -69,7 +69,7 @@ "checksums": [ { "algorithm": "SHA1", - "checksumValue": "fe793156ab9bbc0f5496e4959880329d88e9f9ba" + "checksumValue": "810c04ade64b5948b7509a3183a868c4126104be" } ], "primaryPackagePurpose": "SOURCE" diff --git a/qodana/results/projectStructure/thirdPartySoftwareList.json b/qodana/results/projectStructure/thirdPartySoftwareList.json index ea13a53549f..c67a3809f80 100644 --- a/qodana/results/projectStructure/thirdPartySoftwareList.json +++ b/qodana/results/projectStructure/thirdPartySoftwareList.json @@ -9,7 +9,7 @@ "Tool: Qodana", "Organization: JetBrains s.r.o." ], - "created": "2024-10-27T20:47:00Z" + "created": "2024-10-30T03:35:48Z" }, "packages": [ { @@ -27,7 +27,7 @@ "checksums": [ { "algorithm": "SHA1", - "checksumValue": "fe793156ab9bbc0f5496e4959880329d88e9f9ba" + "checksumValue": "810c04ade64b5948b7509a3183a868c4126104be" } ], "primaryPackagePurpose": "SOURCE" @@ -48,7 +48,7 @@ "checksums": [ { "algorithm": "SHA1", - "checksumValue": "fe793156ab9bbc0f5496e4959880329d88e9f9ba" + "checksumValue": "810c04ade64b5948b7509a3183a868c4126104be" } ], "primaryPackagePurpose": "SOURCE" @@ -69,7 +69,7 @@ "checksums": [ { "algorithm": "SHA1", - "checksumValue": "fe793156ab9bbc0f5496e4959880329d88e9f9ba" + "checksumValue": "810c04ade64b5948b7509a3183a868c4126104be" } ], "primaryPackagePurpose": "SOURCE" diff --git a/qodana/results/promo.json b/qodana/results/promo.json index 01c53284451..31b4e97098c 100644 --- a/qodana/results/promo.json +++ b/qodana/results/promo.json @@ -1,32 +1 @@ -{"version":"3","listProblem":[{ - "tool": "Code Inspection", - "category": "Declaration redundancy", - "type": "Default annotation parameter value", - "tags": [ - "JAVA" - ], - "severity": "High", - "comment": "Redundant default parameter value assignment", - "detailsInfo": "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", - "sources": [ - { - "type": "file", - "path": "src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BadWordsDiagnostic.java", - "language": "JAVA", - "line": 51, - "offset": 20, - "length": 17, - "code": { - "startLine": 49, - "length": 17, - "offset": 68, - "surroundingCode": " @DiagnosticParameter(\n type = String.class,\n defaultValue = BAD_WORDS_DEFAULT\n )\n private Pattern badWords = CaseInsensitivePattern.compile(BAD_WORDS_DEFAULT);" - } - } - ], - "attributes": { - "module": "bsl-language-server.main", - "inspectionName": "DefaultAnnotationParam" - }, - "hash": "ca52c609965d4a073ebaadadda63e9fd15661f8c1aeb89baf1f580f7907adac4" -}]} \ No newline at end of file +{"version":"3","listProblem":[]} \ No newline at end of file diff --git a/qodana/results/qodana.sarif.json b/qodana/results/qodana.sarif.json index 7bc645c92ad..d2a2e164d16 100644 --- a/qodana/results/qodana.sarif.json +++ b/qodana/results/qodana.sarif.json @@ -14,10 +14,6 @@ "id": "Language injection", "name": "Language injection" }, - { - "id": "JVM languages", - "name": "JVM languages" - }, { "id": "Kotlin", "name": "Kotlin" @@ -29,7 +25,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -40,6 +36,10 @@ } ] }, + { + "id": "JVM languages", + "name": "JVM languages" + }, { "id": "Kotlin/Redundant constructs", "name": "Redundant constructs", @@ -47,7 +47,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -157,8 +157,8 @@ ] }, { - "id": "Java/Error handling", - "name": "Error handling", + "id": "Java/Declaration redundancy", + "name": "Declaration redundancy", "relationships": [ { "target": { @@ -175,13 +175,13 @@ ] }, { - "id": "Java/Declaration redundancy", - "name": "Declaration redundancy", + "id": "Spring/Spring Core/Code", + "name": "Code", "relationships": [ { "target": { - "id": "Java", - "index": 5, + "id": "Spring/Spring Core", + "index": 8, "toolComponent": { "name": "QDJVM" } @@ -193,13 +193,13 @@ ] }, { - "id": "Spring/Spring Core/Code", - "name": "Code", + "id": "Java/Error handling", + "name": "Error handling", "relationships": [ { "target": { - "id": "Spring/Spring Core", - "index": 8, + "id": "Java", + "index": 5, "toolComponent": { "name": "QDJVM" } @@ -235,7 +235,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -381,7 +381,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -411,8 +411,8 @@ ] }, { - "id": "Java/Control flow issues", - "name": "Control flow issues", + "id": "Java/Numeric issues", + "name": "Numeric issues", "relationships": [ { "target": { @@ -429,8 +429,8 @@ ] }, { - "id": "Java/Numeric issues", - "name": "Numeric issues", + "id": "Java/Control flow issues", + "name": "Control flow issues", "relationships": [ { "target": { @@ -593,13 +593,17 @@ ] }, { - "id": "Java/Packaging issues", - "name": "Packaging issues", + "id": "Reactive Streams", + "name": "Reactive Streams" + }, + { + "id": "Reactive Streams/Common", + "name": "Common", "relationships": [ { "target": { - "id": "Java", - "index": 5, + "id": "Reactive Streams", + "index": 44, "toolComponent": { "name": "QDJVM" } @@ -611,17 +615,13 @@ ] }, { - "id": "Reactive Streams", - "name": "Reactive Streams" - }, - { - "id": "Reactive Streams/Common", - "name": "Common", + "id": "Java/Packaging issues", + "name": "Packaging issues", "relationships": [ { "target": { - "id": "Reactive Streams", - "index": 45, + "id": "Java", + "index": 5, "toolComponent": { "name": "QDJVM" } @@ -687,7 +687,7 @@ { "target": { "id": "JVM languages", - "index": 1, + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -703,13 +703,13 @@ "name": "EditorConfig" }, { - "id": "JavaScript and TypeScript/Validity issues", + "id": "Gradle/Validity issues", "name": "Validity issues", "relationships": [ { "target": { - "id": "JavaScript and TypeScript", - "index": 18, + "id": "Gradle", + "index": 49, "toolComponent": { "name": "QDJVM" } @@ -721,13 +721,13 @@ ] }, { - "id": "Gradle/Validity issues", + "id": "JavaScript and TypeScript/Validity issues", "name": "Validity issues", "relationships": [ { "target": { - "id": "Gradle", - "index": 49, + "id": "JavaScript and TypeScript", + "index": 18, "toolComponent": { "name": "QDJVM" } @@ -797,13 +797,13 @@ ] }, { - "id": "Groovy/Probable bugs", - "name": "Probable bugs", + "id": "Kotlin/Other problems", + "name": "Other problems", "relationships": [ { "target": { - "id": "Groovy", - "index": 22, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -815,13 +815,13 @@ ] }, { - "id": "Kotlin/Other problems", - "name": "Other problems", + "id": "Groovy/Probable bugs", + "name": "Probable bugs", "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Groovy", + "index": 22, "toolComponent": { "name": "QDJVM" } @@ -945,7 +945,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -1057,7 +1057,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -1503,7 +1503,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -1699,7 +1699,7 @@ { "target": { "id": "JVM languages", - "index": 1, + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -1959,7 +1959,7 @@ { "target": { "id": "Java/Numeric issues", - "index": 31, + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -2177,7 +2177,7 @@ { "target": { "id": "Reactive Streams", - "index": 45, + "index": 44, "toolComponent": { "name": "QDJVM" } @@ -2379,13 +2379,13 @@ ] }, { - "id": "JavaScript and TypeScript/Imports and dependencies", - "name": "Imports and dependencies", + "id": "Java/Probable bugs/Nullability problems", + "name": "Nullability problems", "relationships": [ { "target": { - "id": "JavaScript and TypeScript", - "index": 18, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -2415,13 +2415,13 @@ ] }, { - "id": "Java/Probable bugs/Nullability problems", - "name": "Nullability problems", + "id": "JavaScript and TypeScript/Imports and dependencies", + "name": "Imports and dependencies", "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "JavaScript and TypeScript", + "index": 18, "toolComponent": { "name": "QDJVM" } @@ -2727,7 +2727,7 @@ { "target": { "id": "Reactive Streams", - "index": 45, + "index": 44, "toolComponent": { "name": "QDJVM" } @@ -2803,7 +2803,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -2857,7 +2857,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -2911,7 +2911,7 @@ { "target": { "id": "Kotlin", - "index": 2, + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -3193,32 +3193,32 @@ "isComprehensive": false }, { - "name": "com.intellij.java", - "version": "242.24024", + "name": "org.jetbrains.kotlin", + "version": "242.24024-IJ", "rules": [ { - "id": "OverrideOnly", + "id": "RedundantRunCatching", "shortDescription": { - "text": "Method can only be overridden" + "text": "Redundant 'runCatching' call" }, "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." + "text": "Reports 'runCatching' calls that are immediately followed by 'getOrThrow'. Such calls can be replaced with just 'run'. Example: 'fun foo() = runCatching { doSomething() }.getOrThrow()' After the quick-fix is applied: 'fun foo() = run { doSomething() }'", + "markdown": "Reports `runCatching` calls that are immediately followed by `getOrThrow`. Such calls can be replaced with just `run`.\n\n**Example:**\n\n\n fun foo() = runCatching { doSomething() }.getOrThrow()\n\nAfter the quick-fix is applied:\n\n\n fun foo() = run { doSomething() }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "OverrideOnly", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantRunCatching", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -3230,19 +3230,19 @@ ] }, { - "id": "CallToSuspiciousStringMethod", + "id": "SimpleRedundantLet", "shortDescription": { - "text": "Call to suspicious 'String' method" + "text": "Redundant receiver-based 'let' call" }, "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." + "text": "Reports redundant receiver-based 'let' calls. The quick-fix removes the redundant 'let' call. Example: 'fun test(s: String?): Int? = s?.let { it.length }' After the quick-fix is applied: 'fun test(s: String?): Int? = s?.length'", + "markdown": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToSuspiciousStringMethod", + "suppressToolId": "SimpleRedundantLet", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3250,8 +3250,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -3263,19 +3263,19 @@ ] }, { - "id": "KeySetIterationMayUseEntrySet", + "id": "RemoveSingleExpressionStringTemplate", "shortDescription": { - "text": "Iteration over 'keySet()' can be optimized" + "text": "Redundant string template" }, "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" + "text": "Reports single-expression string templates that can be safely removed. Example: 'val x = \"Hello\"\n val y = \"$x\"' After the quick-fix is applied: 'val x = \"Hello\"\n val y = x // <== Updated'", + "markdown": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KeySetIterationMayUseEntrySet", + "suppressToolId": "RemoveSingleExpressionStringTemplate", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3283,8 +3283,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -3296,19 +3296,19 @@ ] }, { - "id": "UnnecessaryQualifierForThis", + "id": "NonExhaustiveWhenStatementMigration", "shortDescription": { - "text": "Unnecessary qualifier for 'this' or 'super'" + "text": "Non-exhaustive 'when' statements will be prohibited since 1.7" }, "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" + "text": "Reports a non-exhaustive 'when' statements that will lead to compilation error since 1.7. Motivation types: Problematic/meaningless usage patterns need to be discouraged/blocked (e.g. counterintuitive behaviors) Code is error-prone Inconsistency in the design (things are done differently in different contexts) Impact types: Compilation. Some code that used to compile won't compile any more There were cases when such code worked with no exceptions Some such code could compile without any warnings More details: KT-47709: Make when statements with enum, sealed, and Boolean subjects exhaustive by default The quick-fix adds the missing 'else -> {}' branch. Example: 'sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n }\n }' After the quick-fix is applied: 'sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n else -> {}\n }\n }' This inspection only reports if the Kotlin language level of the project or module is 1.6 or higher.", + "markdown": "Reports a non-exhaustive `when` statements that will lead to compilation error since 1.7.\n\nMotivation types:\n\n* Problematic/meaningless usage patterns need to be discouraged/blocked (e.g. counterintuitive behaviors)\n * Code is error-prone\n* Inconsistency in the design (things are done differently in different contexts)\n\nImpact types:\n\n* Compilation. Some code that used to compile won't compile any more\n * There were cases when such code worked with no exceptions\n * Some such code could compile without any warnings\n\n**More details:** [KT-47709: Make when statements with enum, sealed, and Boolean subjects exhaustive by default](https://youtrack.jetbrains.com/issue/KT-47709)\n\nThe quick-fix adds the missing `else -> {}` branch.\n\n**Example:**\n\n\n sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n else -> {}\n }\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.6 or higher." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryQualifierForThis", + "suppressToolId": "NonExhaustiveWhenStatementMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3316,8 +3316,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -3329,19 +3329,19 @@ ] }, { - "id": "UncheckedExceptionClass", + "id": "IncompleteDestructuring", "shortDescription": { - "text": "Unchecked 'Exception' class" + "text": "Incomplete destructuring declaration" }, "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" + "text": "Reports incomplete destructuring declaration. Example: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person' The quick fix completes destructuring declaration with new variables: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person'", + "markdown": "Reports incomplete destructuring declaration.\n\n**Example:**\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person\n\nThe quick fix completes destructuring declaration with new variables:\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UncheckedExceptionClass", + "suppressToolId": "IncompleteDestructuring", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3349,8 +3349,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -3362,28 +3362,28 @@ ] }, { - "id": "UnusedReturnValue", + "id": "ScopeFunctionConversion", "shortDescription": { - "text": "Method can be made 'void'" + "text": "Scope function can be converted to another one" }, "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." + "text": "Reports scope functions ('let', 'run', 'apply', 'also') that can be converted between each other. Using corresponding functions makes your code simpler. The quick-fix replaces the scope function to another one. Example: 'val x = \"\".let {\n it.length\n }' After the quick-fix is applied: 'val x = \"\".run {\n length\n }'", + "markdown": "Reports scope functions (`let`, `run`, `apply`, `also`) that can be converted between each other.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the scope function to another one.\n\n**Example:**\n\n\n val x = \"\".let {\n it.length\n }\n\nAfter the quick-fix is applied:\n\n\n val x = \"\".run {\n length\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnusedReturnValue", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ScopeFunctionConversion", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -3395,28 +3395,28 @@ ] }, { - "id": "SizeReplaceableByIsEmpty", + "id": "TrailingComma", "shortDescription": { - "text": "'size() == 0' can be replaced with 'isEmpty()'" + "text": "Trailing comma recommendations" }, "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()`." + "text": "Reports trailing commas that do not follow the recommended style guide.", + "markdown": "Reports trailing commas that do not follow the recommended [style guide](https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SizeReplaceableByIsEmpty", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "TrailingComma", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -3428,28 +3428,28 @@ ] }, { - "id": "UnsupportedChronoFieldUnitCall", + "id": "FoldInitializerAndIfToElvis", "shortDescription": { - "text": "Call methods with unsupported 'java.time.temporal.ChronoUnit' and 'java.time.temporal.ChronoField'" + "text": "If-Null return/break/... foldable to '?:'" }, "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" + "text": "Reports an 'if' expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer. Example: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }' The quick-fix converts the 'if' expression with an initializer into an elvis expression: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }'", + "markdown": "Reports an `if` expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.\n\n**Example:**\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }\n\nThe quick-fix converts the `if` expression with an initializer into an elvis expression:\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "UnsupportedChronoFieldUnitCall", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "FoldInitializerAndIfToElvis", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -3461,31 +3461,28 @@ ] }, { - "id": "NumberEquality", + "id": "AmbiguousNonLocalJump", "shortDescription": { - "text": "Number comparison using '==', instead of 'equals()'" + "text": "Ambiguous non-local 'break' or 'continue'" }, "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" + "text": "Reports 'break' or 'continue' usages inside of lambdas of loop-like functions. 'break' and 'continue' keywords always apply to the real loops ('for', 'while', 'do-while'). 'break' and 'continue' never apply to any function; for example, 'break' and 'continue' don't apply to 'forEach', 'filter', 'map'. Using 'break' or 'continue' inside a loop-like function (for example, 'forEach') may be confusing. The inspection suggests adding a label to clarify to which statement 'break' or 'continue' applies to. Since Kotlin doesn't have a concept of loop-like functions, the inspection uses the heuristic. It assumes that functions that don't have one of 'callsInPlace(EXACTLY_ONCE)' or 'callsInPlace(AT_LEAST_ONCE)' contracts are loop-like functions. Example: 'for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue\n println(line)\n }\n }' The quick-fix adds clarifying labels: 'loop@ for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue@loop\n println(line)\n }\n }'", + "markdown": "Reports `break` or `continue` usages inside of lambdas of loop-like functions.\n\n\n`break` and `continue` keywords always apply to the real loops (`for`,\n`while`, `do-while`). `break` and `continue` never apply to any function; for example,\n`break` and `continue` don't apply to `forEach`, `filter`, `map`.\n\n\nUsing `break` or `continue` inside a loop-like function (for example, `forEach`) may be confusing.\nThe inspection suggests adding a label to clarify to which statement `break` or `continue` applies to.\n\n\nSince Kotlin doesn't have a concept of loop-like functions, the inspection uses the heuristic. It assumes that functions that don't\nhave one of `callsInPlace(EXACTLY_ONCE)` or `callsInPlace(AT_LEAST_ONCE)` contracts are loop-like functions.\n\n**Example:**\n\n\n for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue\n println(line)\n }\n }\n\nThe quick-fix adds clarifying labels:\n\n\n loop@ for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue@loop\n println(line)\n }\n }\n" }, "defaultConfiguration": { "enabled": true, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NumberEquality", - "cweIds": [ - 480 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "AmbiguousNonLocalJump", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -3497,19 +3494,19 @@ ] }, { - "id": "ClassWithOnlyPrivateConstructors", + "id": "ReplaceWithStringBuilderAppendRange", "shortDescription": { - "text": "Class with only 'private' constructors should be declared 'final'" + "text": "'StringBuilder.append(CharArray, offset, len)' call on the JVM" }, "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`." + "text": "Reports a 'StringBuilder.append(CharArray, offset, len)' function call on the JVM platform that should be replaced with a 'StringBuilder.appendRange(CharArray, startIndex, endIndex)' function call. The 'append' function behaves differently on the JVM, JS and Native platforms, so using the 'appendRange' function is recommended. Example: 'fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n append(charArray, offset, len)\n }\n }' After the quick-fix is applied: 'fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n appendRange(charArray, offset, offset + len)\n }\n }'", + "markdown": "Reports a `StringBuilder.append(CharArray, offset, len)` function call on the JVM platform that should be replaced with a `StringBuilder.appendRange(CharArray, startIndex, endIndex)` function call.\n\nThe `append` function behaves differently on the JVM, JS and Native platforms, so using the `appendRange` function is recommended.\n\n**Example:**\n\n\n fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n append(charArray, offset, len)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n appendRange(charArray, offset, offset + len)\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ClassWithOnlyPrivateConstructors", + "suppressToolId": "ReplaceWithStringBuilderAppendRange", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3517,8 +3514,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -3530,31 +3527,28 @@ ] }, { - "id": "ComparatorNotSerializable", + "id": "KotlinInvalidBundleOrProperty", "shortDescription": { - "text": "'Comparator' class not declared 'Serializable'" + "text": "Invalid property key" }, "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" + "text": "Reports unresolved references to '.properties' file keys and resource bundles in Kotlin files.", + "markdown": "Reports unresolved references to `.properties` file keys and resource bundles in Kotlin files." }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "error", "parameters": { - "suppressToolId": "ComparatorNotSerializable", - "cweIds": [ - 502 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "InvalidBundleOrProperty", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -3566,19 +3560,19 @@ ] }, { - "id": "UNUSED_IMPORT", + "id": "UselessCallOnCollection", "shortDescription": { - "text": "Unused import" + "text": "Useless call on collection type" }, "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" + "text": "Reports 'filter…' calls from the standard library on already filtered collections. Several functions from the standard library such as 'filterNotNull()' or 'filterIsInstance' have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise, such calls can be omitted as the result will be the same. Remove redundant call quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }'", + "markdown": "Reports `filter...` calls from the standard library on already filtered collections.\n\nSeveral functions from the standard library such as `filterNotNull()` or `filterIsInstance`\nhave sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,\nsuch calls can be omitted as the result will be the same.\n\n**Remove redundant call** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UNUSED_IMPORT", + "suppressToolId": "UselessCallOnCollection", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3586,8 +3580,8 @@ "relationships": [ { "target": { - "id": "Java/Imports", - "index": 24, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -3599,28 +3593,28 @@ ] }, { - "id": "FieldAccessedSynchronizedAndUnsynchronized", + "id": "RedundantRequireNotNullCall", "shortDescription": { - "text": "Field accessed in both 'synchronized' and unsynchronized contexts" + "text": "Redundant 'requireNotNull' or 'checkNotNull' call" }, "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." + "text": "Reports redundant 'requireNotNull' or 'checkNotNull' call on non-nullable expressions. Example: 'fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }' After the quick-fix is applied: 'fun foo(i: Int) {\n ...\n }'", + "markdown": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "FieldAccessedSynchronizedAndUnsynchronized", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantRequireNotNullCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -3632,28 +3626,28 @@ ] }, { - "id": "NegatedEqualityExpression", + "id": "ObjectPropertyName", "shortDescription": { - "text": "Negated equality expression" + "text": "Object property naming convention" }, "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" + "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Top-level properties Properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores. Example: '// top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }'", + "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Top-level properties\n* Properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an uppercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n // top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NegatedEqualityExpression", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ObjectPropertyName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -3665,28 +3659,28 @@ ] }, { - "id": "RemoveLiteralUnderscores", + "id": "PackageDirectoryMismatch", "shortDescription": { - "text": "Underscores in numeric literal" + "text": "Package name does not match containing directory" }, "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" + "text": "Reports 'package' directives that do not match the location of the file. When applying fixes, \"Move refactoring\" defaults are used to update usages of changed declarations, namely: \"Search in comments and strings\" \"Search for text occurrences\"", + "markdown": "Reports `package` directives that do not match the location of the file.\n\n\nWhen applying fixes, \"Move refactoring\" defaults are used to update usages of changed declarations, namely:\n\n* \"Search in comments and strings\"\n* \"Search for text occurrences\"" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "note", "parameters": { - "suppressToolId": "RemoveLiteralUnderscores", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "PackageDirectoryMismatch", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -3698,23 +3692,19 @@ ] }, { - "id": "MathRandomCastToInt", + "id": "KotlinCovariantEquals", "shortDescription": { - "text": "'Math.random()' cast to 'int'" + "text": "Covariant 'equals()'" }, "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" + "text": "Reports 'equals()' that takes an argument type other than 'Any?' if the class does not have another 'equals()' that takes 'Any?' as its argument type. Example: 'class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }' To fix the problem create 'equals()' method that takes an argument of type 'Any?'.", + "markdown": "Reports `equals()` that takes an argument type other than `Any?` if the class does not have another `equals()` that takes `Any?` as its argument type.\n\n**Example:**\n\n\n class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }\n\nTo fix the problem create `equals()` method that takes an argument of type `Any?`." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MathRandomCastToInt", - "cweIds": [ - 330, - 681 - ], + "suppressToolId": "CovariantEquals", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3722,8 +3712,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -3735,28 +3725,28 @@ ] }, { - "id": "DoubleBraceInitialization", + "id": "ReplaceSizeZeroCheckWithIsEmpty", "shortDescription": { - "text": "Double brace initialization" + "text": "Size zero check can be replaced with 'isEmpty()'" }, "fullDescription": { - "text": "Reports Double Brace Initialization. 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. Double brace initialization may cause memory leaks when used in a non-static context. This is because it defines an anonymous class that will reference the surrounding object, when compiled with javac from before Java 18. 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 list = new ArrayList<>() {{\n add(1);\n add(2);\n }};' After the quick-fix is applied: 'List list = new ArrayList<>();\n list.add(1);\n list.add(2);'", - "markdown": "Reports [Double Brace Initialization](https://www.c2.com/cgi/wiki?DoubleBraceInitialization).\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\nDouble brace initialization may cause memory leaks when used in a non-static context. This is because it defines an anonymous class\nthat will reference the surrounding object, when compiled with javac from before Java 18.\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 list = new ArrayList<>() {{\n add(1);\n add(2);\n }};\n\nAfter the quick-fix is applied:\n\n\n List list = new ArrayList<>();\n list.add(1);\n list.add(2);\n" + "text": "Reports 'size == 0' checks on 'Collections/Array/String' that should be replaced with 'isEmpty()'. Using 'isEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }'", + "markdown": "Reports `size == 0` checks on `Collections/Array/String` that should be replaced with `isEmpty()`.\n\nUsing `isEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "DoubleBraceInitialization", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ReplaceSizeZeroCheckWithIsEmpty", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -3768,19 +3758,19 @@ ] }, { - "id": "StringConcatenationInLoops", + "id": "AmbiguousExpressionInWhenBranchMigration", "shortDescription": { - "text": "String concatenation in loop" + "text": "Ambiguous logical expressions in 'when' branches since 1.7" }, "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." + "text": "Reports ambiguous logical expressions in 'when' branches which cause compilation errors in Kotlin 1.8 and later. 'fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n this in (4..7) -> true // is ambiguous\n else -> false\n }' After the quick-fix is applied: 'fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n (this in (4..7)) -> true // wrapped in parentheses\n else -> false\n }' Inspection is available for Kotlin language level starting from 1.7.", + "markdown": "Reports ambiguous logical expressions in `when` branches which cause compilation errors in Kotlin 1.8 and later.\n\n\n fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n this in (4..7) -> true // is ambiguous\n else -> false\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n (this in (4..7)) -> true // wrapped in parentheses\n else -> false\n }\n\nInspection is available for Kotlin language level starting from 1.7." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StringConcatenationInLoop", + "suppressToolId": "AmbiguousExpressionInWhenBranchMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3788,8 +3778,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -3801,31 +3791,28 @@ ] }, { - "id": "CloneableClassInSecureContext", + "id": "RedundantEnumConstructorInvocation", "shortDescription": { - "text": "Cloneable class in secure context" + "text": "Redundant enum constructor invocation" }, "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" + "text": "Reports redundant constructor invocation on an enum entry. Example: 'enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }' After the quick-fix is applied: 'enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }'", + "markdown": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CloneableClassInSecureContext", - "cweIds": [ - 498 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantEnumConstructorInvocation", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -3837,19 +3824,19 @@ ] }, { - "id": "InconsistentTextBlockIndent", + "id": "FakeJvmFieldConstant", "shortDescription": { - "text": "Inconsistent whitespace indentation in text block" + "text": "Kotlin non-const property used as Java constant" }, "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 depends on the Java feature 'Text block literals', which is available since Java 15. 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 depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2021.1" + "text": "Reports Kotlin properties that are not 'const' and used as Java annotation arguments. For example, a property with the '@JvmField' annotation has an initializer that can be evaluated at compile-time, and it has a primitive or 'String' type. Such properties have a 'ConstantValue' attribute in bytecode in Kotlin 1.1-1.2. This attribute allows javac to fold usages of the corresponding field and use that field in annotations. This can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code. This behavior is subject to change in Kotlin 1.3 (no 'ConstantValue' attribute any more). Example: Kotlin code in foo.kt file: 'annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"' Java code: 'public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }' To fix the problem replace the '@JvmField' annotation with the 'const' modifier on a relevant Kotlin property or inline it.", + "markdown": "Reports Kotlin properties that are not `const` and used as Java annotation arguments.\n\n\nFor example, a property with the `@JvmField` annotation has an initializer that can be evaluated at compile-time,\nand it has a primitive or `String` type.\n\n\nSuch properties have a `ConstantValue` attribute in bytecode in Kotlin 1.1-1.2.\nThis attribute allows javac to fold usages of the corresponding field and use that field in annotations.\nThis can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code.\nThis behavior is subject to change in Kotlin 1.3 (no `ConstantValue` attribute any more).\n\n**Example:**\n\nKotlin code in foo.kt file:\n\n\n annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"\n\nJava code:\n\n\n public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }\n\nTo fix the problem replace the `@JvmField` annotation with the `const` modifier on a relevant Kotlin property or inline it." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "InconsistentTextBlockIndent", + "suppressToolId": "FakeJvmFieldConstant", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3857,8 +3844,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -3870,28 +3857,28 @@ ] }, { - "id": "AssertionCanBeIf", + "id": "WhenWithOnlyElse", "shortDescription": { - "text": "Assertion can be replaced with 'if' statement" + "text": "'when' has only 'else' branch and can be simplified" }, "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();' This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", - "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\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + "text": "Reports 'when' expressions with only an 'else' branch that can be simplified. Simplify expression quick-fix can be used to amend the code automatically. Example: 'fun redundant() {\n val x = when { // <== redundant, the quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }'", + "markdown": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, the quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "AssertionCanBeIf", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "WhenWithOnlyElse", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -3903,28 +3890,28 @@ ] }, { - "id": "DoubleNegation", + "id": "InfixCallToOrdinary", "shortDescription": { - "text": "Double negation" + "text": "Infix call may be dot call" }, "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" + "text": "Reports for infix function calls that can be replaced with dot-qualified function calls. Example: '1 xor 2' '1.xor(2)'", + "markdown": "Reports for infix function calls that can be replaced with dot-qualified function calls.\n\nExample:\n\n\n 1 xor 2\n\n\n 1.xor(2)\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "DoubleNegation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "InfixCallToOrdinary", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Code migration", + "index": 109, "toolComponent": { "name": "QDJVM" } @@ -3936,19 +3923,19 @@ ] }, { - "id": "PackageWithTooFewClasses", + "id": "KotlinTestJUnit", "shortDescription": { - "text": "Package with too few classes" + "text": "kotlin-test-junit could be used" }, "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." + "text": "Reports usage of 'kotlin-test' and 'junit' dependency without 'kotlin-test-junit'. It is recommended to use 'kotlin-test-junit' dependency to work with Kotlin and JUnit.", + "markdown": "Reports usage of `kotlin-test` and `junit` dependency without `kotlin-test-junit`.\n\nIt is recommended to use `kotlin-test-junit` dependency to work with Kotlin and JUnit." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PackageWithTooFewClasses", + "suppressToolId": "KotlinTestJUnit", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -3956,8 +3943,8 @@ "relationships": [ { "target": { - "id": "Java/Packaging issues", - "index": 44, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -3969,28 +3956,28 @@ ] }, { - "id": "ReplaceOnLiteralHasNoEffect", + "id": "SafeCastWithReturn", "shortDescription": { - "text": "Replacement operation has no effect" + "text": "Safe cast with 'return' should be replaced with 'if' type check" }, "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" + "text": "Reports safe cast with 'return' that can be replaced with 'if' type check. Using corresponding functions makes your code simpler. The quick-fix replaces the safe cast with 'if' type check. Example: 'fun test(x: Any) {\n x as? String ?: return\n }' After the quick-fix is applied: 'fun test(x: Any) {\n if (x !is String) return\n }'", + "markdown": "Reports safe cast with `return` that can be replaced with `if` type check.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the safe cast with `if` type check.\n\n**Example:**\n\n\n fun test(x: Any) {\n x as? String ?: return\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(x: Any) {\n if (x !is String) return\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ReplaceOnLiteralHasNoEffect", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SafeCastWithReturn", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4002,28 +3989,28 @@ ] }, { - "id": "SingleClassImport", + "id": "ReplaceAssertBooleanWithAssertEquality", "shortDescription": { - "text": "Single class import" + "text": "Assert boolean could be replaced with assert equality" }, "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." + "text": "Reports calls to 'assertTrue()' and 'assertFalse()' that can be replaced with assert equality functions. 'assertEquals()', 'assertSame()', and their negating counterparts (-Not-) provide more informative messages on failure. Example: 'assertTrue(a == b)' After the quick-fix is applied: 'assertEquals(a, b)'", + "markdown": "Reports calls to `assertTrue()` and `assertFalse()` that can be replaced with assert equality functions.\n\n\n`assertEquals()`, `assertSame()`, and their negating counterparts (-Not-) provide more informative messages on\nfailure.\n\n**Example:**\n\n assertTrue(a == b)\n\nAfter the quick-fix is applied:\n\n assertEquals(a, b)\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SingleClassImport", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceAssertBooleanWithAssertEquality", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Imports", - "index": 24, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4035,28 +4022,28 @@ ] }, { - "id": "LoggingConditionDisagreesWithLogLevelStatement", + "id": "UnnecessaryOptInAnnotation", "shortDescription": { - "text": "Log condition does not match logging call" + "text": "Unnecessary '@OptIn' annotation" }, "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." + "text": "Reports unnecessary opt-in annotations that can be safely removed. '@OptIn' annotation is required for the code using experimental APIs that can change any time in the future. This annotation becomes useless and possibly misleading if no such API is used (e.g., when the experimental API becomes stable and does not require opting in its usage anymore). Remove annotation quick-fix can be used to remove the unnecessary '@OptIn' annotation. Example: '@OptIn(ExperimentalApi::class)\n fun foo(x: Bar) {\n x.baz()\n }' After the quick-fix is applied: 'fun foo(x: Bar) {\n x.baz()\n }'", + "markdown": "Reports unnecessary opt-in annotations that can be safely removed.\n\n`@OptIn` annotation is required for the code using experimental APIs that can change\nany time in the future. This annotation becomes useless and possibly misleading if no such API is used\n(e.g., when the experimental API becomes stable and does not require opting in its usage anymore).\n\n\n**Remove annotation** quick-fix can be used to remove the unnecessary `@OptIn` annotation.\n\nExample:\n\n\n @OptIn(ExperimentalApi::class)\n fun foo(x: Bar) {\n x.baz()\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Bar) {\n x.baz()\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "LoggingConditionDisagreesWithLogLevelStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UnnecessaryOptInAnnotation", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "JVM languages/Logging", - "index": 52, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -4068,19 +4055,19 @@ ] }, { - "id": "BadOddness", + "id": "NonVarPropertyInExternalInterface", "shortDescription": { - "text": "Suspicious oddness check" + "text": "External interface contains val property" }, "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." + "text": "Reports not var properties in external interface. Read more in the migration guide.", + "markdown": "Reports not var properties in external interface. Read more in the [migration guide](https://kotlinlang.org/docs/js-ir-migration.html#convert-properties-of-external-interfaces-to-var)." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "BadOddness", + "suppressToolId": "NonVarPropertyInExternalInterface", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4088,8 +4075,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -4101,19 +4088,19 @@ ] }, { - "id": "SystemOutErr", + "id": "ReplaceStringFormatWithLiteral", "shortDescription": { - "text": "Use of 'System.out' or 'System.err'" + "text": "'String.format' call can be replaced with string templates" }, "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. The provided quick-fix supports SLF4J and Log4j 2. It replaces 'System.out' and 'System.err' calls with log calls Example: 'public static void test(Object o) {\n System.out.println(\"Test: \"+ o);\n }' After the quick-fix is applied: 'private static final Logger log = LoggerFactory.getLogger(Test.class);\n\n public static void test(Object o) {\n log.info(\"Test: {}\", o);;\n }' Use the Log method for 'System.err' option to specify a method which it is used to log a message for 'System.err' calls. Use the Log method for 'System.out' option to specify a method which it is used to log a message for 'System.out' calls.", - "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.\n\nThe provided quick-fix supports **SLF4J** and **Log4j 2** .\nIt replaces `System.out` and `System.err` calls with log calls\n\n**Example:**\n\n\n public static void test(Object o) {\n System.out.println(\"Test: \"+ o);\n }\n\nAfter the quick-fix is applied:\n\n\n private static final Logger log = LoggerFactory.getLogger(Test.class);\n\n public static void test(Object o) {\n log.info(\"Test: {}\", o);;\n }\n\n\nUse the **Log method for 'System.err'** option to specify a method which it is used to log a message for 'System.err' calls.\nUse the **Log method for 'System.out'** option to specify a method which it is used to log a message for 'System.out' calls." + "text": "Reports 'String.format' calls that can be replaced with string templates. Using string templates makes your code simpler. The quick-fix replaces the call with a string template. Example: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }' After the quick-fix is applied: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }'", + "markdown": "Reports `String.format` calls that can be replaced with string templates.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces the call with a string template.\n\n**Example:**\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "UseOfSystemOutOrSystemErr", + "suppressToolId": "ReplaceStringFormatWithLiteral", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -4121,8 +4108,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4134,28 +4121,28 @@ ] }, { - "id": "CheckedExceptionClass", + "id": "ReplaceNotNullAssertionWithElvisReturn", "shortDescription": { - "text": "Checked exception class" + "text": "Not-null assertion can be replaced with 'return'" }, "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" + "text": "Reports not-null assertion ('!!') calls that can be replaced with the elvis operator and return ('?: return'). A not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of '!!' is good practice. The quick-fix replaces the not-null assertion with 'return' or 'return null'. Example: 'fun test(number: Int?) {\n val x = number!!\n }' After the quick-fix is applied: 'fun test(number: Int?) {\n val x = number ?: return\n }'", + "markdown": "Reports not-null assertion (`!!`) calls that can be replaced with the elvis operator and return (`?: return`).\n\nA not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of `!!` is good practice.\n\nThe quick-fix replaces the not-null assertion with `return` or `return null`.\n\n**Example:**\n\n\n fun test(number: Int?) {\n val x = number!!\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(number: Int?) {\n val x = number ?: return\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CheckedExceptionClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceNotNullAssertionWithElvisReturn", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4167,28 +4154,28 @@ ] }, { - "id": "SerializableStoresNonSerializable", + "id": "ReplaceSubstringWithSubstringBefore", "shortDescription": { - "text": "'Serializable' object implicitly stores non-'Serializable' object" + "text": "'substring' call should be replaced with 'substringBefore'" }, "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" + "text": "Reports calls like 's.substring(0, s.indexOf(x))' that can be replaced with 's.substringBefore(x)'. Using 'substringBefore()' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringBefore'. Example: 'fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringBefore('x')\n }'", + "markdown": "Reports calls like `s.substring(0, s.indexOf(x))` that can be replaced with `s.substringBefore(x)`.\n\nUsing `substringBefore()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringBefore`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringBefore('x')\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SerializableStoresNonSerializable", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceSubstringWithSubstringBefore", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4200,28 +4187,28 @@ ] }, { - "id": "InsertLiteralUnderscores", + "id": "ReplaceWithOperatorAssignment", "shortDescription": { - "text": "Unreadable numeric literal" + "text": "Assignment can be replaced with operator assignment" }, "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" + "text": "Reports modifications of variables with a simple assignment (such as 'y = y + x') that can be replaced with an operator assignment. The quick-fix replaces the assignment with an assignment operator. Example: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }' After the quick-fix is applied: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }'", + "markdown": "Reports modifications of variables with a simple assignment (such as `y = y + x`) that can be replaced with an operator assignment.\n\nThe quick-fix replaces the assignment with an assignment operator.\n\n**Example:**\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "InsertLiteralUnderscores", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ReplaceWithOperatorAssignment", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4233,19 +4220,19 @@ ] }, { - "id": "BreakStatement", + "id": "UnusedSymbol", "shortDescription": { - "text": "'break' statement" + "text": "Unused symbol" }, "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 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 strs) {\n for (String str : strs) {\n if (str.contains(\"stop\")) break;\n handleStr(str);\n }\n }\n" + "text": "Reports symbols that are not used or not reachable from entry points.", + "markdown": "Reports symbols that are not used or not reachable from entry points." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BreakStatement", + "suppressToolId": "unused", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4253,8 +4240,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -4266,32 +4253,28 @@ ] }, { - "id": "JDBCExecuteWithNonConstantString", + "id": "ReplaceCollectionCountWithSize", "shortDescription": { - "text": "Call to 'Statement.execute()' with non-constant string" + "text": "Collection count can be converted to size" }, "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" + "text": "Reports calls to 'Collection.count()'. This function call can be replaced with '.size'. '.size' form ensures that the operation is O(1) and won't allocate extra objects, whereas 'count()' could be confused with 'Iterable.count()', which is O(n) and allocating. Example: 'fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }' After the quick-fix is applied: 'fun foo() {\n var list = listOf(1,2,3)\n list.size\n }'", + "markdown": "Reports calls to `Collection.count()`.\n\n\nThis function call can be replaced with `.size`.\n\n\n`.size` form ensures that the operation is O(1) and won't allocate extra objects, whereas\n`count()` could be confused with `Iterable.count()`, which is O(n) and allocating.\n\n\n**Example:**\n\n fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }\n\nAfter the quick-fix is applied:\n\n fun foo() {\n var list = listOf(1,2,3)\n list.size\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "JDBCExecuteWithNonConstantString", - "cweIds": [ - 89, - 564 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceCollectionCountWithSize", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4303,19 +4286,19 @@ ] }, { - "id": "ConstantValueVariableUse", + "id": "ReplaceArrayEqualityOpWithArraysEquals", "shortDescription": { - "text": "Use of variable whose value is known to be constant" + "text": "Arrays comparison via '==' and '!='" }, "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" + "text": "Reports usages of '==' or '!=' operator for arrays that should be replaced with 'contentEquals()'. The '==' and '!='operators compare array references instead of their content. Examples: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }' After the quick-fix is applied: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }'", + "markdown": "Reports usages of `==` or `!=` operator for arrays that should be replaced with `contentEquals()`.\n\n\nThe `==` and `!=`operators compare array references instead of their content.\n\n**Examples:**\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }\n\nAfter the quick-fix is applied:\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ConstantValueVariableUse", + "suppressToolId": "ReplaceArrayEqualityOpWithArraysEquals", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4323,8 +4306,8 @@ "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -4336,23 +4319,19 @@ ] }, { - "id": "NewStringBufferWithCharArgument", + "id": "DeprecatedGradleDependency", "shortDescription": { - "text": "StringBuilder constructor call with 'char' argument" + "text": "Deprecated library is used in Gradle" }, "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" + "text": "Reports deprecated dependencies in Gradle build scripts. Example: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }' After the quick-fix applied: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }'", + "markdown": "Reports deprecated dependencies in Gradle build scripts.\n\n**Example:**\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }\n\nAfter the quick-fix applied:\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NewStringBufferWithCharArgument", - "cweIds": [ - 628, - 704 - ], + "suppressToolId": "DeprecatedGradleDependency", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4360,8 +4339,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -4373,19 +4352,19 @@ ] }, { - "id": "ClassGetClass", + "id": "CastDueToProgressionResolutionChangeMigration", "shortDescription": { - "text": "Suspicious 'Class.getClass()' call" + "text": "Progression resolution change since 1.9" }, "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" + "text": "Reports overloaded function calls where an argument requires an explicit cast to resolve to a proper declaration. The current compiler warning (available since Kotlin 1.6.20) will become an error in Kotlin 1.8. Progressions and ranges types ('kotlin.ranges') will start implementing the 'Collection' interface in Kotlin 1.9 and later. This update will cause a change in resolution for overloaded functions. For instance, in the example below, the 'test(1..5)' call will be resolved to 'test(t: Any)' in Kotlin 1.8 and earlier and to 'test(t: Collection<*>)' in Kotlin 1.9 and later. 'fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n fun invoke() {\n test(1..5) // IntRange becomes Collection in 1.9\n }' The provided quick-fix captures the behaviour specific to the compiler of version 1.8 and earlier: 'fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test(1..5) // resolved to 'test(t: T)' before Kotlin 1.9\n }' After the quick-fix is applied: 'fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test((1..5) as Iterable) // resolved to 'test(t: T)' in Kotlin 1.9\n }' Inspection is available for the Kotlin language level starting from 1.6.", + "markdown": "Reports overloaded function calls where an argument requires an explicit cast to resolve to a proper declaration.\nThe current compiler warning (available since Kotlin 1.6.20) will become an error in Kotlin 1.8.\n\n\nProgressions and ranges types (`kotlin.ranges`) will start implementing the `Collection` interface in Kotlin\n1.9 and later. This update will cause a change in resolution for overloaded functions. For instance, in the example below, the\n`test(1..5)` call will be resolved to `test(t: Any)` in Kotlin 1.8 and earlier and to\n`test(t: Collection<*>)` in Kotlin 1.9 and later.\n\n\n fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n fun invoke() {\n test(1..5) // IntRange becomes Collection in 1.9\n }\n\nThe provided quick-fix captures the behaviour specific to the compiler of version 1.8 and earlier:\n\n\n fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test(1..5) // resolved to 'test(t: T)' before Kotlin 1.9\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test((1..5) as Iterable) // resolved to 'test(t: T)' in Kotlin 1.9\n }\n\nInspection is available for the Kotlin language level starting from 1.6." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassGetClass", + "suppressToolId": "CastDueToProgressionResolutionChangeMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4393,8 +4372,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -4406,28 +4385,28 @@ ] }, { - "id": "ResultOfObjectAllocationIgnored", + "id": "ConvertReferenceToLambda", "shortDescription": { - "text": "Result of object allocation ignored" + "text": "Can be replaced with lambda" }, "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." + "text": "Reports a function reference expression that can be replaced with a function literal (lambda). Sometimes, passing a lambda looks more straightforward and more consistent with the rest of the code. Also, the fix might be handy if you need to replace a simple call with something more complex. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }'", + "markdown": "Reports a function reference expression that can be replaced with a function literal (lambda).\n\n\nSometimes, passing a lambda looks more straightforward and more consistent with the rest of the code.\nAlso, the fix might be handy if you need to replace a simple call with something more complex.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ResultOfObjectAllocationIgnored", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertReferenceToLambda", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4439,28 +4418,28 @@ ] }, { - "id": "UnusedLibrary", + "id": "UnlabeledReturnInsideLambda", "shortDescription": { - "text": "Unused library" + "text": "Unlabeled return inside lambda" }, "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." + "text": "Reports unlabeled 'return' expressions inside inline lambda. Such expressions can be confusing because it might be unclear which scope belongs to 'return'. Change to return@… quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }'", + "markdown": "Reports unlabeled `return` expressions inside inline lambda.\n\nSuch expressions can be confusing because it might be unclear which scope belongs to `return`.\n\n**Change to return@...** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnusedLibrary", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UnlabeledReturnInsideLambda", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4472,19 +4451,19 @@ ] }, { - "id": "ObsoleteCollection", + "id": "AddConversionCallMigration", "shortDescription": { - "text": "Use of obsolete collection type" + "text": "Explicit conversion from `Int` needed since 1.9" }, "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." + "text": "Reports expressions that will be of type 'Int', thus causing compilation errors in Kotlin 1.9 and later. Example: 'fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte(1 + 1) // will be resolved to Int in 1.9\n }' After the quick-fix is applied: 'fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte((1 + 1).toByte()) // will be resolved to Int in 1.9\n }' Inspection is available for Kotlin language level starting from 1.7.", + "markdown": "Reports expressions that will be of type `Int`, thus causing compilation errors in Kotlin 1.9 and later.\n\nExample:\n\n\n fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte(1 + 1) // will be resolved to Int in 1.9\n }\n\nAfter the quick-fix is applied:\n\n\n fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte((1 + 1).toByte()) // will be resolved to Int in 1.9\n }\n\nInspection is available for Kotlin language level starting from 1.7." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UseOfObsoleteCollectionType", + "suppressToolId": "AddConversionCallMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4492,8 +4471,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -4505,19 +4484,19 @@ ] }, { - "id": "ForEachWithRecordPatternCanBeUsed", + "id": "LateinitVarOverridesLateinitVar", "shortDescription": { - "text": "Enhanced 'for' with a record pattern can be used" + "text": "'lateinit var' property overrides 'lateinit var' property" }, "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 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 records) {\n for (Record(Integer x, String y) : records) {\n System.out.println(y);\n System.out.println(x);\n }\n}' 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 This inspection depends on the Java feature 'Record patterns in for-each loops', which is available since Java X. 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 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 records) {\n for (Record(Integer x, String y) : records) {\n System.out.println(y);\n System.out.println(x);\n }\n }\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\nThis inspection depends on the Java feature 'Record patterns in for-each loops', which is available since Java X.\n\nNew in 2023.1" + "text": "Reports 'lateinit var' properties that override other 'lateinit var' properties. A subclass instance will have two fields for a single property, and the one from the superclass will remain effectively unused. Example: 'open class BaseClass {\n open lateinit var name: String\n }\n\n class RealClass : BaseClass() {\n override lateinit var name: String\n }'", + "markdown": "Reports `lateinit var` properties that override other `lateinit var` properties.\n\nA subclass instance will have two fields for a single property, and the one from the superclass will remain effectively unused.\n\n**Example:**\n\n\n open class BaseClass {\n open lateinit var name: String\n }\n\n class RealClass : BaseClass() {\n override lateinit var name: String\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ForEachWithRecordPatternCanBeUsed", + "suppressToolId": "LateinitVarOverridesLateinitVar", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4525,8 +4504,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids", - "index": 70, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -4538,32 +4517,28 @@ ] }, { - "id": "MismatchedStringBuilderQueryUpdate", + "id": "VerboseNullabilityAndEmptiness", "shortDescription": { - "text": "Mismatched query and update of 'StringBuilder'" + "text": "Verbose nullability and emptiness check" }, "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" + "text": "Reports combination of 'null' and emptiness checks that can be simplified into a single check. The quick-fix replaces highlighted checks with a combined check call, such as 'isNullOrEmpty()'. Example: 'fun test(list: List?) {\n if (list == null || list.isEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }' After the quick-fix is applied: 'fun test(list: List?) {\n if (list.isNullOrEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }'", + "markdown": "Reports combination of `null` and emptiness checks that can be simplified into a single check.\n\nThe quick-fix replaces highlighted checks with a combined check call, such as `isNullOrEmpty()`.\n\n**Example:**\n\n\n fun test(list: List?) {\n if (list == null || list.isEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List?) {\n if (list.isNullOrEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "MismatchedQueryAndUpdateOfStringBuilder", - "cweIds": [ - 561, - 563 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "VerboseNullabilityAndEmptiness", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4575,19 +4550,19 @@ ] }, { - "id": "FinalizeNotProtected", + "id": "DifferentKotlinGradleVersion", "shortDescription": { - "text": "'finalize()' should be protected, not public" + "text": "Kotlin Gradle and IDE plugins versions are different" }, "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" + "text": "Reports that Gradle plugin version isn't properly supported in the current IDE plugin. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }' To fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin.", + "markdown": "Reports that Gradle plugin version isn't properly supported in the current IDE plugin.\n\nThis can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }\n\nTo fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FinalizeNotProtected", + "suppressToolId": "DifferentKotlinGradleVersion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4595,8 +4570,8 @@ "relationships": [ { "target": { - "id": "Java/Finalization", - "index": 75, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -4608,19 +4583,19 @@ ] }, { - "id": "ModuleWithTooManyClasses", + "id": "KotlinEqualsBetweenInconvertibleTypes", "shortDescription": { - "text": "Module with too many classes" + "text": "'equals()' between objects of inconvertible types" }, "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." + "text": "Reports calls to 'equals()' where the receiver and the argument are of incompatible primitive, enum, or string types. While such a call might theoretically be useful, most likely it represents a bug. Example: '5.equals(\"\");'", + "markdown": "Reports calls to `equals()` where the receiver and the argument are of incompatible primitive, enum, or string types.\n\nWhile such a call might theoretically be useful, most likely it represents a bug.\n\n**Example:**\n\n 5.equals(\"\");\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ModuleWithTooManyClasses", + "suppressToolId": "EqualsBetweenInconvertibleTypes", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4628,8 +4603,8 @@ "relationships": [ { "target": { - "id": "Java/Modularization issues", - "index": 76, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -4641,28 +4616,28 @@ ] }, { - "id": "InfiniteLoopStatement", + "id": "JoinDeclarationAndAssignment", "shortDescription": { - "text": "Infinite loop statement" + "text": "Join declaration and assignment" }, "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" + "text": "Reports property declarations that can be joined with the following assignment. Example: 'val x: String\n x = System.getProperty(\"\")' The quick fix joins the declaration with the assignment: 'val x = System.getProperty(\"\")' Configure the inspection: You can disable the option Report with complex initialization of member properties to skip properties with complex initialization. This covers two cases: The property initializer is complex (it is a multiline or a compound/control-flow expression) The property is first initialized and then immediately used in subsequent code (for example, to call additional initialization methods)", + "markdown": "Reports property declarations that can be joined with the following assignment.\n\n**Example:**\n\n\n val x: String\n x = System.getProperty(\"\")\n\nThe quick fix joins the declaration with the assignment:\n\n\n val x = System.getProperty(\"\")\n\nConfigure the inspection:\n\nYou can disable the option **Report with complex initialization of member properties** to skip properties with complex initialization. This covers two cases:\n\n1. The property initializer is complex (it is a multiline or a compound/control-flow expression)\n2. The property is first initialized and then immediately used in subsequent code (for example, to call additional initialization methods)" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "InfiniteLoopStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "JoinDeclarationAndAssignment", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4674,28 +4649,28 @@ ] }, { - "id": "JavadocHtmlLint", + "id": "HasPlatformType", "shortDescription": { - "text": "HTML problems in Javadoc (DocLint)" + "text": "Function or property has platform type" }, "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\n * Unclosed tag: error\n * Misplaced text or tag:
  • one
  • ,
  • two
\n * Wrong or empty attribute: \n * Self-closed tag:
\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\n * Unclosed tag: error\n * Misplaced text or tag:
  • one
  • ,
  • two
\n * Wrong or empty attribute: \n * Self-closed tag:
\n * ...\n */\n void sample(){ }\n" + "text": "Reports functions and properties that have a platform type. To prevent unexpected errors, the type should be declared explicitly. Example: 'fun foo() = java.lang.String.valueOf(1)' The quick fix allows you to specify the return type: 'fun foo(): String = java.lang.String.valueOf(1)'", + "markdown": "Reports functions and properties that have a platform type.\n\nTo prevent unexpected errors, the type should be declared explicitly.\n\n**Example:**\n\n\n fun foo() = java.lang.String.valueOf(1)\n\nThe quick fix allows you to specify the return type:\n\n\n fun foo(): String = java.lang.String.valueOf(1)\n" }, "defaultConfiguration": { - "enabled": false, - "level": "error", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "JavadocHtmlLint", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "HasPlatformType", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -4707,19 +4682,19 @@ ] }, { - "id": "ClassUnconnectedToPackage", + "id": "DataClassPrivateConstructor", "shortDescription": { - "text": "Class independent of its package" + "text": "Private data class constructor is exposed via the 'copy' method" }, "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." + "text": "Reports the 'private' primary constructor in data classes. 'data' classes have a 'copy()' factory method that can be used similarly to a constructor. A constructor should not be marked as 'private' to provide enough safety. Example: 'data class User private constructor(val name: String)' The quick-fix changes the constructor visibility modifier to 'public': 'data class User(val name: String)'", + "markdown": "Reports the `private` primary constructor in data classes.\n\n\n`data` classes have a `copy()` factory method that can be used similarly to a constructor.\nA constructor should not be marked as `private` to provide enough safety.\n\n**Example:**\n\n\n data class User private constructor(val name: String)\n\nThe quick-fix changes the constructor visibility modifier to `public`:\n\n\n data class User(val name: String)\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ClassUnconnectedToPackage", + "suppressToolId": "DataClassPrivateConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4727,8 +4702,8 @@ "relationships": [ { "target": { - "id": "Java/Packaging issues", - "index": 44, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -4740,19 +4715,19 @@ ] }, { - "id": "ExceptionNameDoesntEndWithException", + "id": "RedundantInnerClassModifier", "shortDescription": { - "text": "Exception class name does not end with 'Exception'" + "text": "Redundant 'inner' modifier" }, "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." + "text": "Reports the 'inner' modifier on a class as redundant if it doesn't reference members of its outer class. Example: 'class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }' After the quick-fix is applied: 'class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }'", + "markdown": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ExceptionClassNameDoesntEndWithException", + "suppressToolId": "RedundantInnerClassModifier", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4760,8 +4735,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Class", - "index": 80, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -4773,19 +4748,19 @@ ] }, { - "id": "NonFinalStaticVariableUsedInClassInitialization", + "id": "JavaCollectionsStaticMethodOnImmutableList", "shortDescription": { - "text": "Non-final static field is used during class initialization" + "text": "Call of Java mutator method on immutable Kotlin collection" }, "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" + "text": "Reports Java mutator methods calls (like 'fill', 'reverse', 'shuffle', 'sort') on an immutable Kotlin collection. This can lead to 'UnsupportedOperationException' at runtime. Example: 'import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }' To fix the problem make the list mutable.", + "markdown": "Reports Java mutator methods calls (like `fill`, `reverse`, `shuffle`, `sort`) on an immutable Kotlin collection.\n\nThis can lead to `UnsupportedOperationException` at runtime.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }\n\nTo fix the problem make the list mutable." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NonFinalStaticVariableUsedInClassInitialization", + "suppressToolId": "JavaCollectionsStaticMethodOnImmutableList", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4793,8 +4768,8 @@ "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -4806,28 +4781,28 @@ ] }, { - "id": "ThreadStopSuspendResume", + "id": "MavenCoroutinesDeprecation", "shortDescription": { - "text": "Call to 'Thread.stop()', 'suspend()' or 'resume()'" + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Maven" }, "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`." + "text": "Reports kotlinx.coroutines library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later.", + "markdown": "Reports **kotlinx.coroutines** library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "CallToThreadStopSuspendOrResumeManager", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MavenCoroutinesDeprecation", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Migration/Maven", + "index": 157, "toolComponent": { "name": "QDJVM" } @@ -4839,28 +4814,28 @@ ] }, { - "id": "UnnecessaryTemporaryOnConversionFromString", + "id": "NullableBooleanElvis", "shortDescription": { - "text": "Unnecessary temporary object in conversion from 'String'" + "text": "Equality check can be used instead of elvis for nullable boolean check" }, "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" + "text": "Reports cases when an equality check should be used instead of the elvis operator. Example: 'fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n}' After the quick-fix is applied: 'fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n}'", + "markdown": "Reports cases when an equality check should be used instead of the elvis operator.\n\n**Example:**\n\n\n fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n }\n\nAfter the quick-fix is applied:\n\n\n fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryTemporaryOnConversionFromString", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "NullableBooleanElvis", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -4872,28 +4847,28 @@ ] }, { - "id": "UseOfConcreteClass", + "id": "UnnecessaryVariable", "shortDescription": { - "text": "Use of concrete class" + "text": "Unnecessary local variable" }, "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." + "text": "Reports local variables that are used only in the very next 'return' statement or are exact copies of other variables. Such variables can be safely inlined to make the code more clear. Example: 'fun sum(a: Int, b: Int): Int {\n val c = a + b\n return c\n }' After the quick-fix is applied: 'fun sum(a: Int, b: Int): Int {\n return a + b\n }' Configure the inspection: Use the Report immediately returned variables option to report immediately returned variables. When given descriptive names, such variables may improve the code readability in some cases, that's why this option is disabled by default.", + "markdown": "Reports local variables that are used only in the very next `return` statement or are exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int): Int {\n val c = a + b\n return c\n }\n\nAfter the quick-fix is applied:\n\n\n fun sum(a: Int, b: Int): Int {\n return a + b\n }\n\nConfigure the inspection:\n\nUse the **Report immediately returned variables** option to report immediately returned variables.\nWhen given descriptive names, such variables may improve the code readability in some cases, that's why this option is disabled by default." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UseOfConcreteClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UnnecessaryVariable", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -4905,19 +4880,19 @@ ] }, { - "id": "RedundantLabeledSwitchRuleCodeBlock", + "id": "DeprecatedMavenDependency", "shortDescription": { - "text": "Labeled switch rule has redundant code block" + "text": "Deprecated library is used in Maven" }, "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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14. 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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14.\n\nNew in 2019.1" + "text": "Reports deprecated maven dependency. Example: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n ' The quick fix changes the deprecated dependency to a maintained one: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n '", + "markdown": "Reports deprecated maven dependency.\n\n**Example:**\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n \n\nThe quick fix changes the deprecated dependency to a maintained one:\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n \n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantLabeledSwitchRuleCodeBlock", + "suppressToolId": "DeprecatedMavenDependency", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -4925,8 +4900,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -4938,28 +4913,28 @@ ] }, { - "id": "IOStreamConstructor", + "id": "RedundantEmptyInitializerBlock", "shortDescription": { - "text": "'InputStream' and 'OutputStream' can be constructed using 'Files' methods" + "text": "Redundant empty initializer block" }, "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" + "text": "Reports redundant empty initializer blocks. Example: 'class Foo {\n init {\n // Empty init block\n }\n }' After the quick-fix is applied: 'class Foo {\n }'", + "markdown": "Reports redundant empty initializer blocks.\n\n**Example:**\n\n\n class Foo {\n init {\n // Empty init block\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "IOStreamConstructor", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantEmptyInitializerBlock", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -4971,28 +4946,28 @@ ] }, { - "id": "AssignmentToForLoopParameter", + "id": "RedundantLabeledReturnOnLastExpressionInLambda", "shortDescription": { - "text": "Assignment to 'for' loop parameter" + "text": "Redundant labeled return on the last expression in a lambda" }, "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." + "text": "Reports labeled returns used on the last expressions in lambdas. Such returns are redundant and can be safely removed. Example: 'fun foo() {\n listOf(1,2,3).find {\n return@find true\n }\n}' After the quick-fix is applied: 'fun foo() {\n listOf(1,2,3).find {\n true\n }\n}'", + "markdown": "Reports labeled returns used on the last expressions in lambdas.\n\nSuch returns are redundant and can be safely removed.\n\n**Example:**\n\n\n fun foo() {\n listOf(1,2,3).find {\n return@find true\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1,2,3).find {\n true\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AssignmentToForLoopParameter", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantLabeledReturnOnLastExpressionInLambda", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5004,28 +4979,28 @@ ] }, { - "id": "Java9CollectionFactory", + "id": "GradleKotlinxCoroutinesDeprecation", "shortDescription": { - "text": "Immutable collection creation can be replaced with collection factory call" + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Gradle" }, "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 even = Collections.unmodifiableList(\n Arrays.asList(2, 4, 6, 8, 10, 2));\n List evenCopy = Collections.unmodifiableList(\n new ArrayList<>(list1));' After the quick-fix is applied: 'List even = List.of(2, 4, 6, 8, 10, 2);\n List evenCopy = List.copyOf(list);' 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()'. This inspection depends on the Java feature 'Collection factory methods', which is available since Java 9. 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 even = Collections.unmodifiableList(\n Arrays.asList(2, 4, 6, 8, 10, 2));\n List evenCopy = Collections.unmodifiableList(\n new ArrayList<>(list1));\n\nAfter the quick-fix is applied:\n\n\n List even = List.of(2, 4, 6, 8, 10, 2);\n List evenCopy = List.copyOf(list);\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\nThis inspection depends on the Java feature 'Collection factory methods', which is available since Java 9.\n\nNew in 2017.2" + "text": "Reports 'kotlinx.coroutines' library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+. Example: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }' The quick fix changes the 'kotlinx.coroutines' library version to a compatible with Kotlin 1.3: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }'", + "markdown": "Reports `kotlinx.coroutines` library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+.\n\n**Example:**\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }\n\nThe quick fix changes the `kotlinx.coroutines` library version to a compatible with Kotlin 1.3:\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "error", "parameters": { - "suppressToolId": "Java9CollectionFactory", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "GradleKotlinxCoroutinesDeprecation", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 9", - "index": 87, + "id": "Kotlin/Migration/Gradle", + "index": 165, "toolComponent": { "name": "QDJVM" } @@ -5037,28 +5012,28 @@ ] }, { - "id": "MetaAnnotationWithoutRuntimeRetention", + "id": "WarningOnMainUnusedParameterMigration", "shortDescription": { - "text": "Test annotation without '@Retention(RUNTIME)' annotation" + "text": "Unused 'args' on 'main' since 1.4" }, "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" + "text": "Reports 'main' function with an unused single parameter. Since Kotlin 1.4, it is possible to use the 'main' function without parameter as the entry point to the Kotlin program. The compiler reports a warning for the 'main' function with an unused parameter.", + "markdown": "Reports `main` function with an unused single parameter.\n\nSince Kotlin 1.4, it is possible to use the `main` function without parameter as the entry point to the Kotlin program.\nThe compiler reports a warning for the `main` function with an unused parameter." }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "MetaAnnotationWithoutRuntimeRetention", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "WarningOnMainUnusedParameterMigration", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/JUnit", - "index": 90, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -5070,28 +5045,28 @@ ] }, { - "id": "UnnecessaryContinue", + "id": "RedundantWith", "shortDescription": { - "text": "Unnecessary 'continue' statement" + "text": "Redundant 'with' call" }, "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" + "text": "Reports redundant 'with' function calls that don't access anything from the receiver. Examples: 'class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }'", + "markdown": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryContinue", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantWith", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5103,28 +5078,28 @@ ] }, { - "id": "CStyleArrayDeclaration", + "id": "RedundantLabelMigration", "shortDescription": { - "text": "C-style array declaration" + "text": "Redundant label" }, "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." + "text": "Reports redundant labels which cause compilation errors since Kotlin 1.4. Since Kotlin 1.0, one can mark any statement with a label: 'fun foo() {\n L1@ val x = L2@bar()\n }' However, these labels can be referenced only in a limited number of ways: break / continue from a loop non-local return from an inline lambda or inline anonymous function sssss Such labels are prohibited since Kotlin 1.4. This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports redundant labels which cause compilation errors since Kotlin 1.4.\n\nSince Kotlin 1.0, one can mark any statement with a label:\n\n\n fun foo() {\n L1@ val x = L2@bar()\n }\n\nHowever, these labels can be referenced only in a limited number of ways:\n\n* break / continue from a loop\n* non-local return from an inline lambda or inline anonymous function\nsssss\n\nSuch labels are prohibited since Kotlin 1.4.\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CStyleArrayDeclaration", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantLabelMigration", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -5136,19 +5111,19 @@ ] }, { - "id": "SystemExit", + "id": "KotlinRedundantDiagnosticSuppress", "shortDescription": { - "text": "Call to 'System.exit()' or related methods" + "text": "Redundant diagnostic suppression" }, "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." + "text": "Reports usages of '@Suppress' annotations that can be safely removed because the compiler diagnostic they affect is no longer applicable in this context. Example: 'fun doSmth(@Suppress(\"UNUSED_PARAMETER\") used: Int) {\n println(used)\n }' After the quick-fix is applied: 'fun doSmth(used: Int) {\n println(used)\n }'", + "markdown": "Reports usages of `@Suppress` annotations that can be safely removed because the compiler diagnostic they affect is no longer applicable in this context.\n\n**Example:**\n\n\n fun doSmth(@Suppress(\"UNUSED_PARAMETER\") used: Int) {\n println(used)\n }\n\nAfter the quick-fix is applied:\n\n\n fun doSmth(used: Int) {\n println(used)\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToSystemExit", + "suppressToolId": "KotlinRedundantDiagnosticSuppress", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5156,8 +5131,8 @@ "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5169,28 +5144,28 @@ ] }, { - "id": "DeclareCollectionAsInterface", + "id": "ReplaceNegatedIsEmptyWithIsNotEmpty", "shortDescription": { - "text": "Collection declared by class, not interface" + "text": "Negated call can be simplified" }, "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 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 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 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 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`)." + "text": "Reports negation 'isEmpty()' and 'isNotEmpty()' for collections and 'String', or 'isBlank()' and 'isNotBlank()' for 'String'. Using corresponding functions makes your code simpler. The quick-fix replaces the negation call with the corresponding call from the Standard Library. Example: 'fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }' After the quick-fix is applied: 'fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }'", + "markdown": "Reports negation `isEmpty()` and `isNotEmpty()` for collections and `String`, or `isBlank()` and `isNotBlank()` for `String`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the negation call with the corresponding call from the Standard Library.\n\n**Example:**\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CollectionDeclaredAsConcreteClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceNegatedIsEmptyWithIsNotEmpty", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5202,19 +5177,19 @@ ] }, { - "id": "TrivialStringConcatenation", + "id": "DelegationToVarProperty", "shortDescription": { - "text": "Concatenation with empty string" + "text": "Delegating to 'var' property" }, "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." + "text": "Reports interface delegation to a 'var' property. Only initial value of a property is used for delegation, any later assignments do not affect it. Example: 'class Example(var text: CharSequence): CharSequence by text' The quick-fix replaces a property with immutable one: 'class Example(val text: CharSequence): CharSequence by text' Alternative way, if you rely on mutability for some reason: 'class Example(text: CharSequence): CharSequence by text {\n var text = text\n }'", + "markdown": "Reports interface delegation to a `var` property.\n\nOnly initial value of a property is used for delegation, any later assignments do not affect it.\n\n**Example:**\n\n\n class Example(var text: CharSequence): CharSequence by text\n\nThe quick-fix replaces a property with immutable one:\n\n\n class Example(val text: CharSequence): CharSequence by text\n\nAlternative way, if you rely on mutability for some reason:\n\n\n class Example(text: CharSequence): CharSequence by text {\n var text = text\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ConcatenationWithEmptyString", + "suppressToolId": "DelegationToVarProperty", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5222,8 +5197,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -5235,28 +5210,28 @@ ] }, { - "id": "SuspiciousInvocationHandlerImplementation", + "id": "ConstantConditionIf", "shortDescription": { - "text": "Suspicious 'InvocationHandler' implementation" + "text": "Condition of 'if' expression is constant" }, "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" + "text": "Reports 'if' expressions that have 'true' or 'false' constant literal condition and can be simplified. While occasionally intended, this construction is confusing and often the result of a typo or previous refactoring. Example: 'fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }' The quick-fix removes the 'if' condition: 'fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }'", + "markdown": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nThe quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "SuspiciousInvocationHandlerImplementation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConstantConditionIf", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5268,28 +5243,28 @@ ] }, { - "id": "UnreachableCode", + "id": "RedundantLambdaArrow", "shortDescription": { - "text": "Unreachable code" + "text": "Redundant lambda arrow" }, "fullDescription": { - "text": "Reports the code which is never reached according to data flow analysis. It can be the result of previous always-true or always-false condition, unreachable loop body or catch section. Usually (though not always) unreachable code is a consequence of a previous warning, so check inspection warnings form \"Nullability and data flow problems\", \"Constant values\", or \"Redundant operation on empty container\" to better understand the cause. Example: 'void finishApplication() {\n System.exit(0);\n System.out.println(\"Application is terminated\"); // Unreachable code\n }' Note that this inspection relies on method contract inference. In particular, if you call a static or final method that always throws an exception, then the \"always failing\" contract will be inferred, and code after the method call will be considered unreachable. For example: 'void run() {\n performAction();\n System.out.println(\"Action is performed\"); // Unreachable code\n }\n \n static void performAction() {\n throw new AssertionError();\n }' This may cause false-positives if any kind of code postprocessing is used, for example, if an annotation processor later replaces the method body with something useful. To avoid false-positive warnings, suppress the automatic contract inference with explicit '@org.jetbrains.annotations.Contract' annotation from 'org.jetbrains:annotations' package: 'void run() {\n performAction();\n System.out.println(\"Action is performed\"); // No warning anymore\n }\n\n @Contract(\"-> _\") // implementation will be replaced\n static void performAction() {\n throw new AssertionError();\n }' New in 2024.1", - "markdown": "Reports the code which is never reached according to data flow analysis. It can be the result of previous always-true or always-false condition, unreachable loop body or catch section. Usually (though not always) unreachable code is a consequence of a previous warning, so check inspection warnings form \"Nullability and data flow problems\", \"Constant values\", or \"Redundant operation on empty container\" to better understand the cause.\n\nExample:\n\n\n void finishApplication() {\n System.exit(0);\n System.out.println(\"Application is terminated\"); // Unreachable code\n }\n\n\nNote that this inspection relies on method contract inference. In particular, if you call a static or final method\nthat always throws an exception, then the \"always failing\" contract will be inferred, and code after the method call\nwill be considered unreachable. For example:\n\n\n void run() {\n performAction();\n System.out.println(\"Action is performed\"); // Unreachable code\n }\n \n static void performAction() {\n throw new AssertionError();\n }\n\n\nThis may cause false-positives if any kind of code postprocessing is used, for example, if an annotation processor\nlater replaces the method body with something useful. To avoid false-positive warnings, suppress the automatic\ncontract inference with explicit `@org.jetbrains.annotations.Contract` annotation from\n`org.jetbrains:annotations` package:\n\n\n void run() {\n performAction();\n System.out.println(\"Action is performed\"); // No warning anymore\n }\n\n @Contract(\"-> _\") // implementation will be replaced\n static void performAction() {\n throw new AssertionError();\n }\n\nNew in 2024.1" + "text": "Reports redundant lambda arrows in lambdas without parameters. Example: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }' After the quick-fix is applied: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }'", + "markdown": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnreachableCode", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantLambdaArrow", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5301,28 +5276,28 @@ ] }, { - "id": "HtmlTagCanBeJavadocTag", + "id": "KotlinInternalInJava", "shortDescription": { - "text": "'...' can be replaced with '{@code ...}'" + "text": "Usage of Kotlin internal declarations from Java" }, "fullDescription": { - "text": "Reports usages of '' 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 ArrayList<Integer>\n */\n List getList(){ ... }' After the quick-fix is applied: '/**\n * @return empty {@code ArrayList}\n */\n List getList(){ ... }'", - "markdown": "Reports usages of `` 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 ArrayList<Integer>\n */\n List getList(){ ... }\n\nAfter the quick-fix is applied:\n\n\n /**\n * @return empty {@code ArrayList}\n */\n List getList(){ ... }\n" + "text": "Reports usages of Kotlin 'internal' declarations in Java code that is located in a different module. The 'internal' keyword is designed to restrict access to a class, function, or property from other modules. Due to JVM limitations, 'internal' classes, functions, and properties can still be accessed from outside Kotlin, which may later lead to compatibility problems.", + "markdown": "Reports usages of Kotlin `internal` declarations in Java code that is located in a different module.\n\n\nThe `internal` keyword is designed to restrict access to a class, function, or property from other modules.\nDue to JVM limitations, `internal` classes, functions, and properties can still be\naccessed from outside Kotlin, which may later lead to compatibility problems." }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "error", "parameters": { - "suppressToolId": "HtmlTagCanBeJavadocTag", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "KotlinInternalInJava", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -5334,28 +5309,28 @@ ] }, { - "id": "ClassEscapesItsScope", + "id": "NoConstructorMigration", "shortDescription": { - "text": "Class is exposed outside of its visibility scope" + "text": "Forbidden constructor call" }, "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." + "text": "Reports a constructor calls on functional supertypes that will lead to compilation error since 1.9. Motivation types: The implementation does not abide by a published spec or documentation More details: KT-46344: No error for a super class constructor call on a function interface in supertypes list The quick-fix removes a constructor call. Example: 'abstract class A : () -> Int()' After the quick-fix is applied: 'abstract class A : () -> Int' This inspection only reports if the Kotlin language level of the project or module is 1.7 or higher.", + "markdown": "Reports a constructor calls on functional supertypes that will lead to compilation error since 1.9.\n\nMotivation types:\n\n* The implementation does not abide by a published spec or documentation\n\n**More details:** [KT-46344: No error for a super class constructor call on a function interface in supertypes list](https://youtrack.jetbrains.com/issue/KT-46344)\n\nThe quick-fix removes a constructor call.\n\n**Example:**\n\n\n abstract class A : () -> Int()\n\nAfter the quick-fix is applied:\n\n\n abstract class A : () -> Int\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.7 or higher." }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "error", "parameters": { - "suppressToolId": "ClassEscapesDefinedScope", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "NoConstructorMigration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -5367,31 +5342,28 @@ ] }, { - "id": "EqualsUsesNonFinalVariable", + "id": "RedundantValueArgument", "shortDescription": { - "text": "Non-final field referenced in 'equals()'" + "text": "Redundant value argument" }, "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" + "text": "Reports arguments that are equal to the default values of the corresponding parameters. Example: 'fun foo(x: Int, y: Int = 2) {}\n\nfun bar() {\n foo(1, 2)\n}' After the quick-fix is applied: 'fun bar() {\n foo(1)\n}'", + "markdown": "Reports arguments that are equal to the default values of the corresponding parameters.\n\n**Example:**\n\n\n fun foo(x: Int, y: Int = 2) {}\n\n fun bar() {\n foo(1, 2)\n }\n\nAfter the quick-fix is applied:\n\n\n fun bar() {\n foo(1)\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NonFinalFieldReferenceInEquals", - "cweIds": [ - 697 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantValueArgument", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5403,28 +5375,28 @@ ] }, { - "id": "NestedAssignment", + "id": "UseWithIndex", "shortDescription": { - "text": "Nested assignment" + "text": "Manually incremented index variable can be replaced with use of 'withIndex()'" }, "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" + "text": "Reports 'for' loops with a manually incremented index variable. 'for' loops with a manually incremented index variable can be simplified with the 'withIndex()' function. Use withIndex() instead of manual index increment quick-fix can be used to amend the code automatically. Example: 'fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }' After the quick-fix is applied: 'fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }'", + "markdown": "Reports `for` loops with a manually incremented index variable.\n\n`for` loops with a manually incremented index variable can be simplified with the `withIndex()` function.\n\n**Use withIndex() instead of manual index increment** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NestedAssignment", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UseWithIndex", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5436,28 +5408,28 @@ ] }, { - "id": "AutoUnboxing", + "id": "ImplicitThis", "shortDescription": { - "text": "Auto-unboxing" + "text": "Implicit 'this'" }, "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." + "text": "Reports usages of implicit this. Example: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }' The quick fix specifies this explicitly: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }'", + "markdown": "Reports usages of implicit **this** .\n\n**Example:**\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }\n\nThe quick fix specifies **this** explicitly:\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AutoUnboxing", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ImplicitThis", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5469,19 +5441,19 @@ ] }, { - "id": "NonFinalFieldInImmutable", + "id": "KotlinCatchMayIgnoreException", "shortDescription": { - "text": "Non-final field in '@Immutable' class" + "text": "'catch' block may ignore exception" }, "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`" + "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. The inspection won't report any 'catch' parameters named 'ignore', 'ignored', or '_'. You can use the quick-fix to change the exception name to '_'. Example: 'try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }' After the quick-fix is applied: 'try {\n throwingMethod()\n } catch (_: IOException) {\n\n }' Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments.", + "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\n\n\nThe inspection won't report any `catch` parameters named `ignore`, `ignored`, or `_`.\n\n\nYou can use the quick-fix to change the exception name to `_`.\n\n**Example:**\n\n\n try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throwingMethod()\n } catch (_: IOException) {\n\n }\n\nUse the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NonFinalFieldInImmutable", + "suppressToolId": "CatchMayIgnoreException", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5489,8 +5461,8 @@ "relationships": [ { "target": { - "id": "Java/Concurrency annotation issues", - "index": 100, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -5502,23 +5474,19 @@ ] }, { - "id": "StringConcatenationInMessageFormatCall", + "id": "DifferentStdlibGradleVersion", "shortDescription": { - "text": "String concatenation as argument to 'MessageFormat.format()' call" + "text": "Kotlin library and Gradle plugin versions are different" }, "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)`." + "text": "Reports different Kotlin stdlib and compiler versions. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }' To fix the problem change the kotlin stdlib version to match the kotlin compiler version.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }\n\nTo fix the problem change the kotlin stdlib version to match the kotlin compiler version." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "StringConcatenationInMessageFormatCall", - "cweIds": [ - 116, - 134 - ], + "suppressToolId": "DifferentStdlibGradleVersion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5526,8 +5494,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -5539,19 +5507,19 @@ ] }, { - "id": "CallToStringConcatCanBeReplacedByOperator", + "id": "CanBeVal", "shortDescription": { - "text": "Call to 'String.concat()' can be replaced with '+'" + "text": "Local 'var' is never modified and can be declared as 'val'" }, "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" + "text": "Reports local variables declared with the 'var' keyword that are never modified. Kotlin encourages to declare practically immutable variables using the 'val' keyword, ensuring that their value will never change. Example: 'fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }' The quick-fix replaces the 'var' keyword with 'val': 'fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }'", + "markdown": "Reports local variables declared with the `var` keyword that are never modified.\n\nKotlin encourages to declare practically immutable variables using the `val` keyword, ensuring that their value will never change.\n\n**Example:**\n\n\n fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n\nThe quick-fix replaces the `var` keyword with `val`:\n\n\n fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToStringConcatCanBeReplacedByOperator", + "suppressToolId": "CanBeVal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5559,8 +5527,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5572,28 +5540,28 @@ ] }, { - "id": "HardcodedFileSeparators", + "id": "ReplaceWithIgnoreCaseEquals", "shortDescription": { - "text": "Hardcoded file separator" + "text": "Should be replaced with 'equals(..., ignoreCase = true)'" }, "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." + "text": "Reports case-insensitive comparisons that can be replaced with 'equals(..., ignoreCase = true)'. By using 'equals()' you don't have to allocate extra strings with 'toLowerCase()' or 'toUpperCase()' to compare strings. The quick-fix replaces the case-insensitive comparison that uses 'toLowerCase()' or 'toUpperCase()' with 'equals(..., ignoreCase = true)'. Note: May change semantics for some locales. Example: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }' After the quick-fix is applied: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }'", + "markdown": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "HardcodedFileSeparator", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceWithIgnoreCaseEquals", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5605,28 +5573,28 @@ ] }, { - "id": "ConfusingFloatingPointLiteral", + "id": "ReplaceSubstringWithSubstringAfter", "shortDescription": { - "text": "Confusing floating-point literal" + "text": "'substring' call should be replaced with 'substringAfter'" }, "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." + "text": "Reports calls like 's.substring(s.indexOf(x))' that can be replaced with 's.substringAfter(x)'. Using 's.substringAfter(x)' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringAfter'. Example: 'fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringAfter('x')\n }'", + "markdown": "Reports calls like `s.substring(s.indexOf(x))` that can be replaced with `s.substringAfter(x)`.\n\nUsing `s.substringAfter(x)` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringAfter`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringAfter('x')\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ConfusingFloatingPointLiteral", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceSubstringWithSubstringAfter", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5638,19 +5606,19 @@ ] }, { - "id": "JavadocReference", + "id": "RedundantCompanionReference", "shortDescription": { - "text": "Declaration has problems in Javadoc references" + "text": "Redundant 'Companion' reference" }, "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." + "text": "Reports redundant 'Companion' reference. Example: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }' After the quick-fix is applied: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }'", + "markdown": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JavadocReference", + "suppressToolId": "RedundantCompanionReference", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5658,8 +5626,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5671,19 +5639,19 @@ ] }, { - "id": "LoggingPlaceholderCountMatchesArgumentCount", + "id": "KDocUnresolvedReference", "shortDescription": { - "text": "Number of placeholders does not match number of arguments in logging call" + "text": "Unresolved reference in KDoc" }, "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." + "text": "Reports unresolved references in KDoc comments. Example: '/**\n * [unresolvedLink]\n */\n fun foo() {}' To fix the problem make the link valid.", + "markdown": "Reports unresolved references in KDoc comments.\n\n**Example:**\n\n\n /**\n * [unresolvedLink]\n */\n fun foo() {}\n\nTo fix the problem make the link valid." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "LoggingPlaceholderCountMatchesArgumentCount", + "suppressToolId": "KDocUnresolvedReference", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5691,8 +5659,8 @@ "relationships": [ { "target": { - "id": "JVM languages/Logging", - "index": 52, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -5704,28 +5672,28 @@ ] }, { - "id": "ImplicitArrayToString", + "id": "NestedLambdaShadowedImplicitParameter", "shortDescription": { - "text": "Call to 'toString()' on array" + "text": "Nested lambda has shadowed implicit parameter" }, "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" + "text": "Reports nested lambdas with shadowed implicit parameters. Example: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n}' After the quick-fix is applied: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n}'", + "markdown": "Reports nested lambdas with shadowed implicit parameters.\n\n**Example:**\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ImplicitArrayToString", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "NestedLambdaShadowedImplicitParameter", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5737,28 +5705,28 @@ ] }, { - "id": "ReuseOfLocalVariable", + "id": "RedundantSamConstructor", "shortDescription": { - "text": "Reuse of local variable" + "text": "Redundant SAM constructor" }, "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" + "text": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas. Example: 'fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}' After the quick-fix is applied: 'fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}'", + "markdown": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.\n\n**Example:**\n\n\n fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReuseOfLocalVariable", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "RedundantSamConstructor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5770,19 +5738,19 @@ ] }, { - "id": "BooleanMethodNameMustStartWithQuestion", + "id": "InconsistentCommentForJavaParameter", "shortDescription": { - "text": "Boolean method name must start with question word" + "text": "Inconsistent comment for Java parameter" }, "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 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 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." + "text": "Reports inconsistent parameter names for Java method calls specified in a comment block. Examples: '// Java\n public class JavaService {\n public void invoke(String command) {}\n }' '// Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }' The quick fix corrects the parameter name in the comment block: 'fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }'", + "markdown": "Reports inconsistent parameter names for **Java** method calls specified in a comment block.\n\n**Examples:**\n\n\n // Java\n public class JavaService {\n public void invoke(String command) {}\n }\n\n\n // Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }\n\nThe quick fix corrects the parameter name in the comment block:\n\n\n fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BooleanMethodNameMustStartWithQuestion", + "suppressToolId": "InconsistentCommentForJavaParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5790,8 +5758,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -5803,19 +5771,19 @@ ] }, { - "id": "SynchronizationOnLocalVariableOrMethodParameter", + "id": "RemoveRedundantCallsOfConversionMethods", "shortDescription": { - "text": "Synchronization on local variable or method parameter" + "text": "Redundant call of conversion method" }, "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" + "text": "Reports redundant calls to conversion methods (for example, 'toString()' on a 'String' or 'toDouble()' on a 'Double'). Use the 'Remove redundant calls of the conversion method' quick-fix to clean up the code.", + "markdown": "Reports redundant calls to conversion methods (for example, `toString()` on a `String` or `toDouble()` on a `Double`).\n\nUse the 'Remove redundant calls of the conversion method' quick-fix to clean up the code." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SynchronizationOnLocalVariableOrMethodParameter", + "suppressToolId": "RemoveRedundantCallsOfConversionMethods", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5823,8 +5791,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -5836,19 +5804,19 @@ ] }, { - "id": "NegatedConditionalExpression", + "id": "KotlinThrowableNotThrown", "shortDescription": { - "text": "Negated conditional expression" + "text": "Throwable not thrown" }, "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" + "text": "Reports instantiations of 'Throwable' or its subclasses, when the created 'Throwable' is never actually thrown. The reported code indicates mistakes that are hard to catch in tests. Also, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the resulting 'Throwable' instance is not thrown. Example: 'fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }'", + "markdown": "Reports instantiations of `Throwable` or its subclasses, when the created `Throwable` is never actually thrown.\n\nThe reported code indicates mistakes that are hard to catch in tests.\n\n\nAlso, this inspection reports method calls that return instances of `Throwable` or its subclasses,\nwhen the resulting `Throwable` instance is not thrown.\n\n**Example:**\n\n\n fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NegatedConditionalExpression", + "suppressToolId": "ThrowableNotThrown", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -5856,8 +5824,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -5869,28 +5837,28 @@ ] }, { - "id": "FinalMethod", + "id": "KotlinSealedInheritorsInJava", "shortDescription": { - "text": "Method can't be overridden" + "text": "Inheritance of Kotlin sealed interface/class from Java" }, "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." + "text": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code. Example: '// Kotlin file: MathExpression.kt\n\nsealed class MathExpression\n\ndata class Const(val number: Double) : MathExpression()\ndata class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()' '// Java file: NotANumber.java\n\npublic class NotANumber extends MathExpression {\n}'", + "markdown": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code.\n\n**Example:**\n\n\n // Kotlin file: MathExpression.kt\n\n sealed class MathExpression\n\n data class Const(val number: Double) : MathExpression()\n data class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()\n\n\n // Java file: NotANumber.java\n\n public class NotANumber extends MathExpression {\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "error", "parameters": { - "suppressToolId": "FinalMethod", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "KotlinSealedInheritorsInJava", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -5902,28 +5870,28 @@ ] }, { - "id": "SuspiciousSystemArraycopy", + "id": "SimplifyNegatedBinaryExpression", "shortDescription": { - "text": "Suspicious 'System.arraycopy()' call" + "text": "Negated boolean expression can be simplified" }, "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" + "text": "Reports negated boolean expressions that can be simplified. The quick-fix simplifies the boolean expression. Example: 'fun test(n: Int) {\n !(0 == 1)\n }' After the quick-fix is applied: 'fun test(n: Int) {\n 0 != 1\n }' Please note that this action may change code semantics if IEEE-754 NaN values are involved: 'fun main() {\n println(!(Double.NaN >= 0)) // true\n }' After the quick-fix is applied: 'fun main() {\n println(Double.NaN < 0) // false\n }'", + "markdown": "Reports negated boolean expressions that can be simplified.\n\nThe quick-fix simplifies the boolean expression.\n\n**Example:**\n\n\n fun test(n: Int) {\n !(0 == 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(n: Int) {\n 0 != 1\n }\n\nPlease note that this action may change code semantics if IEEE-754 NaN values are involved:\n\n\n fun main() {\n println(!(Double.NaN >= 0)) // true\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n println(Double.NaN < 0) // false\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "SuspiciousSystemArraycopy", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SimplifyNegatedBinaryExpression", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5935,28 +5903,28 @@ ] }, { - "id": "AbsoluteAlignmentInUserInterface", + "id": "MemberVisibilityCanBePrivate", "shortDescription": { - "text": "Absolute alignment in AWT/Swing code" + "text": "Class member can have 'private' visibility" }, "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" + "text": "Reports declarations that can be made 'private' to follow the encapsulation principle. Example: 'class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}' After the quick-fix is applied (considering there are no usages of 'url' outside of 'Service' class): 'class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}'", + "markdown": "Reports declarations that can be made `private` to follow the encapsulation principle.\n\n**Example:**\n\n\n class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n\nAfter the quick-fix is applied (considering there are no usages of `url` outside of `Service` class):\n\n\n class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AbsoluteAlignmentInUserInterface", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MemberVisibilityCanBePrivate", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -5968,28 +5936,28 @@ ] }, { - "id": "RedundantLambdaParameterType", + "id": "SelfAssignment", "shortDescription": { - "text": "Redundant lambda parameter types" + "text": "Redundant assignment" }, "fullDescription": { - "text": "Reports lambda formal parameter types that are redundant because they can be inferred from the context. Example: 'Map map = ...\n map.forEach((String s, Integer i) -> log.info(s + \"=\" + i));' The quick-fix removes the parameter types from the lambda. 'Map 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 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 map = ...\n map.forEach((s, i) -> log.info(s + \"=\" + i));\n" + "text": "Reports assignments of a variable to itself. The quick-fix removes the redundant assignment. Example: 'fun test() {\n var bar = 1\n bar = bar\n }' After the quick-fix is applied: 'fun test() {\n var bar = 1\n }'", + "markdown": "Reports assignments of a variable to itself.\n\nThe quick-fix removes the redundant assignment.\n\n**Example:**\n\n\n fun test() {\n var bar = 1\n bar = bar\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n var bar = 1\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantLambdaParameterType", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "SelfAssignment", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -6001,19 +5969,19 @@ ] }, { - "id": "SuspiciousReturnByteInputStream", + "id": "RecursiveEqualsCall", "shortDescription": { - "text": "Suspicious byte value returned from 'InputStream.read()'" + "text": "Recursive equals call" }, "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" + "text": "Reports recursive 'equals'('==') calls. In Kotlin, '==' compares object values by calling 'equals' method under the hood. '===', on the other hand, compares objects by reference. '===' is commonly used in 'equals' method implementation. But '===' may be mistakenly mixed up with '==' leading to infinite recursion. Example: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }' After the quick-fix is applied: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }'", + "markdown": "Reports recursive `equals`(`==`) calls.\n\n\nIn Kotlin, `==` compares object values by calling `equals` method under the hood.\n`===`, on the other hand, compares objects by reference.\n\n\n`===` is commonly used in `equals` method implementation.\nBut `===` may be mistakenly mixed up with `==` leading to infinite recursion.\n\n**Example:**\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousReturnByteInputStream", + "suppressToolId": "RecursiveEqualsCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6021,8 +5989,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -6034,19 +6002,19 @@ ] }, { - "id": "ConditionalExpression", + "id": "ExplicitThis", "shortDescription": { - "text": "Conditional expression" + "text": "Redundant explicit 'this'" }, "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)." + "text": "Reports an explicit 'this' when it can be omitted. Example: 'class C {\n private val i = 1\n fun f() = this.i\n }' The quick-fix removes the redundant 'this': 'class C {\n private val i = 1\n fun f() = i\n }'", + "markdown": "Reports an explicit `this` when it can be omitted.\n\n**Example:**\n\n\n class C {\n private val i = 1\n fun f() = this.i\n }\n\nThe quick-fix removes the redundant `this`:\n\n\n class C {\n private val i = 1\n fun f() = i\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ConditionalExpression", + "suppressToolId": "ExplicitThis", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -6054,8 +6022,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -6067,28 +6035,28 @@ ] }, { - "id": "UseOfClone", + "id": "NullChecksToSafeCall", "shortDescription": { - "text": "Use of 'clone()' or 'Cloneable'" + "text": "Null-checks can be replaced with safe-calls" }, "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" + "text": "Reports chained null-checks that can be replaced with safe-calls. Example: 'fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }' After the quick-fix is applied: 'fun test(my: My?) {\n if (my?.foo() != null) {}\n }'", + "markdown": "Reports chained null-checks that can be replaced with safe-calls.\n\n**Example:**\n\n\n fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(my: My?) {\n if (my?.foo() != null) {}\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UseOfClone", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "NullChecksToSafeCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Cloning issues", - "index": 116, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -6100,28 +6068,28 @@ ] }, { - "id": "MissingFinalNewline", + "id": "UnusedMainParameter", "shortDescription": { - "text": "Missing final new line" + "text": "Main parameter is not necessary" }, "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." + "text": "Reports 'main' function with an unused single parameter.", + "markdown": "Reports `main` function with an unused single parameter." }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "note", "parameters": { - "suppressToolId": "MissingFinalNewline", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "UnusedMainParameter", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Manifest", - "index": 117, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6133,28 +6101,28 @@ ] }, { - "id": "NestedTryStatement", + "id": "FunctionWithLambdaExpressionBody", "shortDescription": { - "text": "Nested 'try' statement" + "text": "Function with '= { ... }' and inferred return type" }, "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." + "text": "Reports functions with '= { ... }' and inferred return type. Example: 'fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.' The quick fix removes braces: 'fun sum(a: Int, b: Int) = a + b'", + "markdown": "Reports functions with `= { ... }` and inferred return type.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.\n\nThe quick fix removes braces:\n\n\n fun sum(a: Int, b: Int) = a + b\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NestedTryStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "FunctionWithLambdaExpressionBody", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6166,28 +6134,28 @@ ] }, { - "id": "NonStaticFinalLogger", + "id": "ArrayInDataClass", "shortDescription": { - "text": "Non-constant logger" + "text": "Array property in data class" }, "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." + "text": "Reports properties with an 'Array' type in a 'data' class without overridden 'equals()' or 'hashCode()'. Array parameters are compared by reference equality, which is likely an unexpected behavior. It is strongly recommended to override 'equals()' and 'hashCode()' in such cases. Example: 'data class Text(val lines: Array)' The quick-fix generates missing 'equals()' and 'hashCode()' implementations: 'data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }'", + "markdown": "Reports properties with an `Array` type in a `data` class without overridden `equals()` or `hashCode()`.\n\n\nArray parameters are compared by reference equality, which is likely an unexpected behavior.\nIt is strongly recommended to override `equals()` and `hashCode()` in such cases.\n\n**Example:**\n\n\n data class Text(val lines: Array)\n\nThe quick-fix generates missing `equals()` and `hashCode()` implementations:\n\n\n data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "NonConstantLogger", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ArrayInDataClass", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Logging", - "index": 119, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -6199,28 +6167,28 @@ ] }, { - "id": "ConditionalExpressionWithIdenticalBranches", + "id": "ConvertTwoComparisonsToRangeCheck", "shortDescription": { - "text": "Conditional expression with identical branches" + "text": "Two comparisons should be converted to a range check" }, "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" + "text": "Reports two consecutive comparisons that can be converted to a range check. Checking against a range makes code simpler by removing test subject duplication. Example: 'fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }' The quick-fix replaces the comparison-based check with a range one: 'fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }'", + "markdown": "Reports two consecutive comparisons that can be converted to a range check.\n\nChecking against a range makes code simpler by removing test subject duplication.\n\n**Example:**\n\n\n fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }\n\nThe quick-fix replaces the comparison-based check with a range one:\n\n\n fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ConditionalExpressionWithIdenticalBranches", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertTwoComparisonsToRangeCheck", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6232,28 +6200,28 @@ ] }, { - "id": "OnlyOneElementUsed", + "id": "LocalVariableName", "shortDescription": { - "text": "Only one element is used" + "text": "Local variable naming convention" }, "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" + "text": "Reports local variables that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with a lowercase letter, use camel case and no underscores. Example: 'fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }'", + "markdown": "Reports local variables that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#function-names): it has to start with a lowercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OnlyOneElementUsed", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LocalVariableName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -6265,28 +6233,28 @@ ] }, { - "id": "UnnecessaryBoxing", + "id": "ReplaceUntilWithRangeUntil", "shortDescription": { - "text": "Unnecessary boxing" + "text": "Replace 'until' with '..<' operator" }, "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." + "text": "Reports 'until' that can be replaced with '..<' operator. Every 'until' to '..<' replacement doesn't change the semantic in any way. The UX research shows that developers make ~20-30% fewer errors when reading code containing '..<' compared to 'until'. Example: 'fun main(args: Array) {\n for (index in 0 until args.size) {\n println(index)\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (index in 0..) {\n for (index in 0 until args.size) {\n println(index)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (index in 0.. Int) {\n b(a * a)\n}\n\nfun foo() {\n square(2, { it })\n}' After the quick-fix is applied: 'fun foo() {\n square(2){ it }\n}'", + "markdown": "Reports lambda expressions in parentheses which can be moved outside.\n\n**Example:**\n\n\n fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n }\n\n fun foo() {\n square(2, { it })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n square(2){ it }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "serial", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MoveLambdaOutsideParentheses", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6430,28 +6398,28 @@ ] }, { - "id": "TestCaseWithNoTestMethods", + "id": "ProhibitTypeParametersForLocalVariablesMigration", "shortDescription": { - "text": "Test class without tests" + "text": "Local variable with type parameters" }, "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." + "text": "Reports local variables with type parameters. A type parameter for a local variable doesn't make sense because it can't be specialized. Example: 'fun main() {\n val x = \"\"\n }' After the quick-fix is applied: 'fun main() {\n val x = \"\"\n }' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports local variables with type parameters.\n\nA type parameter for a local variable doesn't make sense because it can't be specialized.\n\n**Example:**\n\n\n fun main() {\n val x = \"\"\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val x = \"\"\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "JUnitTestCaseWithNoTests", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ProhibitTypeParametersForLocalVariablesMigration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "JVM languages/Test frameworks", - "index": 123, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -6463,32 +6431,28 @@ ] }, { - "id": "MismatchedArrayReadWrite", + "id": "TestFunctionName", "shortDescription": { - "text": "Mismatched read and write of array" + "text": "Test function naming convention" }, "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" + "text": "Reports test function names that do not follow the recommended naming conventions.", + "markdown": "Reports test function names that do not follow the [recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods)." }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "MismatchedReadAndWriteOfArray", - "cweIds": [ - 561, - 563 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "TestFunctionName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -6500,19 +6464,19 @@ ] }, { - "id": "UnnecessarilyQualifiedStaticUsage", + "id": "RecursivePropertyAccessor", "shortDescription": { - "text": "Unnecessarily qualified static access" + "text": "Recursive property accessor" }, "fullDescription": { - "text": "Reports usages of static members unnecessarily qualified with the class name. Qualification with the class is unnecessary when the static member is available in a surrounding class or in a super class of a surrounding class. Such qualification 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 unnecessarily qualified with the class name.\n\n\nQualification with the class is unnecessary when the static member is available in a surrounding class\nor in a super class of a surrounding class. Such qualification 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." + "text": "Reports recursive property accessor calls which can end up with a 'StackOverflowError'. Such calls are usually confused with backing field access. Example: 'var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }' After the quick-fix is applied: 'var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }'", + "markdown": "Reports recursive property accessor calls which can end up with a `StackOverflowError`.\nSuch calls are usually confused with backing field access.\n\n**Example:**\n\n\n var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }\n\nAfter the quick-fix is applied:\n\n\n var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnnecessarilyQualifiedStaticUsage", + "suppressToolId": "RecursivePropertyAccessor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6520,8 +6484,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -6533,19 +6497,19 @@ ] }, { - "id": "SystemGetProperty", + "id": "RedundantUnitExpression", "shortDescription": { - "text": "Call to 'System.getProperty(str)' could be simplified" + "text": "Redundant 'Unit'" }, "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)." + "text": "Reports redundant 'Unit' expressions. 'Unit' in Kotlin can be used as the return type of functions that do not return anything meaningful. The 'Unit' type has only one possible value, which is the 'Unit' object. Examples: 'fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }'", + "markdown": "Reports redundant `Unit` expressions.\n\n\n`Unit` in Kotlin can be used as the return type of functions that do not return anything meaningful.\nThe `Unit` type has only one possible value, which is the `Unit` object.\n\n**Examples:**\n\n\n fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SystemGetProperty", + "suppressToolId": "RedundantUnitExpression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6553,8 +6517,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -6566,19 +6530,19 @@ ] }, { - "id": "CollectionsMustHaveInitialCapacity", + "id": "PlatformExtensionReceiverOfInline", "shortDescription": { - "text": "Collection without initial capacity" + "text": "'inline fun' with nullable receiver until Kotlin 1.2" }, "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();' 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();\n\nUse the following options to configure the inspection:\n\n* List collection classes that should be checked.\n* Whether to ignore field initializers." + "text": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). It's recommended to add an explicit '!!' you want an exception to be thrown, or consider changing the function's receiver type to nullable if it should work without exceptions. Example: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }' After the quick-fix is applied: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nIt's recommended to add an explicit `!!` you want an exception to be thrown,\nor consider changing the function's receiver type to nullable if it should work without exceptions.\n\n**Example:**\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CollectionWithoutInitialCapacity", + "suppressToolId": "PlatformExtensionReceiverOfInline", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6586,8 +6550,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -6599,29 +6563,29 @@ ] }, { - "id": "ClassOnlyUsedInOneModule", + "id": "SuspiciousEqualsCombination", "shortDescription": { - "text": "Class only used from one other module" + "text": "Suspicious combination of == and ===" }, "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." + "text": "Reports '==' and '===' comparisons that are both used on the same variable within a single expression. Due to similarities '==' and '===' could be mixed without notice, and it takes a close look to check that '==' used instead of '===' Example: 'if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return'", + "markdown": "Reports `==` and `===` comparisons that are both used on the same variable within a single expression.\n\nDue to similarities `==` and `===` could be mixed without notice, and\nit takes a close look to check that `==` used instead of `===`\n\nExample:\n\n\n if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "ClassOnlyUsedInOneModule", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SuspiciousEqualsCombination", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Modularization issues", - "index": 76, - "toolComponent": { + "id": "Kotlin/Probable bugs", + "index": 28, + "toolComponent": { "name": "QDJVM" } }, @@ -6632,28 +6596,28 @@ ] }, { - "id": "TryStatementWithMultipleResources", + "id": "UnusedDataClassCopyResult", "shortDescription": { - "text": "'try' statement with multiple resources can be split" + "text": "Unused result of data class copy" }, "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" + "text": "Reports calls to data class 'copy' function without using its result.", + "markdown": "Reports calls to data class `copy` function without using its result." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "TryStatementWithMultipleResources", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "UnusedDataClassCopyResult", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -6665,28 +6629,28 @@ ] }, { - "id": "CloneableImplementsClone", + "id": "RedundantElseInIf", "shortDescription": { - "text": "Cloneable class without 'clone()' method" + "text": "Redundant 'else' in 'if'" }, "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." + "text": "Reports redundant 'else' in 'if' with 'return' Example: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }' After the quick-fix is applied: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }'", + "markdown": "Reports redundant `else` in `if` with `return`\n\n**Example:**\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "CloneableClassWithoutClone", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantElseInIf", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Cloning issues", - "index": 116, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6698,19 +6662,19 @@ ] }, { - "id": "TypeMayBeWeakened", + "id": "JavaIoSerializableObjectMustHaveReadResolve", "shortDescription": { - "text": "Type may be weakened" + "text": "Serializable object must implement 'readResolve'" }, "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 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 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." + "text": "Reports 'object's ('data object' including) that implement 'java.io.Serializable' but don't implement readResolve Example: 'import java.io.Serializable\n\n object Foo : Serializable' The quick fix implements 'readResolve' method: 'import java.io.Serializable\n\n object Foo : Serializable {\n private fun readResolve() = Foo\n }'", + "markdown": "Reports `object`s (`data object` including) that implement `java.io.Serializable` but don't implement\n[readResolve](https://docs.oracle.com/en/java/javase/11/docs/specs/serialization/input.html#the-readresolve-method)\n\n**Example:**\n\n\n import java.io.Serializable\n\n object Foo : Serializable\n\nThe quick fix implements `readResolve` method:\n\n\n import java.io.Serializable\n\n object Foo : Serializable {\n private fun readResolve() = Foo\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "TypeMayBeWeakened", + "suppressToolId": "JavaIoSerializableObjectMustHaveReadResolve", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6718,8 +6682,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -6731,28 +6695,28 @@ ] }, { - "id": "OctalAndDecimalIntegersMixed", + "id": "ReplacePutWithAssignment", "shortDescription": { - "text": "Octal and decimal integers in same array" + "text": "'map.put()' can be converted to assignment" }, "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};`" + "text": "Reports 'map.put' function calls that can be replaced with indexing operator ('[]'). Using syntactic sugar makes your code simpler. The quick-fix replaces 'put' call with the assignment. Example: 'fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }' After the quick-fix is applied: 'fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }'", + "markdown": "Reports `map.put` function calls that can be replaced with indexing operator (`[]`).\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces `put` call with the assignment.\n\n**Example:**\n\n\n fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OctalAndDecimalIntegersInSameArray", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplacePutWithAssignment", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6764,28 +6728,28 @@ ] }, { - "id": "Deprecation", + "id": "KotlinDoubleNegation", "shortDescription": { - "text": "Deprecated API usage" + "text": "Redundant double negation" }, "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." + "text": "Reports redundant double negations. Example: 'val truth = !!true'", + "markdown": "Reports redundant double negations.\n\n**Example:**\n\n val truth = !!true\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "deprecation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "DoubleNegation", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -6797,28 +6761,28 @@ ] }, { - "id": "ConditionSignal", + "id": "FunctionName", "shortDescription": { - "text": "Call to 'signal()' instead of 'signalAll()'" + "text": "Function naming convention" }, "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." + "text": "Reports function names that do not follow the recommended naming conventions. Example: 'fun Foo() {}' To fix the problem change the name of the function to match the recommended naming conventions.", + "markdown": "Reports function names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n fun Foo() {}\n\nTo fix the problem change the name of the function to match the recommended naming conventions." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CallToSignalInsteadOfSignalAll", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "FunctionName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -6830,19 +6794,19 @@ ] }, { - "id": "PublicMethodWithoutLogging", + "id": "DifferentKotlinMavenVersion", "shortDescription": { - "text": "'public' method without logging" + "text": "Maven and IDE plugins versions are different" }, "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." + "text": "Reports that Maven plugin version isn't properly supported in the current IDE plugin. This inconsistency may lead to different error reporting behavior in the IDE and the compiler", + "markdown": "Reports that Maven plugin version isn't properly supported in the current IDE plugin.\n\nThis inconsistency may lead to different error reporting behavior in the IDE and the compiler" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PublicMethodWithoutLogging", + "suppressToolId": "DifferentKotlinMavenVersion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6850,8 +6814,8 @@ "relationships": [ { "target": { - "id": "Java/Logging", - "index": 119, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -6863,19 +6827,19 @@ ] }, { - "id": "ClassNestingDepth", + "id": "RedundantUnitReturnType", "shortDescription": { - "text": "Inner class too deeply nested" + "text": "Redundant 'Unit' return type" }, "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." + "text": "Reports a redundant 'Unit' return type which can be omitted.", + "markdown": "Reports a redundant `Unit` return type which can be omitted." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InnerClassTooDeeplyNested", + "suppressToolId": "RedundantUnitReturnType", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6883,8 +6847,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -6896,28 +6860,28 @@ ] }, { - "id": "LambdaParameterTypeCanBeSpecified", + "id": "ReplaceRangeToWithUntil", "shortDescription": { - "text": "Lambda parameter type can be specified" + "text": "'rangeTo' or the '..' call should be replaced with 'until'" }, "fullDescription": { - "text": "Reports lambda parameters that do not have their type specified and suggests adding the missing type declarations. Example: 'Function length = a -> a.length();' After the quick-fix is applied: 'Function length = (String a) -> a.length();' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "markdown": "Reports lambda parameters that do not have their type specified and suggests adding the missing type declarations.\n\nExample:\n\n\n Function length = a -> a.length();\n\nAfter the quick-fix is applied:\n\n\n Function length = (String a) -> a.length();\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with 'until'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }'", + "markdown": "Reports calls to `rangeTo` or the `..` operator instead of calls to `until`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces `rangeTo` or the `..` call with `until`.\n\n**Example:**\n\n\n fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "LambdaParameterTypeCanBeSpecified", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ReplaceRangeToWithUntil", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6929,19 +6893,19 @@ ] }, { - "id": "TextLabelInSwitchStatement", + "id": "UnusedEquals", "shortDescription": { - "text": "Text label in 'switch' statement" + "text": "Unused equals expression" }, "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" + "text": "Reports unused 'equals'('==') expressions.", + "markdown": "Reports unused `equals`(`==`) expressions." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "TextLabelInSwitchStatement", + "suppressToolId": "UnusedEquals", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6949,8 +6913,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -6962,19 +6926,19 @@ ] }, { - "id": "PackageVisibleInnerClass", + "id": "UnclearPrecedenceOfBinaryExpression", "shortDescription": { - "text": "Package-visible nested class" + "text": "Multiple operators with different precedence" }, "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." + "text": "Reports binary expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }", + "markdown": "Reports binary expressions that consist of different operators without parentheses.\n\nSuch expressions can be less readable due to different [precedence rules](https://kotlinlang.org/docs/reference/grammar.html#expressions) of operators.\n\nExample:\n\n```\n fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }\n```" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PackageVisibleInnerClass", + "suppressToolId": "UnclearPrecedenceOfBinaryExpression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -6982,8 +6946,8 @@ "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -6995,19 +6959,19 @@ ] }, { - "id": "UnnecessaryUnaryMinus", + "id": "UnusedLambdaExpressionBody", "shortDescription": { - "text": "Unnecessary unary minus" + "text": "Unused return value of a function with lambda expression body" }, "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" + "text": "Reports calls with an unused return value when the called function returns a lambda from an expression body. If there is '=' between function header and body block, code from the function will not be evaluated which can lead to incorrect behavior. Remove = token from function declaration can be used to amend the code automatically. Example: 'fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }' After the quick-fix is applied: 'fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }'", + "markdown": "Reports calls with an unused return value when the called function returns a lambda from an expression body.\n\n\nIf there is `=` between function header and body block,\ncode from the function will not be evaluated which can lead to incorrect behavior.\n\n**Remove = token from function declaration** can be used to amend the code automatically.\n\nExample:\n\n\n fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }\n\nAfter the quick-fix is applied:\n\n\n fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryUnaryMinus", + "suppressToolId": "UnusedLambdaExpressionBody", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -7015,8 +6979,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -7028,28 +6992,28 @@ ] }, { - "id": "MethodMayBeStatic", + "id": "ConvertLambdaToReference", "shortDescription": { - "text": "Method can be made 'static'" + "text": "Can be replaced with function reference" }, "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()`." + "text": "Reports function literal expressions that can be replaced with function references. Replacing lambdas with function references often makes code look more concise and understandable. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }'", + "markdown": "Reports function literal expressions that can be replaced with function references.\n\nReplacing lambdas with function references often makes code look more concise and understandable.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "MethodMayBeStatic", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertLambdaToReference", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7061,28 +7025,28 @@ ] }, { - "id": "TestMethodWithoutAssertion", + "id": "RedundantSetter", "shortDescription": { - "text": "Test method without assertions" + "text": "Redundant property setter" }, "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." + "text": "Reports redundant property setters. Setter is considered to be redundant in one of the following cases: Setter has no body. Accessor visibility isn't changed, declaration isn't 'external' and has no annotations. 'var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated' Setter body is a block with a single statement assigning the parameter to the backing field. 'var prop: Int = 0\n set(value) { // redundant\n field = value\n }'", + "markdown": "Reports redundant property setters.\n\n\nSetter is considered to be redundant in one of the following cases:\n\n1. Setter has no body. Accessor visibility isn't changed, declaration isn't `external` and has no annotations.\n\n\n var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated\n \n2. Setter body is a block with a single statement assigning the parameter to the backing field.\n\n\n var prop: Int = 0\n set(value) { // redundant\n field = value\n }\n \n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "TestMethodWithoutAssertion", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantSetter", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "JVM languages/Test frameworks", - "index": 123, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -7094,28 +7058,28 @@ ] }, { - "id": "EscapedSpace", + "id": "CanSealedSubClassBeObject", "shortDescription": { - "text": "Non-terminal use of '\\s' escape sequence" + "text": "Sealed subclass without state and overridden equals" }, "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 depends on the Java feature ''\\s' escape sequences', which is available since Java 15. 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 depends on the Java feature ''\\\\s' escape sequences', which is available since Java 15.\n\nNew in 2022.3" + "text": "Reports direct inheritors of 'sealed' classes that have no state and overridden 'equals()' method. It's highly recommended to override 'equals()' to provide comparison stability, or convert the 'class' to an 'object' to reach the same effect. Example: 'sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }' The quick-fix converts a 'class' into an 'object': 'sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }'", + "markdown": "Reports direct inheritors of `sealed` classes that have no state and overridden `equals()` method.\n\nIt's highly recommended to override `equals()` to provide comparison stability, or convert the `class` to an `object` to reach the same effect.\n\n**Example:**\n\n\n sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n\nThe quick-fix converts a `class` into an `object`:\n\n\n sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "EscapedSpace", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "CanSealedSubClassBeObject", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -7127,28 +7091,28 @@ ] }, { - "id": "ContinueStatement", + "id": "PropertyName", "shortDescription": { - "text": "'continue' statement" + "text": "Property naming convention" }, "fullDescription": { - "text": "Reports 'continue' statements. 'continue' statements complicate refactoring and can be confusing. Example: 'void foo(List 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 strs) {\n for (String str : strs) {\n if (str.contains(\"skip\")) continue;\n handleStr(str);\n }\n }\n" + "text": "Reports property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, property names should start with a lowercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val My_Cool_Property = \"\"' The quick-fix renames the class according to the Kotlin naming conventions: 'val myCoolProperty = \"\"'", + "markdown": "Reports property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nproperty names should start with a lowercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val My_Cool_Property = \"\"\n\nThe quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val myCoolProperty = \"\"\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ContinueStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "PropertyName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -7160,19 +7124,19 @@ ] }, { - "id": "MisorderedAssertEqualsArguments", + "id": "InlineClassDeprecatedMigration", "shortDescription": { - "text": "Misordered 'assertEquals()' arguments" + "text": "Inline classes are deprecated since 1.5" }, "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" + "text": "Reports inline classes that are deprecated and cause compilation warnings in Kotlin 1.5 and later. See What's new in Kotlin 1.5.0 Example: 'inline class Password(val s: String)' After the quick-fix is applied: '@JvmInline\n value class Password(val s: String)' Inspection is available for Kotlin language level starting from 1.5.", + "markdown": "Reports inline classes that are deprecated and cause compilation warnings in Kotlin 1.5 and later.\nSee [What's new in Kotlin 1.5.0](https://kotlinlang.org/docs/whatsnew15.html#inline-classes)\n\nExample:\n\n\n inline class Password(val s: String)\n\nAfter the quick-fix is applied:\n\n\n @JvmInline\n value class Password(val s: String)\n\nInspection is available for Kotlin language level starting from 1.5." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MisorderedAssertEqualsArguments", + "suppressToolId": "InlineClassDeprecatedMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -7180,8 +7144,8 @@ "relationships": [ { "target": { - "id": "Java/Test frameworks", - "index": 130, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -7193,19 +7157,19 @@ ] }, { - "id": "StaticVariableInitialization", + "id": "KotlinMavenPluginPhase", "shortDescription": { - "text": "Static field may not be initialized" + "text": "Kotlin Maven Plugin misconfigured" }, "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." + "text": "Reports kotlin-maven-plugin configuration issues", + "markdown": "Reports kotlin-maven-plugin configuration issues" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "StaticVariableMayNotBeInitialized", + "suppressToolId": "KotlinMavenPluginPhase", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -7213,8 +7177,8 @@ "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -7226,32 +7190,28 @@ ] }, { - "id": "ConstantAssertCondition", + "id": "ConvertToStringTemplate", "shortDescription": { - "text": "Constant condition in 'assert' statement" + "text": "String concatenation that can be converted to string template" }, "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 }' This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", - "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\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + "text": "Reports string concatenation that can be converted to a string template. Using string templates is recommended as it makes code easier to read. Example: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }' After the quick-fix is applied: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }'", + "markdown": "Reports string concatenation that can be converted to a string template.\n\nUsing string templates is recommended as it makes code easier to read.\n\n**Example:**\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ConstantAssertCondition", - "cweIds": [ - 570, - 571 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertToStringTemplate", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7263,28 +7223,28 @@ ] }, { - "id": "JavaReflectionInvocation", + "id": "SimplifiableCall", "shortDescription": { - "text": "Reflective invocation arguments mismatch" + "text": "Library function call could be simplified" }, "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" + "text": "Reports library function calls which could be replaced by simplified one. Using corresponding functions makes your code simpler. The quick-fix replaces the function calls with another one. Example: 'fun test(list: List) {\n list.filter { it is String }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.filterIsInstance()\n }'", + "markdown": "Reports library function calls which could be replaced by simplified one.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the function calls with another one.\n\n**Example:**\n\n\n fun test(list: List) {\n list.filter { it is String }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.filterIsInstance()\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "JavaReflectionInvocation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SimplifiableCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Reflective access", - "index": 131, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7296,28 +7256,28 @@ ] }, { - "id": "CaughtExceptionImmediatelyRethrown", + "id": "ObjectLiteralToLambda", "shortDescription": { - "text": "Caught exception is immediately rethrown" + "text": "Object literal can be converted to lambda" }, "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" + "text": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression. Example: 'class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n}' After the quick-fix is applied: 'fun foo() {\n threadPool.submit { println(\"hello\") }\n }'", + "markdown": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.\n\n**Example:**\n\n\n class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n threadPool.submit { println(\"hello\") }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "CaughtExceptionImmediatelyRethrown", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ObjectLiteralToLambda", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7329,31 +7289,28 @@ ] }, { - "id": "ArrayHashCode", + "id": "RedundantLambdaOrAnonymousFunction", "shortDescription": { - "text": "'hashCode()' called on array" + "text": "Redundant creation of lambda or anonymous function" }, "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))`" + "text": "Reports lambdas or anonymous functions that are created and used immediately. 'fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }'", + "markdown": "Reports lambdas or anonymous functions that are created and used immediately.\n\n\n fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ArrayHashCode", - "cweIds": [ - 328 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantLambdaOrAnonymousFunction", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -7365,28 +7322,28 @@ ] }, { - "id": "WaitNotInLoop", + "id": "ConvertObjectToDataObject", "shortDescription": { - "text": "'wait()' not called in loop" + "text": "Convert 'object' to 'data object'" }, "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" + "text": "Reports 'object' that can be converted to 'data object' 'data object' auto-generates 'toString', 'equals' and 'hashCode' The inspection suggests to convert 'object' to 'data object' in 2 cases: When custom 'toString' returns name of the class When 'object' inherits sealed 'class'/'interface' Example: 'object Foo {\n override fun toString(): String = \"Foo\"\n }' After the quick-fix is applied: 'data object Foo' This inspection only reports if the Kotlin language level of the project or module is 1.9 or higher", + "markdown": "Reports `object` that can be converted to `data object`\n\n`data object` auto-generates `toString`, `equals` and `hashCode`\n\nThe inspection suggests to convert `object` to `data object` in 2 cases:\n\n* When custom `toString` returns name of the class\n* When `object` inherits sealed `class`/`interface`\n\n**Example:**\n\n\n object Foo {\n override fun toString(): String = \"Foo\"\n }\n\nAfter the quick-fix is applied:\n\n\n data object Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.9 or higher" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "WaitNotInLoop", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertObjectToDataObject", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -7398,28 +7355,28 @@ ] }, { - "id": "ExternalizableWithSerializationMethods", + "id": "BooleanLiteralArgument", "shortDescription": { - "text": "Externalizable class with 'readObject()' or 'writeObject()'" + "text": "Boolean literal argument without parameter name" }, "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" + "text": "Reports call arguments with 'Boolean' type without explicit parameter names specified. When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding. Example: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }' The quick-fix adds missing parameter names: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }'", + "markdown": "Reports call arguments with `Boolean` type without explicit parameter names specified.\n\n\nWhen multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes.\nExplicit parameter names allow for easier code reading and understanding.\n\n**Example:**\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }\n\nThe quick-fix adds missing parameter names:\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ExternalizableClassWithSerializationMethods", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "BooleanLiteralArgument", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7431,28 +7388,28 @@ ] }, { - "id": "SafeLock", + "id": "ConvertArgumentToSet", "shortDescription": { - "text": "Lock acquired but not safely unlocked" + "text": "Argument could be converted to 'Set' to improve performance" }, "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" + "text": "Detects the function calls that could work faster with an argument converted to 'Set'. Operations like 'minus' or 'intersect' are more effective when their argument is a set. An explicit conversion of an 'Iterable' or an 'Array' into a 'Set' can often make code more effective. The quick-fix adds an explicit conversion to the function call. Example: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size' After the quick-fix is applied: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size'", + "markdown": "Detects the function calls that could work faster with an argument converted to `Set`.\n\n\nOperations like 'minus' or 'intersect' are more effective when their argument is a set.\nAn explicit conversion of an `Iterable` or an `Array`\ninto a `Set` can often make code more effective.\n\n\nThe quick-fix adds an explicit conversion to the function call.\n\n**Example:**\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size\n\nAfter the quick-fix is applied:\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "LockAcquiredButNotSafelyReleased", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertArgumentToSet", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -7464,28 +7421,28 @@ ] }, { - "id": "JavaLangInvokeHandleSignature", + "id": "ReplaceGuardClauseWithFunctionCall", "shortDescription": { - "text": "MethodHandle/VarHandle type mismatch" + "text": "Guard clause can be replaced with Kotlin's function call" }, "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" + "text": "Reports guard clauses that can be replaced with a function call. Example: 'fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }' After the quick-fix is applied: 'fun test(foo: Int?) {\n checkNotNull(foo)\n }'", + "markdown": "Reports guard clauses that can be replaced with a function call.\n\n**Example:**\n\n fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }\n\nAfter the quick-fix is applied:\n\n fun test(foo: Int?) {\n checkNotNull(foo)\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "JavaLangInvokeHandleSignature", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceGuardClauseWithFunctionCall", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Reflective access", - "index": 131, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7497,28 +7454,28 @@ ] }, { - "id": "ReturnThis", + "id": "ReplaceToStringWithStringTemplate", "shortDescription": { - "text": "Return of 'this'" + "text": "Call of 'toString' could be replaced with string template" }, "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" + "text": "Reports 'toString' function calls that can be replaced with a string template. Using string templates makes your code simpler. The quick-fix replaces 'toString' with a string template. Example: 'fun test(): String {\n val x = 1\n return x.toString()\n }' After the quick-fix is applied: 'fun test(): String {\n val x = 1\n return \"$x\"\n }'", + "markdown": "Reports `toString` function calls that can be replaced with a string template.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces `toString` with a string template.\n\n**Example:**\n\n\n fun test(): String {\n val x = 1\n return x.toString()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): String {\n val x = 1\n return \"$x\"\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ReturnOfThis", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceToStringWithStringTemplate", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7530,28 +7487,28 @@ ] }, { - "id": "CanBeFinal", + "id": "ProtectedInFinal", "shortDescription": { - "text": "Declaration can have 'final' modifier" + "text": "'protected' visibility is effectively 'private' in a final class" }, "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." + "text": "Reports 'protected' visibility used inside of a 'final' class. In such cases 'protected' members are accessible only in the class itself, so they are effectively 'private'. Example: 'class FinalClass {\n protected fun foo() {}\n }' After the quick-fix is applied: 'class FinalClass {\n private fun foo() {}\n }'", + "markdown": "Reports `protected` visibility used inside of a `final` class. In such cases `protected` members are accessible only in the class itself, so they are effectively `private`.\n\n**Example:**\n\n\n class FinalClass {\n protected fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class FinalClass {\n private fun foo() {}\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CanBeFinal", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ProtectedInFinal", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7563,28 +7520,28 @@ ] }, { - "id": "UnnecessaryLabelOnBreakStatement", + "id": "ReplaceRangeStartEndInclusiveWithFirstLast", "shortDescription": { - "text": "Unnecessary label on 'break' statement" + "text": "Boxed properties should be replaced with unboxed" }, "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" + "text": "Reports boxed 'Range.start' and 'Range.endInclusive' properties. These properties can be replaced with unboxed 'first' and 'last' properties to avoid redundant calls. The quick-fix replaces 'start' and 'endInclusive' properties with the corresponding 'first' and 'last'. Example: 'fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }' After the quick-fix is applied: 'fun foo(range: CharRange) {\n val lastElement = range.last\n }'", + "markdown": "Reports **boxed** `Range.start` and `Range.endInclusive` properties.\n\nThese properties can be replaced with **unboxed** `first` and `last` properties to avoid redundant calls.\n\nThe quick-fix replaces `start` and `endInclusive` properties with the corresponding `first` and `last`.\n\n**Example:**\n\n\n fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(range: CharRange) {\n val lastElement = range.last\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryLabelOnBreakStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceRangeStartEndInclusiveWithFirstLast", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7596,28 +7553,28 @@ ] }, { - "id": "NakedNotify", + "id": "ReplaceSizeCheckWithIsNotEmpty", "shortDescription": { - "text": "'notify()' or 'notifyAll()' without corresponding state change" + "text": "Size check can be replaced with 'isNotEmpty()'" }, "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" + "text": "Reports size checks of 'Collections/Array/String' that should be replaced with 'isNotEmpty()'. Using 'isNotEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isNotEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }'", + "markdown": "Reports size checks of `Collections/Array/String` that should be replaced with `isNotEmpty()`.\n\nUsing `isNotEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isNotEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NakedNotify", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceSizeCheckWithIsNotEmpty", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7629,19 +7586,19 @@ ] }, { - "id": "ClassCoupling", + "id": "RedundantSemicolon", "shortDescription": { - "text": "Overly coupled class" + "text": "Redundant semicolon" }, "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." + "text": "Reports redundant semicolons (';') that can be safely removed. Kotlin does not require a semicolon at the end of each statement or expression. The quick-fix is suggested to remove redundant semicolons. Example: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};' After the quick-fix is applied: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}' There are two cases though where a semicolon is required: Several statements placed on a single line need to be separated with semicolons: 'map.forEach { val (key, value) = it; println(\"$key -> $value\") }' 'enum' classes that also declare properties or functions, require a semicolon after the list of enum constants: 'enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }'", + "markdown": "Reports redundant semicolons (`;`) that can be safely removed.\n\n\nKotlin does not require a semicolon at the end of each statement or expression.\nThe quick-fix is suggested to remove redundant semicolons.\n\n**Example:**\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};\n\nAfter the quick-fix is applied:\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}\n\nThere are two cases though where a semicolon is required:\n\n1. Several statements placed on a single line need to be separated with semicolons:\n\n\n map.forEach { val (key, value) = it; println(\"$key -> $value\") }\n\n2. `enum` classes that also declare properties or functions, require a semicolon after the list of enum constants:\n\n\n enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }\n \n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OverlyCoupledClass", + "suppressToolId": "RedundantSemicolon", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -7649,8 +7606,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -7662,28 +7619,28 @@ ] }, { - "id": "EmptySynchronizedStatement", + "id": "IntroduceWhenSubject", "shortDescription": { - "text": "Empty 'synchronized' statement" + "text": "'when' that can be simplified by introducing an argument" }, "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." + "text": "Reports a 'when' expression that can be simplified by introducing a subject argument. Example: 'fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }' The quick fix introduces a subject argument: 'fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }'", + "markdown": "Reports a `when` expression that can be simplified by introducing a subject argument.\n\n**Example:**\n\n\n fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n\nThe quick fix introduces a subject argument:\n\n\n fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "EmptySynchronizedStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "IntroduceWhenSubject", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7695,28 +7652,28 @@ ] }, { - "id": "TextBlockMigration", + "id": "DeprecatedCallableAddReplaceWith", "shortDescription": { - "text": "Text block can be used" + "text": "@Deprecated annotation without 'replaceWith' argument" }, "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 Report single string literals option to highlight single literals containing line breaks. The quick-fix will still be available even when this option is disabled. Example: 'String html = \"\\n\" +\n \" \\n\" +\n \"

Hello, world

\\n\" +\n \" \\n\" +\n \"\\n\";' After the quick-fix is applied: 'String html = \"\"\"\n \n \n

Hello, world

\n \n \n \"\"\";' This inspection depends on the Java feature 'Text block literals', which is available since Java 15. 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 **Report single string literals** option to highlight single literals containing line breaks.\nThe quick-fix will still be available even when this option is disabled.\n\n\n**Example:**\n\n\n String html = \"\\n\" +\n \" \\n\" +\n \"

Hello, world

\\n\" +\n \" \\n\" +\n \"\\n\";\n\nAfter the quick-fix is applied:\n\n\n String html = \"\"\"\n \n \n

Hello, world

\n \n \n \"\"\";\n\nThis inspection depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2019.3" + "text": "Reports deprecated functions and properties that do not have the 'kotlin.ReplaceWith' argument in its 'kotlin.deprecated' annotation and suggests to add one based on their body. Kotlin provides the 'ReplaceWith' argument to replace deprecated declarations automatically. It is recommended to use the argument to fix deprecation issues in code. Example: '@Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42' The quick-fix adds the 'ReplaceWith()' argument: '@Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42'", + "markdown": "Reports deprecated functions and properties that do not have the `kotlin.ReplaceWith` argument in its `kotlin.deprecated` annotation and suggests to add one based on their body.\n\n\nKotlin provides the `ReplaceWith` argument to replace deprecated declarations automatically.\nIt is recommended to use the argument to fix deprecation issues in code.\n\n**Example:**\n\n\n @Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42\n\nThe quick-fix adds the `ReplaceWith()` argument:\n\n\n @Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "TextBlockMigration", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "DeprecatedCallableAddReplaceWith", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 15", - "index": 132, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -7728,28 +7685,28 @@ ] }, { - "id": "ObjectAllocationInLoop", + "id": "ComplexRedundantLet", "shortDescription": { - "text": "Object allocation in loop" + "text": "Redundant argument-based 'let' call" }, "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" + "text": "Reports a redundant argument-based 'let' call. 'let' is redundant when the lambda parameter is only used as a qualifier in a call expression. If you need to give a name to the qualifying expression, declare a local variable. Example: 'fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }' The quick-fix removes the extra 'let()' call: 'fun example() {\n \"1,2,3\".split(',')\n }' Alternative: 'fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }'", + "markdown": "Reports a redundant argument-based `let` call.\n\n`let` is redundant when the lambda parameter is only used as a qualifier in a call expression.\n\nIf you need to give a name to the qualifying expression, declare a local variable.\n\n**Example:**\n\n\n fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }\n\nThe quick-fix removes the extra `let()` call:\n\n\n fun example() {\n \"1,2,3\".split(',')\n }\n\nAlternative:\n\n\n fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ObjectAllocationInLoop", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ComplexRedundantLet", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -7761,19 +7718,19 @@ ] }, { - "id": "NonFinalClone", + "id": "RemoveRedundantSpreadOperator", "shortDescription": { - "text": "Non-final 'clone()' in secure context" + "text": "Redundant spread operator" }, "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" + "text": "Reports the use of a redundant spread operator for a family of 'arrayOf' function calls. Use the 'Remove redundant spread operator' quick-fix to clean up the code. Examples: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }' After the quick-fix is applied: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }'", + "markdown": "Reports the use of a redundant spread operator for a family of `arrayOf` function calls.\n\nUse the 'Remove redundant spread operator' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonFinalClone", + "suppressToolId": "RemoveRedundantSpreadOperator", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -7781,8 +7738,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -7794,28 +7751,28 @@ ] }, { - "id": "ChainedEquality", + "id": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", "shortDescription": { - "text": "Chained equality comparisons" + "text": "'@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4" }, "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" + "text": "Reports '@JvmOverloads' on constructors of annotation classes because it's meaningless. There is no footprint of '@JvmOverloads' in the generated bytecode and Kotlin metadata, so '@JvmOverloads' doesn't affect the generated bytecode and the code behavior. '@JvmOverloads' on constructors of annotation classes causes a compilation error since Kotlin 1.4. Example: 'annotation class A @JvmOverloads constructor(val x: Int = 1)' After the quick-fix is applied: 'annotation class A constructor(val x: Int = 1)'", + "markdown": "Reports `@JvmOverloads` on constructors of annotation classes because it's meaningless.\n\n\nThere is no footprint of `@JvmOverloads` in the generated bytecode and Kotlin metadata,\nso `@JvmOverloads` doesn't affect the generated bytecode and the code behavior.\n\n`@JvmOverloads` on constructors of annotation classes causes a compilation error since Kotlin 1.4.\n\n**Example:**\n\n\n annotation class A @JvmOverloads constructor(val x: Int = 1)\n\nAfter the quick-fix is applied:\n\n\n annotation class A constructor(val x: Int = 1)\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "ChainedEqualityComparisons", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -7827,19 +7784,19 @@ ] }, { - "id": "LossyConversionCompoundAssignment", + "id": "RemoveSetterParameterType", "shortDescription": { - "text": "Possibly lossy implicit cast in compound assignment" + "text": "Redundant setter parameter type" }, "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" + "text": "Reports explicitly specified parameter types in property setters. Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly. Examples: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted' After the quick-fix is applied: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)'", + "markdown": "Reports explicitly specified parameter types in property setters.\n\n\nSetter parameter type always matches the property type, so it's not required to be explicit.\nThe 'Remove explicit type specification' quick-fix allows amending the code accordingly.\n\n**Examples:**\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted\n\nAfter the quick-fix is applied:\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "lossy-conversions", + "suppressToolId": "RemoveSetterParameterType", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -7847,8 +7804,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -7860,28 +7817,28 @@ ] }, { - "id": "ThrowFromFinallyBlock", + "id": "ObjectPrivatePropertyName", "shortDescription": { - "text": "'throw' inside 'finally' block" + "text": "Object private property naming convention" }, "fullDescription": { - "text": "Reports 'throw' statements inside 'finally' blocks. While occasionally intended, such 'throw' statements can hide exceptions thrown from the 'try' and 'catch' blocks, thereby complicating the debugging process. Example: 'class Fascinating {\n void doTask(Task t) {\n try {\n t.activity();\n } finally {\n if (!t.finish()) {\n throw new IllegalStateException();\n }\n }\n }\n }' Use the Warn everywhere declared exceptions may be thrown option to warn on method calls to methods that declare exceptions as well.", - "markdown": "Reports `throw` statements inside `finally` blocks. While occasionally intended, such `throw` statements can hide exceptions thrown from the `try` and `catch` blocks, thereby complicating the debugging process.\n\n**Example:**\n\n\n class Fascinating {\n void doTask(Task t) {\n try {\n t.activity();\n } finally {\n if (!t.finish()) {\n throw new IllegalStateException();\n }\n }\n }\n }\n\nUse the **Warn everywhere declared exceptions may be thrown** option\nto warn on method calls to methods that declare exceptions as well." + "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Private properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an underscore or an uppercase letter, use camel case. Example: 'class Person {\n companion object {\n // property in companion object\n private val NO_NAME = Person()\n }\n }'", + "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Private properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an underscore or an uppercase letter, use camel case.\n\n**Example:**\n\n\n class Person {\n companion object {\n // property in companion object\n private val NO_NAME = Person()\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ThrowFromFinallyBlock", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ObjectPrivatePropertyName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -7893,28 +7850,28 @@ ] }, { - "id": "StaticNonFinalField", + "id": "IfThenToElvis", "shortDescription": { - "text": "'static', non-'final' field" + "text": "If-Then foldable to '?:'" }, "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." + "text": "Reports 'if-then' expressions that can be folded into elvis ('?:') expressions. Example: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo' The quick fix converts the 'if-then' expression into an elvis ('?:') expression: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"'", + "markdown": "Reports `if-then` expressions that can be folded into elvis (`?:`) expressions.\n\n**Example:**\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo\n\nThe quick fix converts the `if-then` expression into an elvis (`?:`) expression:\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "StaticNonFinalField", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "IfThenToElvis", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -7926,28 +7883,28 @@ ] }, { - "id": "EmptyMethod", + "id": "WrapUnaryOperator", "shortDescription": { - "text": "Empty method" + "text": "Ambiguous unary operator use with number constant" }, "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." + "text": "Reports an unary operator followed by a dot qualifier such as '-1.inc()'. Code like '-1.inc()' can be misleading because '-' has a lower precedence than '.inc()'. As a result, '-1.inc()' evaluates to '-2' and not '0' as it might be expected. Wrap unary operator and value with () quick-fix can be used to amend the code automatically.", + "markdown": "Reports an unary operator followed by a dot qualifier such as `-1.inc()`.\n\nCode like `-1.inc()` can be misleading because `-` has a lower precedence than `.inc()`.\nAs a result, `-1.inc()` evaluates to `-2` and not `0` as it might be expected.\n\n**Wrap unary operator and value with ()** quick-fix can be used to amend the code automatically." }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "EmptyMethod", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "WrapUnaryOperator", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -7959,19 +7916,19 @@ ] }, { - "id": "SimplifiableEqualsExpression", + "id": "ConflictingExtensionProperty", "shortDescription": { - "text": "Unnecessary 'null' check before 'equals()' call" + "text": "Extension property conflicting with synthetic one" }, "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`." + "text": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java 'get' or 'set' methods. Such properties should be either removed or renamed to avoid breaking code by future changes in the compiler. The quick-fix deletes an extention property. Example: 'val File.name: String\n get() = getName()' The quick-fix adds the '@Deprecated' annotation: '@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()'", + "markdown": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java `get` or `set` methods.\n\nSuch properties should be either removed or renamed to avoid breaking code by future changes in the compiler.\n\nThe quick-fix deletes an extention property.\n\n**Example:**\n\n\n val File.name: String\n get() = getName()\n\nThe quick-fix adds the `@Deprecated` annotation:\n\n\n @Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SimplifiableEqualsExpression", + "suppressToolId": "ConflictingExtensionProperty", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -7979,8 +7936,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -7992,28 +7949,28 @@ ] }, { - "id": "NonCommentSourceStatements", + "id": "ReplaceJavaStaticMethodWithKotlinAnalog", "shortDescription": { - "text": "Overly long method" + "text": "Java methods should be replaced with Kotlin analog" }, "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." + "text": "Reports a Java method call that can be replaced with a Kotlin function, for example, 'System.out.println()'. Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code. The quick-fix replaces the Java method calls on the same Kotlin call. Example: 'import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }' After the quick-fix is applied: 'fun main() {\n val a = listOf(1, 3, null)\n }'", + "markdown": "Reports a Java method call that can be replaced with a Kotlin function, for example, `System.out.println()`.\n\nReplacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.\n\nThe quick-fix replaces the Java method calls on the same Kotlin call.\n\n**Example:**\n\n\n import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = listOf(1, 3, null)\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OverlyLongMethod", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceJavaStaticMethodWithKotlinAnalog", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8025,28 +7982,28 @@ ] }, { - "id": "ConfusingMainMethod", + "id": "RemoveEmptyParenthesesFromLambdaCall", "shortDescription": { - "text": "Confusing 'main()' method" + "text": "Unnecessary parentheses in function call with lambda" }, "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." + "text": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses. Use the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code. Examples: 'fun foo() {\n listOf(1).forEach() { }\n }' After the quick-fix is applied: 'fun foo() {\n listOf(1).forEach { }\n }'", + "markdown": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.\n\nUse the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo() {\n listOf(1).forEach() { }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1).forEach { }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ConfusingMainMethod", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveEmptyParenthesesFromLambdaCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8058,28 +8015,28 @@ ] }, { - "id": "MultipleVariablesInDeclaration", + "id": "RemoveExplicitSuperQualifier", "shortDescription": { - "text": "Multiple variables in one declaration" + "text": "Unnecessary supertype qualification" }, "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" + "text": "Reports 'super' member calls with redundant supertype qualification. Code in a derived class can call its superclass functions and property accessors implementations using the 'super' keyword. To specify the supertype from which the inherited implementation is taken, 'super' can be qualified by the supertype name in angle brackets, e.g. 'super'. Sometimes this qualification is redundant and can be omitted. Use the 'Remove explicit supertype qualification' quick-fix to clean up the code. Examples: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }' After the quick-fix is applied: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }'", + "markdown": "Reports `super` member calls with redundant supertype qualification.\n\n\nCode in a derived class can call its superclass functions and property accessors implementations using the `super` keyword.\nTo specify the supertype from which the inherited implementation is taken, `super` can be qualified by the supertype name in\nangle brackets, e.g. `super`. Sometimes this qualification is redundant and can be omitted.\nUse the 'Remove explicit supertype qualification' quick-fix to clean up the code.\n\n**Examples:**\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "MultipleVariablesInDeclaration", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "RemoveExplicitSuperQualifier", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8091,19 +8048,19 @@ ] }, { - "id": "IOResource", + "id": "RedundantExplicitType", "shortDescription": { - "text": "I/O resource opened but not safely closed" + "text": "Obvious explicit type" }, "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." + "text": "Reports local variables' explicitly given types which are obvious and thus redundant, like 'val f: Foo = Foo()'. Example: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }' After the quick-fix is applied: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }'", + "markdown": "Reports local variables' explicitly given types which are obvious and thus redundant, like `val f: Foo = Foo()`.\n\n**Example:**\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }\n\nAfter the quick-fix is applied:\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IOResourceOpenedButNotSafelyClosed", + "suppressToolId": "RedundantExplicitType", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -8111,8 +8068,8 @@ "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8124,19 +8081,19 @@ ] }, { - "id": "CallToSimpleGetterInClass", + "id": "SuspiciousVarProperty", "shortDescription": { - "text": "Call to simple getter from within class" + "text": "Suspicious 'var' property: its setter does not influence its getter result" }, "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." + "text": "Reports 'var' properties with default setter and getter that do not reference backing field. Such properties do not affect calling its setter; therefore, it will be clearer to change such property to 'val' and delete the initializer. Change to val and delete initializer quick-fix can be used to amend the code automatically. Example: '// This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1'", + "markdown": "Reports `var` properties with default setter and getter that do not reference backing field.\n\n\nSuch properties do not affect calling its setter; therefore, it will be clearer to change such property to `val` and delete the initializer.\n\n**Change to val and delete initializer** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CallToSimpleGetterFromWithinClass", + "suppressToolId": "SuspiciousVarProperty", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -8144,8 +8101,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -8157,28 +8114,28 @@ ] }, { - "id": "NonSerializableFieldInSerializableClass", + "id": "JavaCollectionsStaticMethod", "shortDescription": { - "text": "Non-serializable field in a 'Serializable' class" + "text": "Java Collections static method call can be replaced with Kotlin stdlib" }, "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." + "text": "Reports a Java 'Collections' static method call that can be replaced with Kotlin stdlib. Example: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }' The quick fix replaces Java 'Collections' static method call with the corresponding Kotlin stdlib method call: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }'", + "markdown": "Reports a Java `Collections` static method call that can be replaced with Kotlin stdlib.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }\n\nThe quick fix replaces Java `Collections` static method call with the corresponding Kotlin stdlib method call:\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NonSerializableFieldInSerializableClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "JavaCollectionsStaticMethod", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8190,28 +8147,28 @@ ] }, { - "id": "EnhancedSwitchMigration", + "id": "MoveVariableDeclarationIntoWhen", "shortDescription": { - "text": "Statement can be replaced with enhanced 'switch'" + "text": "Variable declaration could be moved inside 'when'" }, "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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14. 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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14.\n\nNew in 2019.1" + "text": "Reports variable declarations that can be moved inside a 'when' expression. Example: 'fun someCalc(x: Int) = x * 42\n\nfun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}' After the quick-fix is applied: 'fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}'", + "markdown": "Reports variable declarations that can be moved inside a `when` expression.\n\n**Example:**\n\n\n fun someCalc(x: Int) = x * 42\n\n fun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "EnhancedSwitchMigration", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MoveVariableDeclarationIntoWhen", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 14", - "index": 138, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8223,28 +8180,28 @@ ] }, { - "id": "DoubleLiteralMayBeFloatLiteral", + "id": "RemoveEmptyParenthesesFromAnnotationEntry", "shortDescription": { - "text": "Cast to 'float' can be 'float' literal" + "text": "Remove unnecessary parentheses" }, "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" + "text": "Reports redundant empty parentheses in annotation entries. Use the 'Remove unnecessary parentheses' quick-fix to clean up the code. Examples: 'annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }'", + "markdown": "Reports redundant empty parentheses in annotation entries.\n\nUse the 'Remove unnecessary parentheses' quick-fix to clean up the code.\n\n**Examples:**\n\n\n annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "DoubleLiteralMayBeFloatLiteral", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveEmptyParenthesesFromAnnotationEntry", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues/Cast", - "index": 139, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8256,28 +8213,28 @@ ] }, { - "id": "OverloadedMethodsWithSameNumberOfParameters", + "id": "SimplifiableCallChain", "shortDescription": { - "text": "Overloaded methods with same number of parameters" + "text": "Call chain on collection type can be simplified" }, "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 void execute(RunnableFuture 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 void execute(RunnableFuture c) {}\n }\n\n\nUse the option to ignore overloaded methods whose parameter types are definitely incompatible." + "text": "Reports two-call chains replaceable by a single call. It can help you to avoid redundant code execution. The quick-fix replaces the call chain with a single call. Example: 'fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }' After the quick-fix is applied: 'fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }'", + "markdown": "Reports two-call chains replaceable by a single call.\n\nIt can help you to avoid redundant code execution.\n\nThe quick-fix replaces the call chain with a single call.\n\n**Example:**\n\n\n fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OverloadedMethodsWithSameNumberOfParameters", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SimplifiableCallChain", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8289,28 +8246,28 @@ ] }, { - "id": "ParametersPerMethod", + "id": "ReplaceCallWithBinaryOperator", "shortDescription": { - "text": "Method with too many parameters" + "text": "Can be replaced with binary operator" }, "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." + "text": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones. Example: 'fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return 2 > 1\n }'", + "markdown": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones.\n\n**Example:**\n\n fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }\n\nAfter the quick-fix is applied:\n\n fun test(): Boolean {\n return 2 > 1\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "MethodWithTooManyParameters", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceCallWithBinaryOperator", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8322,19 +8279,19 @@ ] }, { - "id": "OverlyLongLambda", + "id": "ReplacePrintlnWithLogging", "shortDescription": { - "text": "Overly long lambda expression" + "text": "Call to 'print()' or 'println()'" }, "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." + "text": "Reports usages of 'print' or 'println'. 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 `print` or `println`.\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": "OverlyLongLambda", + "suppressToolId": "ReplacePrintlnWithLogging", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -8342,8 +8299,8 @@ "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -8355,19 +8312,19 @@ ] }, { - "id": "CloneDeclaresCloneNotSupported", + "id": "UnusedUnaryOperator", "shortDescription": { - "text": "'clone()' does not declare 'CloneNotSupportedException'" + "text": "Unused unary operator" }, "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" + "text": "Reports unary operators for number types on unused expressions. Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading. Example: 'fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }'", + "markdown": "Reports unary operators for number types on unused expressions.\n\nUnary operators break previous expression if they are used without braces.\nAs a result, mathematical expressions spanning multi lines can be misleading.\n\nExample:\n\n\n fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CloneDoesntDeclareCloneNotSupportedException", + "suppressToolId": "UnusedUnaryOperator", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -8375,8 +8332,8 @@ "relationships": [ { "target": { - "id": "Java/Cloning issues", - "index": 116, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -8388,28 +8345,28 @@ ] }, { - "id": "BooleanExpressionMayBeConditional", + "id": "ClassName", "shortDescription": { - "text": "Boolean expression can be replaced with conditional expression" + "text": "Class naming convention" }, "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" + "text": "Reports class names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, class names should start with an uppercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'class user(val name: String)' The quick-fix renames the class according to the Kotlin naming conventions: 'class User(val name: String)'", + "markdown": "Reports class names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nclass names should start with an uppercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n class user(val name: String)\n\nThe quick-fix renames the class according to the Kotlin naming conventions:\n\n\n class User(val name: String)\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "BooleanExpressionMayBeConditional", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ClassName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -8421,28 +8378,28 @@ ] }, { - "id": "UnnecessaryExplicitNumericCast", + "id": "RemoveEmptyPrimaryConstructor", "shortDescription": { - "text": "Unnecessary explicit numeric cast" + "text": "Redundant empty primary constructor" }, "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;`" + "text": "Reports empty primary constructors when they are implicitly available anyway. A primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers. Use the 'Remove empty primary constructor' quick-fix to clean up the code. Examples: 'class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier'", + "markdown": "Reports empty primary constructors when they are implicitly available anyway.\n\n\nA primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers.\nUse the 'Remove empty primary constructor' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryExplicitNumericCast", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveEmptyPrimaryConstructor", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues/Cast", - "index": 139, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8454,28 +8411,28 @@ ] }, { - "id": "TransientFieldNotInitialized", + "id": "RemoveEmptySecondaryConstructorBody", "shortDescription": { - "text": "Transient field is not initialized on deserialization" + "text": "Redundant constructor body" }, "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" + "text": "Reports empty bodies of secondary constructors.", + "markdown": "Reports empty bodies of secondary constructors." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "TransientFieldNotInitialized", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveEmptySecondaryConstructorBody", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8487,28 +8444,28 @@ ] }, { - "id": "PropertyValueSetToItself", + "id": "FloatingPointLiteralPrecision", "shortDescription": { - "text": "Property value set to itself" + "text": "Floating-point literal exceeds the available precision" }, "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" + "text": "Reports floating-point literals that cannot be represented with the required precision using IEEE 754 'Float' and 'Double' types. For example, '1.9999999999999999999' has too many significant digits, so its representation as a 'Double' will be rounded to '2.0'. Specifying excess digits may be misleading as it hides the fact that computations use rounded values instead. The quick-fix replaces the literal with a rounded value that matches the actual representation of the constant. Example: 'val x: Float = 3.14159265359f' After the quick-fix is applied: 'val x: Float = 3.1415927f'", + "markdown": "Reports floating-point literals that cannot be represented with the required precision using [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) `Float` and `Double` types.\n\n\nFor example, `1.9999999999999999999` has too many significant digits,\nso its representation as a `Double` will be rounded to `2.0`.\nSpecifying excess digits may be misleading as it hides the fact that computations\nuse rounded values instead.\n\n\nThe quick-fix replaces the literal with a rounded value that matches the actual representation\nof the constant.\n\n**Example:**\n\n\n val x: Float = 3.14159265359f\n\nAfter the quick-fix is applied:\n\n\n val x: Float = 3.1415927f\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "PropertyValueSetToItself", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "FloatingPointLiteralPrecision", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/JavaBeans issues", - "index": 141, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -8520,28 +8477,28 @@ ] }, { - "id": "ClassInitializer", + "id": "ConvertPairConstructorToToFunction", "shortDescription": { - "text": "Non-'static' initializer" + "text": "Convert Pair constructor to 'to' function" }, "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." + "text": "Reports a 'Pair' constructor invocation that can be replaced with a 'to()' infix function call. Explicit constructor invocations may add verbosity, especially if they are used multiple times. Replacing constructor calls with 'to()' makes code easier to read and maintain. Example: 'val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )' After the quick-fix is applied: 'val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )'", + "markdown": "Reports a `Pair` constructor invocation that can be replaced with a `to()` infix function call.\n\n\nExplicit constructor invocations may add verbosity, especially if they are used multiple times.\nReplacing constructor calls with `to()` makes code easier to read and maintain.\n\n**Example:**\n\n\n val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )\n\nAfter the quick-fix is applied:\n\n\n val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NonStaticInitializer", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertPairConstructorToToFunction", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8553,28 +8510,28 @@ ] }, { - "id": "ContinueOrBreakFromFinallyBlock", + "id": "RedundantGetter", "shortDescription": { - "text": "'continue' or 'break' inside 'finally' block" + "text": "Redundant property getter" }, "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" + "text": "Reports redundant property getters. Example: 'class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }' After the quick-fix is applied: 'class Test {\n val a = 1\n val b = 1\n }'", + "markdown": "Reports redundant property getters.\n\n**Example:**\n\n\n class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n val a = 1\n val b = 1\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ContinueOrBreakFromFinallyBlock", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantGetter", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8586,28 +8543,28 @@ ] }, { - "id": "LengthOneStringsInConcatenation", + "id": "RedundantIf", "shortDescription": { - "text": "Single character string concatenation" + "text": "Redundant 'if' statement" }, "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" + "text": "Reports 'if' statements which can be simplified to a single statement. Example: 'fun test(): Boolean {\n if (foo()) {\n return true\n } else {\n return false\n }\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return foo()\n }'", + "markdown": "Reports `if` statements which can be simplified to a single statement.\n\n**Example:**\n\n\n fun test(): Boolean {\n if (foo()) {\n return true\n } else {\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): Boolean {\n return foo()\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "SingleCharacterStringConcatenation", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "RedundantIf", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8619,19 +8576,19 @@ ] }, { - "id": "ClassWithTooManyTransitiveDependencies", + "id": "KDocMissingDocumentation", "shortDescription": { - "text": "Class with too many transitive dependencies" + "text": "Missing KDoc comments for public declarations" }, "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." + "text": "Reports public declarations that do not have KDoc comments. Example: 'class A' The quick fix generates the comment block above the declaration: '/**\n *\n */\n class A'", + "markdown": "Reports public declarations that do not have KDoc comments.\n\n**Example:**\n\n\n class A\n\nThe quick fix generates the comment block above the declaration:\n\n\n /**\n *\n */\n class A\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassWithTooManyTransitiveDependencies", + "suppressToolId": "KDocMissingDocumentation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -8639,8 +8596,8 @@ "relationships": [ { "target": { - "id": "Java/Dependency issues", - "index": 146, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -8652,28 +8609,28 @@ ] }, { - "id": "UnnecessaryThis", + "id": "RemoveExplicitTypeArguments", "shortDescription": { - "text": "Unnecessary 'this' qualifier" + "text": "Unnecessary type argument" }, "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." + "text": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted. Use the 'Remove explicit type arguments' quick-fix to clean up the code. Examples: '// 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()' After the quick-fix is applied: 'fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()'", + "markdown": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted.\n\nUse the 'Remove explicit type arguments' quick-fix to clean up the code.\n\n**Examples:**\n\n\n // 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()\n\nAfter the quick-fix is applied:\n\n\n fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryThis", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveExplicitTypeArguments", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8685,19 +8642,19 @@ ] }, { - "id": "LoopWithImplicitTerminationCondition", + "id": "RedundantVisibilityModifier", "shortDescription": { - "text": "Loop with implicit termination condition" + "text": "Redundant visibility modifier" }, "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." + "text": "Reports visibility modifiers that match the default visibility of an element ('public' for most elements, 'protected' for members that override a protected member).", + "markdown": "Reports visibility modifiers that match the default visibility of an element (`public` for most elements, `protected` for members that override a protected member)." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LoopWithImplicitTerminationCondition", + "suppressToolId": "RedundantVisibilityModifier", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -8705,8 +8662,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -8718,19 +8675,19 @@ ] }, { - "id": "ExplicitArrayFilling", + "id": "EnumValuesSoftDeprecateInJava", "shortDescription": { - "text": "Explicit array filling" + "text": "'Enum.values()' is recommended to be replaced by 'Enum.getEntries()' since Kotlin 1.9" }, "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 -1\n x > 0 -> 1\n else -> 0\n }\n }' After the quick-fix is applied: 'fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }'", + "markdown": "Reports `return` expressions (one-liners or `when`) that can be replaced with expression body syntax.\n\nExpression body syntax is recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#functions).\n\n**Convert to expression body** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "IntegerMultiplicationImplicitCastToLong", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UseExpressionBody", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues/Cast", - "index": 139, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8817,19 +8774,19 @@ ] }, { - "id": "ReplaceAssignmentWithOperatorAssignment", + "id": "MapGetWithNotNullAssertionOperator", "shortDescription": { - "text": "Assignment can be replaced with operator assignment" + "text": "'map.get()' with not-null assertion operator (!!)" }, "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." + "text": "Reports 'map.get()!!' that can be replaced with 'map.getValue()', 'map.getOrElse()', and so on. Example: 'fun test(map: Map): String = map.get(0)!!' After the quick-fix is applied: 'fun test(map: Map): String = map.getValue(0)'", + "markdown": "Reports `map.get()!!` that can be replaced with `map.getValue()`, `map.getOrElse()`, and so on.\n\n**Example:**\n\n\n fun test(map: Map): String = map.get(0)!!\n\nAfter the quick-fix is applied:\n\n\n fun test(map: Map): String = map.getValue(0)\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "AssignmentReplaceableWithOperatorAssignment", + "suppressToolId": "MapGetWithNotNullAssertionOperator", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -8837,8 +8794,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8850,28 +8807,28 @@ ] }, { - "id": "ReturnFromFinallyBlock", + "id": "SortModifiers", "shortDescription": { - "text": "'return' inside 'finally' block" + "text": "Non-canonical modifier order" }, "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" + "text": "Reports modifiers that do not follow the order recommended by the style guide. Sort modifiers quick-fix can be used to amend the code automatically. Examples: 'private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"'", + "markdown": "Reports modifiers that do not follow the order recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#modifiers-order).\n\n**Sort modifiers** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ReturnInsideFinallyBlock", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SortModifiers", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8883,28 +8840,28 @@ ] }, { - "id": "RedundantExplicitClose", + "id": "EnumEntryName", "shortDescription": { - "text": "Redundant 'close()'" + "text": "Enum entry naming convention" }, "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" + "text": "Reports enum entry names that do not follow the recommended naming conventions. Example: 'enum class Foo {\n _Foo,\n foo\n }' To fix the problem rename enum entries to match the recommended naming conventions.", + "markdown": "Reports enum entry names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n enum class Foo {\n _Foo,\n foo\n }\n\nTo fix the problem rename enum entries to match the recommended naming conventions." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "RedundantExplicitClose", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "EnumEntryName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -8916,28 +8873,28 @@ ] }, { - "id": "AssertStatement", + "id": "ReplaceSubstringWithDropLast", "shortDescription": { - "text": "'assert' statement" + "text": "'substring' call should be replaced with 'dropLast' call" }, "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. This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", - "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.\n\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + "text": "Reports calls like 's.substring(0, s.length - x)' that can be replaced with 's.dropLast(x)'. Using corresponding functions makes your code simpler. The quick-fix replaces the 'substring' call with 'dropLast'. Example: 'fun foo(s: String) {\n s.substring(0, s.length - 5)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.dropLast(5)\n }'", + "markdown": "Reports calls like `s.substring(0, s.length - x)` that can be replaced with `s.dropLast(x)`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `dropLast`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.length - 5)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.dropLast(5)\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AssertStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceSubstringWithDropLast", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Java language level issues", - "index": 147, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -8949,19 +8906,19 @@ ] }, { - "id": "UnnecessarySemicolon", + "id": "SetterBackingFieldAssignment", "shortDescription": { - "text": "Unnecessary semicolon" + "text": "Existing backing field without assignment" }, "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" + "text": "Reports property setters that don't update the backing field. The quick-fix adds an assignment to the backing field. Example: 'class Test {\n var foo: Int = 1\n set(value) {\n }\n }' After the quick-fix is applied: 'class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }'", + "markdown": "Reports property setters that don't update the backing field.\n\nThe quick-fix adds an assignment to the backing field.\n\n**Example:**\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnnecessarySemicolon", + "suppressToolId": "SetterBackingFieldAssignment", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -8969,8 +8926,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -8982,28 +8939,28 @@ ] }, { - "id": "JavadocBlankLines", + "id": "CopyWithoutNamedArguments", "shortDescription": { - "text": "Blank line should be replaced with

to break lines" + "text": "'copy' method of data class is called without named arguments" }, "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 (

). 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 *

\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 (\\).\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 *

\n * Does absolutely nothing\n */\n void foo() {}\n }\n\nNew in 2022.1" + "text": "Reports calls to a data class' 'copy()' method without named arguments. As all arguments of the 'copy()' function are optional, it might be hard to understand what properties are modified. Providing parameter names explicitly makes code easy to understand without navigating to the 'data class' declaration. Example: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }' The quick-fix provides parameter names to all 'copy()' arguments: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }'", + "markdown": "Reports calls to a data class' `copy()` method without named arguments.\n\n\nAs all arguments of the `copy()` function are optional, it might be hard to understand what properties are modified.\nProviding parameter names explicitly makes code easy to understand without navigating to the `data class` declaration.\n\n**Example:**\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }\n\nThe quick-fix provides parameter names to all `copy()` arguments:\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "JavadocBlankLines", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "CopyWithoutNamedArguments", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9015,28 +8972,28 @@ ] }, { - "id": "TypeParameterExtendsFinalClass", + "id": "RedundantConstructorKeyword", "shortDescription": { - "text": "Type parameter extends 'final' class" + "text": "Redundant 'constructor' keyword" }, "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 list; // Warning: the Integer class is a final class\n }' After the quick-fix is applied: 'void foo() {\n List list;\n }' This inspection depends on the Java feature 'Generics', which is available since Java 5.", - "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 list; // Warning: the Integer class is a final class\n }\n\nAfter the quick-fix is applied:\n\n\n void foo() {\n List list;\n }\n\nThis inspection depends on the Java feature 'Generics', which is available since Java 5." + "text": "Reports a redundant 'constructor' keyword on primary constructors. Example: 'class Foo constructor(x: Int, y: Int)' After the quick-fix is applied: 'class Foo(x: Int, y: Int)'", + "markdown": "Reports a redundant 'constructor' keyword on primary constructors.\n\n**Example:**\n\n\n class Foo constructor(x: Int, y: Int)\n\nAfter the quick-fix is applied:\n\n\n class Foo(x: Int, y: Int)\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "TypeParameterExtendsFinalClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantConstructorKeyword", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -9048,19 +9005,19 @@ ] }, { - "id": "UtilityClassWithPublicConstructor", + "id": "KotlinDeprecation", "shortDescription": { - "text": "Utility class with 'public' constructor" + "text": "Usage of redundant or deprecated syntax or deprecated symbols" }, "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" + "text": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (Code | Code Cleanup). The quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax. It also replaces deprecated symbols with their proposed substitutions.", + "markdown": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (**Code \\| Code Cleanup** ).\n\n\nThe quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax.\n\n\nIt also replaces deprecated symbols with their proposed substitutions." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UtilityClassWithPublicConstructor", + "suppressToolId": "KotlinDeprecation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9068,8 +9025,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -9081,28 +9038,28 @@ ] }, { - "id": "TrivialIf", + "id": "ReplaceSubstringWithTake", "shortDescription": { - "text": "Redundant 'if' statement" + "text": "'substring' call should be replaced with 'take' call" }, "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." + "text": "Reports calls like 's.substring(0, x)' that can be replaced with 's.take(x)'. Using 'take()' makes your code simpler. The quick-fix replaces the 'substring' call with 'take()'. Example: 'fun foo(s: String) {\n s.substring(0, 10)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.take(10)\n }'", + "markdown": "Reports calls like `s.substring(0, x)` that can be replaced with `s.take(x)`.\n\nUsing `take()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `take()`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, 10)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.take(10)\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "RedundantIfStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceSubstringWithTake", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9114,28 +9071,28 @@ ] }, { - "id": "InstanceGuardedByStatic", + "id": "ReplaceRangeToWithRangeUntil", "shortDescription": { - "text": "Instance member guarded by static field" + "text": "'rangeTo' or the '..' call should be replaced with '..<'" }, "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`" + "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to '..<'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with '..<'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0..) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }' The quick-fix wraps call chain into 'asSequence()' and 'toList()': 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()'", + "markdown": "Reports call chain on a `Collection` that should be converted into **Sequence** .\n\nEach `Collection` transforming function (such as `map()` or `filter()`) creates a new\n`Collection` (typically `List` or `Set`) under the hood.\nIn case of multiple consequent calls, and a huge number of items in `Collection`, memory traffic might be significant.\nIn such a case, using `Sequence` is preferred.\n\n**Example:**\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n\nThe quick-fix wraps call chain into `asSequence()` and `toList()`:\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "BooleanMethodIsAlwaysInverted", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertCallChainIntoSequence", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9180,28 +9137,28 @@ ] }, { - "id": "AutoCloseableResource", + "id": "AddOperatorModifier", "shortDescription": { - "text": "AutoCloseable used without 'try'-with-resources" + "text": "Function should have 'operator' modifier" }, "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. This inspection depends on the Java feature 'Try-with-resources', which is available since Java 7.", - "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.\n\nThis inspection depends on the Java feature 'Try-with-resources', which is available since Java 7." + "text": "Reports a function that matches one of the operator conventions but lacks the 'operator' keyword. By adding the 'operator' modifier, you might allow function consumers to write idiomatic Kotlin code. Example: 'class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }' The quick-fix adds the 'operator' modifier keyword: 'class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }'", + "markdown": "Reports a function that matches one of the operator conventions but lacks the `operator` keyword.\n\nBy adding the `operator` modifier, you might allow function consumers to write idiomatic Kotlin code.\n\n**Example:**\n\n\n class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }\n\nThe quick-fix adds the `operator` modifier keyword:\n\n\n class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "resource", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "AddOperatorModifier", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9213,28 +9170,28 @@ ] }, { - "id": "SingleStatementInBlock", + "id": "MayBeConstant", "shortDescription": { - "text": "Code block contains single statement" + "text": "Might be 'const'" }, "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" + "text": "Reports top-level 'val' properties in objects that might be declared as 'const' for better performance and Java interoperability. Example: 'object A {\n val foo = 1\n }' After the quick-fix is applied: 'object A {\n const val foo = 1\n }'", + "markdown": "Reports top-level `val` properties in objects that might be declared as `const` for better performance and Java interoperability.\n\n**Example:**\n\n\n object A {\n val foo = 1\n }\n\nAfter the quick-fix is applied:\n\n\n object A {\n const val foo = 1\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "SingleStatementInBlock", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "MayBeConstant", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9246,28 +9203,28 @@ ] }, { - "id": "TestCaseWithConstructor", + "id": "ReplaceIsEmptyWithIfEmpty", "shortDescription": { - "text": "TestCase with non-trivial constructors" + "text": "'if' condition can be replaced with lambda call" }, "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" + "text": "Reports 'isEmpty', 'isBlank', 'isNotEmpty', or 'isNotBlank' calls in an 'if' statement to assign a default value. The quick-fix replaces the 'if' condition with 'ifEmpty' or 'ifBlank' calls. Example: 'fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }' After the quick-fix is applied: 'fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }' This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.", + "markdown": "Reports `isEmpty`, `isBlank`, `isNotEmpty`, or `isNotBlank` calls in an `if` statement to assign a default value.\n\nThe quick-fix replaces the `if` condition with `ifEmpty` or `ifBlank` calls.\n\n**Example:**\n\n\n fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }\n\nThis inspection only reports if the Kotlin language version of the project or module is 1.3 or higher." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "JUnitTestCaseWithNonTrivialConstructors", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceIsEmptyWithIfEmpty", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "JVM languages/Test frameworks", - "index": 123, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9279,28 +9236,28 @@ ] }, { - "id": "ReadObjectAndWriteObjectPrivate", + "id": "ReplaceWithImportAlias", "shortDescription": { - "text": "'readObject()' or 'writeObject()' not declared 'private'" + "text": "Fully qualified name can be replaced with existing import alias" }, "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" + "text": "Reports fully qualified names that can be replaced with an existing import alias. Example: 'import foo.Foo as Bar\nfun main() {\n foo.Foo()\n}' After the quick-fix is applied: 'import foo.Foo as Bar\nfun main() {\n Bar()\n}'", + "markdown": "Reports fully qualified names that can be replaced with an existing import alias.\n\n**Example:**\n\n\n import foo.Foo as Bar\n fun main() {\n foo.Foo()\n }\n\nAfter the quick-fix is applied:\n\n\n import foo.Foo as Bar\n fun main() {\n Bar()\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NonPrivateSerializationMethod", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" - } + "suppressToolId": "ReplaceWithImportAlias", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" + } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9312,28 +9269,28 @@ ] }, { - "id": "RedundantFileCreation", + "id": "SimplifyBooleanWithConstants", "shortDescription": { - "text": "Redundant 'File' instance creation" + "text": "Boolean expression can be simplified" }, "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" + "text": "Reports boolean expression parts that can be reduced to constants. The quick-fix simplifies the condition. Example: 'fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }' After the quick-fix is applied: 'fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }'", + "markdown": "Reports boolean expression parts that can be reduced to constants.\n\nThe quick-fix simplifies the condition.\n\n**Example:**\n\n\n fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "RedundantFileCreation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SimplifyBooleanWithConstants", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9345,28 +9302,28 @@ ] }, { - "id": "PointlessBooleanExpression", + "id": "OverrideDeprecatedMigration", "shortDescription": { - "text": "Pointless boolean expression" + "text": "Do not propagate method deprecation through overrides since 1.9" }, "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." + "text": "Reports a declarations that are propagated by '@Deprecated' annotation that will lead to compilation error since 1.9. Motivation types: Implementation changes are required for implementation design/architectural reasons Inconsistency in the design (things are done differently in different contexts) More details: KT-47902: Do not propagate method deprecation through overrides The quick-fix copies '@Deprecated' annotation from the parent declaration. Example: 'open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n override fun foo() {}\n }' After the quick-fix is applied: 'open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n @Deprecated(\"Don't use\")\n override fun foo() {}\n }' This inspection only reports if the Kotlin language level of the project or module is 1.6 or higher.", + "markdown": "Reports a declarations that are propagated by `@Deprecated` annotation that will lead to compilation error since 1.9.\n\nMotivation types:\n\n* Implementation changes are required for implementation design/architectural reasons\n* Inconsistency in the design (things are done differently in different contexts)\n\n**More details:** [KT-47902: Do not propagate method deprecation through overrides](https://youtrack.jetbrains.com/issue/KT-47902)\n\nThe quick-fix copies `@Deprecated` annotation from the parent declaration.\n\n**Example:**\n\n\n open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n override fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n @Deprecated(\"Don't use\")\n override fun foo() {}\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.6 or higher." }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "error", "parameters": { - "suppressToolId": "PointlessBooleanExpression", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "OverrideDeprecatedMigration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -9378,19 +9335,19 @@ ] }, { - "id": "ListenerMayUseAdapter", + "id": "RedundantModalityModifier", "shortDescription": { - "text": "Class may extend adapter instead of implementing listener" + "text": "Redundant modality modifier" }, "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." + "text": "Reports the modality modifiers that match the default modality of an element ('final' for most elements, 'open' for members with an 'override'). Example: 'final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }' After the quick-fix is applied: 'class Foo\n\n open class Bar : Comparable {\n override fun compareTo(other: Bar): Int = 0\n }'", + "markdown": "Reports the modality modifiers that match the default modality of an element (`final` for most elements, `open` for members with an `override`).\n\n**Example:**\n\n\n final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo\n\n open class Bar : Comparable {\n override fun compareTo(other: Bar): Int = 0\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ListenerMayUseAdapter", + "suppressToolId": "RedundantModalityModifier", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9398,8 +9355,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -9411,28 +9368,28 @@ ] }, { - "id": "ExpressionComparedToItself", + "id": "SimplifyAssertNotNull", "shortDescription": { - "text": "Expression is compared to itself" + "text": "'assert' call can be replaced with '!!' or '?:'" }, "fullDescription": { - "text": "Reports comparisons where left and right operand represent the identical expression. While sometimes comparison of an expression with itself could be intended, in most cases they are the result of an oversight. Example: '// Probably left.getLength() == right.getLength() was intended\n boolean result = left.getLength() == left.getLength();' To ignore comparisons that may produce side effects, use the Ignore conditions with side effects option. Disabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations. Example: 'native int unknownMethod();\n \n ...\n \n if (unknownMethod() > unknownMethod()) {\n System.out.println(\"Got it\");\n }' Due to possible side effects of 'unknownMethod()' (on the example), the warning will only be triggered if the Ignore conditions with side effects option is disabled. New in 2024.2", - "markdown": "Reports comparisons where left and right operand represent the identical expression. While sometimes comparison of an expression with itself could be intended, in most cases they are the result of an oversight.\n\nExample:\n\n\n // Probably left.getLength() == right.getLength() was intended\n boolean result = left.getLength() == left.getLength();\n\n\nTo ignore comparisons that may produce side effects, use the **Ignore conditions with side effects** option.\nDisabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations.\n\nExample:\n\n\n native int unknownMethod();\n \n ...\n \n if (unknownMethod() > unknownMethod()) {\n System.out.println(\"Got it\");\n }\n\nDue to possible side effects of `unknownMethod()` (on the example), the warning will only be\ntriggered if the **Ignore conditions with side effects** option is disabled.\n\nNew in 2024.2" + "text": "Reports 'assert' calls that check a not null value of the declared variable. Using '!!' or '?:' makes your code simpler. The quick-fix replaces 'assert' with '!!' or '?:' operator in the variable initializer. Example: 'fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }' After the quick-fix is applied: 'fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }'", + "markdown": "Reports `assert` calls that check a not null value of the declared variable.\n\nUsing `!!` or `?:` makes your code simpler.\n\nThe quick-fix replaces `assert` with `!!` or `?:` operator in the variable initializer.\n\n**Example:**\n\n\n fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ExpressionComparedToItself", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SimplifyAssertNotNull", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9444,19 +9401,19 @@ ] }, { - "id": "RefusedBequest", + "id": "ConvertNaNEquality", "shortDescription": { - "text": "Method does not call super method" + "text": "Convert equality check with 'NaN' to 'isNaN' call" }, "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." + "text": "Reports an equality check with 'Float.NaN' or 'Double.NaN' that should be replaced with an 'isNaN()' check. According to IEEE 754, equality check against NaN always returns 'false', even for 'NaN == NaN'. Therefore, such a check is likely to be a mistake. The quick-fix replaces comparison with 'isNaN()' check that uses a different comparison technique and handles 'NaN' values correctly. Example: 'fun check(value: Double): Boolean {\n return Double.NaN == value\n }' After the fix is applied: 'fun check(value: Double): Boolean {\n return value.isNaN()\n }'", + "markdown": "Reports an equality check with `Float.NaN` or `Double.NaN` that should be replaced with an `isNaN()` check.\n\n\nAccording to IEEE 754, equality check against NaN always returns `false`, even for `NaN == NaN`.\nTherefore, such a check is likely to be a mistake.\n\nThe quick-fix replaces comparison with `isNaN()` check that uses a different comparison technique and handles `NaN` values correctly.\n\n**Example:**\n\n\n fun check(value: Double): Boolean {\n return Double.NaN == value\n }\n\nAfter the fix is applied:\n\n\n fun check(value: Double): Boolean {\n return value.isNaN()\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MethodDoesntCallSuperMethod", + "suppressToolId": "ConvertNaNEquality", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9464,8 +9421,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -9477,28 +9434,28 @@ ] }, { - "id": "UnnecessaryReturn", + "id": "ReplaceManualRangeWithIndicesCalls", "shortDescription": { - "text": "Unnecessary 'return' statement" + "text": "Range can be converted to indices or iteration" }, "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." + "text": "Reports 'until' and 'rangeTo' operators that can be replaced with 'Collection.indices' or iteration over collection inside 'for' loop. Using syntactic sugar makes your code simpler. The quick-fix replaces the manual range with the corresponding construction. Example: 'fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }'", + "markdown": "Reports `until` and `rangeTo` operators that can be replaced with `Collection.indices` or iteration over collection inside `for` loop.\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces the manual range with the corresponding construction.\n\n**Example:**\n\n\n fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryReturnStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceManualRangeWithIndicesCalls", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9510,19 +9467,19 @@ ] }, { - "id": "PublicInnerClass", + "id": "KotlinLoggerInitializedWithForeignClass", "shortDescription": { - "text": "'public' nested class" + "text": "Logger initialized with foreign 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." + "text": "Reports 'Logger' instances initialized with a class literal other than the class the 'Logger' resides in. This can happen when copy-pasting from another class. It may result in logging events under an unexpected category and incorrect filtering. Use the inspection options to specify the logger factory classes and methods recognized by this inspection. Example: 'class AnotherService\nclass MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n}' After the quick-fix is applied: 'class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n}'", + "markdown": "Reports `Logger` instances initialized with a class literal other than the class the `Logger` resides in.\n\n\nThis can happen when copy-pasting from another class.\nIt may result in logging events under an unexpected category and incorrect filtering.\n\n\nUse the inspection options to specify the logger factory classes and methods recognized by this inspection.\n\n**Example:**\n\n\n class AnotherService\n class MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PublicInnerClass", + "suppressToolId": "KotlinLoggerInitializedWithForeignClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9530,8 +9487,8 @@ "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Kotlin/Logging", + "index": 203, "toolComponent": { "name": "QDJVM" } @@ -9543,28 +9500,28 @@ ] }, { - "id": "NonFinalGuard", + "id": "RedundantAsSequence", "shortDescription": { - "text": "Non-final '@GuardedBy' field" + "text": "Redundant 'asSequence' call" }, "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`" + "text": "Reports redundant 'asSequence()' call that can never have a positive performance effect. 'asSequence()' speeds up collection processing that includes multiple operations because it performs operations lazily and doesn't create intermediate collections. However, if a terminal operation (such as 'toList()') is used right after 'asSequence()', this doesn't give you any positive performance effect. Example: 'fun test(list: List) {\n list.asSequence().last()\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.last()\n }'", + "markdown": "Reports redundant `asSequence()` call that can never have a positive performance effect.\n\n\n`asSequence()` speeds up collection processing that includes multiple operations because it performs operations lazily\nand doesn't create intermediate collections.\n\n\nHowever, if a terminal operation (such as `toList()`) is used right after `asSequence()`, this doesn't give\nyou any positive performance effect.\n\n**Example:**\n\n\n fun test(list: List) {\n list.asSequence().last()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.last()\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NonFinalGuard", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantAsSequence", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Concurrency annotation issues", - "index": 100, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9576,32 +9533,28 @@ ] }, { - "id": "CollectionAddedToSelf", + "id": "RemoveToStringInStringTemplate", "shortDescription": { - "text": "Collection added to itself" + "text": "Redundant call to 'toString()' in string template" }, "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" + "text": "Reports calls to 'toString()' in string templates that can be safely removed. Example: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }'", + "markdown": "Reports calls to `toString()` in string templates that can be safely removed.\n\n**Example:**\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }\n\nAfter the quick-fix is applied:\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "CollectionAddedToSelf", - "cweIds": [ - 664, - 688 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveToStringInStringTemplate", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -9613,19 +9566,19 @@ ] }, { - "id": "UnnecessarySuperQualifier", + "id": "KotlinUnusedImport", "shortDescription": { - "text": "Unnecessary 'super' qualifier" + "text": "Unused import directive" }, "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*" + "text": "Reports redundant 'import' statements. Default and unused imports can be safely removed. Example: 'import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }'", + "markdown": "Reports redundant `import` statements.\n\nDefault and unused imports can be safely removed.\n\n**Example:**\n\n\n import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessarySuperQualifier", + "suppressToolId": "UnusedImport", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9633,8 +9586,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -9646,19 +9599,19 @@ ] }, { - "id": "EqualsOnSuspiciousObject", + "id": "CanBePrimaryConstructorProperty", "shortDescription": { - "text": "'equals()' called on classes which don't override it" + "text": "Property is explicitly assigned to constructor parameter" }, "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" + "text": "Reports properties that are explicitly assigned to primary constructor parameters. Properties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability. Example: 'class User(name: String) {\n val name = name\n }' The quick-fix joins the parameter and property declaration into a primary constructor parameter: 'class User(val name: String) {\n }'", + "markdown": "Reports properties that are explicitly assigned to primary constructor parameters.\n\nProperties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability.\n\n**Example:**\n\n\n class User(name: String) {\n val name = name\n }\n\nThe quick-fix joins the parameter and property declaration into a primary constructor parameter:\n\n\n class User(val name: String) {\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EqualsOnSuspiciousObject", + "suppressToolId": "CanBePrimaryConstructorProperty", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9666,8 +9619,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -9679,28 +9632,28 @@ ] }, { - "id": "UseOfPropertiesAsHashtable", + "id": "JavaMapForEach", "shortDescription": { - "text": "Use of 'Properties' object as a 'Hashtable'" + "text": "Java Map.forEach method call should be replaced with Kotlin's forEach" }, "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" + "text": "Reports a Java Map.'forEach' method call that can be replaced with Kotlin's forEach. Example: 'fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}' The quick-fix adds parentheses: 'fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}'", + "markdown": "Reports a Java Map.`forEach` method call that can be replaced with Kotlin's **forEach** .\n\n**Example:**\n\n\n fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n\nThe quick-fix adds parentheses:\n\n\n fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UseOfPropertiesAsHashtable", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "JavaMapForEach", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9712,28 +9665,28 @@ ] }, { - "id": "MethodCoupling", + "id": "RedundantObjectTypeCheck", "shortDescription": { - "text": "Overly coupled method" + "text": "Non-idiomatic 'is' type check for an object" }, "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." + "text": "Reports non-idiomatic 'is' type checks for an object. It's recommended to replace such checks with reference comparison. Example: 'object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }' After the quick-fix is applied: 'object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }'", + "markdown": "Reports non-idiomatic `is` type checks for an object.\n\nIt's recommended to replace such checks with reference comparison.\n\n**Example:**\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }\n\nAfter the quick-fix is applied:\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OverlyCoupledMethod", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantObjectTypeCheck", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9745,19 +9698,19 @@ ] }, { - "id": "AccessToStaticFieldLockedOnInstance", + "id": "SuspendFunctionOnCoroutineScope", "shortDescription": { - "text": "Access to 'static' field locked on instance data" + "text": "Ambiguous coroutineContext due to CoroutineScope receiver of suspend function" }, "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." + "text": "Reports calls and accesses of 'CoroutineScope' extensions or members inside suspend functions with 'CoroutineScope' receiver. When a function is 'suspend' and has 'CoroutineScope' receiver, it has ambiguous access to 'CoroutineContext' via 'kotlin.coroutines.coroutineContext' and via 'CoroutineScope.coroutineContext', and two these contexts are different in general. To improve this situation, one can wrap suspicious call inside 'coroutineScope { ... }' or get rid of 'CoroutineScope' function receiver.", + "markdown": "Reports calls and accesses of `CoroutineScope` extensions or members inside suspend functions with `CoroutineScope` receiver.\n\nWhen a function is `suspend` and has `CoroutineScope` receiver,\nit has ambiguous access to `CoroutineContext` via `kotlin.coroutines.coroutineContext` and via `CoroutineScope.coroutineContext`,\nand two these contexts are different in general.\n\n\nTo improve this situation, one can wrap suspicious call inside `coroutineScope { ... }` or\nget rid of `CoroutineScope` function receiver." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AccessToStaticFieldLockedOnInstance", + "suppressToolId": "SuspendFunctionOnCoroutineScope", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9765,8 +9718,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -9778,28 +9731,28 @@ ] }, { - "id": "VariableTypeCanBeExplicit", + "id": "DifferentMavenStdlibVersion", "shortDescription": { - "text": "Variable type can be explicit" + "text": "Library and maven plugin versions are different" }, "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\";' This inspection depends on the Java feature 'Local variable type inference', which is available since Java 10.", - "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\nThis inspection depends on the Java feature 'Local variable type inference', which is available since Java 10." + "text": "Reports different Kotlin stdlib and compiler versions. Using different versions of the Kotlin compiler and the standard library can lead to unpredictable runtime problems and should be avoided.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\nUsing different versions of the Kotlin compiler and the standard library can lead to unpredictable\nruntime problems and should be avoided." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "VariableTypeCanBeExplicit", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "DifferentMavenStdlibVersion", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 10", - "index": 160, + "id": "Kotlin", + "index": 1, "toolComponent": { "name": "QDJVM" } @@ -9811,28 +9764,28 @@ ] }, { - "id": "Java8ListSort", + "id": "ImplicitNullableNothingType", "shortDescription": { - "text": "'Collections.sort()' can be replaced with 'List.sort()'" + "text": "Implicit 'Nothing?' type" }, "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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8.", - "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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8." + "text": "Reports variables and functions with the implicit Nothing? type. Example: 'fun foo() = null' The quick fix specifies the return type explicitly: 'fun foo(): Nothing? = null'", + "markdown": "Reports variables and functions with the implicit **Nothing?** type.\n\n**Example:**\n\n\n fun foo() = null\n\nThe quick fix specifies the return type explicitly:\n\n\n fun foo(): Nothing? = null\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "Java8ListSort", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ImplicitNullableNothingType", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -9844,28 +9797,28 @@ ] }, { - "id": "ComparatorCombinators", + "id": "ReplaceAssociateFunction", "shortDescription": { - "text": "'Comparator' combinator can be used" + "text": "'associate' can be replaced with 'associateBy' or 'associateWith'" }, "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));' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "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\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "text": "Reports calls to 'associate()' and 'associateTo()' that can be replaced with 'associateBy()' or 'associateWith()'. Both functions accept a transformer function applied to elements of a given sequence or collection (as a receiver). The pairs are then used to build the resulting 'Map'. Given the transformer refers to 'it', the 'associate[To]()' call can be replaced with more performant 'associateBy()' or 'associateWith()'. Examples: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }' After the quick-fix is applied: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }'", + "markdown": "Reports calls to `associate()` and `associateTo()` that can be replaced with `associateBy()` or `associateWith()`.\n\n\nBoth functions accept a transformer function applied to elements of a given sequence or collection (as a receiver).\nThe pairs are then used to build the resulting `Map`.\n\n\nGiven the transformer refers to `it`, the `associate[To]()` call can be replaced with more performant `associateBy()`\nor `associateWith()`.\n\n**Examples:**\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }\n\nAfter the quick-fix is applied:\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ComparatorCombinators", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceAssociateFunction", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9877,28 +9830,28 @@ ] }, { - "id": "EqualsReplaceableByObjectsCall", + "id": "ObsoleteExperimentalCoroutines", "shortDescription": { - "text": "'equals()' expression replaceable by 'Objects.equals()' expression" + "text": "Experimental coroutines usages are deprecated since 1.3" }, "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 depends on the Java feature 'java.util.Objects API', which is available since Java 7.", - "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 depends on the Java feature 'java.util.Objects API', which is available since Java 7." + "text": "Reports code that uses experimental coroutines. Such usages are incompatible with Kotlin 1.3+ and should be updated.", + "markdown": "Reports code that uses experimental coroutines.\n\nSuch usages are incompatible with Kotlin 1.3+ and should be updated." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "error", "parameters": { - "suppressToolId": "EqualsReplaceableByObjectsCall", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ObsoleteExperimentalCoroutines", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 7", - "index": 161, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -9910,28 +9863,28 @@ ] }, { - "id": "AbstractMethodCallInConstructor", + "id": "LiftReturnOrAssignment", "shortDescription": { - "text": "Abstract method called during object construction" + "text": "Return or assignment can be lifted out" }, "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." + "text": "Reports 'if', 'when', and 'try' statements that can be converted to expressions by lifting the 'return' statement or an assignment out. Example: 'fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }' After the quick-fix is applied: 'fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }' If you would like this inspection to highlight more complex code with multi-statement branches, uncheck the option \"Report only if each branch is a single statement\".", + "markdown": "Reports `if`, `when`, and `try` statements that can be converted to expressions by lifting the `return` statement or an assignment out.\n\n**Example:**\n\n\n fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }\n\nIf you would like this inspection to highlight more complex code with multi-statement branches, uncheck the option \"Report only if each branch is a single statement\"." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AbstractMethodCallInConstructor", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LiftReturnOrAssignment", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -9943,28 +9896,28 @@ ] }, { - "id": "TailRecursion", + "id": "SimplifyWhenWithBooleanConstantCondition", "shortDescription": { - "text": "Tail recursion" + "text": "Simplifiable 'when'" }, "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" + "text": "Reports 'when' expressions with the constant 'true' or 'false' branches. Simplify \"when\" quick-fix can be used to amend the code automatically. Examples: 'fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }'", + "markdown": "Reports `when` expressions with the constant `true` or `false` branches.\n\n**Simplify \"when\"** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "TailRecursion", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "SimplifyWhenWithBooleanConstantCondition", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -9976,19 +9929,19 @@ ] }, { - "id": "StringEqualsEmptyString", + "id": "KotlinConstantConditions", "shortDescription": { - "text": "'String.equals()' can be replaced with 'String.isEmpty()'" + "text": "Constant conditions" }, "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." + "text": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable 'when' branches and some expressions that are statically known to fail always. Examples: 'fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n}\nfun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n}' Uncheck the \"Warn when constant is stored in variable\" option to avoid reporting of variables having constant values not in conditions. New in 2021.3", + "markdown": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable `when` branches and some expressions that are statically known to fail always.\n\nExamples:\n\n\n fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n }\n fun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n }\n\n\nUncheck the \"Warn when constant is stored in variable\" option to avoid reporting of variables having constant values not in conditions.\n\nNew in 2021.3" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "StringEqualsEmptyString", + "suppressToolId": "KotlinConstantConditions", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -9996,8 +9949,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -10009,28 +9962,28 @@ ] }, { - "id": "PreviewFeature", + "id": "ForEachParameterNotUsed", "shortDescription": { - "text": "Preview Feature warning" + "text": "Iterated elements are not used in forEach" }, "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" + "text": "Reports 'forEach' loops that do not use iterable values. Example: 'listOf(1, 2, 3).forEach { }' The quick fix introduces anonymous parameter in the 'forEach' section: 'listOf(1, 2, 3).forEach { _ -> }'", + "markdown": "Reports `forEach` loops that do not use iterable values.\n\n**Example:**\n\n\n listOf(1, 2, 3).forEach { }\n\nThe quick fix introduces anonymous parameter in the `forEach` section:\n\n\n listOf(1, 2, 3).forEach { _ -> }\n" }, "defaultConfiguration": { "enabled": true, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "preview", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ForEachParameterNotUsed", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Compiler issues", - "index": 162, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -10042,19 +9995,19 @@ ] }, { - "id": "TooBroadThrows", + "id": "LeakingThis", "shortDescription": { - "text": "Overly broad 'throws' clause" + "text": "Leaking 'this' in constructor" }, "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." + "text": "Reports unsafe operations with 'this' during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using 'this' as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out. Example: 'abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }'", + "markdown": "Reports unsafe operations with `this` during object construction including:\n\n* Accessing a non-final property during class initialization: from a constructor or property initialization\n* Calling a non-final function during class initialization\n* Using `this` as a function argument in a constructor of a non-final class\n\n\nIf other classes inherit from the given class,\nthey may not be fully initialized at the moment when an unsafe operation is carried out.\n\n**Example:**\n\n\n abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "OverlyBroadThrowsClause", + "suppressToolId": "LeakingThis", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10062,8 +10015,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -10075,28 +10028,28 @@ ] }, { - "id": "ImplicitSubclassInspection", + "id": "AddVarianceModifier", "shortDescription": { - "text": "Final declaration can't be overridden at runtime" + "text": "Type parameter can have 'in' or 'out' variance" }, "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." + "text": "Reports type parameters that can have 'in' or 'out' variance. Using 'in' and 'out' variance provides more precise type inference in Kotlin and clearer code semantics. Example: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }' The quick-fix adds the matching variance modifier: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }'", + "markdown": "Reports type parameters that can have `in` or `out` variance.\n\nUsing `in` and `out` variance provides more precise type inference in Kotlin and clearer code semantics.\n\n**Example:**\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }\n\nThe quick-fix adds the matching variance modifier:\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "error", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ImplicitSubclassInspection", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "AddVarianceModifier", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -10108,28 +10061,28 @@ ] }, { - "id": "ObjectEqualsCanBeEquality", + "id": "RemoveForLoopIndices", "shortDescription": { - "text": "'equals()' call can be replaced with '=='" + "text": "Unused loop index" }, "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." + "text": "Reports 'for' loops iterating over a collection using the 'withIndex()' function and not using the index variable. Use the \"Remove indices in 'for' loop\" quick-fix to clean up the code. Examples: 'fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }' After the quick-fix is applied: 'fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }'", + "markdown": "Reports `for` loops iterating over a collection using the `withIndex()` function and not using the index variable.\n\nUse the \"Remove indices in 'for' loop\" quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ObjectEqualsCanBeEquality", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "RemoveForLoopIndices", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -10141,22 +10094,19 @@ ] }, { - "id": "JDBCPrepareStatementWithNonConstantString", + "id": "RedundantSuspendModifier", "shortDescription": { - "text": "Call to 'Connection.prepare*()' with non-constant string" + "text": "Redundant 'suspend' modifier" }, "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" + "text": "Reports 'suspend' modifier as redundant if no other suspending functions are called inside.", + "markdown": "Reports `suspend` modifier as redundant if no other suspending functions are called inside." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JDBCPrepareStatementWithNonConstantString", - "cweIds": [ - 89 - ], + "suppressToolId": "RedundantSuspendModifier", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10164,8 +10114,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -10177,32 +10127,28 @@ ] }, { - "id": "SystemProperties", + "id": "SuspiciousAsDynamic", "shortDescription": { - "text": "Access of system properties" + "text": "Suspicious 'asDynamic' member invocation" }, "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." + "text": "Reports usages of 'asDynamic' function on a receiver of dynamic type. 'asDynamic' function has no effect for expressions of dynamic type. 'asDynamic' function on a receiver of dynamic type can lead to runtime problems because 'asDynamic' will be executed in JavaScript environment, and such function may not be present at runtime. The intended way is to use this function on usual Kotlin type. Remove \"asDynamic\" invocation quick-fix can be used to amend the code automatically. Example: 'fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }'", + "markdown": "Reports usages of `asDynamic` function on a receiver of dynamic type.\n\n`asDynamic` function has no effect for expressions of dynamic type.\n\n`asDynamic` function on a receiver of dynamic type can lead to runtime problems because `asDynamic`\nwill be executed in JavaScript environment, and such function may not be present at runtime.\nThe intended way is to use this function on usual Kotlin type.\n\n**Remove \"asDynamic\" invocation** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AccessOfSystemProperties", - "cweIds": [ - 250, - 668 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SuspiciousAsDynamic", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -10214,28 +10160,28 @@ ] }, { - "id": "InvalidComparatorMethodReference", + "id": "FilterIsInstanceCallWithClassLiteralArgument", "shortDescription": { - "text": "Invalid method reference used for 'Comparator'" + "text": "'filterIsInstance' call with a class literal argument" }, "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 ints = foo();\n ints.sort(Math::min);' After the quick-fix is applied: 'ArrayList 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 ints = foo();\n ints.sort(Math::min);\n\nAfter the quick-fix is applied:\n\n\n ArrayList ints = foo();\n ints.sort(Comparator.reverseOrder());\n" + "text": "Reports calls of the Kotlin standard library function 'filterIsInstance' with a class literal argument. It is more idiomatic to use a version of this function with a reified type parameter, to avoid the '::class.java' syntax. Note: inspection is not reported for generic class literals because the 'Class<*, *>' syntax in the type argument list may be undesirable. Example: 'fun foo(list: List<*>) {\n list.filterIsInstance(Int::class.java)\n }' After the quick-fix is applied: 'fun foo(list: List<*>) {\n list.filterIsInstance()\n }'", + "markdown": "Reports calls of the Kotlin standard library function `filterIsInstance` with a class literal argument. It is more idiomatic to use a version of this function with a reified type parameter, to avoid the `::class.java` syntax.\n\nNote: inspection is not reported for generic class literals because the `Class<*, *>` syntax in the type argument list may be undesirable.\n\nExample:\n\n\n fun foo(list: List<*>) {\n list.filterIsInstance(Int::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List<*>) {\n list.filterIsInstance()\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "InvalidComparatorMethodReference", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "FilterIsInstanceCallWithClassLiteralArgument", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -10247,28 +10193,28 @@ ] }, { - "id": "Java9ModuleExportsPackageToItself", + "id": "FromClosedRangeMigration", "shortDescription": { - "text": "Module exports/opens package to itself" + "text": "MIN_VALUE step in fromClosedRange() since 1.3" }, "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 depends on the Java feature 'Modules', which is available since Java 9.", - "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 depends on the Java feature 'Modules', which is available since Java 9." + "text": "Reports 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. It is prohibited to call 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. All such calls should be checked during migration to Kotlin 1.3+. Example: 'IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)' To fix the problem change the step of the progression.", + "markdown": "Reports `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with `MIN_VALUE` step.\n\n\nIt is prohibited to call `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with\n`MIN_VALUE` step. All such calls should be checked during migration to Kotlin 1.3+.\n\n**Example:**\n\n\n IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)\n\nTo fix the problem change the step of the progression." }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "Java9ModuleExportsPackageToItself", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "FromClosedRangeMigration", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -10280,19 +10226,19 @@ ] }, { - "id": "ToArrayCallWithZeroLengthArrayArgument", + "id": "RemoveRedundantBackticks", "shortDescription": { - "text": "'Collection.toArray()' call style" + "text": "Redundant backticks" }, "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." + "text": "Reports redundant backticks in references. Some of the Kotlin keywords are valid identifiers in Java, for example: 'in', 'object', 'is'. If a Java library uses a Kotlin keyword for a method, you can still call the method escaping it with the backtick character ('`'), for example, 'foo.`is`(bar)'. Sometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is paired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code. Examples: 'fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks'", + "markdown": "Reports redundant backticks in references.\n\n\nSome of the Kotlin keywords are valid identifiers in Java, for example: `in`, `object`, `is`.\nIf a Java library uses a Kotlin keyword for a method, you can still call the method escaping it\nwith the backtick character (`````), for example, ``foo.`is`(bar)``.\nSometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is\npaired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code.\n\n**Examples:**\n\n\n fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ToArrayCallWithZeroLengthArrayArgument", + "suppressToolId": "RemoveRedundantBackticks", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10300,8 +10246,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -10313,19 +10259,19 @@ ] }, { - "id": "LoggerInitializedWithForeignClass", + "id": "ReplaceReadLineWithReadln", "shortDescription": { - "text": "Logger initialized with foreign class" + "text": "'readLine' can be replaced with 'readln' or 'readlnOrNull'" }, "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." + "text": "Reports calls to 'readLine()' that can be replaced with 'readln()' or 'readlnOrNull()'. Using corresponding functions makes your code simpler. The quick-fix replaces 'readLine()!!' with 'readln()' and 'readLine()' with 'readlnOrNull()'. Examples: 'val x = readLine()!!\n val y = readLine()?.length' After the quick-fix is applied: 'val x = readln()\n val y = readlnOrNull()?.length'", + "markdown": "Reports calls to `readLine()` that can be replaced with `readln()` or `readlnOrNull()`.\n\n\nUsing corresponding functions makes your code simpler.\n\n\nThe quick-fix replaces `readLine()!!` with `readln()` and `readLine()` with `readlnOrNull()`.\n\n**Examples:**\n\n\n val x = readLine()!!\n val y = readLine()?.length\n\nAfter the quick-fix is applied:\n\n\n val x = readln()\n val y = readlnOrNull()?.length\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "note", "parameters": { - "suppressToolId": "LoggerInitializedWithForeignClass", + "suppressToolId": "ReplaceReadLineWithReadln", "ideaSeverity": "WEAK WARNING", "qodanaSeverity": "Moderate" } @@ -10333,8 +10279,8 @@ "relationships": [ { "target": { - "id": "Java/Logging", - "index": 119, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -10346,28 +10292,28 @@ ] }, { - "id": "MarkerInterface", + "id": "SimplifyNestedEachInScopeFunction", "shortDescription": { - "text": "Marker interface" + "text": "Scope function with nested forEach can be simplified" }, "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." + "text": "Reports 'forEach' functions in the scope functions such as 'also' or 'apply' that can be simplified. Convert forEach call to onEach quick-fix can be used to amend the code automatically. Examples: 'fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }' After the quick-fix is applied: 'fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }'", + "markdown": "Reports `forEach` functions in the scope functions such as `also` or `apply` that can be simplified.\n\n**Convert forEach call to onEach** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "MarkerInterface", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SimplifyNestedEachInScopeFunction", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -10379,31 +10325,28 @@ ] }, { - "id": "SortedCollectionWithNonComparableKeys", + "id": "UnsafeCastFromDynamic", "shortDescription": { - "text": "Sorted collection with non-comparable elements" + "text": "Implicit (unsafe) cast from dynamic type" }, "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" + "text": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.", + "markdown": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type." }, "defaultConfiguration": { "enabled": true, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SortedCollectionWithNonComparableKeys", - "cweIds": [ - 697 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UnsafeCastFromDynamic", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -10415,19 +10358,19 @@ ] }, { - "id": "CommentedOutCode", + "id": "PublicApiImplicitType", "shortDescription": { - "text": "Commented out code" + "text": "Public API declaration with implicit return type" }, "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" + "text": "Reports 'public' and 'protected' functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly. Example: 'fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()' After the quick-fix is applied: 'fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()'", + "markdown": "Reports `public` and `protected` functions and properties that have an implicit return type.\nFor API stability reasons, it's recommended to specify such types explicitly.\n\n**Example:**\n\n\n fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n\nAfter the quick-fix is applied:\n\n\n fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "CommentedOutCode", + "suppressToolId": "PublicApiImplicitType", "ideaSeverity": "WEAK WARNING", "qodanaSeverity": "Moderate" } @@ -10435,8 +10378,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -10448,19 +10391,19 @@ ] }, { - "id": "ClassWithoutLogger", + "id": "DeclaringClassMigration", "shortDescription": { - "text": "Class without logger" + "text": "Deprecated 'Enum.declaringClass' property" }, "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." + "text": "Reports 'declaringClass' property calls on Enum that will lead to compilation error since 1.9. 'Enum.getDeclaringClass' is among \"hidden\" Java functions which aren't normally visible by resolve. However, it's visible via synthetic property that is a front-end bug. More details: KT-49653 Deprecate and remove Enum.declaringClass synthetic property The quick-fix replaces a call with 'declaringJavaClass'. Example: 'fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringClass)\n }' After the quick-fix is applied: 'fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringJavaClass)\n }' This inspection only reports if the Kotlin language level of the project or module is 1.7 or higher.", + "markdown": "Reports 'declaringClass' property calls on Enum that will lead to compilation error since 1.9.\n\n'Enum.getDeclaringClass' is among \"hidden\" Java functions which aren't normally visible by resolve. However, it's visible via synthetic\nproperty that is a front-end bug.\n\n**More details:** [KT-49653 Deprecate and remove Enum.declaringClass synthetic\nproperty](https://youtrack.jetbrains.com/issue/KT-49653)\n\nThe quick-fix replaces a call with 'declaringJavaClass'.\n\n**Example:**\n\n\n fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringClass)\n }\n\nAfter the quick-fix is applied:\n\n\n fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringJavaClass)\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.7 or higher." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassWithoutLogger", + "suppressToolId": "DeclaringClassMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10468,8 +10411,8 @@ "relationships": [ { "target": { - "id": "Java/Logging", - "index": 119, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -10481,28 +10424,28 @@ ] }, { - "id": "ReturnOfInnerClass", + "id": "ReplaceMapIndexedWithListGenerator", "shortDescription": { - "text": "Return of instance of anonymous, local or inner class" + "text": "Replace 'mapIndexed' with List generator" }, "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." + "text": "Reports a 'mapIndexed' call that can be replaced by 'List' generator. Example: 'val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }' After the quick-fix is applied: 'val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }'", + "markdown": "Reports a `mapIndexed` call that can be replaced by `List` generator.\n\n**Example:**\n\n\n val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }\n\nAfter the quick-fix is applied:\n\n\n val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ReturnOfInnerClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceMapIndexedWithListGenerator", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -10514,19 +10457,19 @@ ] }, { - "id": "AnonymousClassComplexity", + "id": "ControlFlowWithEmptyBody", "shortDescription": { - "text": "Overly complex anonymous class" + "text": "Control flow with empty body" }, "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." + "text": "Reports 'if', 'while', 'do' or 'for' statements with empty bodies. While occasionally intended, this construction is confusing and often the result of a typo. The quick-fix removes a statement. Example: 'if (a > b) {}'", + "markdown": "Reports `if`, `while`, `do` or `for` statements with empty bodies.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo.\n\nThe quick-fix removes a statement.\n\n**Example:**\n\n\n if (a > b) {}\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "OverlyComplexAnonymousInnerClass", + "suppressToolId": "ControlFlowWithEmptyBody", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10534,8 +10477,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -10547,28 +10490,28 @@ ] }, { - "id": "WaitWithoutCorrespondingNotify", + "id": "LoopToCallChain", "shortDescription": { - "text": "'wait()' without corresponding 'notify()'" + "text": "Loop can be replaced with stdlib operations" }, "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" + "text": "Reports 'for' loops that can be replaced with a sequence of stdlib operations (like 'map', 'filter', and so on). Example: 'fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n}' After the quick-fix is applied: 'fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n}'", + "markdown": "Reports `for` loops that can be replaced with a sequence of stdlib operations (like `map`, `filter`, and so on).\n\n**Example:**\n\n\n fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "WaitWithoutCorrespondingNotify", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LoopToCallChain", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -10580,28 +10523,28 @@ ] }, { - "id": "UseOfAWTPeerClass", + "id": "RemoveEmptyClassBody", "shortDescription": { - "text": "Use of AWT peer class" + "text": "Replace empty class body" }, "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" + "text": "Reports declarations of classes and objects with an empty body. Use the 'Remove redundant empty class body' quick-fix to clean up the code. Examples: 'class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }' After the quick fix is applied: 'class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }'", + "markdown": "Reports declarations of classes and objects with an empty body.\n\nUse the 'Remove redundant empty class body' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }\n\nAfter the quick fix is applied:\n\n\n class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UseOfAWTPeerClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveEmptyClassBody", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -10613,28 +10556,28 @@ ] }, { - "id": "RedundantExplicitVariableType", + "id": "CanBeParameter", "shortDescription": { - "text": "Local variable type can be omitted" + "text": "Constructor parameter is never used as a property" }, "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 }' This inspection depends on the Java feature 'Local variable type inference', which is available since Java 10.", - "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\n\nThis inspection depends on the Java feature 'Local variable type inference', which is available since Java 10." + "text": "Reports primary constructor parameters that can have 'val' or 'var' removed. Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them. Note that the referenced object might be garbage-collected earlier. Example: 'class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }' The quick-fix removes the extra 'val' or 'var' keyword: 'class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }'", + "markdown": "Reports primary constructor parameters that can have `val` or `var` removed.\n\n\nClass properties declared in the constructor increase memory consumption.\nIf the parameter value is only used in the constructor, you can omit them.\n\nNote that the referenced object might be garbage-collected earlier.\n\n**Example:**\n\n\n class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n\nThe quick-fix removes the extra `val` or `var` keyword:\n\n\n class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantExplicitVariableType", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CanBeParameter", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 10", - "index": 160, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -10646,28 +10589,28 @@ ] }, { - "id": "SerializableWithUnconstructableAncestor", + "id": "RedundantReturnLabel", "shortDescription": { - "text": "Serializable class with unconstructable ancestor" + "text": "Redundant 'return' label" }, "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" + "text": "Reports redundant return labels outside of lambda expressions. Example: 'fun test() {\n return@test\n }' After the quick-fix is applied: 'fun test() {\n return\n }'", + "markdown": "Reports redundant return labels outside of lambda expressions.\n\n**Example:**\n\n\n fun test() {\n return@test\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SerializableClassWithUnconstructableAncestor", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantReturnLabel", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -10679,28 +10622,28 @@ ] }, { - "id": "ExcessiveLambdaUsage", + "id": "PackageName", "shortDescription": { - "text": "Excessive lambda usage" + "text": "Package naming convention" }, "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)' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8. 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\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.\n\nNew in 2017.1" + "text": "Reports package names that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: names of packages are always lowercase and should not contain underscores. Example: 'org.example.project' Using multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case Example: 'org.example.myProject'", + "markdown": "Reports package names that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): names of packages are always lowercase and should not contain underscores.\n\n**Example:**\n`org.example.project`\n\nUsing multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case\n\n**Example:**\n`org.example.myProject`" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ExcessiveLambdaUsage", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "PackageName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -10712,28 +10655,28 @@ ] }, { - "id": "LambdaBodyCanBeCodeBlock", + "id": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", "shortDescription": { - "text": "Lambda body can be code block" + "text": "Meaningless annotations targets on superclass" }, "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}' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "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\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "text": "Reports meaningless annotation targets on superclasses since Kotlin 1.4. Annotation targets such as '@get:' are meaningless on superclasses and are prohibited. Example: 'interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo' After the quick-fix is applied: 'interface Foo\n\n annotation class Ann\n\n class E : Foo' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports meaningless annotation targets on superclasses since Kotlin 1.4.\n\nAnnotation targets such as `@get:` are meaningless on superclasses and are prohibited.\n\n**Example:**\n\n\n interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo\n\nAfter the quick-fix is applied:\n\n\n interface Foo\n\n annotation class Ann\n\n class E : Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "error", "parameters": { - "suppressToolId": "LambdaBodyCanBeCodeBlock", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -10745,19 +10688,19 @@ ] }, { - "id": "ParameterHidingMemberVariable", + "id": "ReplaceWithEnumMap", "shortDescription": { - "text": "Parameter hides field" + "text": "'HashMap' can be replaced with 'EnumMap'" }, "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." + "text": "Reports 'hashMapOf' function or 'HashMap' constructor calls that can be replaced with an 'EnumMap' constructor call. Using 'EnumMap' constructor makes your code simpler. The quick-fix replaces the function call with the 'EnumMap' constructor call. Example: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()' After the quick-fix is applied: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)'", + "markdown": "Reports `hashMapOf` function or `HashMap` constructor calls that can be replaced with an `EnumMap` constructor call.\n\nUsing `EnumMap` constructor makes your code simpler.\n\nThe quick-fix replaces the function call with the `EnumMap` constructor call.\n\n**Example:**\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()\n\nAfter the quick-fix is applied:\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ParameterHidesMemberVariable", + "suppressToolId": "ReplaceWithEnumMap", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10765,8 +10708,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -10778,19 +10721,19 @@ ] }, { - "id": "CustomSecurityManager", + "id": "EnumValuesSoftDeprecate", "shortDescription": { - "text": "Custom 'SecurityManager'" + "text": "'Enum.values()' is recommended to be replaced by 'Enum.entries' since 1.9" }, "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" + "text": "Reports calls from Kotlin to 'values()' method in enum classes that can be replaced with 'entries' property read. Use of 'Enum.entries' may improve performance of your code. The quick-fix replaces 'values()' with 'entries'. More details: KT-48872 Provide modern and performant replacement for Enum.values() Note: 'entries' property type is different from the return type of 'values()' method ('EnumEntries' which inherits from 'List' instead of 'Array'). Due to this in some cases quick fix inserts extra '.toTypedArray()' conversion to not break the code, but for most common cases replacement will be done without it (e.g. in 'for' loop). Example: 'enum class Version {\n V1, V2\n }\n\n Version.values().forEach { /* .. */ }\n val firstVersion = Version.values()[0]\n functionExpectingArray(Version.values())' After the quick-fix is applied: 'enum class Version {\n V1, V2\n }\n\n Version.entries.forEach { /* .. */ }\n val firstVersion = Version.entries[0]\n functionExpectingArray(Version.entries.toTypedArray())'", + "markdown": "Reports calls from Kotlin to `values()` method in enum classes that can be replaced with `entries` property read.\n\n\nUse of `Enum.entries` may improve performance of your code.\n\n\nThe quick-fix replaces `values()` with `entries`.\n\n\n**More details:** [KT-48872 Provide modern and performant replacement for Enum.values()](https://youtrack.jetbrains.com/issue/KT-48872)\n\n\n**Note:** `entries` property type is different from the return type of `values()` method\n(`EnumEntries` which inherits from `List` instead of `Array`).\nDue to this in some cases quick fix inserts extra `.toTypedArray()` conversion to not break the code, but\nfor most common cases replacement will be done without it (e.g. in `for` loop).\n\n**Example:**\n\n\n enum class Version {\n V1, V2\n }\n\n Version.values().forEach { /* .. */ }\n val firstVersion = Version.values()[0]\n functionExpectingArray(Version.values())\n\nAfter the quick-fix is applied:\n\n\n enum class Version {\n V1, V2\n }\n\n Version.entries.forEach { /* .. */ }\n val firstVersion = Version.entries[0]\n functionExpectingArray(Version.entries.toTypedArray())\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CustomSecurityManager", + "suppressToolId": "EnumValuesSoftDeprecate", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10798,8 +10741,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -10811,28 +10754,28 @@ ] }, { - "id": "TimeToString", + "id": "SuspiciousCollectionReassignment", "shortDescription": { - "text": "Call to 'Time.toString()'" + "text": "Augmented assignment creates a new collection under the hood" }, "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." + "text": "Reports augmented assignment ('+=') expressions on a read-only 'Collection'. Augmented assignment ('+=') expression on a read-only 'Collection' temporarily allocates a new collection, which may hurt performance. Change type to mutable quick-fix can be used to amend the code automatically. Example: 'fun test() {\n var list = listOf(0)\n list += 42 // A new list is allocated here, equivalent to list = list + 42\n }' After the quick-fix is applied: 'fun test() {\n val list = mutableListOf(0)\n list += 42\n }'", + "markdown": "Reports augmented assignment (`+=`) expressions on a read-only `Collection`.\n\nAugmented assignment (`+=`) expression on a read-only `Collection` temporarily allocates a new collection,\nwhich may hurt performance.\n\n**Change type to mutable** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test() {\n var list = listOf(0)\n list += 42 // A new list is allocated here, equivalent to list = list + 42\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n val list = mutableListOf(0)\n list += 42\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "CallToTimeToString", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SuspiciousCollectionReassignment", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -10844,22 +10787,19 @@ ] }, { - "id": "ObjectEquality", + "id": "RedundantNotNullExtensionReceiverOfInline", "shortDescription": { - "text": "Object comparison using '==', instead of 'equals()'" + "text": "'inline fun' extension receiver can be explicitly nullable until Kotlin 1.2" }, "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." + "text": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver. Example: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' After the quick-fix is applied: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nThus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's\nrecommended to make such functions to have nullable receiver.\n\n**Example:**\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ObjectEquality", - "cweIds": [ - 480 - ], + "suppressToolId": "RedundantNotNullExtensionReceiverOfInline", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -10867,8 +10807,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -10880,28 +10820,28 @@ ] }, { - "id": "PatternVariablesCanBeReplacedWithCast", + "id": "RedundantElvisReturnNull", "shortDescription": { - "text": "Using 'instanceof' with patterns" + "text": "Redundant '?: return null'" }, "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" + "text": "Reports redundant '?: return null' Example: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }' After the quick-fix is applied: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }'", + "markdown": "Reports redundant `?: return null`\n\n**Example:**\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "PatternVariablesCanBeReplacedWithCast", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "RedundantElvisReturnNull", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -10913,28 +10853,28 @@ ] }, { - "id": "ManualArrayToCollectionCopy", + "id": "PrivatePropertyName", "shortDescription": { - "text": "Manual array to collection copy" + "text": "Private property naming convention" }, "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 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 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 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 list, String[] arr) {\n Collections.addAll(list, arr);\n }\n" + "text": "Reports private property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, private property names should start with a lowercase letter and use camel case. Optionally, underscore prefix is allowed but only for private properties. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val _My_Cool_Property = \"\"' The quick-fix renames the class according to the Kotlin naming conventions: 'val _myCoolProperty = \"\"'", + "markdown": "Reports private property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nprivate property names should start with a lowercase letter and use camel case.\nOptionally, underscore prefix is allowed but only for **private** properties.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val _My_Cool_Property = \"\"\n\nThe quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val _myCoolProperty = \"\"\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ManualArrayToCollectionCopy", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "PrivatePropertyName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -10946,28 +10886,28 @@ ] }, { - "id": "SwitchLabeledRuleCanBeCodeBlock", + "id": "ObsoleteKotlinJsPackages", "shortDescription": { - "text": "Labeled switch rule can have code block" + "text": "'kotlin.browser' and 'kotlin.dom' packages are deprecated since 1.4" }, "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 };' This inspection depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14. 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\nThis inspection depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14.\n\nNew in 2019.1" + "text": "Reports usages of 'kotlin.dom' and 'kotlin.browser' packages. These packages were moved to 'kotlinx.dom' and 'kotlinx.browser' respectively in Kotlin 1.4+.", + "markdown": "Reports usages of `kotlin.dom` and `kotlin.browser` packages.\n\nThese packages were moved to `kotlinx.dom` and `kotlinx.browser`\nrespectively in Kotlin 1.4+." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "error", "parameters": { - "suppressToolId": "SwitchLabeledRuleCanBeCodeBlock", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ObsoleteKotlinJsPackages", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -10979,19 +10919,19 @@ ] }, { - "id": "JavaReflectionMemberAccess", + "id": "KotlinJvmAnnotationInJava", "shortDescription": { - "text": "Reflective access to non-existent or not visible class member" + "text": "Kotlin JVM annotation in Java" }, "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" + "text": "Reports useless Kotlin JVM annotations in Java code. Example: 'import kotlin.jvm.Volatile;\n\n public class Test {\n @Volatile\n public int i;\n }'", + "markdown": "Reports useless Kotlin JVM annotations in Java code.\n\n**Example:**\n\n\n import kotlin.jvm.Volatile;\n\n public class Test {\n @Volatile\n public int i;\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "JavaReflectionMemberAccess", + "suppressToolId": "KotlinJvmAnnotationInJava", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -10999,8 +10939,8 @@ "relationships": [ { "target": { - "id": "Java/Reflective access", - "index": 131, + "id": "Kotlin/Java interop issues", + "index": 78, "toolComponent": { "name": "QDJVM" } @@ -11012,28 +10952,28 @@ ] }, { - "id": "ObviousNullCheck", + "id": "CascadeIf", "shortDescription": { - "text": "Null-check method is called with obviously non-null argument" + "text": "Cascade 'if' can be replaced with 'when'" }, "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" + "text": "Reports 'if' statements with three or more branches that can be replaced with the 'when' expression. Example: 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }' The quick-fix converts the 'if' expression to 'when': 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }'", + "markdown": "Reports `if` statements with three or more branches that can be replaced with the `when` expression.\n\n**Example:**\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n\nThe quick-fix converts the `if` expression to `when`:\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ObviousNullCheck", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "CascadeIf", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11045,19 +10985,19 @@ ] }, { - "id": "SerialVersionUIDNotStaticFinal", + "id": "EmptyRange", "shortDescription": { - "text": "'serialVersionUID' field not declared 'private static final long'" + "text": "Range with start greater than endInclusive is empty" }, "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" + "text": "Reports ranges that are empty because the 'start' value is greater than the 'endInclusive' value. Example: 'val range = 2..1' The quick-fix changes the '..' operator to 'downTo': 'val range = 2 downTo 1'", + "markdown": "Reports ranges that are empty because the `start` value is greater than the `endInclusive` value.\n\n**Example:**\n\n\n val range = 2..1\n\nThe quick-fix changes the `..` operator to `downTo`:\n\n\n val range = 2 downTo 1\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SerialVersionUIDWithWrongSignature", + "suppressToolId": "EmptyRange", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11065,8 +11005,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11078,19 +11018,19 @@ ] }, { - "id": "InnerClassOnInterface", + "id": "NonExternalClassifierExtendingStateOrProps", "shortDescription": { - "text": "Inner class of interface" + "text": "Non-external classifier extending State or Props" }, "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" + "text": "Reports non-external classifier extending State or Props. Read more in the migration guide.", + "markdown": "Reports non-external classifier extending State or Props. Read more in the [migration guide](https://kotlinlang.org/docs/js-ir-migration.html#convert-js-and-react-related-classes-and-interfaces-to-external-interfaces)." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "InnerClassOfInterface", + "suppressToolId": "NonExternalClassifierExtendingStateOrProps", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11098,8 +11038,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Kotlin/React/Probable bugs", + "index": 207, "toolComponent": { "name": "QDJVM" } @@ -11111,28 +11051,28 @@ ] }, { - "id": "UnusedLabel", + "id": "OptionalExpectation", "shortDescription": { - "text": "Unused label" + "text": "Optionally expected annotation has no actual annotation" }, "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" + "text": "Reports optionally expected annotations without actual annotation in some platform modules. Example: '// common code\n@OptionalExpectation\nexpect annotation class JvmName(val name: String)\n\n@JvmName(name = \"JvmFoo\")\nfun foo() { }\n\n// jvm code\nactual annotation class JvmName(val name: String)' The inspection also reports cases when 'actual annotation class JvmName' is omitted for non-JVM platforms (for example, Native).", + "markdown": "Reports optionally expected annotations without actual annotation in some platform modules.\n\n**Example:**\n\n // common code\n @OptionalExpectation\n expect annotation class JvmName(val name: String)\n\n @JvmName(name = \"JvmFoo\")\n fun foo() { }\n\n // jvm code\n actual annotation class JvmName(val name: String)\n\nThe inspection also reports cases when `actual annotation class JvmName` is omitted for non-JVM platforms (for example, Native)." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnusedLabel", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "OptionalExpectation", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11144,19 +11084,19 @@ ] }, { - "id": "PublicFieldAccessedInSynchronizedContext", + "id": "DestructuringWrongName", "shortDescription": { - "text": "Non-private field accessed in 'synchronized' context" + "text": "Variable in destructuring declaration uses name of a wrong data class property" }, "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" + "text": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class. Example: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }' The quick-fix changes variable's name to match the name of the corresponding class field: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }'", + "markdown": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class.\n\n**Example:**\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }\n\nThe quick-fix changes variable's name to match the name of the corresponding class field:\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NonPrivateFieldAccessedInSynchronizedContext", + "suppressToolId": "DestructuringWrongName", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11164,8 +11104,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11177,28 +11117,28 @@ ] }, { - "id": "ForeachStatement", + "id": "IfThenToSafeAccess", "shortDescription": { - "text": "Enhanced 'for' statement" + "text": "If-Then foldable to '?.'" }, "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 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 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." + "text": "Reports 'if-then' expressions that can be folded into safe-access ('?.') expressions. Example: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }' The quick fix converts the 'if-then' expression into a safe-access ('?.') expression: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }'", + "markdown": "Reports `if-then` expressions that can be folded into safe-access (`?.`) expressions.\n\n**Example:**\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }\n\nThe quick fix converts the `if-then` expression into a safe-access (`?.`) expression:\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ForeachStatement", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "IfThenToSafeAccess", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Java language level issues", - "index": 147, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11210,28 +11150,28 @@ ] }, { - "id": "OptionalUsedAsFieldOrParameterType", + "id": "RestrictReturnStatementTargetMigration", "shortDescription": { - "text": "'Optional' used as field or parameter type" + "text": "Target label does not denote a function since 1.4" }, "fullDescription": { - "text": "Reports any cases in which 'java.util.Optional', '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 name; // Optional field\n\n // Optional parameter\n void setName(Optional name) {\n this.name = name;\n }\n }'", - "markdown": "Reports any cases in which `java.util.Optional`, `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 name; // Optional field\n\n // Optional parameter\n void setName(Optional name) {\n this.name = name;\n }\n }\n" + "text": "Reports labels that don't points to a functions. It's forbidden to declare a target label that does not denote a function. The quick-fix removes the label. Example: 'fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }' After the quick-fix is applied: 'fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }' This inspection only reports if the language level of the project or module is 1.4 or higher.", + "markdown": "Reports labels that don't points to a functions.\n\nIt's forbidden to declare a target label that does not denote a function.\n\nThe quick-fix removes the label.\n\n**Example:**\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }\n\nAfter the quick-fix is applied:\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }\n\nThis inspection only reports if the language level of the project or module is 1.4 or higher." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "OptionalUsedAsFieldOrParameterType", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RestrictReturnStatementTargetMigration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -11243,24 +11183,19 @@ ] }, { - "id": "ReplaceAllDot", + "id": "MigrateDiagnosticSuppression", "shortDescription": { - "text": "Suspicious regex expression argument" + "text": "Diagnostic name should be replaced" }, "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" + "text": "Reports suppressions with old diagnostic names, for example '@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")'. Some of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant. Example: '@Suppress(\"HEADER_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}' After the quick-fix is applied: '@Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}'", + "markdown": "Reports suppressions with old diagnostic names, for example `@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")`.\n\n\nSome of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant.\n\n**Example:**\n\n\n @Suppress(\"HEADER_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n\nAfter the quick-fix is applied:\n\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousRegexArgument", - "cweIds": [ - 20, - 185, - 628 - ], + "suppressToolId": "MigrateDiagnosticSuppression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11268,8 +11203,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Other problems", + "index": 60, "toolComponent": { "name": "QDJVM" } @@ -11281,19 +11216,19 @@ ] }, { - "id": "ForCanBeForeach", + "id": "NonNullableBooleanPropertyInExternalInterface", "shortDescription": { - "text": "'for' loop can be replaced with enhanced for loop" + "text": "External interface contains non-nullable boolean property" }, "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 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 depends on the Java feature 'For-each loops', which is available since Java 5.", - "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 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 depends on the Java feature 'For-each loops', which is available since Java 5." + "text": "Reports non-nullable boolean properties in external interface. Read more in the migration guide.", + "markdown": "Reports non-nullable boolean properties in external interface. Read more in the [migration guide](https://kotlinlang.org/docs/js-ir-migration.html#make-boolean-properties-nullable-in-external-interfaces)." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ForLoopReplaceableByForEach", + "suppressToolId": "NonNullableBooleanPropertyInExternalInterface", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11301,8 +11236,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11314,19 +11249,19 @@ ] }, { - "id": "PackageVisibleField", + "id": "DeferredResultUnused", "shortDescription": { - "text": "Package-visible field" + "text": "'@Deferred' result is unused" }, "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" + "text": "Reports function calls with the 'Deferred' result type if the return value is not used. If the 'Deferred' return value is not used, the call site would not wait to complete this function. Example: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }' The quick-fix provides a variable with the 'Deferred' initializer: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }'", + "markdown": "Reports function calls with the `Deferred` result type if the return value is not used.\n\nIf the `Deferred` return value is not used, the call site would not wait to complete this function.\n\n**Example:**\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }\n\nThe quick-fix provides a variable with the `Deferred` initializer:\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PackageVisibleField", + "suppressToolId": "DeferredResultUnused", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11334,8 +11269,8 @@ "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11347,19 +11282,19 @@ ] }, { - "id": "InstantiationOfUtilityClass", + "id": "SelfReferenceConstructorParameter", "shortDescription": { - "text": "Instantiation of utility class" + "text": "Constructor can never be complete" }, "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." + "text": "Reports constructors with a non-null self-reference parameter. Such constructors never instantiate a class. The quick-fix converts the parameter type to nullable. Example: 'class SelfRef(val ref: SelfRef)' After the quick-fix is applied: 'class SelfRef(val ref: SelfRef?)'", + "markdown": "Reports constructors with a non-null self-reference parameter.\n\nSuch constructors never instantiate a class.\n\nThe quick-fix converts the parameter type to nullable.\n\n**Example:**\n\n\n class SelfRef(val ref: SelfRef)\n\nAfter the quick-fix is applied:\n\n\n class SelfRef(val ref: SelfRef?)\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "InstantiationOfUtilityClass", + "suppressToolId": "SelfReferenceConstructorParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11367,8 +11302,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11380,19 +11315,19 @@ ] }, { - "id": "TrailingWhitespacesInTextBlock", + "id": "MainFunctionReturnUnit", "shortDescription": { - "text": "Trailing whitespace in text block" + "text": "Main function should return 'Unit'" }, "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 depends on the Java feature 'Text block literals', which is available since Java 15. 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 depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2021.1" + "text": "Reports when a main function does not have a return type of 'Unit'. Example: 'fun main() = \"Hello world!\"'", + "markdown": "Reports when a main function does not have a return type of `Unit`.\n\n**Example:**\n`fun main() = \"Hello world!\"`" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "TrailingWhitespacesInTextBlock", + "suppressToolId": "MainFunctionReturnUnit", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11400,8 +11335,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11413,28 +11348,28 @@ ] }, { - "id": "NewClassNamingConvention", + "id": "SuspiciousCallableReferenceInLambda", "shortDescription": { - "text": "Class naming convention" + "text": "Suspicious callable reference used as lambda result" }, "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." + "text": "Reports lambda expressions with one callable reference. It is a common error to replace a lambda with a callable reference without changing curly braces to parentheses. Example: 'listOf(1,2,3).map { it::toString }' After the quick-fix is applied: 'listOf(1,2,3).map(Int::toString)'", + "markdown": "Reports lambda expressions with one callable reference.\n\nIt is a common error to replace a lambda with a callable reference without changing curly braces to parentheses.\n\n**Example:**\n\n listOf(1,2,3).map { it::toString }\n\nAfter the quick-fix is applied:\n\n listOf(1,2,3).map(Int::toString)\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "NewClassNamingConvention", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SuspiciousCallableReferenceInLambda", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Naming conventions/Class", - "index": 80, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11446,19 +11381,19 @@ ] }, { - "id": "UseCompareMethod", + "id": "ConvertSecondaryConstructorToPrimary", "shortDescription": { - "text": "'compare()' method can be used to compare numbers" + "text": "Convert to primary constructor" }, "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" + "text": "Reports a secondary constructor that can be replaced with a more concise primary constructor. Example: 'class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }' The quick-fix converts code automatically: 'class User(val name: String) {\n }'", + "markdown": "Reports a secondary constructor that can be replaced with a more concise primary constructor.\n\n**Example:**\n\n\n class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }\n\nThe quick-fix converts code automatically:\n\n\n class User(val name: String) {\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UseCompareMethod", + "suppressToolId": "ConvertSecondaryConstructorToPrimary", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11466,8 +11401,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids", - "index": 70, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11479,28 +11414,28 @@ ] }, { - "id": "MoveFieldAssignmentToInitializer", + "id": "ReplaceGetOrSet", "shortDescription": { - "text": "Field assignment can be moved to initializer" + "text": "Explicit 'get' or 'set' call" }, "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" + "text": "Reports explicit calls to 'get' or 'set' functions which can be replaced by an indexing operator '[]'. Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the 'operator' modifier: 'operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}' The functions above correspond to the indexing operator. Example: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }' After the quick-fix is applied: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }'", + "markdown": "Reports explicit calls to `get` or `set` functions which can be replaced by an indexing operator `[]`.\n\n\nKotlin allows custom implementations for the predefined set of operators on types.\nTo overload an operator, you can mark the corresponding function with the `operator` modifier:\n\n\n operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}\n \nThe functions above correspond to the indexing operator.\n\n**Example:**\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }\n\nAfter the quick-fix is applied:\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "MoveFieldAssignmentToInitializer", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ReplaceGetOrSet", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11512,32 +11447,28 @@ ] }, { - "id": "StringConcatenationInFormatCall", + "id": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", "shortDescription": { - "text": "String concatenation as argument to 'format()' call" + "text": "Repeated annotation which is not marked as '@Repeatable'" }, "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`." + "text": "Reports the repeated use of a non-'@Repeatable' annotation on property accessors. As a result of using non-'@Repeatable' annotation multiple times, both annotation usages will appear in the bytecode leading to an ambiguity in reflection calls. Since Kotlin 1.4 it's mandatory to either mark annotation as '@Repeatable' or not repeat the annotation, otherwise it will lead to compilation error. Example: 'annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports the repeated use of a non-`@Repeatable` annotation on property accessors.\n\n\nAs a result of using non-`@Repeatable` annotation multiple times, both annotation usages\nwill appear in the bytecode leading to an ambiguity in reflection calls.\n\n\nSince Kotlin 1.4 it's mandatory to either mark annotation as `@Repeatable` or not\nrepeat the annotation, otherwise it will lead to compilation error.\n\n**Example:**\n\n\n annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "StringConcatenationInFormatCall", - "cweIds": [ - 116, - 134 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Migration", + "index": 16, "toolComponent": { "name": "QDJVM" } @@ -11549,28 +11480,28 @@ ] }, { - "id": "WaitWhileHoldingTwoLocks", + "id": "Destructure", "shortDescription": { - "text": "'wait()' while holding two locks" + "text": "Use destructuring declaration" }, "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" + "text": "Reports declarations that can be destructured. Example: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }' The quick-fix destructures the declaration and introduces new variables with names from the corresponding class: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }'", + "markdown": "Reports declarations that can be destructured.\n\n**Example:**\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }\n\nThe quick-fix destructures the declaration and introduces new variables with names from the corresponding class:\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "WaitWhileHoldingTwoLocks", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "Destructure", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11582,19 +11513,19 @@ ] }, { - "id": "SerializableInnerClassWithNonSerializableOuterClass", + "id": "UnusedReceiverParameter", "shortDescription": { - "text": "Serializable non-'static' inner class with non-Serializable outer class" + "text": "Unused receiver parameter" }, "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." + "text": "Reports receiver parameter of extension functions and properties that is not used. Remove redundant receiver parameter can be used to amend the code automatically.", + "markdown": "Reports receiver parameter of extension functions and properties that is not used.\n\n**Remove redundant receiver parameter** can be used to amend the code automatically." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SerializableInnerClassWithNonSerializableOuterClass", + "suppressToolId": "UnusedReceiverParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11602,8 +11533,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -11615,31 +11546,28 @@ ] }, { - "id": "SuspiciousListRemoveInLoop", + "id": "ConvertTryFinallyToUseCall", "shortDescription": { - "text": "Suspicious 'List.remove()' in loop" + "text": "Convert try / finally to use() call" }, "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 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 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" + "text": "Reports a 'try-finally' block with 'resource.close()' in 'finally' which can be converted to a 'resource.use()' call. 'use()' is easier to read and less error-prone as there is no need in explicit 'close()' call. Example: 'fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }' After the quick-fix applied: 'fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }'", + "markdown": "Reports a `try-finally` block with `resource.close()` in `finally` which can be converted to a `resource.use()` call.\n\n`use()` is easier to read and less error-prone as there is no need in explicit `close()` call.\n\n**Example:**\n\n\n fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }\n\nAfter the quick-fix applied:\n\n\n fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "SuspiciousListRemoveInLoop", - "cweIds": [ - 129 - ], - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConvertTryFinallyToUseCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11651,28 +11579,28 @@ ] }, { - "id": "NegativeIntConstantInLongContext", + "id": "KotlinRedundantOverride", "shortDescription": { - "text": "Negative int hexadecimal constant in long context" + "text": "Redundant overriding method" }, "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" + "text": "Reports redundant overriding declarations. An override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility. Example: 'open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }' After the quick-fix is applied: 'class Bar : Foo() {\n }'", + "markdown": "Reports redundant overriding declarations.\n\n\nAn override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility.\n\n**Example:**\n\n\n open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }\n\nAfter the quick-fix is applied:\n\n\n class Bar : Foo() {\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "NegativeIntConstantInLongContext", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantOverride", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -11684,19 +11612,19 @@ ] }, { - "id": "WhileLoopSpinsOnField", + "id": "RunBlocking", "shortDescription": { - "text": "'while' loop spins on field" + "text": "RunBlocking in coroutine" }, "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." + "text": "Reports runBlocking builders that can be reached from coroutines. Coroutines share threads for execution. When a runBlocking builder is called from a coroutine it blocks the underlying thread and prevents other coroutines from using this resource. This can result in performance issues and in bad cases thread starvation. It provides a potential callstack from coroutine primitive (suspend function or builder) to runBlocking builder. Example: 'suspend fun main() {\n foo() \n }\n\n fun foo() {\n runBlocking { suspendFunction() }\n }' Potential solution: 'suspend fun main() {\n foo() \n }\n\n suspend fun foo() {\n suspendFunction()\n }' Use the explore functions with overrides option to configure analysis for virtual functions: Use the No option to skip analysis for a function with overrides. Use the Yes, excluding overrides option to only explore the function in the defined callee type. Use the Yes, including overrides option to explore the function and all overrides.", + "markdown": "Reports runBlocking builders that can be reached from coroutines.\n\nCoroutines share threads for execution. When a runBlocking builder is called from a coroutine it blocks the underlying thread and prevents other coroutines from using this resource. This can result in performance issues and in bad cases thread starvation.\n\nIt provides a potential callstack from coroutine primitive (suspend function or builder) to runBlocking builder.\n\nExample:\n\n\n suspend fun main() {\n foo() \n }\n\n fun foo() {\n runBlocking { suspendFunction() }\n }\n\nPotential solution:\n\n\n suspend fun main() {\n foo() \n }\n\n suspend fun foo() {\n suspendFunction()\n }\n\nUse the **explore functions with overrides** option to configure analysis for virtual functions:\n\n* Use the **No** option to skip analysis for a function with overrides.\n* Use the **Yes, excluding overrides** option to only explore the function in the defined callee type.\n* Use the **Yes, including overrides** option to explore the function and all overrides." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "WhileLoopSpinsOnField", + "suppressToolId": "RunBlocking", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11704,8 +11632,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Coroutine inspections", + "index": 209, "toolComponent": { "name": "QDJVM" } @@ -11717,28 +11645,28 @@ ] }, { - "id": "DefaultAnnotationParam", + "id": "ReplaceArrayOfWithLiteral", "shortDescription": { - "text": "Default annotation parameter value" + "text": "'arrayOf' call can be replaced with array literal [...]" }, "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" + "text": "Reports 'arrayOf' calls that can be replaced with array literals '[...]'. Examples: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass' After the quick-fix is applied: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass'", + "markdown": "Reports `arrayOf` calls that can be replaced with array literals `[...]`.\n\n**Examples:**\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass\n\nAfter the quick-fix is applied:\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "DefaultAnnotationParam", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceArrayOfWithLiteral", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11750,28 +11678,28 @@ ] }, { - "id": "SynchronizeOnLock", + "id": "ReplaceToWithInfixForm", "shortDescription": { - "text": "Synchronization on a 'Lock' object" + "text": "'to' call should be replaced with infix form" }, "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" + "text": "Reports 'to' function calls that can be replaced with the infix form. Using the infix form makes your code simpler. The quick-fix replaces 'to' with the infix form. Example: 'fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) {\n val pair = a to b\n }'", + "markdown": "Reports `to` function calls that can be replaced with the infix form.\n\nUsing the infix form makes your code simpler.\n\nThe quick-fix replaces `to` with the infix form.\n\n**Example:**\n\n\n fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int, b: Int) {\n val pair = a to b\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SynchroniziationOnLockObject", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReplaceToWithInfixForm", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Kotlin/Style issues", + "index": 2, "toolComponent": { "name": "QDJVM" } @@ -11783,28 +11711,28 @@ ] }, { - "id": "BadExceptionCaught", + "id": "ConstPropertyName", "shortDescription": { - "text": "Prohibited 'Exception' caught" + "text": "Const property naming convention" }, "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." + "text": "Reports 'const' property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, 'const' properties should use uppercase underscore-separated names. Example: 'const val Planck: Double = 6.62607015E-34' The quick-fix renames the property: 'const val PLANCK: Double = 6.62607015E-34'", + "markdown": "Reports `const` property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#property-names),\n`const` properties should use uppercase underscore-separated names.\n\n**Example:**\n\n\n const val Planck: Double = 6.62607015E-34\n\nThe quick-fix renames the property:\n\n\n const val PLANCK: Double = 6.62607015E-34\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ProhibitedExceptionCaught", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConstPropertyName", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Naming conventions", + "index": 71, "toolComponent": { "name": "QDJVM" } @@ -11816,19 +11744,19 @@ ] }, { - "id": "InstanceofCatchParameter", + "id": "RedundantNullableReturnType", "shortDescription": { - "text": "'instanceof' on 'catch' parameter" + "text": "Redundant nullable return type" }, "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" + "text": "Reports functions and variables with nullable return type which never return or become 'null'. Example: 'fun greeting(user: String): String? = \"Hello, $user!\"' After the quick-fix is applied: 'fun greeting(user: String): String = \"Hello, $user!\"'", + "markdown": "Reports functions and variables with nullable return type which never return or become `null`.\n\n**Example:**\n\n\n fun greeting(user: String): String? = \"Hello, $user!\"\n\nAfter the quick-fix is applied:\n\n\n fun greeting(user: String): String = \"Hello, $user!\"\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InstanceofCatchParameter", + "suppressToolId": "RedundantNullableReturnType", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11836,8 +11764,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Kotlin/Redundant constructs", + "index": 4, "toolComponent": { "name": "QDJVM" } @@ -11849,19 +11777,19 @@ ] }, { - "id": "RedundantScheduledForRemovalAnnotation", + "id": "UselessCallOnNotNull", "shortDescription": { - "text": "Redundant @ScheduledForRemoval annotation" + "text": "Useless call on not-null type" }, "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" + "text": "Reports calls on not-null receiver that make sense only for nullable receiver. Several functions from the standard library such as 'orEmpty()' or 'isNullOrEmpty' have sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same. Remove redundant call and Change call to … quick-fixes can be used to amend the code automatically. Examples: 'fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }'", + "markdown": "Reports calls on not-null receiver that make sense only for nullable receiver.\n\nSeveral functions from the standard library such as `orEmpty()` or `isNullOrEmpty`\nhave sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same.\n\n**Remove redundant call** and **Change call to ...** quick-fixes can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantScheduledForRemovalAnnotation", + "suppressToolId": "UselessCallOnNotNull", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11869,8 +11797,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11882,23 +11810,19 @@ ] }, { - "id": "OptionalGetWithoutIsPresent", + "id": "EqualsOrHashCode", "shortDescription": { - "text": "Optional.get() is called without isPresent() check" + "text": "'equals()' and 'hashCode()' not paired" }, "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 list) {\n final Optional optional =\n list.stream().filter(x -> x > 10).findFirst();\n final Integer result = optional.get(); // problem here\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "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 list) {\n final Optional optional =\n list.stream().filter(x -> x > 10).findFirst();\n final Integer result = optional.get(); // problem here\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "text": "Reports classes that override 'equals()' but do not override 'hashCode()', or vice versa. It also reports object declarations that override either 'equals()' or 'hashCode()'. This can lead to undesired behavior when a class is added to a 'Collection' Example: 'class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }' The quick-fix overrides 'equals()' or 'hashCode()' for classes and deletes these methods for objects: 'class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }'", + "markdown": "Reports classes that override `equals()` but do not override `hashCode()`, or vice versa. It also reports object declarations that override either `equals()` or `hashCode()`.\n\nThis can lead to undesired behavior when a class is added to a `Collection`\n\n**Example:**\n\n\n class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }\n\nThe quick-fix overrides `equals()` or `hashCode()` for classes and deletes these methods for objects:\n\n\n class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "OptionalGetWithoutIsPresent", - "cweIds": [ - 252, - 476 - ], + "suppressToolId": "EqualsOrHashCode", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11906,8 +11830,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Kotlin/Probable bugs", + "index": 28, "toolComponent": { "name": "QDJVM" } @@ -11917,21 +11841,33 @@ ] } ] - }, + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + { + "name": "com.intellij.java", + "version": "242.24024", + "rules": [ { - "id": "OnDemandImport", + "id": "OverrideOnly", "shortDescription": { - "text": "'*' import" + "text": "Method can only be overridden" }, "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." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "OnDemandImport", + "suppressToolId": "OverrideOnly", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11939,8 +11875,8 @@ "relationships": [ { "target": { - "id": "Java/Imports", - "index": 24, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -11952,19 +11888,19 @@ ] }, { - "id": "FallthruInSwitchStatement", + "id": "CallToSuspiciousStringMethod", "shortDescription": { - "text": "Fallthrough in 'switch' statement" + "text": "Call to suspicious 'String' method" }, "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" + "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": "fallthrough", + "suppressToolId": "CallToSuspiciousStringMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -11972,8 +11908,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -11985,22 +11921,19 @@ ] }, { - "id": "RedundantOperationOnEmptyContainer", + "id": "KeySetIterationMayUseEntrySet", "shortDescription": { - "text": "Redundant operation on empty container" + "text": "Iteration over 'keySet()' can be optimized" }, "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" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantOperationOnEmptyContainer", - "cweIds": [ - 561 - ], + "suppressToolId": "KeySetIterationMayUseEntrySet", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12008,8 +11941,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -12021,19 +11954,19 @@ ] }, { - "id": "OptionalIsPresent", + "id": "UnnecessaryQualifierForThis", "shortDescription": { - "text": "Non functional style 'Optional.isPresent()' usage" + "text": "Unnecessary qualifier for 'this' or 'super'" }, "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 depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "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 depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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": "OptionalIsPresent", + "suppressToolId": "UnnecessaryQualifierForThis", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12054,19 +11987,19 @@ ] }, { - "id": "AtomicFieldUpdaterNotStaticFinal", + "id": "UnusedReturnValue", "shortDescription": { - "text": "'AtomicFieldUpdater' field not declared 'static final'" + "text": "Method can be made 'void'" }, "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

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
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
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
idFieldUpdater = AtomicIntegerFieldUpdater.newUpdater(Main.class, \"id\");\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AtomicFieldUpdaterNotStaticFinal", + "suppressToolId": "UnusedReturnValue", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12074,8 +12007,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -12087,19 +12020,19 @@ ] }, { - "id": "Java8MapForEach", + "id": "UncheckedExceptionClass", "shortDescription": { - "text": "Map.forEach() can be used" + "text": "Unchecked 'Exception' class" }, "fullDescription": { - "text": "Suggests replacing 'for(Entry entry : map.entrySet()) {...}' or 'map.entrySet().forEach(entry -> ...)' with 'map.forEach((key, value) -> ...)'. Example 'void print(Map 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 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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8. 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 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 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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8.\n\nNew in 2017.1" + "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": "Java8MapForEach", + "suppressToolId": "UncheckedExceptionClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12107,8 +12040,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -12120,19 +12053,19 @@ ] }, { - "id": "RecordStoreResource", + "id": "SizeReplaceableByIsEmpty", "shortDescription": { - "text": "'RecordStore' opened but not safely closed" + "text": "'size() == 0' can be replaced with 'isEmpty()'" }, "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" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "RecordStoreOpenedButNotSafelyClosed", + "suppressToolId": "SizeReplaceableByIsEmpty", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12140,8 +12073,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -12153,28 +12086,28 @@ ] }, { - "id": "ObjectsEqualsCanBeSimplified", + "id": "UnsupportedChronoFieldUnitCall", "shortDescription": { - "text": "'Objects.equals()' can be replaced with 'equals()'" + "text": "Call methods with unsupported 'java.time.temporal.ChronoUnit' and 'java.time.temporal.ChronoField'" }, "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);' This inspection depends on the Java feature 'java.util.Objects API', which is available since Java 7. 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\nThis inspection depends on the Java feature 'java.util.Objects API', which is available since Java 7.\n\nNew in 2018.3" + "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": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ObjectsEqualsCanBeSimplified", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "UnsupportedChronoFieldUnitCall", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -12186,19 +12119,22 @@ ] }, { - "id": "ClassLoaderInstantiation", + "id": "NumberEquality", "shortDescription": { - "text": "'ClassLoader' instantiation" + "text": "Number comparison using '==', instead of 'equals()'" }, "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" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ClassLoaderInstantiation", + "suppressToolId": "NumberEquality", + "cweIds": [ + 480 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12206,8 +12142,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -12219,19 +12155,19 @@ ] }, { - "id": "NativeMethods", + "id": "ClassWithOnlyPrivateConstructors", "shortDescription": { - "text": "Native method" + "text": "Class with only 'private' constructors should be declared 'final'" }, "fullDescription": { - "text": "Reports methods declared 'native'. Native methods are inherently unportable.", - "markdown": "Reports methods declared `native`. Native methods are inherently unportable." + "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": "NativeMethod", + "suppressToolId": "ClassWithOnlyPrivateConstructors", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12239,8 +12175,8 @@ "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -12252,21 +12188,21 @@ ] }, { - "id": "EqualsWithItself", + "id": "ComparatorNotSerializable", "shortDescription": { - "text": "'equals()' called on itself" + "text": "'Comparator' class not declared 'Serializable'" }, "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." + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EqualsWithItself", + "suppressToolId": "ComparatorNotSerializable", "cweIds": [ - 571 + 502 ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" @@ -12275,8 +12211,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -12288,19 +12224,19 @@ ] }, { - "id": "ClassInheritanceDepth", + "id": "UNUSED_IMPORT", "shortDescription": { - "text": "Class too deep in inheritance tree" + "text": "Unused import" }, "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." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "ClassTooDeepInInheritanceTree", + "suppressToolId": "UNUSED_IMPORT", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12308,8 +12244,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Java/Imports", + "index": 24, "toolComponent": { "name": "QDJVM" } @@ -12321,28 +12257,28 @@ ] }, { - "id": "MarkedForRemoval", + "id": "FieldAccessedSynchronizedAndUnsynchronized", "shortDescription": { - "text": "Usage of API marked for removal" + "text": "Field accessed in both 'synchronized' and unsynchronized contexts" }, "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" + "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": "error", + "level": "warning", "parameters": { - "suppressToolId": "removal", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "FieldAccessedSynchronizedAndUnsynchronized", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -12354,27 +12290,27 @@ ] }, { - "id": "NestedConditionalExpression", + "id": "RemoveLiteralUnderscores", "shortDescription": { - "text": "Nested conditional expression" + "text": "Underscores in numeric literal" }, "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" + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "NestedConditionalExpression", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RemoveLiteralUnderscores", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", + "id": "Java/Numeric issues", "index": 30, "toolComponent": { "name": "QDJVM" @@ -12387,19 +12323,19 @@ ] }, { - "id": "BulkFileAttributesRead", + "id": "NegatedEqualityExpression", "shortDescription": { - "text": "Bulk 'Files.readAttributes()' call can be used" + "text": "Negated equality expression" }, "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" + "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": "BulkFileAttributesRead", + "suppressToolId": "NegatedEqualityExpression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12407,8 +12343,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -12420,19 +12356,23 @@ ] }, { - "id": "ImplicitNumericConversion", + "id": "MathRandomCastToInt", "shortDescription": { - "text": "Implicit numeric conversion" + "text": "'Math.random()' cast to 'int'" }, "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." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ImplicitNumericConversion", + "suppressToolId": "MathRandomCastToInt", + "cweIds": [ + 330, + 681 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12440,8 +12380,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -12453,28 +12393,28 @@ ] }, { - "id": "WhileCanBeForeach", + "id": "DoubleBraceInitialization", "shortDescription": { - "text": "'while' loop can be replaced with enhanced 'for' loop" + "text": "Double brace initialization" }, "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 depends on the Java feature 'For-each loops', which is available since Java 5.", - "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 depends on the Java feature 'For-each loops', which is available since Java 5." + "text": "Reports Double Brace Initialization. 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. Double brace initialization may cause memory leaks when used in a non-static context. This is because it defines an anonymous class that will reference the surrounding object, when compiled with javac from before Java 18. 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 list = new ArrayList<>() {{\n add(1);\n add(2);\n }};' After the quick-fix is applied: 'List list = new ArrayList<>();\n list.add(1);\n list.add(2);'", + "markdown": "Reports [Double Brace Initialization](https://www.c2.com/cgi/wiki?DoubleBraceInitialization).\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\nDouble brace initialization may cause memory leaks when used in a non-static context. This is because it defines an anonymous class\nthat will reference the surrounding object, when compiled with javac from before Java 18.\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 list = new ArrayList<>() {{\n add(1);\n add(2);\n }};\n\nAfter the quick-fix is applied:\n\n\n List list = new ArrayList<>();\n list.add(1);\n list.add(2);\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "WhileLoopReplaceableByForEach", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "DoubleBraceInitialization", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -12486,22 +12426,19 @@ ] }, { - "id": "NotNullFieldNotInitialized", + "id": "StringConcatenationInLoops", "shortDescription": { - "text": "@NotNull field is not initialized" + "text": "String concatenation in loop" }, "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.", - "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." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NotNullFieldNotInitialized", - "cweIds": [ - 476 - ], + "suppressToolId": "StringConcatenationInLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12509,8 +12446,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs/Nullability problems", - "index": 174, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -12522,19 +12459,22 @@ ] }, { - "id": "OverlyComplexBooleanExpression", + "id": "CloneableClassInSecureContext", "shortDescription": { - "text": "Overly complex boolean expression" + "text": "Cloneable class in secure context" }, "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." + "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": "OverlyComplexBooleanExpression", + "suppressToolId": "CloneableClassInSecureContext", + "cweIds": [ + 498 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12542,8 +12482,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -12555,19 +12495,19 @@ ] }, { - "id": "NotifyCalledOnCondition", + "id": "InconsistentTextBlockIndent", "shortDescription": { - "text": "'notify()' or 'notifyAll()' called on 'java.util.concurrent.locks.Condition' object" + "text": "Inconsistent whitespace indentation in text block" }, "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" + "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 depends on the Java feature 'Text block literals', which is available since Java 15. 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 depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2021.1" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NotifyCalledOnCondition", + "suppressToolId": "InconsistentTextBlockIndent", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12575,8 +12515,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -12588,19 +12528,19 @@ ] }, { - "id": "NewMethodNamingConvention", + "id": "DoubleNegation", "shortDescription": { - "text": "Method naming convention" + "text": "Double negation" }, "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." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NewMethodNamingConvention", + "suppressToolId": "DoubleNegation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12608,8 +12548,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -12621,28 +12561,28 @@ ] }, { - "id": "OverlyStrongTypeCast", + "id": "AssertionCanBeIf", "shortDescription": { - "text": "Overly strong type cast" + "text": "Assertion can be replaced with 'if' statement" }, "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." + "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();' This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", + "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\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OverlyStrongTypeCast", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "AssertionCanBeIf", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -12654,19 +12594,19 @@ ] }, { - "id": "JavaLangImport", + "id": "PackageWithTooFewClasses", "shortDescription": { - "text": "Unnecessary import from the 'java.lang' package" + "text": "Package with too few classes" }, "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." + "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": "JavaLangImport", + "suppressToolId": "PackageWithTooFewClasses", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12674,8 +12614,8 @@ "relationships": [ { "target": { - "id": "Java/Imports", - "index": 24, + "id": "Java/Packaging issues", + "index": 46, "toolComponent": { "name": "QDJVM" } @@ -12687,19 +12627,19 @@ ] }, { - "id": "UtilityClass", + "id": "ReplaceOnLiteralHasNoEffect", "shortDescription": { - "text": "Utility class" + "text": "Replacement operation has no effect" }, "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." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "UtilityClass", + "suppressToolId": "ReplaceOnLiteralHasNoEffect", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12707,8 +12647,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -12720,19 +12660,19 @@ ] }, { - "id": "ClassNameDiffersFromFileName", + "id": "SingleClassImport", "shortDescription": { - "text": "Class name differs from file name" + "text": "Single class import" }, "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." + "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": "ClassNameDiffersFromFileName", + "suppressToolId": "SingleClassImport", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12740,8 +12680,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Imports", + "index": 24, "toolComponent": { "name": "QDJVM" } @@ -12753,19 +12693,19 @@ ] }, { - "id": "IndexOfReplaceableByContains", + "id": "LoggingConditionDisagreesWithLogLevelStatement", "shortDescription": { - "text": "'String.indexOf()' expression can be replaced with 'contains()'" + "text": "Log condition does not match logging call" }, "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." + "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": "IndexOfReplaceableByContains", + "suppressToolId": "LoggingConditionDisagreesWithLogLevelStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12773,8 +12713,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "JVM languages/Logging", + "index": 52, "toolComponent": { "name": "QDJVM" } @@ -12786,28 +12726,28 @@ ] }, { - "id": "StringConcatenationArgumentToLogCall", + "id": "BadOddness", "shortDescription": { - "text": "Non-constant string concatenation as argument to logging call" + "text": "Suspicious oddness check" }, "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." + "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": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "StringConcatenationArgumentToLogCall", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "BadOddness", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Logging", - "index": 119, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -12819,28 +12759,28 @@ ] }, { - "id": "OptionalContainsCollection", + "id": "SystemOutErr", "shortDescription": { - "text": "'Optional' contains array or collection" + "text": "Use of 'System.out' or 'System.err'" }, "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> foo() {\n return Optional.empty();\n }' This code could look like: 'List foo() {\n return List.of();\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "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> foo() {\n return Optional.empty();\n }\n\nThis code could look like:\n\n\n List foo() {\n return List.of();\n }\n \nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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. The provided quick-fix supports SLF4J and Log4j 2. It replaces 'System.out' and 'System.err' calls with log calls Example: 'public static void test(Object o) {\n System.out.println(\"Test: \"+ o);\n }' After the quick-fix is applied: 'private static final Logger log = LoggerFactory.getLogger(Test.class);\n\n public static void test(Object o) {\n log.info(\"Test: {}\", o);;\n }' Use the Log method for 'System.err' option to specify a method which it is used to log a message for 'System.err' calls. Use the Log method for 'System.out' option to specify a method which it is used to log a message for 'System.out' calls.", + "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.\n\nThe provided quick-fix supports **SLF4J** and **Log4j 2** .\nIt replaces `System.out` and `System.err` calls with log calls\n\n**Example:**\n\n\n public static void test(Object o) {\n System.out.println(\"Test: \"+ o);\n }\n\nAfter the quick-fix is applied:\n\n\n private static final Logger log = LoggerFactory.getLogger(Test.class);\n\n public static void test(Object o) {\n log.info(\"Test: {}\", o);;\n }\n\n\nUse the **Log method for 'System.err'** option to specify a method which it is used to log a message for 'System.err' calls.\nUse the **Log method for 'System.out'** option to specify a method which it is used to log a message for 'System.out' calls." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OptionalContainsCollection", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UseOfSystemOutOrSystemErr", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -12852,19 +12792,19 @@ ] }, { - "id": "SimplifiableAssertion", + "id": "CheckedExceptionClass", "shortDescription": { - "text": "Simplifiable assertion" + "text": "Checked exception class" }, "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();` |" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SimplifiableAssertion", + "suppressToolId": "CheckedExceptionClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12872,8 +12812,8 @@ "relationships": [ { "target": { - "id": "Java/Test frameworks", - "index": 130, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -12885,25 +12825,19 @@ ] }, { - "id": "LoadLibraryWithNonConstantString", + "id": "SerializableStoresNonSerializable", "shortDescription": { - "text": "Call to 'System.loadLibrary()' with non-constant string" + "text": "'Serializable' object implicitly stores non-'Serializable' object" }, "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" + "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": "LoadLibraryWithNonConstantString", - "cweIds": [ - 114, - 494, - 676, - 829 - ], + "suppressToolId": "SerializableStoresNonSerializable", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12911,8 +12845,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -12924,28 +12858,28 @@ ] }, { - "id": "InterfaceMethodClashesWithObject", + "id": "InsertLiteralUnderscores", "shortDescription": { - "text": "Interface method clashes with method in 'Object'" + "text": "Unreadable numeric literal" }, "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" + "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": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "InterfaceMethodClashesWithObject", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "InsertLiteralUnderscores", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -12957,19 +12891,19 @@ ] }, { - "id": "StaticMethodOnlyUsedInOneClass", + "id": "BreakStatement", "shortDescription": { - "text": "Static member only used from one other class" + "text": "'break' statement" }, "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." + "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 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 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": "StaticMethodOnlyUsedInOneClass", + "suppressToolId": "BreakStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -12977,8 +12911,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -12990,19 +12924,23 @@ ] }, { - "id": "RedundantEscapeInRegexReplacement", + "id": "JDBCExecuteWithNonConstantString", "shortDescription": { - "text": "Redundant escape in regex replacement string" + "text": "Call to 'Statement.execute()' with non-constant 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" + "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": "RedundantEscapeInRegexReplacement", + "suppressToolId": "JDBCExecuteWithNonConstantString", + "cweIds": [ + 89, + 564 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13010,8 +12948,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -13023,19 +12961,19 @@ ] }, { - "id": "SynchronizedOnLiteralObject", + "id": "ConstantValueVariableUse", "shortDescription": { - "text": "Synchronization on an object initialized with a literal" + "text": "Use of variable whose value is known to be constant" }, "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." + "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": "SynchronizedOnLiteralObject", + "suppressToolId": "ConstantValueVariableUse", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13043,9 +12981,9 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, - "toolComponent": { + "id": "Java/Data flow", + "index": 65, + "toolComponent": { "name": "QDJVM" } }, @@ -13056,19 +12994,23 @@ ] }, { - "id": "Java9ReflectionClassVisibility", + "id": "NewStringBufferWithCharArgument", "shortDescription": { - "text": "Reflective access across modules issues" + "text": "StringBuilder constructor call with 'char' argument" }, "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 depends on the Java feature 'Modules', which is available since Java 9.", - "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 depends on the Java feature 'Modules', which is available since Java 9." + "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": "Java9ReflectionClassVisibility", + "suppressToolId": "NewStringBufferWithCharArgument", + "cweIds": [ + 628, + 704 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13076,8 +13018,8 @@ "relationships": [ { "target": { - "id": "Java/Reflective access", - "index": 131, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -13089,19 +13031,19 @@ ] }, { - "id": "CharsetObjectCanBeUsed", + "id": "ClassGetClass", "shortDescription": { - "text": "Standard 'Charset' object can be used" + "text": "Suspicious 'Class.getClass()' call" }, "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" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CharsetObjectCanBeUsed", + "suppressToolId": "ClassGetClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13109,8 +13051,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -13122,19 +13064,19 @@ ] }, { - "id": "UseOfSunClasses", + "id": "ResultOfObjectAllocationIgnored", "shortDescription": { - "text": "Use of 'sun.*' classes" + "text": "Result of object allocation ignored" }, "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." + "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": "UseOfSunClasses", + "suppressToolId": "ResultOfObjectAllocationIgnored", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13142,8 +13084,8 @@ "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -13155,19 +13097,19 @@ ] }, { - "id": "RedundantCast", + "id": "UnusedLibrary", "shortDescription": { - "text": "Redundant type cast" + "text": "Unused library" }, "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 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 l, Object o) {\n l.remove((String)o);\n } \n" + "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": "RedundantCast", + "suppressToolId": "UnusedLibrary", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13175,8 +13117,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -13188,28 +13130,28 @@ ] }, { - "id": "AnonymousInnerClass", + "id": "ObsoleteCollection", "shortDescription": { - "text": "Anonymous class can be replaced with inner class" + "text": "Use of obsolete collection type" }, "fullDescription": { - "text": "Reports anonymous classes. Occasionally replacing anonymous classes with inner classes can lead to more readable and maintainable code. Some code standards discourage anonymous classes. Example: 'class Example {\n public static void main(String[] args) {\n new Thread() {\n public void run() {\n work()\n }\n\n private void work() {}\n }.start();\n }\n }' After the quick-fix is applied: 'class Example {\n public static void main(String[] args) {\n new MyThread().start();\n }\n\n private static class MyThread extends Thread {\n public void run() {\n work();\n }\n\n private void work() {}\n }\n }'", - "markdown": "Reports anonymous classes.\n\nOccasionally replacing anonymous classes with inner classes can lead to more readable and maintainable code.\nSome code standards discourage anonymous classes.\n\n**Example:**\n\n\n class Example {\n public static void main(String[] args) {\n new Thread() {\n public void run() {\n work()\n }\n\n private void work() {}\n }.start();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n public static void main(String[] args) {\n new MyThread().start();\n }\n\n private static class MyThread extends Thread {\n public void run() {\n work();\n }\n\n private void work() {}\n }\n }\n" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "AnonymousInnerClass", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "UseOfObsoleteCollectionType", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -13221,19 +13163,19 @@ ] }, { - "id": "SimplifyCollector", + "id": "ForEachWithRecordPatternCanBeUsed", "shortDescription": { - "text": "Simplifiable collector" + "text": "Enhanced 'for' with a record pattern can be used" }, "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 depends on the Java feature 'Stream and Optional API', which is available since Java 8. 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 depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2017.1" + "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 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 records) {\n for (Record(Integer x, String y) : records) {\n System.out.println(y);\n System.out.println(x);\n }\n}' 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 This inspection depends on the Java feature 'Record patterns in for-each loops', which is available since Java X. 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 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 records) {\n for (Record(Integer x, String y) : records) {\n System.out.println(y);\n System.out.println(x);\n }\n }\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\nThis inspection depends on the Java feature 'Record patterns in for-each loops', which is available since Java X.\n\nNew in 2023.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SimplifyCollector", + "suppressToolId": "ForEachWithRecordPatternCanBeUsed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13241,8 +13183,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Java language level migration aids", + "index": 70, "toolComponent": { "name": "QDJVM" } @@ -13254,19 +13196,23 @@ ] }, { - "id": "MultipleTopLevelClassesInFile", + "id": "MismatchedStringBuilderQueryUpdate", "shortDescription": { - "text": "Multiple top level classes in single file" + "text": "Mismatched query and update of 'StringBuilder'" }, "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." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MultipleTopLevelClassesInFile", + "suppressToolId": "MismatchedQueryAndUpdateOfStringBuilder", + "cweIds": [ + 561, + 563 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13274,8 +13220,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -13287,19 +13233,19 @@ ] }, { - "id": "IteratorNextDoesNotThrowNoSuchElementException", + "id": "FinalizeNotProtected", "shortDescription": { - "text": "'Iterator.next()' which can't throw 'NoSuchElementException'" + "text": "'finalize()' should be protected, not public" }, "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 {\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 {\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" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "IteratorNextCanNotThrowNoSuchElementException", + "suppressToolId": "FinalizeNotProtected", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13307,8 +13253,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Finalization", + "index": 75, "toolComponent": { "name": "QDJVM" } @@ -13320,23 +13266,19 @@ ] }, { - "id": "IncorrectMessageFormat", + "id": "ModuleWithTooManyClasses", "shortDescription": { - "text": "Incorrect 'MessageFormat' pattern" + "text": "Module with too many classes" }, "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" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IncorrectMessageFormat", - "cweIds": [ - 628, - 707 - ], + "suppressToolId": "ModuleWithTooManyClasses", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13344,8 +13286,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Modularization issues", + "index": 76, "toolComponent": { "name": "QDJVM" } @@ -13357,19 +13299,19 @@ ] }, { - "id": "SuspiciousTernaryOperatorInVarargsCall", + "id": "InfiniteLoopStatement", "shortDescription": { - "text": "Suspicious ternary operator in varargs method call" + "text": "Infinite loop statement" }, "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 }' This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5. 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\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.\n\nNew in 2020.3" + "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": "SuspiciousTernaryOperatorInVarargsCall", + "suppressToolId": "InfiniteLoopStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13377,8 +13319,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -13390,28 +13332,28 @@ ] }, { - "id": "SerializableInnerClassHasSerialVersionUIDField", + "id": "JavadocHtmlLint", "shortDescription": { - "text": "Serializable non-static inner class without 'serialVersionUID'" + "text": "HTML problems in Javadoc (DocLint)" }, "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." + "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\n * Unclosed tag: error\n * Misplaced text or tag:
  • one
  • ,
  • two
\n * Wrong or empty attribute: \n * Self-closed tag:
\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\n * Unclosed tag: error
\n * Misplaced text or tag:
  • one
  • ,
  • two
\n * Wrong or empty attribute: \n * Self-closed tag:
\n * ...\n */\n void sample(){ }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "SerializableNonStaticInnerClassWithoutSerialVersionUID", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "JavadocHtmlLint", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -13423,19 +13365,19 @@ ] }, { - "id": "ParameterNameDiffersFromOverriddenParameter", + "id": "ClassUnconnectedToPackage", "shortDescription": { - "text": "Parameter name differs from parameter in overridden or overloaded method" + "text": "Class independent of its package" }, "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." + "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": "ParameterNameDiffersFromOverriddenParameter", + "suppressToolId": "ClassUnconnectedToPackage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13443,8 +13385,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Packaging issues", + "index": 46, "toolComponent": { "name": "QDJVM" } @@ -13456,19 +13398,19 @@ ] }, { - "id": "OctalLiteral", + "id": "ExceptionNameDoesntEndWithException", "shortDescription": { - "text": "Octal integer" + "text": "Exception class name does not end with 'Exception'" }, "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" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OctalInteger", + "suppressToolId": "ExceptionClassNameDoesntEndWithException", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13476,8 +13418,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Naming conventions/Class", + "index": 80, "toolComponent": { "name": "QDJVM" } @@ -13489,19 +13431,19 @@ ] }, { - "id": "ReadWriteStringCanBeUsed", + "id": "NonFinalStaticVariableUsedInClassInitialization", "shortDescription": { - "text": "'Files.readString()' or 'Files.writeString()' can be used" + "text": "Non-final static field is used during class initialization" }, "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" + "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": "ReadWriteStringCanBeUsed", + "suppressToolId": "NonFinalStaticVariableUsedInClassInitialization", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13509,8 +13451,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 11", - "index": 178, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -13522,19 +13464,19 @@ ] }, { - "id": "CyclomaticComplexity", + "id": "ThreadStopSuspendResume", "shortDescription": { - "text": "Overly complex method" + "text": "Call to 'Thread.stop()', 'suspend()' or 'resume()'" }, "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." + "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": "OverlyComplexMethod", + "suppressToolId": "CallToThreadStopSuspendOrResumeManager", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13542,8 +13484,8 @@ "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -13555,19 +13497,19 @@ ] }, { - "id": "AwaitNotInLoop", + "id": "UnnecessaryTemporaryOnConversionFromString", "shortDescription": { - "text": "'await()' not called in loop" + "text": "Unnecessary temporary object in conversion from 'String'" }, "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" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AwaitNotInLoop", + "suppressToolId": "UnnecessaryTemporaryOnConversionFromString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13575,8 +13517,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -13588,19 +13530,19 @@ ] }, { - "id": "StaticVariableUninitializedUse", + "id": "UseOfConcreteClass", "shortDescription": { - "text": "Static field used before initialization" + "text": "Use of concrete class" }, "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." + "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": "StaticVariableUsedBeforeInitialization", + "suppressToolId": "UseOfConcreteClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13608,8 +13550,8 @@ "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -13621,19 +13563,19 @@ ] }, { - "id": "CyclicClassDependency", + "id": "RedundantLabeledSwitchRuleCodeBlock", "shortDescription": { - "text": "Cyclic class dependency" + "text": "Labeled switch rule has redundant code block" }, "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." + "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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14. 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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14.\n\nNew in 2019.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CyclicClassDependency", + "suppressToolId": "RedundantLabeledSwitchRuleCodeBlock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13641,8 +13583,8 @@ "relationships": [ { "target": { - "id": "Java/Dependency issues", - "index": 146, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -13654,19 +13596,19 @@ ] }, { - "id": "StringBufferReplaceableByStringBuilder", + "id": "IOStreamConstructor", "shortDescription": { - "text": "'StringBuffer' may be 'StringBuilder'" + "text": "'InputStream' and 'OutputStream' can be constructed using 'Files' methods" }, "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." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "StringBufferMayBeStringBuilder", + "suppressToolId": "IOStreamConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13674,8 +13616,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -13687,19 +13629,19 @@ ] }, { - "id": "SynchronizedMethod", + "id": "AssignmentToForLoopParameter", "shortDescription": { - "text": "'synchronized' method" + "text": "Assignment to 'for' loop parameter" }, "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." + "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": "SynchronizedMethod", + "suppressToolId": "AssignmentToForLoopParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13707,8 +13649,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -13720,28 +13662,28 @@ ] }, { - "id": "AbstractMethodWithMissingImplementations", + "id": "Java9CollectionFactory", "shortDescription": { - "text": "Abstract method with missing implementations" + "text": "Immutable collection creation can be replaced with collection factory call" }, "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." + "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 even = Collections.unmodifiableList(\n Arrays.asList(2, 4, 6, 8, 10, 2));\n List evenCopy = Collections.unmodifiableList(\n new ArrayList<>(list1));' After the quick-fix is applied: 'List even = List.of(2, 4, 6, 8, 10, 2);\n List evenCopy = List.copyOf(list);' 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()'. This inspection depends on the Java feature 'Collection factory methods', which is available since Java 9. 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 even = Collections.unmodifiableList(\n Arrays.asList(2, 4, 6, 8, 10, 2));\n List evenCopy = Collections.unmodifiableList(\n new ArrayList<>(list1));\n\nAfter the quick-fix is applied:\n\n\n List even = List.of(2, 4, 6, 8, 10, 2);\n List evenCopy = List.copyOf(list);\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\nThis inspection depends on the Java feature 'Collection factory methods', which is available since Java 9.\n\nNew in 2017.2" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AbstractMethodWithMissingImplementations", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "Java9CollectionFactory", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Java language level migration aids/Java 9", + "index": 87, "toolComponent": { "name": "QDJVM" } @@ -13753,19 +13695,19 @@ ] }, { - "id": "Convert2MethodRef", + "id": "MetaAnnotationWithoutRuntimeRetention", "shortDescription": { - "text": "Lambda can be replaced with method reference" + "text": "Test annotation without '@Retention(RUNTIME)' annotation" }, "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 depends on the following Java features: Lambda expressions Method references These features are available since Java 8.", - "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 depends on the following Java features:\n\n* Lambda expressions\n* Method references\n\nThese features are available since Java 8." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "Convert2MethodRef", + "suppressToolId": "MetaAnnotationWithoutRuntimeRetention", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13773,8 +13715,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/JUnit", + "index": 90, "toolComponent": { "name": "QDJVM" } @@ -13786,19 +13728,19 @@ ] }, { - "id": "ClassOnlyUsedInOnePackage", + "id": "UnnecessaryContinue", "shortDescription": { - "text": "Class only used from one other package" + "text": "Unnecessary 'continue' statement" }, "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." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "ClassOnlyUsedInOnePackage", + "suppressToolId": "UnnecessaryContinue", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13806,8 +13748,8 @@ "relationships": [ { "target": { - "id": "Java/Packaging issues", - "index": 44, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -13819,19 +13761,19 @@ ] }, { - "id": "UnnecessaryToStringCall", + "id": "CStyleArrayDeclaration", "shortDescription": { - "text": "Unnecessary call to 'toString()'" + "text": "C-style array declaration" }, "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. Removing redundant 'toString()' calls can occasionally even improve performance and reduce object allocations. 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. Removing the explicit 'toString()' in these cases will change the runtime semantics from throwing a 'NullPointException' to silently accepting the value when it is '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,\nand the explicit call to `toString()` is not needed.\nRemoving redundant `toString()` calls can occasionally even improve performance and reduce object allocations.\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.\nRemoving the explicit `toString()` in these cases will change the runtime semantics\nfrom throwing a `NullPointException` to silently accepting the value when it is `null`." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryToStringCall", + "suppressToolId": "CStyleArrayDeclaration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13852,19 +13794,19 @@ ] }, { - "id": "SuppressionAnnotation", + "id": "SystemExit", "shortDescription": { - "text": "Inspection suppression annotation" + "text": "Call to 'System.exit()' or related methods" }, "fullDescription": { - "text": "Reports comments or annotations suppressing inspections. This inspection can be useful when leaving suppressions intentionally for further review. Example: '@SuppressWarnings(\"unused\")\nstatic Stream 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 stringProvider() {\n return Stream.of(\"foo\", \"bar\");\n }\n" + "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": "SuppressionAnnotation", + "suppressToolId": "CallToSystemExit", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13872,8 +13814,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -13885,19 +13827,19 @@ ] }, { - "id": "SynchronizeOnNonFinalField", + "id": "DeclareCollectionAsInterface", "shortDescription": { - "text": "Synchronization on a non-final field" + "text": "Collection declared by class, not interface" }, "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" + "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 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 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 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 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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SynchronizeOnNonFinalField", + "suppressToolId": "CollectionDeclaredAsConcreteClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13905,8 +13847,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -13918,28 +13860,28 @@ ] }, { - "id": "ReturnSeparatedFromComputation", + "id": "TrivialStringConcatenation", "shortDescription": { - "text": "'return' separated from the result computation" + "text": "Concatenation with empty string" }, "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" + "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": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReturnSeparatedFromComputation", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ConcatenationWithEmptyString", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -13951,22 +13893,19 @@ ] }, { - "id": "ArrayObjectsEquals", + "id": "SuspiciousInvocationHandlerImplementation", "shortDescription": { - "text": "Use of shallow or 'Objects' methods with arrays" + "text": "Suspicious 'InvocationHandler' implementation" }, "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" + "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": "ArrayObjectsEquals", - "cweIds": [ - 480 - ], + "suppressToolId": "SuspiciousInvocationHandlerImplementation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -13987,22 +13926,19 @@ ] }, { - "id": "EqualsWhichDoesntCheckParameterClass", + "id": "UnreachableCode", "shortDescription": { - "text": "'equals()' method which does not check class of parameter" + "text": "Unreachable code" }, "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" + "text": "Reports the code which is never reached according to data flow analysis. It can be the result of previous always-true or always-false condition, unreachable loop body or catch section. Usually (though not always) unreachable code is a consequence of a previous warning, so check inspection warnings form \"Nullability and data flow problems\", \"Constant values\", or \"Redundant operation on empty container\" to better understand the cause. Example: 'void finishApplication() {\n System.exit(0);\n System.out.println(\"Application is terminated\"); // Unreachable code\n }' Note that this inspection relies on method contract inference. In particular, if you call a static or final method that always throws an exception, then the \"always failing\" contract will be inferred, and code after the method call will be considered unreachable. For example: 'void run() {\n performAction();\n System.out.println(\"Action is performed\"); // Unreachable code\n }\n \n static void performAction() {\n throw new AssertionError();\n }' This may cause false-positives if any kind of code postprocessing is used, for example, if an annotation processor later replaces the method body with something useful. To avoid false-positive warnings, suppress the automatic contract inference with explicit '@org.jetbrains.annotations.Contract' annotation from 'org.jetbrains:annotations' package: 'void run() {\n performAction();\n System.out.println(\"Action is performed\"); // No warning anymore\n }\n\n @Contract(\"-> _\") // implementation will be replaced\n static void performAction() {\n throw new AssertionError();\n }' New in 2024.1", + "markdown": "Reports the code which is never reached according to data flow analysis. It can be the result of previous always-true or always-false condition, unreachable loop body or catch section. Usually (though not always) unreachable code is a consequence of a previous warning, so check inspection warnings form \"Nullability and data flow problems\", \"Constant values\", or \"Redundant operation on empty container\" to better understand the cause.\n\nExample:\n\n\n void finishApplication() {\n System.exit(0);\n System.out.println(\"Application is terminated\"); // Unreachable code\n }\n\n\nNote that this inspection relies on method contract inference. In particular, if you call a static or final method\nthat always throws an exception, then the \"always failing\" contract will be inferred, and code after the method call\nwill be considered unreachable. For example:\n\n\n void run() {\n performAction();\n System.out.println(\"Action is performed\"); // Unreachable code\n }\n \n static void performAction() {\n throw new AssertionError();\n }\n\n\nThis may cause false-positives if any kind of code postprocessing is used, for example, if an annotation processor\nlater replaces the method body with something useful. To avoid false-positive warnings, suppress the automatic\ncontract inference with explicit `@org.jetbrains.annotations.Contract` annotation from\n`org.jetbrains:annotations` package:\n\n\n void run() {\n performAction();\n System.out.println(\"Action is performed\"); // No warning anymore\n }\n\n @Contract(\"-> _\") // implementation will be replaced\n static void performAction() {\n throw new AssertionError();\n }\n\nNew in 2024.1" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EqualsWhichDoesntCheckParameterClass", - "cweIds": [ - 697 - ], + "suppressToolId": "UnreachableCode", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14023,19 +13959,19 @@ ] }, { - "id": "UseHashCodeMethodInspection", + "id": "HtmlTagCanBeJavadocTag", "shortDescription": { - "text": "Standard 'hashCode()' method can be used" + "text": "'...' can be replaced with '{@code ...}'" }, "fullDescription": { - "text": "Reports bitwise operations that can be replaced with a call to the 'Long.hashCode()' or 'Double.hashCode()' methods. It detects the construct '(int)(x ^ (x >>> 32))' where 'x' is a variable of type 'long' or the result of a previous 'Double.doubleToLongBits()' call. The replacement shortens the code, improving its readability. Example: 'int result = (int)(var ^ (var >>> 32));' After applying the quick-fix: 'int result = Long.hashCode(var);' This inspection only reports if the language level of the project or module is 8 or higher. New in 2024.1", - "markdown": "Reports bitwise operations that can be replaced with a call to the `Long.hashCode()` or `Double.hashCode()` methods. It detects the construct `(int)(x ^ (x >>> 32))` where `x` is a variable of type `long` or the result of a previous `Double.doubleToLongBits()` call. The replacement shortens the code, improving its readability.\n\n**Example:**\n\n\n int result = (int)(var ^ (var >>> 32));\n\nAfter applying the quick-fix:\n\n\n int result = Long.hashCode(var);\n\nThis inspection only reports if the language level of the project or module is 8 or higher.\n\nNew in 2024.1" + "text": "Reports usages of '' 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 ArrayList<Integer>\n */\n List getList(){ ... }' After the quick-fix is applied: '/**\n * @return empty {@code ArrayList}\n */\n List getList(){ ... }'", + "markdown": "Reports usages of `` 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 ArrayList<Integer>\n */\n List getList(){ ... }\n\nAfter the quick-fix is applied:\n\n\n /**\n * @return empty {@code ArrayList}\n */\n List getList(){ ... }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UseHashCodeMethodInspection", + "suppressToolId": "HtmlTagCanBeJavadocTag", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14043,8 +13979,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -14056,19 +13992,19 @@ ] }, { - "id": "AssignmentToSuperclassField", + "id": "ClassEscapesItsScope", "shortDescription": { - "text": "Constructor assigns value to field defined in superclass" + "text": "Class is exposed outside of its visibility scope" }, "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" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AssignmentToSuperclassField", + "suppressToolId": "ClassEscapesDefinedScope", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14076,8 +14012,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -14089,19 +14025,22 @@ ] }, { - "id": "NumericOverflow", + "id": "EqualsUsesNonFinalVariable", "shortDescription": { - "text": "Numeric overflow" + "text": "Non-final field referenced in 'equals()'" }, "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" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NumericOverflow", + "suppressToolId": "NonFinalFieldReferenceInEquals", + "cweIds": [ + 697 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14109,8 +14048,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -14122,22 +14061,19 @@ ] }, { - "id": "SuspiciousIndentAfterControlStatement", + "id": "NestedAssignment", "shortDescription": { - "text": "Suspicious indentation after control statement without braces" + "text": "Nested assignment" }, "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" - }, + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousIndentAfterControlStatement", - "cweIds": [ - 483 - ], + "suppressToolId": "NestedAssignment", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14145,8 +14081,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -14158,19 +14094,19 @@ ] }, { - "id": "ClassNewInstance", + "id": "AutoUnboxing", "shortDescription": { - "text": "Unsafe call to 'Class.newInstance()'" + "text": "Auto-unboxing" }, "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" + "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": "ClassNewInstance", + "suppressToolId": "AutoUnboxing", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14178,8 +14114,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -14191,28 +14127,32 @@ ] }, { - "id": "LimitedScopeInnerClass", + "id": "StringConcatenationInMessageFormatCall", "shortDescription": { - "text": "Local class" + "text": "String concatenation as argument to 'MessageFormat.format()' call" }, "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: 'class Example {\n void test() {\n class Local { // here\n }\n new Local();\n }\n }' After the quick-fix is applied: 'class Example {\n void test() {\n new Local();\n }\n\n private static class Local { // here\n }\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 class Example {\n void test() {\n class Local { // here\n }\n new Local();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n void test() {\n new Local();\n }\n\n private static class Local { // here\n }\n }\n" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "LimitedScopeInnerClass", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "StringConcatenationInMessageFormatCall", + "cweIds": [ + 116, + 134 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -14224,19 +14164,19 @@ ] }, { - "id": "MultiplyOrDivideByPowerOfTwo", + "id": "NonFinalFieldInImmutable", "shortDescription": { - "text": "Multiplication or division by power of two" + "text": "Non-final field in '@Immutable' class" }, "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." + "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": "MultiplyOrDivideByPowerOfTwo", + "suppressToolId": "NonFinalFieldInImmutable", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14244,8 +14184,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Concurrency annotation issues", + "index": 100, "toolComponent": { "name": "QDJVM" } @@ -14257,19 +14197,19 @@ ] }, { - "id": "MethodCallInLoopCondition", + "id": "CallToStringConcatCanBeReplacedByOperator", "shortDescription": { - "text": "Method call in loop condition" + "text": "Call to 'String.concat()' can be replaced with '+'" }, "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`." + "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": "MethodCallInLoopCondition", + "suppressToolId": "CallToStringConcatCanBeReplacedByOperator", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14277,8 +14217,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -14290,19 +14230,19 @@ ] }, { - "id": "ForLoopReplaceableByWhile", + "id": "HardcodedFileSeparators", "shortDescription": { - "text": "'for' loop may be replaced by 'while' loop" + "text": "Hardcoded file separator" }, "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." + "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": "ForLoopReplaceableByWhile", + "suppressToolId": "HardcodedFileSeparator", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14310,8 +14250,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -14323,19 +14263,19 @@ ] }, { - "id": "MethodCount", + "id": "ConfusingFloatingPointLiteral", "shortDescription": { - "text": "Class with too many methods" + "text": "Confusing floating-point literal" }, "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." + "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": "ClassWithTooManyMethods", + "suppressToolId": "ConfusingFloatingPointLiteral", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14343,8 +14283,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -14356,19 +14296,19 @@ ] }, { - "id": "StaticFieldReferenceOnSubclass", + "id": "JavadocReference", "shortDescription": { - "text": "Static field referenced via subclass" + "text": "Declaration has problems in Javadoc references" }, "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" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "StaticFieldReferencedViaSubclass", + "suppressToolId": "JavadocReference", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14376,8 +14316,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -14389,19 +14329,19 @@ ] }, { - "id": "BlockingMethodInNonBlockingContext", + "id": "LoggingPlaceholderCountMatchesArgumentCount", "shortDescription": { - "text": "Possibly blocking call in non-blocking context" + "text": "Number of placeholders does not match number of arguments in logging call" }, "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 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 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)" + "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": "BlockingMethodInNonBlockingContext", + "suppressToolId": "LoggingPlaceholderCountMatchesArgumentCount", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14409,8 +14349,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "JVM languages/Logging", + "index": 52, "toolComponent": { "name": "QDJVM" } @@ -14422,23 +14362,19 @@ ] }, { - "id": "IgnoreResultOfCall", + "id": "ImplicitArrayToString", "shortDescription": { - "text": "Result of method call ignored" + "text": "Call to 'toString()' on array" }, "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." + "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": "ResultOfMethodCallIgnored", - "cweIds": [ - 252, - 563 - ], + "suppressToolId": "ImplicitArrayToString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14459,28 +14395,28 @@ ] }, { - "id": "AssertBetweenInconvertibleTypes", + "id": "ReuseOfLocalVariable", "shortDescription": { - "text": "'assertEquals()' between objects of inconvertible types" + "text": "Reuse of local variable" }, "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" + "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": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "AssertBetweenInconvertibleTypes", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReuseOfLocalVariable", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "JVM languages/Test frameworks", - "index": 123, + "id": "Java/Data flow", + "index": 65, "toolComponent": { "name": "QDJVM" } @@ -14492,28 +14428,28 @@ ] }, { - "id": "SwitchExpressionCanBePushedDown", + "id": "BooleanMethodNameMustStartWithQuestion", "shortDescription": { - "text": "Common subexpression can be extracted from 'switch'" + "text": "Boolean method name must start with question word" }, "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. This inspection depends on the Java feature ''switch' expressions', which is available since Java 14. 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\nThis inspection depends on the Java feature ''switch' expressions', which is available since Java 14.\n\nNew in 2022.3" + "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 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 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": "note", + "level": "warning", "parameters": { - "suppressToolId": "SwitchExpressionCanBePushedDown", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "BooleanMethodNameMustStartWithQuestion", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -14525,28 +14461,28 @@ ] }, { - "id": "ConfusingElse", + "id": "SynchronizationOnLocalVariableOrMethodParameter", "shortDescription": { - "text": "Redundant 'else'" + "text": "Synchronization on local variable or method parameter" }, "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." + "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": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ConfusingElseBranch", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "SynchronizationOnLocalVariableOrMethodParameter", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -14558,19 +14494,19 @@ ] }, { - "id": "InnerClassReferencedViaSubclass", + "id": "FinalMethod", "shortDescription": { - "text": "Inner class referenced via subclass" + "text": "Method can't be overridden" }, "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" + "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": "InnerClassReferencedViaSubclass", + "suppressToolId": "FinalMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14578,8 +14514,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -14591,19 +14527,19 @@ ] }, { - "id": "ChannelResource", + "id": "NegatedConditionalExpression", "shortDescription": { - "text": "'Channel' opened but not safely closed" + "text": "Negated conditional expression" }, "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." + "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": "ChannelOpenedButNotSafelyClosed", + "suppressToolId": "NegatedConditionalExpression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14611,8 +14547,8 @@ "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -14624,19 +14560,19 @@ ] }, { - "id": "ScheduledThreadPoolExecutorWithZeroCoreThreads", + "id": "SuspiciousSystemArraycopy", "shortDescription": { - "text": "'ScheduledThreadPoolExecutor' with zero core threads" + "text": "Suspicious 'System.arraycopy()' call" }, "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" + "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": "ScheduledThreadPoolExecutorWithZeroCoreThreads", + "suppressToolId": "SuspiciousSystemArraycopy", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14657,19 +14593,19 @@ ] }, { - "id": "JavaEmptyModuleInfoFile", + "id": "AbsoluteAlignmentInUserInterface", "shortDescription": { - "text": "Empty 'module-info.java' file" + "text": "Absolute alignment in AWT/Swing code" }, "fullDescription": { - "text": "Reports an empty 'module-info.java' file, indicating unresolved module dependencies. Automatically adds necessary 'requires' statements by inspecting imports. To suppress this warning, you may write any comment inside the module statement body, like this: 'module module.name {\n // no dependencies\n}' Quick Fix: Fill in module dependencies fills in missing 'requires' based on source code imports. New in 2024.1", - "markdown": "Reports an empty `module-info.java` file, indicating unresolved module dependencies. Automatically adds necessary `requires` statements by inspecting imports. To suppress this warning, you may write any comment inside the module statement body, like this:\n\n\n module module.name {\n // no dependencies\n }\n\n**Quick Fix:** *Fill in module dependencies* fills in missing `requires` based on source code imports. New in 2024.1" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JavaEmptyModuleInfoFile", + "suppressToolId": "AbsoluteAlignmentInUserInterface", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14677,8 +14613,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -14690,19 +14626,19 @@ ] }, { - "id": "ClassMayBeInterface", + "id": "RedundantLambdaParameterType", "shortDescription": { - "text": "Abstract 'class' may be 'interface'" + "text": "Redundant lambda parameter types" }, "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)." + "text": "Reports lambda formal parameter types that are redundant because they can be inferred from the context. Example: 'Map map = ...\n map.forEach((String s, Integer i) -> log.info(s + \"=\" + i));' The quick-fix removes the parameter types from the lambda. 'Map 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 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 map = ...\n map.forEach((s, i) -> log.info(s + \"=\" + i));\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ClassMayBeInterface", + "suppressToolId": "RedundantLambdaParameterType", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -14710,8 +14646,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -14723,28 +14659,28 @@ ] }, { - "id": "UnnecessaryCallToStringValueOf", + "id": "ConditionalExpression", "shortDescription": { - "text": "Unnecessary conversion to 'String'" + "text": "Conditional expression" }, "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()`." + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryCallToStringValueOf", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConditionalExpression", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -14756,19 +14692,19 @@ ] }, { - "id": "StringReplaceableByStringBuffer", + "id": "SuspiciousReturnByteInputStream", "shortDescription": { - "text": "Non-constant 'String' can be replaced with 'StringBuilder'" + "text": "Suspicious byte value returned from 'InputStream.read()'" }, "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." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NonConstantStringShouldBeStringBuffer", + "suppressToolId": "SuspiciousReturnByteInputStream", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14776,8 +14712,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -14789,19 +14725,19 @@ ] }, { - "id": "FinallyBlockCannotCompleteNormally", + "id": "UseOfClone", "shortDescription": { - "text": "'finally' block which can not complete normally" + "text": "Use of 'clone()' or 'Cloneable'" }, "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" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "finally", + "suppressToolId": "UseOfClone", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14809,8 +14745,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Cloning issues", + "index": 116, "toolComponent": { "name": "QDJVM" } @@ -14822,28 +14758,28 @@ ] }, { - "id": "ConstantOnWrongSideOfComparison", + "id": "MissingFinalNewline", "shortDescription": { - "text": "Constant on wrong side of comparison" + "text": "Missing final new line" }, "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" + "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": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "ConstantOnWrongSideOfComparison", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MissingFinalNewline", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Manifest", + "index": 117, "toolComponent": { "name": "QDJVM" } @@ -14855,19 +14791,19 @@ ] }, { - "id": "UnnecessarilyQualifiedStaticallyImportedElement", + "id": "NestedTryStatement", "shortDescription": { - "text": "Unnecessarily qualified statically imported element" + "text": "Nested 'try' statement" }, "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" + "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": "UnnecessarilyQualifiedStaticallyImportedElement", + "suppressToolId": "NestedTryStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14875,8 +14811,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -14888,19 +14824,19 @@ ] }, { - "id": "ObjectToString", + "id": "NonStaticFinalLogger", "shortDescription": { - "text": "Call to default 'toString()'" + "text": "Non-constant logger" }, "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" + "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": "ObjectToString", + "suppressToolId": "NonConstantLogger", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14908,8 +14844,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Logging", + "index": 119, "toolComponent": { "name": "QDJVM" } @@ -14921,19 +14857,19 @@ ] }, { - "id": "UseOfJDBCDriverClass", + "id": "ConditionalExpressionWithIdenticalBranches", "shortDescription": { - "text": "Use of concrete JDBC driver class" + "text": "Conditional expression with identical branches" }, "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" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UseOfJDBCDriverClass", + "suppressToolId": "ConditionalExpressionWithIdenticalBranches", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14941,8 +14877,8 @@ "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -14954,19 +14890,19 @@ ] }, { - "id": "JDBCResource", + "id": "OnlyOneElementUsed", "shortDescription": { - "text": "JDBC resource opened but not safely closed" + "text": "Only one element is used" }, "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." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "JDBCResourceOpenedButNotSafelyClosed", + "suppressToolId": "OnlyOneElementUsed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -14974,8 +14910,8 @@ "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -14987,28 +14923,28 @@ ] }, { - "id": "LoggingSimilarMessage", + "id": "BadExceptionThrown", "shortDescription": { - "text": "Non-distinguishable logging calls" + "text": "Prohibited exception thrown" }, "fullDescription": { - "text": "Reports SLF4J, Log4j2 logging calls in one class, such as 'logger.info(\"message: {}\", key)' with similar log messages. These calls can be non-distinguishable from each other, and this introduces difficulties to understand where a certain log message is coming from. Example (for Java): 'private static void request1(String text) {\n log.info(\"Message: {}\", text); //similar call\n doSomething1();\n }\n\n private static void request2(int i) {\n log.info(\"Message: {}\", i); //similar call\n doSomething2();\n }' Use the Minimum length of a similar sequence option to set the minimum length of similar sequences after which calls will be reported Use the Do not report calls with the 'error' log level option to ignore messages with `error` log level and when there is an exception. It may be useful to hide the warnings, because call sites can still be located using stack traces New in 2024.1", - "markdown": "Reports SLF4J, Log4j2 logging calls in one class, such as `logger.info(\"message: {}\", key)` with similar log messages. These calls can be non-distinguishable from each other, and this introduces difficulties to understand where a certain log message is coming from.\n\n**Example (for Java):**\n\n\n private static void request1(String text) {\n log.info(\"Message: {}\", text); //similar call\n doSomething1();\n }\n\n private static void request2(int i) {\n log.info(\"Message: {}\", i); //similar call\n doSomething2();\n }\n\n* Use the **Minimum length of a similar sequence** option to set the minimum length of similar sequences after which calls will be reported\n* Use the **Do not report calls with the 'error' log level** option to ignore messages with \\`error\\` log level and when there is an exception. It may be useful to hide the warnings, because call sites can still be located using stack traces\n\nNew in 2024.1" + "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": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "LoggingSimilarMessage", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ProhibitedExceptionThrown", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages/Logging", - "index": 52, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -15020,28 +14956,28 @@ ] }, { - "id": "IfCanBeAssertion", + "id": "UnnecessaryBoxing", "shortDescription": { - "text": "Statement can be replaced with 'assert' or 'Objects.requireNonNull'" + "text": "Unnecessary boxing" }, "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. This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", - "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.\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + "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": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "IfCanBeAssertion", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "UnnecessaryBoxing", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -15053,19 +14989,19 @@ ] }, { - "id": "JavadocDeclaration", + "id": "Anonymous2MethodRef", "shortDescription": { - "text": "Javadoc declaration problems" + "text": "Anonymous type can be replaced with method reference" }, "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." + "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 };' After the quick-fix is applied: '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 depends on the Java feature 'Method references', which is available since Java 8.", + "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\nAfter the quick-fix is applied:\n\n\n 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 depends on the Java feature 'Method references', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JavadocDeclaration", + "suppressToolId": "Anonymous2MethodRef", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15073,8 +15009,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -15086,19 +15022,19 @@ ] }, { - "id": "AssignmentToMethodParameter", + "id": "PublicMethodNotExposedInInterface", "shortDescription": { - "text": "Assignment to method parameter" + "text": "'public' method not exposed in interface" }, "fullDescription": { - "text": "Reports assignment to, or modification of method parameters. Although occasionally intended, this construct may be confusing and is therefore prohibited in some Java projects. The quick-fix adds a declaration of a new variable. Example: 'void printTrimmed(String s) {\n s = s.trim();\n System.out.println(s);\n }' After the quick-fix is applied: 'void printTrimmed(String s) {\n String trimmed = s.trim();\n System.out.println(trimmed);\n }' Use the Ignore if assignment is a transformation of the original parameter option to ignore assignments that modify the parameter value based on its previous value.", - "markdown": "Reports assignment to, or modification of method parameters.\n\nAlthough occasionally intended, this construct may be confusing\nand is therefore prohibited in some Java projects.\n\nThe quick-fix adds a declaration of a new variable.\n\n**Example:**\n\n\n void printTrimmed(String s) {\n s = s.trim();\n System.out.println(s);\n }\n\nAfter the quick-fix is applied:\n\n\n void printTrimmed(String s) {\n String trimmed = s.trim();\n System.out.println(trimmed);\n }\n\n\nUse the **Ignore if assignment is a transformation of the original parameter** option to ignore assignments that modify\nthe parameter value based on its previous value." + "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": "AssignmentToMethodParameter", + "suppressToolId": "PublicMethodNotExposedInInterface", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15106,8 +15042,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -15119,19 +15055,19 @@ ] }, { - "id": "LocalVariableHidingMemberVariable", + "id": "SerializableHasSerialVersionUIDField", "shortDescription": { - "text": "Local variable hides field" + "text": "Serializable class without 'serialVersionUID'" }, "fullDescription": { - "text": "Reports local variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the variable where the identically named field is intended. A quick-fix is suggested to rename the variable. Example: 'public class Foo {\n public Object foo;\n\n void bar() {\n Object o = new Object() {\n void baz() {\n Object foo; // Local variable 'foo' hides field in class 'Foo'\n }\n };\n }\n }' You can configure the following options for this inspection: Ignore non-accessible fields - ignore local variables named identically to superclass fields that are not visible (for example, because they are private). Ignore local variables in a static context hiding non-static fields - for example when the local variable is inside a static method or inside a method which is inside a static inner class.", - "markdown": "Reports local variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the variable where the identically named field is intended.\n\nA quick-fix is suggested to rename the variable.\n\n**Example:**\n\n\n public class Foo {\n public Object foo;\n\n void bar() {\n Object o = new Object() {\n void baz() {\n Object foo; // Local variable 'foo' hides field in class 'Foo'\n }\n };\n }\n }\n\n\nYou can configure the following options for this inspection:\n\n1. **Ignore non-accessible fields** - ignore local variables named identically to superclass fields that are not visible (for example, because they are private).\n2. **Ignore local variables in a static context hiding non-static fields** - for example when the local variable is inside a static method or inside a method which is inside a static inner class." + "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": "LocalVariableHidesMemberVariable", + "suppressToolId": "serial", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15139,8 +15075,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -15152,19 +15088,19 @@ ] }, { - "id": "UnnecessaryTemporaryOnConversionToString", + "id": "TestCaseWithNoTestMethods", "shortDescription": { - "text": "Unnecessary temporary object in conversion to 'String'" + "text": "Test class without tests" }, "fullDescription": { - "text": "Reports unnecessary creation of temporary objects when converting from a primitive type to 'String'. Example: 'String foo = new Integer(3).toString();' After the quick-fix is applied: 'String foo = Integer.toString(3);'", - "markdown": "Reports unnecessary creation of temporary objects when converting from a primitive type to `String`.\n\n**Example:**\n\n\n String foo = new Integer(3).toString();\n\nAfter the quick-fix is applied:\n\n\n String foo = Integer.toString(3);\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryTemporaryOnConversionToString", + "suppressToolId": "JUnitTestCaseWithNoTests", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15172,8 +15108,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "JVM languages/Test frameworks", + "index": 123, "toolComponent": { "name": "QDJVM" } @@ -15185,19 +15121,23 @@ ] }, { - "id": "InterfaceMayBeAnnotatedFunctional", + "id": "MismatchedArrayReadWrite", "shortDescription": { - "text": "Interface may be annotated as '@FunctionalInterface'" + "text": "Mismatched read and write of array" }, "fullDescription": { - "text": "Reports interfaces that can be annotated with '@FunctionalInterface'. Annotating an interface with '@FunctionalInterface' indicates that the interface is functional and no more 'abstract' methods can be added to it. Example: 'interface FileProcessor {\n void execute(File file);\n }' After the quick-fix is applied: '@FunctionalInterface\n interface FileProcessor {\n void execute(File file);\n }' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "markdown": "Reports interfaces that can be annotated with `@FunctionalInterface`.\n\nAnnotating an interface with `@FunctionalInterface` indicates that the interface\nis functional and no more `abstract` methods can be added to it.\n\n**Example:**\n\n\n interface FileProcessor {\n void execute(File file);\n }\n\nAfter the quick-fix is applied:\n\n\n @FunctionalInterface\n interface FileProcessor {\n void execute(File file);\n }\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "InterfaceMayBeAnnotatedFunctional", + "suppressToolId": "MismatchedReadAndWriteOfArray", + "cweIds": [ + 561, + 563 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15205,8 +15145,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -15218,19 +15158,19 @@ ] }, { - "id": "BreakStatementWithLabel", + "id": "UnnecessarilyQualifiedStaticUsage", "shortDescription": { - "text": "'break' statement with label" + "text": "Unnecessarily qualified static access" }, "fullDescription": { - "text": "Reports 'break' statements with labels. Labeled 'break' statements complicate refactoring and can be confusing. Example: 'void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) break outer;\n handleChar(ch);\n }\n }\n }'", - "markdown": "Reports `break` statements with labels.\n\nLabeled `break` statements complicate refactoring and can be confusing.\n\nExample:\n\n\n void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) break outer;\n handleChar(ch);\n }\n }\n }\n" + "text": "Reports usages of static members unnecessarily qualified with the class name. Qualification with the class is unnecessary when the static member is available in a surrounding class or in a super class of a surrounding class. Such qualification 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 unnecessarily qualified with the class name.\n\n\nQualification with the class is unnecessary when the static member is available in a surrounding class\nor in a super class of a surrounding class. Such qualification 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": "BreakStatementWithLabel", + "suppressToolId": "UnnecessarilyQualifiedStaticUsage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15238,8 +15178,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -15251,22 +15191,19 @@ ] }, { - "id": "StringEquality", + "id": "SystemGetProperty", "shortDescription": { - "text": "String comparison using '==', instead of 'equals()'" + "text": "Call to 'System.getProperty(str)' could be simplified" }, "fullDescription": { - "text": "Reports code that uses of == or != to compare strings. These operators determine referential equality instead of comparing content. In most cases, strings should be compared using 'equals()', which does a character-by-character comparison when the strings are different objects. Example: 'void foo(String s, String t) {\n final boolean b = t == s;\n }' If 't' 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(String s, String t) {\n final boolean b = t.equals(s);\n }'", - "markdown": "Reports code that uses of **==** or **!=** to compare strings.\n\n\nThese operators determine referential equality instead of comparing content.\nIn most cases, strings should be compared using `equals()`,\nwhich does a character-by-character comparison when the strings are different objects.\n\n**Example:**\n\n\n void foo(String s, String t) {\n final boolean b = t == s;\n }\n\nIf `t` 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\n void foo(String s, String t) {\n final boolean b = t.equals(s);\n }\n" + "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": "StringEquality", - "cweIds": [ - 597 - ], + "suppressToolId": "SystemGetProperty", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15274,8 +15211,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -15287,19 +15224,19 @@ ] }, { - "id": "SuspiciousLiteralUnderscore", + "id": "CollectionsMustHaveInitialCapacity", "shortDescription": { - "text": "Suspicious underscore in number literal" + "text": "Collection without initial capacity" }, "fullDescription": { - "text": "Reports decimal number literals that use the underscore numeric separator with groups where the number of digits is not three. Such literals may contain a typo. This inspection will not warn on literals containing two consecutive underscores. It is also allowed to omit underscores in the fractional part of 'double' and 'float' literals. Example: 'int oneMillion = 1_000_0000;'", - "markdown": "Reports decimal number literals that use the underscore numeric separator with groups where the number of digits is not three. Such literals may contain a typo.\n\nThis inspection will not warn on literals containing two consecutive underscores.\nIt is also allowed to omit underscores in the fractional part of `double` and `float` literals.\n\n**Example:** `int oneMillion = 1_000_0000;`" + "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();' 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();\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": "SuspiciousLiteralUnderscore", + "suppressToolId": "CollectionWithoutInitialCapacity", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15307,8 +15244,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -15320,19 +15257,19 @@ ] }, { - "id": "StaticCallOnSubclass", + "id": "ClassOnlyUsedInOneModule", "shortDescription": { - "text": "Static method referenced via subclass" + "text": "Class only used from one other module" }, "fullDescription": { - "text": "Reports static method calls where the call is qualified by a subclass of the declaring class, rather than by the declaring class itself. Java allows such qualification for classes, but such calls may indicate a subtle confusion of inheritance and overriding. Example: 'class Parent {\n public static void print(String str) {}\n }\n class Child extends Parent {}\n\n Child.print(\"Hello, world!\");' After the quick-fix is applied: 'Parent.print(\"Hello, world!\");'", - "markdown": "Reports static method calls 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 for classes, but such calls\nmay indicate a subtle confusion of inheritance and overriding.\n\n**Example:**\n\n\n class Parent {\n public static void print(String str) {}\n }\n class Child extends Parent {}\n\n Child.print(\"Hello, world!\");\n\nAfter the quick-fix is applied:\n\n\n Parent.print(\"Hello, world!\");\n" + "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": "StaticMethodReferencedViaSubclass", + "suppressToolId": "ClassOnlyUsedInOneModule", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15340,8 +15277,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Modularization issues", + "index": 76, "toolComponent": { "name": "QDJVM" } @@ -15353,28 +15290,28 @@ ] }, { - "id": "ReadResolveAndWriteReplaceProtected", + "id": "TryStatementWithMultipleResources", "shortDescription": { - "text": "'readResolve()' or 'writeReplace()' not declared 'protected'" + "text": "'try' statement with multiple resources can be split" }, "fullDescription": { - "text": "Reports classes that implement 'java.io.Serializable' where the 'readResolve()' or 'writeReplace()' methods are not declared 'protected'. Declaring 'readResolve()' and 'writeReplace()' methods 'private' can force subclasses to silently ignore them, while declaring them 'public' allows them to be invoked by untrusted code. If the containing class is declared 'final', these methods can be declared 'private'. Example: 'class ClassWithSerialization implements Serializable {\n public Object writeReplace() { // warning: 'writeReplace()' not declared protected\n ...\n }\n }'", - "markdown": "Reports classes that implement `java.io.Serializable` where the `readResolve()` or `writeReplace()` methods are not declared `protected`.\n\n\nDeclaring `readResolve()` and `writeReplace()` methods `private`\ncan force subclasses to silently ignore them, while declaring them\n`public` allows them to be invoked by untrusted code.\n\n\nIf the containing class is declared `final`, these methods can be declared `private`.\n\n**Example:**\n\n\n class ClassWithSerialization implements Serializable {\n public Object writeReplace() { // warning: 'writeReplace()' not declared protected\n ...\n }\n }\n \n" + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ReadResolveAndWriteReplaceProtected", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "TryStatementWithMultipleResources", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -15386,19 +15323,19 @@ ] }, { - "id": "UnnecessaryLabelOnContinueStatement", + "id": "TypeMayBeWeakened", "shortDescription": { - "text": "Unnecessary label on 'continue' statement" + "text": "Type may be weakened" }, "fullDescription": { - "text": "Reports 'continue' statements with unnecessary labels. Example: 'LABEL:\n while (a > b) {\n System.out.println(\"Hello\");\n //the code below is the last statement in a loop,\n //so unnecessary label and continue can be removed\n continue LABEL;\n }'", - "markdown": "Reports `continue` statements with unnecessary labels.\n\nExample:\n\n\n LABEL:\n while (a > b) {\n System.out.println(\"Hello\");\n //the code below is the last statement in a loop,\n //so unnecessary label and continue can be removed\n continue LABEL;\n }\n" + "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 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 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": "UnnecessaryLabelOnContinueStatement", + "suppressToolId": "TypeMayBeWeakened", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15406,8 +15343,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -15419,19 +15356,19 @@ ] }, { - "id": "ParameterNamingConvention", + "id": "CloneableImplementsClone", "shortDescription": { - "text": "Method parameter naming convention" + "text": "Cloneable class without 'clone()' method" }, "fullDescription": { - "text": "Reports method parameters whose names are too short, too long, or do not follow the specified regular expression pattern. Example: 'void fooBar(int X)' should be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter. Configure the inspection: Use the fields in the Options section to specify the minimum length, maximum length, and a regular expression expected for method parameter names. Specify 0 in order not to check the length of names. Regular expressions should be specified in the standard 'java.util.regex' format.", - "markdown": "Reports method parameters whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:** `void fooBar(int X)`\nshould be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter.\n\nConfigure the inspection:\n\n\nUse the fields in the **Options** section to specify the minimum length, maximum length, and a regular expression expected for\nmethod parameter names. Specify **0** in order not to check the length of names.\n\nRegular expressions should be specified in the standard `java.util.regex` format." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MethodParameterNamingConvention", + "suppressToolId": "CloneableClassWithoutClone", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15439,8 +15376,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Cloning issues", + "index": 116, "toolComponent": { "name": "QDJVM" } @@ -15452,28 +15389,28 @@ ] }, { - "id": "MethodCanBeVariableArityMethod", + "id": "OctalAndDecimalIntegersMixed", "shortDescription": { - "text": "Method can have varargs parameter" + "text": "Octal and decimal integers in same array" }, "fullDescription": { - "text": "Reports methods that can be converted to variable arity methods. Example: 'void process(String name, Object[] objects);' After the quick-fix is applied: 'void process(String name, Object... objects);' This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.", - "markdown": "Reports methods that can be converted to variable arity methods.\n\n**Example:**\n\n\n void process(String name, Object[] objects);\n\nAfter the quick-fix is applied:\n\n\n void process(String name, Object... objects);\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5." + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "MethodCanBeVariableArityMethod", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "OctalAndDecimalIntegersInSameArray", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -15485,19 +15422,19 @@ ] }, { - "id": "AbstractClassNeverImplemented", + "id": "Deprecation", "shortDescription": { - "text": "Abstract class which has no concrete subclass" + "text": "Deprecated API usage" }, "fullDescription": { - "text": "Reports 'abstract' classes that have no concrete subclasses.", - "markdown": "Reports `abstract` classes that have no concrete subclasses." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "AbstractClassNeverImplemented", + "suppressToolId": "deprecation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15505,8 +15442,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -15518,28 +15455,28 @@ ] }, { - "id": "StreamToLoop", + "id": "ConditionSignal", "shortDescription": { - "text": "Stream API call chain can be replaced with loop" + "text": "Call to 'signal()' instead of 'signalAll()'" }, "fullDescription": { - "text": "Reports Stream API chains, 'Iterable.forEach()', and 'Map.forEach()' calls that can be automatically converted into classical loops. This can help to downgrade for backward compatibility with earlier Java versions. Example: 'String joinNonEmpty(List list) {\n return list.stream() // Stream can be converted to loop\n .filter(s -> !s.isEmpty())\n .map(String::trim)\n .collect(Collectors.joining(\", \"));\n }' After the quick-fix is applied: 'String joinNonEmpty(List list) {\n StringJoiner joiner = new StringJoiner(\", \");\n for (String s : list) {\n if (!s.isEmpty()) {\n String trim = s.trim();\n joiner.add(trim);\n }\n }\n return joiner.toString();\n }' Note that sometimes this inspection might cause slight semantic changes. Special care should be taken when it comes to short-circuiting, as it's not specified how many elements will be actually read when the stream short-circuits. Configure the inspection: Use the Iterate unknown Stream sources via Stream.iterator() option to suggest conversions for streams with unrecognized source. In this case, iterator will be created from the stream. For example, when checkbox is selected, the conversion will be suggested here: 'List handles = ProcessHandle.allProcesses().collect(Collectors.toList());' In this case, the result will be as follows: 'List handles = new ArrayList<>();\n for (Iterator it = ProcessHandle.allProcesses().iterator(); it.hasNext(); ) {\n ProcessHandle allProcess = it.next();\n handles.add(allProcess);\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2017.1", - "markdown": "Reports Stream API chains, `Iterable.forEach()`, and `Map.forEach()` calls that can be automatically converted into classical loops. This can help to downgrade for backward compatibility with earlier Java versions.\n\n**Example:**\n\n\n String joinNonEmpty(List list) {\n return list.stream() // Stream can be converted to loop\n .filter(s -> !s.isEmpty())\n .map(String::trim)\n .collect(Collectors.joining(\", \"));\n }\n\nAfter the quick-fix is applied:\n\n\n String joinNonEmpty(List list) {\n StringJoiner joiner = new StringJoiner(\", \");\n for (String s : list) {\n if (!s.isEmpty()) {\n String trim = s.trim();\n joiner.add(trim);\n }\n }\n return joiner.toString();\n }\n\n\nNote that sometimes this inspection might cause slight semantic changes.\nSpecial care should be taken when it comes to short-circuiting, as it's not specified how many elements will be actually read when\nthe stream short-circuits.\n\nConfigure the inspection:\n\nUse the **Iterate unknown Stream sources via Stream.iterator()** option to suggest conversions for streams with unrecognized source.\nIn this case, iterator will be created from the stream.\nFor example, when checkbox is selected, the conversion will be suggested here:\n\n\n List handles = ProcessHandle.allProcesses().collect(Collectors.toList());\n\nIn this case, the result will be as follows:\n\n\n List handles = new ArrayList<>();\n for (Iterator it = ProcessHandle.allProcesses().iterator(); it.hasNext(); ) {\n ProcessHandle allProcess = it.next();\n handles.add(allProcess);\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2017.1" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "StreamToLoop", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CallToSignalInsteadOfSignalAll", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -15551,19 +15488,19 @@ ] }, { - "id": "NotifyWithoutCorrespondingWait", + "id": "PublicMethodWithoutLogging", "shortDescription": { - "text": "'notify()' without corresponding 'wait()'" + "text": "'public' method without logging" }, "fullDescription": { - "text": "Reports calls to 'Object.notify()' or 'Object.notifyAll()' for which no call to a corresponding 'Object.wait()' can be found. Only calls that target fields of the current class are reported by this inspection. Example: 'synchronized (synList) {\n synList.notify(); //synList.wait() is never called\n }'", - "markdown": "Reports calls to `Object.notify()` or `Object.notifyAll()` for which no call to a corresponding `Object.wait()` can be found.\n\nOnly calls that target fields of the current class are reported by this inspection.\n\n**Example:**\n\n\n synchronized (synList) {\n synList.notify(); //synList.wait() is never called\n }\n" + "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": "NotifyWithoutCorrespondingWait", + "suppressToolId": "PublicMethodWithoutLogging", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15571,8 +15508,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Logging", + "index": 119, "toolComponent": { "name": "QDJVM" } @@ -15584,19 +15521,19 @@ ] }, { - "id": "ClassInitializerMayBeStatic", + "id": "ClassNestingDepth", "shortDescription": { - "text": "Class initializer may be 'static'" + "text": "Inner class too deeply nested" }, "fullDescription": { - "text": "Reports instance initializers which may be made 'static'. An instance initializer may be static if it does not reference any of its class' non-static members. Static initializers are executed once the class is resolved, while instance initializers are executed on each instantiation of the class. This inspection doesn't report instance empty initializers and initializers in anonymous classes. Example: 'class A {\n public static String CONSTANT;\n {\n CONSTANT = \"Hello\";\n }\n }' After the quick-fix is applied: 'class A {\n public static String CONSTANT;\n static {\n CONSTANT = \"Hello\"; //now initialized only once per class\n }\n }'", - "markdown": "Reports instance initializers which may be made `static`.\n\n\nAn instance initializer may be static if it does not reference any of its class' non-static members.\nStatic initializers are executed once the class is resolved,\nwhile instance initializers are executed on each instantiation of the class.\n\nThis inspection doesn't report instance empty initializers and initializers in anonymous classes.\n\n**Example:**\n\n\n class A {\n public static String CONSTANT;\n {\n CONSTANT = \"Hello\";\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n public static String CONSTANT;\n static {\n CONSTANT = \"Hello\"; //now initialized only once per class\n }\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassInitializerMayBeStatic", + "suppressToolId": "InnerClassTooDeeplyNested", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15604,8 +15541,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -15617,28 +15554,28 @@ ] }, { - "id": "MagicCharacter", + "id": "LambdaParameterTypeCanBeSpecified", "shortDescription": { - "text": "Magic character" + "text": "Lambda parameter type can be specified" }, "fullDescription": { - "text": "Reports character literals that are used without constant declaration. These characters might result in bad code readability. Also, there might be errors if a character is changed only in one location but not everywhere in code. Example: 'char c = 'c';'", - "markdown": "Reports character literals that are used without constant declaration. These characters might result in bad code readability. Also, there might be errors if a character is changed only in one location but not everywhere in code.\n\n**Example:**\n\n char c = 'c';\n" + "text": "Reports lambda parameters that do not have their type specified and suggests adding the missing type declarations. Example: 'Function length = a -> a.length();' After the quick-fix is applied: 'Function length = (String a) -> a.length();' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "markdown": "Reports lambda parameters that do not have their type specified and suggests adding the missing type declarations.\n\nExample:\n\n\n Function length = a -> a.length();\n\nAfter the quick-fix is applied:\n\n\n Function length = (String a) -> a.length();\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "MagicCharacter", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LambdaParameterTypeCanBeSpecified", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -15650,19 +15587,19 @@ ] }, { - "id": "SlowAbstractSetRemoveAll", + "id": "TextLabelInSwitchStatement", "shortDescription": { - "text": "Call to 'set.removeAll(list)' may work slowly" + "text": "Text label in 'switch' statement" }, "fullDescription": { - "text": "Reports calls to 'java.util.Set.removeAll()' with a 'java.util.List' argument. Such a call can be slow when the size of the argument is greater than or equal to the size of the set, and the set is a subclass of 'java.util.AbstractSet'. In this case, 'List.contains()' is called for each element in the set, which will perform a linear search. Example: 'public void check(String... ss) {\n // possible O(n^2) complexity\n mySet.removeAll(List.of(ss));\n }' After the quick fix is applied: 'public void check(String... ss) {\n // O(n) complexity\n List.of(ss).forEach(mySet::remove);\n }' New in 2020.3", - "markdown": "Reports calls to `java.util.Set.removeAll()` with a `java.util.List` argument.\n\n\nSuch a call can be slow when the size of the argument is greater than or equal to the size of the set,\nand the set is a subclass of `java.util.AbstractSet`.\nIn this case, `List.contains()` is called for each element in the set, which will perform a linear search.\n\n**Example:**\n\n\n public void check(String... ss) {\n // possible O(n^2) complexity\n mySet.removeAll(List.of(ss));\n }\n\nAfter the quick fix is applied:\n\n\n public void check(String... ss) {\n // O(n) complexity\n List.of(ss).forEach(mySet::remove);\n }\n\nNew in 2020.3" + "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": "SlowAbstractSetRemoveAll", + "suppressToolId": "TextLabelInSwitchStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15670,8 +15607,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -15683,19 +15620,19 @@ ] }, { - "id": "ArrayEquality", + "id": "PackageVisibleInnerClass", "shortDescription": { - "text": "Array comparison using '==', instead of 'Arrays.equals()'" + "text": "Package-visible nested class" }, "fullDescription": { - "text": "Reports operators '==' and '!=' used to test for array equality. In most cases, testing for the equality of array contents is intended, which can be done with the 'java.util.Arrays.equals()' method. A quick-fix is suggested to replace '==' with 'java.util.Arrays.equals()'. Example: 'void foo(Object[] x, Object[] y) {\n boolean comparison = x == y;\n }' After the quick-fix is applied: 'void foo(Object[] x, Object[] y) {\n boolean comparison = Arrays.equals(x, y);\n }'", - "markdown": "Reports operators `==` and `!=` used to test for array equality. In most cases, testing for the equality of array contents is intended, which can be done with the `java.util.Arrays.equals()` method.\n\n\nA quick-fix is suggested to replace `==` with `java.util.Arrays.equals()`.\n\n**Example:**\n\n\n void foo(Object[] x, Object[] y) {\n boolean comparison = x == y;\n }\n\nAfter the quick-fix is applied:\n\n\n void foo(Object[] x, Object[] y) {\n boolean comparison = Arrays.equals(x, y);\n }\n" + "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": "ArrayEquality", + "suppressToolId": "PackageVisibleInnerClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15703,8 +15640,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -15716,19 +15653,19 @@ ] }, { - "id": "StaticCollection", + "id": "UnnecessaryUnaryMinus", "shortDescription": { - "text": "Static collection" + "text": "Unnecessary unary minus" }, "fullDescription": { - "text": "Reports static fields of a 'Collection' type. While it's not necessarily a problem, static collections often cause memory leaks and are therefore prohibited by some coding standards. Example: 'public class Example {\n static List list = new ArrayList<>();\n\n }' Configure the inspection: Use the Ignore weak static collections or maps option to ignore the fields of the 'java.util.WeakHashMap' type.", - "markdown": "Reports static fields of a `Collection` type. While it's not necessarily a problem, static collections often cause memory leaks and are therefore prohibited by some coding standards.\n\n**Example:**\n\n\n public class Example {\n static List list = new ArrayList<>();\n\n }\n\n\nConfigure the inspection:\n\n* Use the **Ignore weak static collections or maps** option to ignore the fields of the `java.util.WeakHashMap` type." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "StaticCollection", + "suppressToolId": "UnnecessaryUnaryMinus", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15736,8 +15673,8 @@ "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -15749,19 +15686,19 @@ ] }, { - "id": "NonExceptionNameEndsWithException", + "id": "MethodMayBeStatic", "shortDescription": { - "text": "Non-exception class name ends with 'Exception'" + "text": "Method can be made 'static'" }, "fullDescription": { - "text": "Reports non-'exception' classes whose names end with 'Exception'. Such classes may cause confusion by breaking a common naming convention and often indicate that the 'extends Exception' clause is missing. Example: 'public class NotStartedException {}' A quick-fix that renames such classes is available only in the editor.", - "markdown": "Reports non-`exception` classes whose names end with `Exception`.\n\nSuch classes may cause confusion by breaking a common naming convention and\noften indicate that the `extends Exception` clause is missing.\n\n**Example:**\n\n public class NotStartedException {}\n\nA quick-fix that renames such classes is available only in the editor." + "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": "NonExceptionNameEndsWithException", + "suppressToolId": "MethodMayBeStatic", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15769,8 +15706,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Class", - "index": 80, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -15782,19 +15719,19 @@ ] }, { - "id": "SystemGC", + "id": "TestMethodWithoutAssertion", "shortDescription": { - "text": "Call to 'System.gc()' or 'Runtime.gc()'" + "text": "Test method without assertions" }, "fullDescription": { - "text": "Reports 'System.gc()' or 'Runtime.gc()' calls. While occasionally useful in testing, explicitly triggering garbage collection via 'System.gc()' is almost never recommended in production code and can result in serious performance issues.", - "markdown": "Reports `System.gc()` or `Runtime.gc()` calls. While occasionally useful in testing, explicitly triggering garbage collection via `System.gc()` is almost never recommended in production code and can result in serious performance issues." + "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": "CallToSystemGC", + "suppressToolId": "TestMethodWithoutAssertion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15802,8 +15739,8 @@ "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "JVM languages/Test frameworks", + "index": 123, "toolComponent": { "name": "QDJVM" } @@ -15815,19 +15752,19 @@ ] }, { - "id": "ClassComplexity", + "id": "EscapedSpace", "shortDescription": { - "text": "Overly complex class" + "text": "Non-terminal use of '\\s' escape sequence" }, "fullDescription": { - "text": "Reports 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. Too high complexity indicates that the class should be refactored into several smaller classes. Use the Cyclomatic complexity limit field below to specify the maximum allowed complexity for a class.", - "markdown": "Reports 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\nToo high complexity indicates that the class should be refactored into several smaller classes.\n\nUse the **Cyclomatic complexity limit** field below to specify the maximum allowed complexity for a class." + "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 depends on the Java feature ''\\s' escape sequences', which is available since Java 15. 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 depends on the Java feature ''\\\\s' escape sequences', which is available since Java 15.\n\nNew in 2022.3" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OverlyComplexClass", + "suppressToolId": "EscapedSpace", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15835,8 +15772,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -15848,23 +15785,19 @@ ] }, { - "id": "OverflowingLoopIndex", + "id": "ContinueStatement", "shortDescription": { - "text": "Loop executes zero or billions of times" + "text": "'continue' statement" }, "fullDescription": { - "text": "Reports loops that cannot be completed without an index overflow or loops that don't loop at all. It usually happens because of a mistake in the update operation. Example: 'void foo(int s) {\n for (int i = s; i > 12; i++) { // i-- should be here\n System.out.println(i);\n }\n }' New in 2019.1", - "markdown": "Reports loops that cannot be completed without an index overflow or loops that don't loop at all. It usually happens because of a mistake in the update operation.\n\nExample:\n\n\n void foo(int s) {\n for (int i = s; i > 12; i++) { // i-- should be here\n System.out.println(i);\n }\n }\n\nNew in 2019.1" + "text": "Reports 'continue' statements. 'continue' statements complicate refactoring and can be confusing. Example: 'void foo(List 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 strs) {\n for (String str : strs) {\n if (str.contains(\"skip\")) continue;\n handleStr(str);\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OverflowingLoopIndex", - "cweIds": [ - 691, - 835 - ], + "suppressToolId": "ContinueStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15872,8 +15805,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -15885,19 +15818,19 @@ ] }, { - "id": "InnerClassMayBeStatic", + "id": "MisorderedAssertEqualsArguments", "shortDescription": { - "text": "Inner class may be 'static'" + "text": "Misordered 'assertEquals()' arguments" }, "fullDescription": { - "text": "Reports inner classes that can be made 'static'. A 'static' inner class does not keep an implicit reference to its enclosing instance. When using Java 17 or before, this prevents a common cause of memory leaks and uses less memory per instance of the class. Example: 'public class Outer {\n class Inner { // not static\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }' After the quick-fix is applied: 'public class Outer {\n static class Inner {\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }'", - "markdown": "Reports inner classes that can be made `static`.\n\nA `static` inner class does not keep an implicit reference to its enclosing instance.\nWhen using Java 17 or before,\nthis prevents a common cause of memory leaks and uses less memory per instance of the class.\n\n**Example:**\n\n\n public class Outer {\n class Inner { // not static\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Outer {\n static class Inner {\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InnerClassMayBeStatic", + "suppressToolId": "MisorderedAssertEqualsArguments", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15905,8 +15838,8 @@ "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "Java/Test frameworks", + "index": 130, "toolComponent": { "name": "QDJVM" } @@ -15918,19 +15851,19 @@ ] }, { - "id": "SetReplaceableByEnumSet", + "id": "StaticVariableInitialization", "shortDescription": { - "text": "'Set' can be replaced with 'EnumSet'" + "text": "Static field may not be initialized" }, "fullDescription": { - "text": "Reports instantiations of 'java.util.Set' objects whose content types are enumerated classes. Such 'Set' objects can be replaced with 'java.util.EnumSet' objects. 'EnumSet' implementations can be much more efficient compared to other sets, as the underlying data structure is a bit vector. Use the quick-fix to replace the initializer with a call to 'EnumSet.noneOf()'. This quick-fix is not available when the type of the variable is a sub-class of 'Set'. Example: 'enum MyEnum { FOO, BAR; }\n\n Set enums = new HashSet();' After the quick-fix is applied: 'enum MyEnum { FOO, BAR; }\n\n Set enums = EnumSet.noneOf(MyEnum.class);'", - "markdown": "Reports instantiations of `java.util.Set` objects whose content types are enumerated classes. Such `Set` objects can be replaced with `java.util.EnumSet` objects.\n\n\n`EnumSet` implementations can be much more efficient compared to\nother sets, as the underlying data structure is a bit vector. Use the quick-fix to replace the initializer with a call to\n`EnumSet.noneOf()`. This quick-fix is not available when the type of the variable is a sub-class of `Set`.\n\n**Example:**\n\n\n enum MyEnum { FOO, BAR; }\n\n Set enums = new HashSet();\n\nAfter the quick-fix is applied:\n\n\n enum MyEnum { FOO, BAR; }\n\n Set enums = EnumSet.noneOf(MyEnum.class);\n" + "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": "SetReplaceableByEnumSet", + "suppressToolId": "StaticVariableMayNotBeInitialized", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15938,8 +15871,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -15951,19 +15884,23 @@ ] }, { - "id": "Java9UndeclaredServiceUsage", + "id": "ConstantAssertCondition", "shortDescription": { - "text": "Usage of service not declared in 'module-info'" + "text": "Constant condition in 'assert' statement" }, "fullDescription": { - "text": "Reports situations in which a service is loaded with 'java.util.ServiceLoader' but it isn't declared with the 'uses' clause in the 'module-info.java' file and suggests inserting it. This inspection depends on the Java feature 'Modules', which is available since Java 9. New in 2018.1", - "markdown": "Reports situations in which a service is loaded with `java.util.ServiceLoader` but it isn't declared with the `uses` clause in the `module-info.java` file and suggests inserting it.\n\nThis inspection depends on the Java feature 'Modules', which is available since Java 9.\n\nNew in 2018.1" + "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 }' This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", + "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\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "Java9UndeclaredServiceUsage", + "suppressToolId": "ConstantAssertCondition", + "cweIds": [ + 570, + 571 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -15971,8 +15908,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -15984,19 +15921,19 @@ ] }, { - "id": "CallToSimpleSetterInClass", + "id": "JavaReflectionInvocation", "shortDescription": { - "text": "Call to simple setter from within class" + "text": "Reflective invocation arguments mismatch" }, "fullDescription": { - "text": "Reports calls to a simple property setter from within the property's class. A simple property setter is defined as one which simply assigns the value of its parameter to a field, and does no other calculations. Such simple setter calls can be safely inlined. Some coding standards also suggest against the use of simple setters for code clarity reasons. Example: 'class Foo {\n private int index;\n public Foo(int idx) {\n setIndex(idx);\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }' After the quick-fix is applied: 'class Foo {\n private int index;\n public Foo(int idx) {\n index = idx;\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }' Use the following options to configure the inspection: Whether to only report setter calls on 'this', not on objects of the same type passed in as a parameter. Whether to ignore non-'private' setters.", - "markdown": "Reports calls to a simple property setter from within the property's class.\n\n\nA simple property setter is defined as one which simply assigns the value of its parameter to a field,\nand does no other calculations. Such simple setter calls can be safely inlined.\nSome coding standards also suggest against the use of simple setters for code clarity reasons.\n\n**Example:**\n\n\n class Foo {\n private int index;\n public Foo(int idx) {\n setIndex(idx);\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n private int index;\n public Foo(int idx) {\n index = idx;\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }\n\nUse the following options to configure the inspection:\n\n* Whether to only report setter calls on `this`, not on objects of the same type passed in as a parameter.\n* Whether to ignore non-`private` setters." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CallToSimpleSetterFromWithinClass", + "suppressToolId": "JavaReflectionInvocation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16004,8 +15941,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Reflective access", + "index": 131, "toolComponent": { "name": "QDJVM" } @@ -16017,19 +15954,19 @@ ] }, { - "id": "UnnecessaryFinalOnLocalVariableOrParameter", + "id": "CaughtExceptionImmediatelyRethrown", "shortDescription": { - "text": "Unnecessary 'final' on local variable or parameter" + "text": "Caught exception is immediately rethrown" }, "fullDescription": { - "text": "Reports local variables or parameters unnecessarily declared 'final'. Some coding standards frown upon variables declared 'final' for reasons of terseness. Example: 'class Foo {\n Foo(Object o) {}\n\n void bar(final Object o) {\n new Foo(o);\n }\n }' After the quick-fix is applied: 'class Foo {\n Foo(Object o) {}\n\n void bar(Object o) {\n new Foo(o);\n }\n }' Use the inspection options to toggle the reporting for: local variables parameters (including parameters of 'catch' blocks and enhanced 'for' statements) Also, you can configure the inspection to only report 'final' parameters of 'abstract' or interface methods, which may be considered extra unnecessary as such markings don't affect the implementation of these methods.", - "markdown": "Reports local variables or parameters unnecessarily declared `final`.\n\nSome coding standards frown upon variables declared `final` for reasons of terseness.\n\n**Example:**\n\n\n class Foo {\n Foo(Object o) {}\n\n void bar(final Object o) {\n new Foo(o);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n Foo(Object o) {}\n\n void bar(Object o) {\n new Foo(o);\n }\n }\n\n\nUse the inspection options to toggle the reporting for:\n\n* local variables\n* parameters (including parameters of `catch` blocks and enhanced `for` statements)\n\n\nAlso, you can configure the inspection to only report `final` parameters of `abstract` or interface\nmethods, which may be considered extra unnecessary as such markings don't\naffect the implementation of these methods." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryFinalOnLocalVariableOrParameter", + "suppressToolId": "CaughtExceptionImmediatelyRethrown", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16037,8 +15974,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -16050,19 +15987,22 @@ ] }, { - "id": "NonBooleanMethodNameMayNotStartWithQuestion", + "id": "ArrayHashCode", "shortDescription": { - "text": "Non-boolean method name must not start with question word" + "text": "'hashCode()' called on array" }, "fullDescription": { - "text": "Reports non-boolean methods whose names start with a question word. Such method names may be confusing. Non-boolean methods that override library methods are ignored by this inspection. Example: 'public void hasName(String name) {\n assert names.contains(name);\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 the question words that should be used only for boolean methods. Use the Ignore methods with 'java.lang.Boolean' return type option to ignore methods with 'java.lang.Boolean' return type. Use the Ignore methods overriding/implementing a super method option to ignore methods which have supers.", - "markdown": "Reports non-boolean methods whose names start with a question word. Such method names may be confusing.\n\nNon-boolean methods that override library methods are ignored by this inspection.\n\n**Example:**\n\n\n public void hasName(String name) {\n assert names.contains(name);\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 the question words that should be used only for boolean methods.\n* Use the **Ignore methods with 'java.lang.Boolean' return type** option to ignore methods with `java.lang.Boolean` return type.\n* Use the **Ignore methods overriding/implementing a super method** option to ignore methods which have supers." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NonBooleanMethodNameMayNotStartWithQuestion", + "suppressToolId": "ArrayHashCode", + "cweIds": [ + 328 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16070,8 +16010,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -16083,19 +16023,19 @@ ] }, { - "id": "WeakerAccess", + "id": "WaitNotInLoop", "shortDescription": { - "text": "Declaration access can be weaker" + "text": "'wait()' not called in loop" }, "fullDescription": { - "text": "Reports fields, methods or classes that may have their access modifier narrowed down. Example: 'class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n void bar(String x, String y) { } // can be private\n }' After the quick-fix is applied: 'class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n private void bar(String x, String y) { }\n }' Use the inspection's options to define the rules for the modifier change suggestions.", - "markdown": "Reports fields, methods or classes that may have their access modifier narrowed down.\n\nExample:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n void bar(String x, String y) { } // can be private\n }\n\nAfter the quick-fix is applied:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n private void bar(String x, String y) { }\n }\n\nUse the inspection's options to define the rules for the modifier change suggestions." + "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": "WeakerAccess", + "suppressToolId": "WaitNotInLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16103,8 +16043,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -16116,28 +16056,28 @@ ] }, { - "id": "ReplaceWithJavadoc", + "id": "ExternalizableWithSerializationMethods", "shortDescription": { - "text": "Comment replaceable with Javadoc" + "text": "Externalizable class with 'readObject()' or 'writeObject()'" }, "fullDescription": { - "text": "Reports a regular comment that belongs to a field, method, or class that can be replaced with a Javadoc comment. Example: 'public class Main {\n /*\n * Hello,\n */\n // World!\n void f() {\n }\n }' After the quick-fix is applied: 'public class Main {\n /**\n * Hello,\n * World!\n */\n void f() {\n }\n }'", - "markdown": "Reports a regular comment that belongs to a field, method, or class that can be replaced with a Javadoc comment.\n\n**Example:**\n\n\n public class Main {\n /*\n * Hello,\n */\n // World!\n void f() {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Main {\n /**\n * Hello,\n * World!\n */\n void f() {\n }\n }\n" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceWithJavadoc", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ExternalizableClassWithSerializationMethods", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -16149,19 +16089,19 @@ ] }, { - "id": "WrapperTypeMayBePrimitive", + "id": "SafeLock", "shortDescription": { - "text": "Wrapper type may be primitive" + "text": "Lock acquired but not safely unlocked" }, "fullDescription": { - "text": "Reports local variables of wrapper type that are mostly used as primitive types. In some cases, boxing can be source of significant performance penalty, especially in loops. Heuristics are applied to estimate the number of boxing operations. For example, conversions inside loops are considered as much more numerous. Example: 'public void example() {\n Integer value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}' After the quick-fix is applied: 'public void example() {\n int value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}' New in 2018.2", - "markdown": "Reports local variables of wrapper type that are mostly used as primitive types.\n\nIn some cases, boxing can be source of significant performance penalty, especially in loops.\n\nHeuristics are applied to estimate the number of boxing operations. For example, conversions inside loops are considered\nas much more numerous.\n\n**Example:**\n\n public void example() {\n Integer value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}\n\nAfter the quick-fix is applied:\n\n public void example() {\n int value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}\n\n\nNew in 2018.2" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "WrapperTypeMayBePrimitive", + "suppressToolId": "LockAcquiredButNotSafelyReleased", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16169,8 +16109,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -16182,22 +16122,19 @@ ] }, { - "id": "EmptyStatementBody", + "id": "JavaLangInvokeHandleSignature", "shortDescription": { - "text": "Statement with empty body" + "text": "MethodHandle/VarHandle type mismatch" }, "fullDescription": { - "text": "Reports 'if', 'while', 'do', 'for', and 'switch' statements with empty bodies. While occasionally intended, such code is confusing and is often the result of a typo. This inspection is disabled in JSP files.", - "markdown": "Reports `if`, `while`, `do`, `for`, and `switch` statements with empty bodies.\n\nWhile occasionally intended, such code is confusing and is often the result of a typo.\n\nThis inspection is disabled in JSP files." + "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": "StatementWithEmptyBody", - "cweIds": [ - 561 - ], + "suppressToolId": "JavaLangInvokeHandleSignature", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16205,8 +16142,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Reflective access", + "index": 131, "toolComponent": { "name": "QDJVM" } @@ -16218,19 +16155,19 @@ ] }, { - "id": "EmptyFinallyBlock", + "id": "ReturnThis", "shortDescription": { - "text": "Empty 'finally' block" + "text": "Return of 'this'" }, "fullDescription": { - "text": "Reports empty 'finally' blocks. Empty 'finally' blocks usually indicate coding errors. They may also remain after code refactoring and can safely be removed. This inspection doesn't report empty 'finally' blocks found in JSP files. Example: 'try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n\n }' After the quick-fix is applied: 'try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }'", - "markdown": "Reports empty `finally` blocks.\n\nEmpty `finally` blocks usually indicate coding errors. They may also remain after code refactoring and can safely be removed.\n\nThis inspection doesn't report empty `finally` blocks found in JSP files.\n\n**Example:**\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EmptyFinallyBlock", + "suppressToolId": "ReturnOfThis", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16238,8 +16175,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -16251,19 +16188,19 @@ ] }, { - "id": "InconsistentLanguageLevel", + "id": "CanBeFinal", "shortDescription": { - "text": "Inconsistent language level settings" + "text": "Declaration can have 'final' modifier" }, "fullDescription": { - "text": "Reports modules which depend on other modules with a higher language level. Such dependencies should be removed or the language level of the module be increased. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", - "markdown": "Reports modules which depend on other modules with a higher language level.\n\nSuch dependencies should be removed or the language level of the module be increased.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor." + "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": "InconsistentLanguageLevel", + "suppressToolId": "CanBeFinal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16271,8 +16208,8 @@ "relationships": [ { "target": { - "id": "Java/Modularization issues", - "index": 76, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -16284,19 +16221,19 @@ ] }, { - "id": "EnumerationCanBeIteration", + "id": "UnnecessaryLabelOnBreakStatement", "shortDescription": { - "text": "Enumeration can be iteration" + "text": "Unnecessary label on 'break' statement" }, "fullDescription": { - "text": "Reports calls to 'Enumeration' methods that are used on collections and may be replaced with equivalent 'Iterator' constructs. Example: 'Enumeration keys = map.keys();\n while (keys.hasMoreElements()) {\n String name = keys.nextElement();\n }' After the quick-fix is applied: 'Iterator iterator = map.keySet().iterator();\n while (iterator.hasNext()) {\n String name = iterator.next();\n }'", - "markdown": "Reports calls to `Enumeration` methods that are used on collections and may be replaced with equivalent `Iterator` constructs.\n\n**Example:**\n\n\n Enumeration keys = map.keys();\n while (keys.hasMoreElements()) {\n String name = keys.nextElement();\n }\n\nAfter the quick-fix is applied:\n\n\n Iterator iterator = map.keySet().iterator();\n while (iterator.hasNext()) {\n String name = iterator.next();\n }\n" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "EnumerationCanBeIteration", + "suppressToolId": "UnnecessaryLabelOnBreakStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16304,8 +16241,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids", - "index": 70, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -16317,19 +16254,19 @@ ] }, { - "id": "FinalStaticMethod", + "id": "NakedNotify", "shortDescription": { - "text": "'static' method declared 'final'" + "text": "'notify()' or 'notifyAll()' without corresponding state change" }, "fullDescription": { - "text": "Reports static methods that are marked as 'final'. Such code might indicate an error or an incorrect assumption about the effect of the 'final' keyword. Static methods are not subject to runtime polymorphism, so the only purpose of the 'final' keyword used with static methods is to ensure the method will not be hidden in a subclass.", - "markdown": "Reports static methods that are marked as `final`.\n\nSuch code might indicate an error or an incorrect assumption about the effect of the `final` keyword.\nStatic methods are not subject to runtime polymorphism, so the only purpose of the `final` keyword used with static methods\nis to ensure the method will not be hidden in a subclass." + "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": "FinalStaticMethod", + "suppressToolId": "NakedNotify", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16337,8 +16274,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -16350,19 +16287,19 @@ ] }, { - "id": "RedundantTypeArguments", + "id": "ClassCoupling", "shortDescription": { - "text": "Redundant type arguments" + "text": "Overly coupled class" }, "fullDescription": { - "text": "Reports calls to parametrized methods with explicit argument types that can be omitted since they will be unambiguously inferred by the compiler. Using redundant type arguments is unnecessary and makes the code less readable. Example: 'List list = Arrays.asList(\"Hello\", \"World\");' A quick-fix is provided to remove redundant type arguments: 'List list = Arrays.asList(\"Hello\", \"World\");'", - "markdown": "Reports calls to parametrized methods with explicit argument types that can be omitted since they will be unambiguously inferred by the compiler.\n\n\nUsing redundant type arguments is unnecessary and makes the code less readable.\n\nExample:\n\n\n List list = Arrays.asList(\"Hello\", \"World\");\n\nA quick-fix is provided to remove redundant type arguments:\n\n\n List list = Arrays.asList(\"Hello\", \"World\");\n" + "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": "RedundantTypeArguments", + "suppressToolId": "OverlyCoupledClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16370,8 +16307,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -16383,19 +16320,19 @@ ] }, { - "id": "FieldHasSetterButNoGetter", + "id": "EmptySynchronizedStatement", "shortDescription": { - "text": "Field has setter but no getter" + "text": "Empty 'synchronized' statement" }, "fullDescription": { - "text": "Reports fields that have setter methods but no getter methods. In certain bean containers, when used within the Java beans specification, such fields might be difficult to work with.", - "markdown": "Reports fields that have setter methods but no getter methods.\n\n\nIn certain bean containers, when used within the Java beans specification, such fields might be difficult\nto work with." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "FieldHasSetterButNoGetter", + "suppressToolId": "EmptySynchronizedStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16403,8 +16340,8 @@ "relationships": [ { "target": { - "id": "Java/JavaBeans issues", - "index": 141, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -16416,26 +16353,19 @@ ] }, { - "id": "RuntimeExecWithNonConstantString", + "id": "TextBlockMigration", "shortDescription": { - "text": "Call to 'Runtime.exec()' with non-constant string" + "text": "Text block can be used" }, "fullDescription": { - "text": "Reports calls to 'java.lang.Runtime.exec()' which take a dynamically-constructed string as the command to execute. Constructed execution strings are a common source of security breaches. By default, this inspection ignores compile-time constants. Example: 'String i = getUserInput();\n Runtime runtime = Runtime.getRuntime();\n runtime.exec(\"foo\" + i); // reports warning' 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: 'static final String COMMAND = \"ping \" + getDomainFromUserInput() + \"'\";'", - "markdown": "Reports calls to `java.lang.Runtime.exec()` which take a dynamically-constructed string as the command to execute.\n\n\nConstructed execution strings are a common source of security breaches.\nBy default, this inspection ignores compile-time constants.\n\n**Example:**\n\n\n String i = getUserInput();\n Runtime runtime = Runtime.getRuntime();\n runtime.exec(\"foo\" + i); // reports warning\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 static final String COMMAND = \"ping \" + getDomainFromUserInput() + \"'\";\n" + "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 Report single string literals option to highlight single literals containing line breaks. The quick-fix will still be available even when this option is disabled. Example: 'String html = \"\\n\" +\n \" \\n\" +\n \"

Hello, world

\\n\" +\n \" \\n\" +\n \"\\n\";' After the quick-fix is applied: 'String html = \"\"\"\n \n \n

Hello, world

\n \n \n \"\"\";' This inspection depends on the Java feature 'Text block literals', which is available since Java 15. 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 **Report single string literals** option to highlight single literals containing line breaks.\nThe quick-fix will still be available even when this option is disabled.\n\n\n**Example:**\n\n\n String html = \"\\n\" +\n \" \\n\" +\n \"

Hello, world

\\n\" +\n \" \\n\" +\n \"\\n\";\n\nAfter the quick-fix is applied:\n\n\n String html = \"\"\"\n \n \n

Hello, world

\n \n \n \"\"\";\n\nThis inspection depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2019.3" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToRuntimeExecWithNonConstantString", - "cweIds": [ - 20, - 77, - 78, - 88, - 94 - ], + "suppressToolId": "TextBlockMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16443,8 +16373,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Java language level migration aids/Java 15", + "index": 132, "toolComponent": { "name": "QDJVM" } @@ -16456,19 +16386,19 @@ ] }, { - "id": "ErrorRethrown", + "id": "ObjectAllocationInLoop", "shortDescription": { - "text": "'Error' not rethrown" + "text": "Object allocation in loop" }, "fullDescription": { - "text": "Reports 'try' statements that catch 'java.lang.Error' or any of its subclasses and do not rethrow the error. Statements that catch 'java.lang.ThreadDeath' are not reported. Example: 'try {\n executeTests(request);\n }\n catch (OutOfMemoryError ex) { // warning: Error 'ex' not rethrown\n return false;\n }'", - "markdown": "Reports `try` statements that catch `java.lang.Error` or any of its subclasses and do not rethrow the error.\n\nStatements that catch `java.lang.ThreadDeath` are not\nreported.\n\n**Example:**\n\n\n try {\n executeTests(request);\n }\n catch (OutOfMemoryError ex) { // warning: Error 'ex' not rethrown\n return false;\n }\n" + "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": "ErrorNotRethrown", + "suppressToolId": "ObjectAllocationInLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16476,8 +16406,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -16489,19 +16419,19 @@ ] }, { - "id": "CyclicPackageDependency", + "id": "ChainedEquality", "shortDescription": { - "text": "Cyclic package dependency" + "text": "Chained equality comparisons" }, "fullDescription": { - "text": "Reports packages that are mutually or cyclically dependent on other packages. 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 packages that are mutually or cyclically dependent on other packages.\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." + "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": "CyclicPackageDependency", + "suppressToolId": "ChainedEqualityComparisons", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16509,8 +16439,8 @@ "relationships": [ { "target": { - "id": "Java/Dependency issues", - "index": 146, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -16522,22 +16452,19 @@ ] }, { - "id": "SystemSetSecurityManager", + "id": "NonFinalClone", "shortDescription": { - "text": "Call to 'System.setSecurityManager()'" + "text": "Non-final 'clone()' in secure context" }, "fullDescription": { - "text": "Reports calls to 'System.setSecurityManager()'. While often benign, any call to 'System.setSecurityManager()' should be closely examined in any security audit.", - "markdown": "Reports calls to `System.setSecurityManager()`.\n\nWhile often benign, any call to `System.setSecurityManager()` should be closely examined in any security audit." + "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": "CallToSystemSetSecurityManager", - "cweIds": [ - 250 - ], + "suppressToolId": "NonFinalClone", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16558,23 +16485,19 @@ ] }, { - "id": "UnsatisfiedRange", + "id": "LossyConversionCompoundAssignment", "shortDescription": { - "text": "Return value is outside of declared range" + "text": "Possibly lossy implicit cast in compound assignment" }, "fullDescription": { - "text": "Reports numeric values returned from methods that don't conform to the declared method return range. You can declare method return range using a number of annotations: 'org.jetbrains.annotations.Range' from JetBrains annotations package (specify 'from' and 'to') 'org.checkerframework.common.value.qual.IntRange' from Checker Framework annotations package (specify 'from' and 'to') 'org.checkerframework.checker.index.qual.GTENegativeOne' from Checker Framework annotations package (range is '>= -1') 'org.checkerframework.checker.index.qual.NonNegative' from Checker Framework annotations package (range is '>= 0') 'org.checkerframework.checker.index.qual.Positive' from Checker Framework annotations package (range is '> 0') 'javax.annotation.Nonnegative' from JSR 305 annotations package (range is '>= 0') 'javax.validation.constraints.Min' (specify minimum value) 'javax.validation.constraints.Max' (specify maximum value) Example: '@Range(from = 0, to = Integer.MAX_VALUE) int getValue() {\n // Warning: -1 is outside of declared range\n return -1;\n }' New in 2021.2", - "markdown": "Reports numeric values returned from methods that don't conform to the declared method return range. You can declare method return range using a number of annotations:\n\n* `org.jetbrains.annotations.Range` from JetBrains annotations package (specify 'from' and 'to')\n* `org.checkerframework.common.value.qual.IntRange` from Checker Framework annotations package (specify 'from' and 'to')\n* `org.checkerframework.checker.index.qual.GTENegativeOne` from Checker Framework annotations package (range is '\\>= -1')\n* `org.checkerframework.checker.index.qual.NonNegative` from Checker Framework annotations package (range is '\\>= 0')\n* `org.checkerframework.checker.index.qual.Positive` from Checker Framework annotations package (range is '\\> 0')\n* `javax.annotation.Nonnegative` from JSR 305 annotations package (range is '\\>= 0')\n* `javax.validation.constraints.Min` (specify minimum value)\n* `javax.validation.constraints.Max` (specify maximum value)\n\nExample:\n\n\n @Range(from = 0, to = Integer.MAX_VALUE) int getValue() {\n // Warning: -1 is outside of declared range\n return -1;\n }\n\nNew in 2021.2" + "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": "UnsatisfiedRange", - "cweIds": [ - 129, - 682 - ], + "suppressToolId": "lossy-conversions", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16582,8 +16505,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -16595,19 +16518,19 @@ ] }, { - "id": "ClassWithTooManyDependencies", + "id": "ThrowFromFinallyBlock", "shortDescription": { - "text": "Class with too many dependencies" + "text": "'throw' inside 'finally' block" }, "fullDescription": { - "text": "Reports classes that are directly dependent on too many other classes in the project. Modifications to any dependency of such classes may require changing the class, thus making it prone to instability. Only top-level classes are reported. Use the Maximum number of dependencies field to specify the maximum allowed number of 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 dependent on too many other classes in the project.\n\nModifications to any dependency of such classes may require changing the class, thus making it prone to instability.\n\nOnly top-level classes are reported.\n\nUse the **Maximum number of dependencies** field to specify the maximum allowed number of dependencies for 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." + "text": "Reports 'throw' statements inside 'finally' blocks. While occasionally intended, such 'throw' statements can hide exceptions thrown from the 'try' and 'catch' blocks, thereby complicating the debugging process. Example: 'class Fascinating {\n void doTask(Task t) {\n try {\n t.activity();\n } finally {\n if (!t.finish()) {\n throw new IllegalStateException();\n }\n }\n }\n }' Use the Warn everywhere declared exceptions may be thrown option to warn on method calls to methods that declare exceptions as well.", + "markdown": "Reports `throw` statements inside `finally` blocks. While occasionally intended, such `throw` statements can hide exceptions thrown from the `try` and `catch` blocks, thereby complicating the debugging process.\n\n**Example:**\n\n\n class Fascinating {\n void doTask(Task t) {\n try {\n t.activity();\n } finally {\n if (!t.finish()) {\n throw new IllegalStateException();\n }\n }\n }\n }\n\nUse the **Warn everywhere declared exceptions may be thrown** option\nto warn on method calls to methods that declare exceptions as well." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ClassWithTooManyDependencies", + "suppressToolId": "ThrowFromFinallyBlock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16615,8 +16538,8 @@ "relationships": [ { "target": { - "id": "Java/Dependency issues", - "index": 146, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -16628,19 +16551,19 @@ ] }, { - "id": "ClassWithoutNoArgConstructor", + "id": "StaticNonFinalField", "shortDescription": { - "text": "Class without no-arg constructor" + "text": "'static', non-'final' field" }, "fullDescription": { - "text": "Reports classes without a constructor that takes no arguments (i.e. has no parameters). No-arg constructors are necessary in some contexts. For example, if a class needs to be created using reflection. Example: 'public class Bean {\n private String name;\n\n public Bean(String name) {\n this.name = name;\n }\n }' Use the checkbox below to ignore classes without explicit constructors. The compiler provides a default no-arg constructor to such classes.", - "markdown": "Reports classes without a constructor that takes no arguments (i.e. has no parameters). No-arg constructors are necessary in some contexts. For example, if a class needs to be created using reflection.\n\n**Example:**\n\n\n public class Bean {\n private String name;\n\n public Bean(String name) {\n this.name = name;\n }\n }\n\n\nUse the checkbox below to ignore classes without explicit constructors.\nThe compiler provides a default no-arg constructor to such classes." + "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": "ClassWithoutNoArgConstructor", + "suppressToolId": "StaticNonFinalField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16648,8 +16571,8 @@ "relationships": [ { "target": { - "id": "Java/JavaBeans issues", - "index": 141, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -16661,22 +16584,19 @@ ] }, { - "id": "CastConflictsWithInstanceof", + "id": "EmptyMethod", "shortDescription": { - "text": "Cast conflicts with 'instanceof'" + "text": "Empty method" }, "fullDescription": { - "text": "Reports type cast expressions that are preceded by an 'instanceof' check for a different type. Although this might be intended, such a construct is most likely an error, and will result in a 'java.lang.ClassCastException' at runtime. Example: 'class Main {\n int whenCharSequenceCastToNumber(Object o){\n if (o instanceof CharSequence) {\n return ((Number) o).intValue();\n }\n return 0;\n }\n\n int earlyReturnWhenNotCharSequence(Object o){\n if (!(o instanceof CharSequence)) return 0;\n return ((Number)o).intValue();\n }\n }'", - "markdown": "Reports type cast expressions that are preceded by an `instanceof` check for a different type.\n\n\nAlthough this might be intended, such a construct is most likely an error, and will\nresult in a `java.lang.ClassCastException` at runtime.\n\n**Example:**\n\n\n class Main {\n int whenCharSequenceCastToNumber(Object o){\n if (o instanceof CharSequence) {\n return ((Number) o).intValue();\n }\n return 0;\n }\n\n int earlyReturnWhenNotCharSequence(Object o){\n if (!(o instanceof CharSequence)) return 0;\n return ((Number)o).intValue();\n }\n }\n" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "CastConflictsWithInstanceof", - "cweIds": [ - 704 - ], + "suppressToolId": "EmptyMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16684,8 +16604,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -16697,19 +16617,19 @@ ] }, { - "id": "Contract", + "id": "SimplifiableEqualsExpression", "shortDescription": { - "text": "Contract issues" + "text": "Unnecessary 'null' check before 'equals()' call" }, "fullDescription": { - "text": "Reports issues in method '@Contract' annotations. The types of issues that can be reported are: Errors in contract syntax Contracts that do not conform to the method signature (wrong parameter count) Method implementations that contradict the contract (e.g. return 'true' when the contract says 'false') Example: '// method has no parameters, but contract expects 1\n @Contract(\"_ -> fail\")\n void x() {\n throw new AssertionError();\n }'", - "markdown": "Reports issues in method `@Contract` annotations. The types of issues that can be reported are:\n\n* Errors in contract syntax\n* Contracts that do not conform to the method signature (wrong parameter count)\n* Method implementations that contradict the contract (e.g. return `true` when the contract says `false`)\n\nExample:\n\n\n // method has no parameters, but contract expects 1\n @Contract(\"_ -> fail\")\n void x() {\n throw new AssertionError();\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "Contract", + "suppressToolId": "SimplifiableEqualsExpression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16717,8 +16637,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -16730,19 +16650,19 @@ ] }, { - "id": "NewExceptionWithoutArguments", + "id": "NonCommentSourceStatements", "shortDescription": { - "text": "Exception constructor called without arguments" + "text": "Overly long method" }, "fullDescription": { - "text": "Reports creation of a exception instance without any arguments specified. When an exception is constructed without any arguments, it contains no information about the problem that occurred, which makes debugging needlessly hard. Example: 'throw new IOException(); // warning: exception without arguments'", - "markdown": "Reports creation of a exception instance without any arguments specified.\n\nWhen an exception is constructed without any arguments, it contains no information about the problem that occurred, which makes\ndebugging needlessly hard.\n\n**Example:**\n\n\n throw new IOException(); // warning: exception without arguments\n" + "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": "NewExceptionWithoutArguments", + "suppressToolId": "OverlyLongMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16750,8 +16670,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -16763,28 +16683,28 @@ ] }, { - "id": "EnhancedSwitchBackwardMigration", + "id": "ConfusingMainMethod", "shortDescription": { - "text": "Enhanced 'switch'" + "text": "Confusing 'main()' method" }, "fullDescription": { - "text": "Reports enhanced 'switch' statements and expressions. Suggests replacing them with regular 'switch' statements. Example: 'boolean even = switch (condition) {\n case 1, 3, 5, 7, 9 -> false;\n default -> true;\n };' After the quick-fix is applied: 'boolean even;\n switch (condition) {\n case 1:\n case 3:\n case 5:\n case 7:\n case 9:\n even = false;\n break;\n default:\n even = true;\n break;\n}' Enhanced 'switch' appeared in Java 14. This inspection can help to downgrade for backward compatibility with earlier Java versions. New in 2019.1", - "markdown": "Reports enhanced `switch` statements and expressions. Suggests replacing them with regular `switch` statements.\n\n**Example:**\n\n\n boolean even = switch (condition) {\n case 1, 3, 5, 7, 9 -> false;\n default -> true;\n };\n\nAfter the quick-fix is applied:\n\n\n boolean even;\n switch (condition) {\n case 1:\n case 3:\n case 5:\n case 7:\n case 9:\n even = false;\n break;\n default:\n even = true;\n break;\n }\n\n\n*Enhanced* `switch` appeared in Java 14.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions.\n\nNew in 2019.1" + "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": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "EnhancedSwitchBackwardMigration", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ConfusingMainMethod", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 14", - "index": 138, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -16796,28 +16716,28 @@ ] }, { - "id": "PackageWithTooManyClasses", + "id": "MultipleVariablesInDeclaration", "shortDescription": { - "text": "Package with too many classes" + "text": "Multiple variables in one declaration" }, "fullDescription": { - "text": "Reports packages that contain too many classes. Overly large packages may indicate a lack of design clarity. 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 allowed number of classes in a package.", - "markdown": "Reports packages that contain too many classes.\n\nOverly large packages may indicate a lack of design clarity.\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 allowed number of classes in a package." + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "PackageWithTooManyClasses", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MultipleVariablesInDeclaration", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Packaging issues", - "index": 44, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -16829,28 +16749,28 @@ ] }, { - "id": "LoggingGuardedByCondition", + "id": "IOResource", "shortDescription": { - "text": "Logging calls guarded by log condition" + "text": "I/O resource opened but not safely closed" }, "fullDescription": { - "text": "Reports logging calls surrounded with a guard condition. This inspection can be used to adjust with a custom code style. Example: 'public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }' After a quick-fix is applied: 'public class TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }' This inspection supports Log4j2 and the SLF4J logging frameworks (except builders). New in 2024.2", - "markdown": "Reports logging calls surrounded with a guard condition. This inspection can be used to adjust with a custom code style.\n\n**Example:**\n\n\n public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }\n\nAfter a quick-fix is applied:\n\n\n public class TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n\nThis inspection supports *Log4j2* and the *SLF4J* logging frameworks (except builders).\n\nNew in 2024.2" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "LoggingGuardedByCondition", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "IOResourceOpenedButNotSafelyClosed", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages/Logging", - "index": 52, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -16862,19 +16782,19 @@ ] }, { - "id": "TryFinallyCanBeTryWithResources", + "id": "CallToSimpleGetterInClass", "shortDescription": { - "text": "'try finally' can be replaced with 'try' with resources" + "text": "Call to simple getter from within class" }, "fullDescription": { - "text": "Reports 'try'-'finally' statements that can use Java 7 Automatic Resource Management, which is less error-prone. A quick-fix is available to convert a 'try'-'finally' statement into a 'try'-with-resources statement. Example: 'PrintStream printStream = new PrintStream(fileName);\n try {\n printStream.print(true);\n } finally {\n printStream.close();\n }' A quick-fix is provided to pass the cause to a constructor: 'try (PrintStream printStream = new PrintStream(fileName)) {\n printStream.print(true);\n }' This inspection depends on the Java feature 'Try-with-resources', which is available since Java 7.", - "markdown": "Reports `try`-`finally` statements that can use Java 7 Automatic Resource Management, which is less error-prone.\n\nA quick-fix is available to convert a `try`-`finally`\nstatement into a `try`-with-resources statement.\n\n**Example:**\n\n\n PrintStream printStream = new PrintStream(fileName);\n try {\n printStream.print(true);\n } finally {\n printStream.close();\n }\n\nA quick-fix is provided to pass the cause to a constructor:\n\n\n try (PrintStream printStream = new PrintStream(fileName)) {\n printStream.print(true);\n }\n\nThis inspection depends on the Java feature 'Try-with-resources', which is available since Java 7." + "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": "TryFinallyCanBeTryWithResources", + "suppressToolId": "CallToSimpleGetterFromWithinClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16882,8 +16802,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 7", - "index": 161, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -16895,19 +16815,19 @@ ] }, { - "id": "SamePackageImport", + "id": "NonSerializableFieldInSerializableClass", "shortDescription": { - "text": "Unnecessary import from the same package" + "text": "Non-serializable field in a 'Serializable' class" }, "fullDescription": { - "text": "Reports 'import' statements that refer to the same package as the containing file. Same-package files 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 same package as the containing file.\n\n\nSame-package files are always implicitly imported, so such `import`\nstatements are redundant and confusing.\n\n\nSince IntelliJ IDEA can automatically detect and fix such statements with its **Optimize Imports**\ncommand, this inspection is mostly useful for offline reporting on code bases that you\ndon't intend to change." + "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": "SamePackageImport", + "suppressToolId": "NonSerializableFieldInSerializableClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16915,8 +16835,8 @@ "relationships": [ { "target": { - "id": "Java/Imports", - "index": 24, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -16928,28 +16848,28 @@ ] }, { - "id": "ThreadLocalSetWithNull", + "id": "EnhancedSwitchMigration", "shortDescription": { - "text": "'ThreadLocal.set()' with null as an argument" + "text": "Statement can be replaced with enhanced 'switch'" }, "fullDescription": { - "text": "Reports 'java.lang.ThreadLocal.set()' with null as an argument. This call does not free the resources, and it may cause a memory leak. It may happen because: Firstly, 'ThreadLocal.set(null)' finds a map associated with the current Thread. If there is no such a map, it will be created It sets key and value: 'map.set(this, value)', where 'this' refers to instance of 'ThreadLocal' 'java.lang.ThreadLocal.remove()' should be used to free the resources. Example: 'ThreadLocal threadLocal = new ThreadLocal<>();\n threadLocal.set(null);' After the quick-fix is applied: 'threadLocal.remove();' New in 2023.2", - "markdown": "Reports `java.lang.ThreadLocal.set()` with null as an argument.\n\nThis call does not free the resources, and it may cause a memory leak.\nIt may happen because:\n\n* Firstly, `ThreadLocal.set(null)` finds a map associated with the current Thread. If there is no such a map, it will be created\n* It sets key and value: `map.set(this, value)`, where `this` refers to instance of `ThreadLocal`\n\n`java.lang.ThreadLocal.remove()` should be used to free the resources.\n\nExample:\n\n\n ThreadLocal threadLocal = new ThreadLocal<>();\n threadLocal.set(null);\n\nAfter the quick-fix is applied:\n\n\n threadLocal.remove();\n\nNew in 2023.2" + "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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14. 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 depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14.\n\nNew in 2019.1" }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "ThreadLocalSetWithNull", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "EnhancedSwitchMigration", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Java language level migration aids/Java 14", + "index": 138, "toolComponent": { "name": "QDJVM" } @@ -16961,19 +16881,19 @@ ] }, { - "id": "MissingJavadoc", + "id": "DoubleLiteralMayBeFloatLiteral", "shortDescription": { - "text": "Missing Javadoc" + "text": "Cast to 'float' can be 'float' literal" }, "fullDescription": { - "text": "Reports missing Javadoc comments and tags. Example: '/**\n * Missing \"@param\" is reported (if configured).\n */\n public void sample(int param){\n }' The quick-fixes add missing tag or missing Javadoc comment: '/**\n * Missing \"@param\" is reported (if configured).\n * @param param\n */\n public void sample(int param){\n }' Inspection can be configured to ignore deprecated elements or simple accessor methods like 'getField()' or 'setField()'. You can also use options below to configure required tags and minimal required visibility for the specific code elements like method, field, class, package, module.", - "markdown": "Reports missing Javadoc comments and tags.\n\nExample:\n\n\n /**\n * Missing \"@param\" is reported (if configured).\n */\n public void sample(int param){\n }\n\nThe quick-fixes add missing tag or missing Javadoc comment:\n\n\n /**\n * Missing \"@param\" is reported (if configured).\n * @param param\n */\n public void sample(int param){\n }\n\n\nInspection can be configured to ignore deprecated elements or simple accessor methods like `getField()` or `setField()`.\nYou can also use options below to configure required tags and minimal required visibility for the specific code elements like method, field, class, package, module." + "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": "MissingJavadoc", + "suppressToolId": "DoubleLiteralMayBeFloatLiteral", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -16981,8 +16901,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Numeric issues/Cast", + "index": 139, "toolComponent": { "name": "QDJVM" } @@ -16994,19 +16914,19 @@ ] }, { - "id": "AwaitWithoutCorrespondingSignal", + "id": "OverloadedMethodsWithSameNumberOfParameters", "shortDescription": { - "text": "'await()' without corresponding 'signal()'" + "text": "Overloaded methods with same number of parameters" }, "fullDescription": { - "text": "Reports calls to 'Condition.await()', for which no call to a corresponding 'Condition.signal()' or 'Condition.signalAll()' can be found. Calling 'Condition.await()' in a thread without corresponding 'Condition.signal()' may cause the thread to become disabled until it is interrupted or \"spurious wakeup\" occurs. Only calls that target fields of the current class are reported by this inspection. Example: 'class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n // isEmpty.signal();\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n isEmpty.await(); // 'await()' doesn't contain corresponding 'signal()'/'signalAll()' call\n // ...\n }\n }'", - "markdown": "Reports calls to `Condition.await()`, for which no call to a corresponding `Condition.signal()` or `Condition.signalAll()` can be found.\n\n\nCalling `Condition.await()` in a thread without corresponding `Condition.signal()` may cause the thread\nto become disabled until it is interrupted or \"spurious wakeup\" occurs.\n\nOnly calls that target fields of the current class are reported by this inspection.\n\n**Example:**\n\n\n class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n // isEmpty.signal();\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n isEmpty.await(); // 'await()' doesn't contain corresponding 'signal()'/'signalAll()' call\n // ...\n }\n }\n" + "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 void execute(RunnableFuture 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 void execute(RunnableFuture c) {}\n }\n\n\nUse the option to ignore overloaded methods whose parameter types are definitely incompatible." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AwaitWithoutCorrespondingSignal", + "suppressToolId": "OverloadedMethodsWithSameNumberOfParameters", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17014,8 +16934,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -17027,19 +16947,19 @@ ] }, { - "id": "UnnecessaryLocalVariable", + "id": "OverlyLongLambda", "shortDescription": { - "text": "Redundant local variable" + "text": "Overly long lambda expression" }, "fullDescription": { - "text": "Reports unnecessary local variables that add nothing to the comprehensibility of a method, including: Local variables that are immediately returned. Local variables that are immediately assigned to another variable and then not used. Local variables that always have the same value as another local variable or parameter. Example: 'boolean yes() {\n boolean b = true;\n return b;\n }' After the quick-fix is applied: 'boolean yes() {\n return true;\n }' Configure the inspection: Use the Ignore immediately returned or thrown variables option to ignore immediately returned or thrown variables. Some coding styles suggest using such variables for clarity and ease of debugging. Use the Ignore variables which have an annotation option to ignore annotated variables.", - "markdown": "Reports unnecessary local variables that add nothing to the comprehensibility of a method, including:\n\n* Local variables that are immediately returned.\n* Local variables that are immediately assigned to another variable and then not used.\n* Local variables that always have the same value as another local variable or parameter.\n\n**Example:**\n\n\n boolean yes() {\n boolean b = true;\n return b;\n }\n\nAfter the quick-fix is applied:\n\n\n boolean yes() {\n return true;\n }\n \nConfigure the inspection:\n\n* Use the **Ignore immediately returned or thrown variables** option to ignore immediately returned or thrown variables. Some coding styles suggest using such variables for clarity and ease of debugging.\n* Use the **Ignore variables which have an annotation** option to ignore annotated variables." + "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": "UnnecessaryLocalVariable", + "suppressToolId": "OverlyLongLambda", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17047,8 +16967,8 @@ "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -17060,19 +16980,19 @@ ] }, { - "id": "Java9RedundantRequiresStatement", + "id": "ParametersPerMethod", "shortDescription": { - "text": "Redundant 'requires' directive in module-info" + "text": "Method with too many parameters" }, "fullDescription": { - "text": "Reports redundant 'requires' directives in Java Platform Module System 'module-info.java' files. A 'requires' directive is redundant when a module 'A' requires a module 'B', but the code in module 'A' doesn't import any packages or classes from 'B'. Furthermore, all modules have an implicitly declared dependence on the 'java.base' module, therefore a 'requires java.base;' directive is always redundant. The quick-fix deletes the redundant 'requires' directive. If the deleted dependency re-exported modules that are actually used, the fix adds a 'requires' directives for these modules. This inspection only reports if the language level of the project or module is 9 or higher. New in 2017.1", - "markdown": "Reports redundant `requires` directives in Java Platform Module System `module-info.java` files. A `requires` directive is redundant when a module `A` requires a module `B`, but the code in module `A` doesn't import any packages or classes from `B`. Furthermore, all modules have an implicitly declared dependence on the `java.base` module, therefore a `requires java.base;` directive is always redundant.\n\n\nThe quick-fix deletes the redundant `requires` directive.\nIf the deleted dependency re-exported modules that are actually used, the fix adds a `requires` directives for these modules.\n\nThis inspection only reports if the language level of the project or module is 9 or higher.\n\nNew in 2017.1" + "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": "Java9RedundantRequiresStatement", + "suppressToolId": "MethodWithTooManyParameters", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17080,8 +17000,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -17093,19 +17013,19 @@ ] }, { - "id": "BusyWait", + "id": "CloneDeclaresCloneNotSupported", "shortDescription": { - "text": "Busy wait" + "text": "'clone()' does not declare 'CloneNotSupportedException'" }, "fullDescription": { - "text": "Reports calls to 'java.lang.Thread.sleep()' that occur inside loops. Such calls are indicative of \"busy-waiting\". Busy-waiting is often inefficient, and may result in unexpected deadlocks as busy-waiting threads do not release locked resources. Example: 'class X {\n volatile int x;\n public void waitX() throws Exception {\n while (x > 0) {\n Thread.sleep(10);//warning: Call to 'Thread.sleep()' in a loop, probably busy-waiting\n }\n }\n }'", - "markdown": "Reports calls to `java.lang.Thread.sleep()` that occur inside loops.\n\nSuch calls\nare indicative of \"busy-waiting\". Busy-waiting is often inefficient, and may result in unexpected deadlocks\nas busy-waiting threads do not release locked resources.\n\n**Example:**\n\n\n class X {\n volatile int x;\n public void waitX() throws Exception {\n while (x > 0) {\n Thread.sleep(10);//warning: Call to 'Thread.sleep()' in a loop, probably busy-waiting\n }\n }\n }\n" + "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": "BusyWait", + "suppressToolId": "CloneDoesntDeclareCloneNotSupportedException", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17113,8 +17033,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Cloning issues", + "index": 116, "toolComponent": { "name": "QDJVM" } @@ -17126,28 +17046,28 @@ ] }, { - "id": "ForLoopWithMissingComponent", + "id": "BooleanExpressionMayBeConditional", "shortDescription": { - "text": "'for' loop with missing components" + "text": "Boolean expression can be replaced with conditional expression" }, "fullDescription": { - "text": "Reports 'for' loops that lack initialization, condition, or update clauses. Some coding styles prohibit such loops. Example: 'for (int i = 0;;i++) {\n // body\n }' Use the Ignore collection iterations option to ignore loops which use an iterator. This is a standard way to iterate over a collection in which the 'for' loop does not have an update clause.", - "markdown": "Reports `for` loops that lack initialization, condition, or update clauses. Some coding styles prohibit such loops.\n\nExample:\n\n\n for (int i = 0;;i++) {\n // body\n }\n\n\nUse the **Ignore collection iterations** option to ignore loops which use an iterator.\nThis is a standard way to iterate over a collection in which the `for` loop does not have an update clause." + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ForLoopWithMissingComponent", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "BooleanExpressionMayBeConditional", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { "id": "Java/Control flow issues", - "index": 30, + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -17159,19 +17079,19 @@ ] }, { - "id": "OverwrittenKey", + "id": "UnnecessaryExplicitNumericCast", "shortDescription": { - "text": "Overwritten Map, Set, or array element" + "text": "Unnecessary explicit numeric cast" }, "fullDescription": { - "text": "Reports code that overwrites a 'Map' key, a 'Set' element, or an array element in a sequence of 'add'/'put' calls or using a Java 9 factory method like 'Set.of' (which will result in runtime exception). This usually occurs due to a copy-paste error. Example: 'map.put(\"A\", 1);\n map.put(\"B\", 2);\n map.put(\"C\", 3);\n map.put(\"D\", 4);\n map.put(\"A\", 5); // duplicating key \"A\", overwrites the previously written entry' New in 2017.3", - "markdown": "Reports code that overwrites a `Map` key, a `Set` element, or an array element in a sequence of `add`/`put` calls or using a Java 9 factory method like `Set.of` (which will result in runtime exception).\n\nThis usually occurs due to a copy-paste error.\n\n**Example:**\n\n\n map.put(\"A\", 1);\n map.put(\"B\", 2);\n map.put(\"C\", 3);\n map.put(\"D\", 4);\n map.put(\"A\", 5); // duplicating key \"A\", overwrites the previously written entry\n\nNew in 2017.3" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OverwrittenKey", + "suppressToolId": "UnnecessaryExplicitNumericCast", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17179,8 +17099,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Numeric issues/Cast", + "index": 139, "toolComponent": { "name": "QDJVM" } @@ -17192,19 +17112,19 @@ ] }, { - "id": "AnonymousClassMethodCount", + "id": "TransientFieldNotInitialized", "shortDescription": { - "text": "Anonymous class with too many methods" + "text": "Transient field is not initialized on deserialization" }, "fullDescription": { - "text": "Reports anonymous inner classes whose method count exceeds the specified maximum. Anonymous classes with numerous methods may be difficult to understand and should be promoted to become named inner classes. Use the Method count limit field to specify the maximum allowed number of methods in an anonymous inner class.", - "markdown": "Reports anonymous inner classes whose method count exceeds the specified maximum.\n\nAnonymous classes with numerous methods may be\ndifficult to understand and should be promoted to become named inner classes.\n\nUse the **Method count limit** field to specify the maximum allowed number of methods in an anonymous inner class." + "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": "AnonymousInnerClassWithTooManyMethods", + "suppressToolId": "TransientFieldNotInitialized", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17212,8 +17132,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -17225,19 +17145,19 @@ ] }, { - "id": "OptionalOfNullableMisuse", + "id": "PropertyValueSetToItself", "shortDescription": { - "text": "Use of Optional.ofNullable with null or not-null argument" + "text": "Property value set to itself" }, "fullDescription": { - "text": "Reports uses of 'Optional.ofNullable()' where always null or always not-null argument is passed. There's no point in using 'Optional.ofNullable()' in this case: either 'Optional.empty()' or 'Optional.of()' should be used to explicitly state the intent of creating an always-empty or always non-empty optional respectively. It's also possible that there's a mistake in 'Optional.ofNullable()' argument, so it should be examined. Example: 'Optional empty = Optional.ofNullable(null); // should be Optional.empty();\nOptional present = Optional.ofNullable(\"value\"); // should be Optional.of(\"value\");' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports uses of `Optional.ofNullable()` where always null or always not-null argument is passed. There's no point in using `Optional.ofNullable()` in this case: either `Optional.empty()` or `Optional.of()` should be used to explicitly state the intent of creating an always-empty or always non-empty optional respectively. It's also possible that there's a mistake in `Optional.ofNullable()` argument, so it should be examined.\n\n\nExample:\n\n\n Optional empty = Optional.ofNullable(null); // should be Optional.empty();\n Optional present = Optional.ofNullable(\"value\"); // should be Optional.of(\"value\"); \n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OptionalOfNullableMisuse", + "suppressToolId": "PropertyValueSetToItself", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17245,8 +17165,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/JavaBeans issues", + "index": 141, "toolComponent": { "name": "QDJVM" } @@ -17258,22 +17178,19 @@ ] }, { - "id": "CastToIncompatibleInterface", + "id": "ClassInitializer", "shortDescription": { - "text": "Cast to incompatible type" + "text": "Non-'static' initializer" }, "fullDescription": { - "text": "Reports type cast expressions where the casted expression has a class/interface type that neither extends/implements the cast class/interface type, nor has subclasses that do. Such a construct is likely erroneous, and will throw a 'java.lang.ClassCastException' at runtime. Example: 'interface A {}\n interface Z {}\n static class C {}\n\n void x(C c) {\n if (c instanceof Z) {\n A a = ((A)c); // cast to incompatible interface 'A'\n }\n }'", - "markdown": "Reports type cast expressions where the casted expression has a class/interface type that neither extends/implements the cast class/interface type, nor has subclasses that do.\n\n\nSuch a construct is likely erroneous, and will\nthrow a `java.lang.ClassCastException` at runtime.\n\n**Example:**\n\n\n interface A {}\n interface Z {}\n static class C {}\n\n void x(C c) {\n if (c instanceof Z) {\n A a = ((A)c); // cast to incompatible interface 'A'\n }\n }\n" + "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": "CastToIncompatibleInterface", - "cweIds": [ - 704 - ], + "suppressToolId": "NonStaticInitializer", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17281,8 +17198,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -17294,19 +17211,19 @@ ] }, { - "id": "SimplifiableConditionalExpression", + "id": "ContinueOrBreakFromFinallyBlock", "shortDescription": { - "text": "Simplifiable conditional expression" + "text": "'continue' or 'break' inside 'finally' block" }, "fullDescription": { - "text": "Reports conditional expressions and suggests simplifying them. Examples: 'condition ? true : foo → condition || foo' 'condition ? false : foo → !condition && foo' 'condition ? foo : !foo → condition == foo' 'condition ? true : false → condition' 'a == b ? b : a → a' 'result != null ? result : null → result'", - "markdown": "Reports conditional expressions and suggests simplifying them.\n\nExamples:\n\n condition ? true : foo → condition || foo\n\n condition ? false : foo → !condition && foo\n\n condition ? foo : !foo → condition == foo\n\n condition ? true : false → condition\n\n a == b ? b : a → a\n\n result != null ? result : null → result\n" + "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": "SimplifiableConditionalExpression", + "suppressToolId": "ContinueOrBreakFromFinallyBlock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17314,8 +17231,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -17327,28 +17244,28 @@ ] }, { - "id": "UnqualifiedMethodAccess", + "id": "LengthOneStringsInConcatenation", "shortDescription": { - "text": "Instance method call not qualified with 'this'" + "text": "Single character string concatenation" }, "fullDescription": { - "text": "Reports calls to non-'static' methods on the same instance that are not qualified with 'this'. Example: 'class Foo {\n void bar() {}\n\n void foo() {\n bar();\n }\n }' After the quick-fix is applied: 'class Foo {\n void bar() {}\n\n void foo() {\n this.bar();\n }\n }'", - "markdown": "Reports calls to non-`static` methods on the same instance that are not qualified with `this`.\n\n**Example:**\n\n\n class Foo {\n void bar() {}\n\n void foo() {\n bar();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n void bar() {}\n\n void foo() {\n this.bar();\n }\n }\n" + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "UnqualifiedMethodAccess", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SingleCharacterStringConcatenation", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -17360,19 +17277,19 @@ ] }, { - "id": "InstanceofIncompatibleInterface", + "id": "ClassWithTooManyTransitiveDependencies", "shortDescription": { - "text": "'instanceof' with incompatible type" + "text": "Class with too many transitive dependencies" }, "fullDescription": { - "text": "Reports 'instanceof' expressions where the expression that is checked has a class/interface type that neither extends/implements the class/interface type on the right-side of the 'instanceof' expression, nor has subclasses that do. Although it could be intended for e.g. library code, such a construct is likely erroneous, because no instance of any class declared in the project could pass this 'instanceof' test. Example: 'class Foo { }\n\n interface Bar { }\n \n class Main {\n void test(Foo f, Bar b) {\n if (f instanceof Bar) { // problem\n System.out.println(\"fail\");\n }\n if (b instanceof Foo) { // problem\n System.out.println(\"fail\");\n }\n }\n }'", - "markdown": "Reports `instanceof` expressions where the expression that is checked has a class/interface type that neither extends/implements the class/interface type on the right-side of the `instanceof` expression, nor has subclasses that do.\n\n\nAlthough it could be intended for e.g. library code, such a construct is likely erroneous,\nbecause no instance of any class declared in the project could pass this `instanceof` test.\n\n**Example:**\n\n\n class Foo { }\n\n interface Bar { }\n \n class Main {\n void test(Foo f, Bar b) {\n if (f instanceof Bar) { // problem\n System.out.println(\"fail\");\n }\n if (b instanceof Foo) { // problem\n System.out.println(\"fail\");\n }\n }\n }\n" + "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": "InstanceofIncompatibleInterface", + "suppressToolId": "ClassWithTooManyTransitiveDependencies", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17380,8 +17297,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Dependency issues", + "index": 146, "toolComponent": { "name": "QDJVM" } @@ -17393,19 +17310,19 @@ ] }, { - "id": "FunctionalExpressionCanBeFolded", + "id": "UnnecessaryThis", "shortDescription": { - "text": "Functional expression can be folded" + "text": "Unnecessary 'this' qualifier" }, "fullDescription": { - "text": "Reports method references or lambda expressions that point to a method of their own functional interface type and hence can be replaced with their qualifiers removing unnecessary object allocation. Example: 'SwingUtilities.invokeLater(r::run);\n SwingUtilities.invokeAndWait(() -> r.run());' After the quick-fix is applied: 'SwingUtilities.invokeLater(r);\n SwingUtilities.invokeAndWait(r);' This inspection reports only if the language level of the project or module is 8 or higher.", - "markdown": "Reports method references or lambda expressions that point to a method of their own functional interface type and hence can be replaced with their qualifiers removing unnecessary object allocation.\n\nExample:\n\n\n SwingUtilities.invokeLater(r::run);\n SwingUtilities.invokeAndWait(() -> r.run());\n\nAfter the quick-fix is applied:\n\n\n SwingUtilities.invokeLater(r);\n SwingUtilities.invokeAndWait(r);\n\nThis inspection reports only if the language level of the project or module is 8 or higher." + "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": "FunctionalExpressionCanBeFolded", + "suppressToolId": "UnnecessaryThis", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17413,8 +17330,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -17426,19 +17343,19 @@ ] }, { - "id": "CustomClassloader", + "id": "LoopWithImplicitTerminationCondition", "shortDescription": { - "text": "Custom 'ClassLoader' is declared" + "text": "Loop with implicit termination condition" }, "fullDescription": { - "text": "Reports user-defined subclasses of 'java.lang.ClassLoader'. While not necessarily representing a security hole, such classes should be thoroughly inspected for possible security issues.", - "markdown": "Reports user-defined subclasses of `java.lang.ClassLoader`.\n\n\nWhile not necessarily representing a security hole, such classes should be thoroughly\ninspected for possible security issues." + "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": "CustomClassloader", + "suppressToolId": "LoopWithImplicitTerminationCondition", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17446,8 +17363,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -17459,19 +17376,19 @@ ] }, { - "id": "UnnecessarySuperConstructor", + "id": "ExplicitArrayFilling", "shortDescription": { - "text": "Unnecessary call to 'super()'" + "text": "Explicit array filling" }, "fullDescription": { - "text": "Reports calls to no-arg superclass constructors during object construction. Such calls are unnecessary and may be removed. Example: 'class Foo {\n Foo() {\n super();\n }\n }' After the quick-fix is applied: 'class Foo {\n Foo() {\n }\n }'", - "markdown": "Reports calls to no-arg superclass constructors during object construction.\n\nSuch calls are unnecessary and may be removed.\n\n**Example:**\n\n\n class Foo {\n Foo() {\n super();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n Foo() {\n }\n }\n" + "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 System.out.println(1);\n case \"2\" -> System.out.println(2);\n case \"3\" -> System.out.println(3);\n default -> System.out.println(4);\n }\n }' This inspection only reports if the language level of the project or module is 7 or higher. Use the Minimum number of 'if' condition branches field to specify the minimum number of 'if' condition branches for an 'if' statement to have to be reported. Note that the terminal 'else' branch (without 'if') is not counted. Use the Suggest switch on numbers option to enable the suggestion of 'switch' statements on primitive and boxed numbers and characters. Use the Suggest switch on enums option to enable the suggestion of 'switch' statements on 'enum' constants. Use the Only suggest on null-safe expressions option to suggest 'switch' statements that can't introduce a 'NullPointerException' only.", - "markdown": "Reports `if` statements that can be replaced with `switch` statements.\n\nThe replacement result is usually shorter and clearer.\n\n**Example:**\n\n\n void test(String str) {\n if (str.equals(\"1\")) {\n System.out.println(1);\n } else if (str.equals(\"2\")) {\n System.out.println(2);\n } else if (str.equals(\"3\")) {\n System.out.println(3);\n } else {\n System.out.println(4);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void test(String str) {\n switch (str) {\n case \"1\" -> System.out.println(1);\n case \"2\" -> System.out.println(2);\n case \"3\" -> System.out.println(3);\n default -> System.out.println(4);\n }\n }\n \nThis inspection only reports if the language level of the project or module is 7 or higher.\n\nUse the **Minimum number of 'if' condition branches** field to specify the minimum number of `if` condition branches\nfor an `if` statement to have to be reported. Note that the terminal `else` branch (without `if`) is not counted.\n\n\nUse the **Suggest switch on numbers** option to enable the suggestion of `switch` statements on\nprimitive and boxed numbers and characters.\n\n\nUse the **Suggest switch on enums** option to enable the suggestion of `switch` statements on\n`enum` constants.\n\n\nUse the **Only suggest on null-safe expressions** option to suggest `switch` statements that can't introduce a `NullPointerException` only." + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "IfCanBeSwitch", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "AssignmentReplaceableWithOperatorAssignment", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids", - "index": 70, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -17591,23 +17508,19 @@ ] }, { - "id": "InfiniteRecursion", + "id": "ReturnFromFinallyBlock", "shortDescription": { - "text": "Infinite recursion" + "text": "'return' inside 'finally' block" }, "fullDescription": { - "text": "Reports methods that call themselves infinitely unless an exception is thrown. Methods reported by this inspection cannot return normally. While such behavior may be intended, in many cases this is just an oversight. Example: 'int baz() {\n return baz();\n }'", - "markdown": "Reports methods that call themselves infinitely unless an exception is thrown.\n\n\nMethods reported by this inspection cannot return normally.\nWhile such behavior may be intended, in many cases this is just an oversight.\n\n**Example:**\n\n int baz() {\n return baz();\n }\n" + "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": "InfiniteRecursion", - "cweIds": [ - 674, - 835 - ], + "suppressToolId": "ReturnInsideFinallyBlock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17615,8 +17528,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -17628,19 +17541,19 @@ ] }, { - "id": "DeprecatedIsStillUsed", + "id": "RedundantExplicitClose", "shortDescription": { - "text": "Deprecated member is still used" + "text": "Redundant 'close()'" }, "fullDescription": { - "text": "Reports deprecated classes, methods, and fields that are used in your code nonetheless. Example: 'class MyCode {\n @Deprecated\n void oldMethod() {}// warning: \"Deprecated member is still used\"\n\n void newMethod() {\n oldMethod(); // forgotten usage\n }\n }' Usages within deprecated elements are ignored. NOTE: Due to performance reasons, a non-private member is checked only when its name rarely occurs in the project.", - "markdown": "Reports deprecated classes, methods, and fields that are used in your code nonetheless.\n\nExample:\n\n\n class MyCode {\n @Deprecated\n void oldMethod() {}// warning: \"Deprecated member is still used\"\n\n void newMethod() {\n oldMethod(); // forgotten usage\n }\n }\n\nUsages within deprecated elements are ignored.\n\n**NOTE:** Due to performance reasons, a non-private member is checked only when its name rarely occurs in the project." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "DeprecatedIsStillUsed", + "suppressToolId": "RedundantExplicitClose", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17648,8 +17561,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -17661,19 +17574,19 @@ ] }, { - "id": "RedundantComparatorComparing", + "id": "AssertStatement", "shortDescription": { - "text": "Comparator method can be simplified" + "text": "'assert' statement" }, "fullDescription": { - "text": "Reports 'Comparator' combinator constructs that can be simplified. Example: 'c.thenComparing(Comparator.comparing(function));\n\n Comparator.comparing(Map.Entry::getKey);\n\n Collections.max(list, Comparator.reverseOrder());' After the quick-fixes are applied: 'c.thenComparing(function)\n\n Map.Entry.comparingByKey()\n\n Collections.min(list, Comparator.naturalOrder());' New in 2018.1", - "markdown": "Reports `Comparator` combinator constructs that can be simplified.\n\nExample:\n\n\n c.thenComparing(Comparator.comparing(function));\n\n Comparator.comparing(Map.Entry::getKey);\n\n Collections.max(list, Comparator.reverseOrder());\n\nAfter the quick-fixes are applied:\n\n\n c.thenComparing(function)\n\n Map.Entry.comparingByKey()\n\n Collections.min(list, Comparator.naturalOrder());\n\nNew in 2018.1" + "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. This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", + "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.\n\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantComparatorComparing", + "suppressToolId": "AssertStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17681,8 +17594,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Java language level issues", + "index": 147, "toolComponent": { "name": "QDJVM" } @@ -17694,22 +17607,19 @@ ] }, { - "id": "VariableNotUsedInsideIf", + "id": "UnnecessarySemicolon", "shortDescription": { - "text": "Reference checked for 'null' is not used inside 'if'" + "text": "Unnecessary semicolon" }, "fullDescription": { - "text": "Reports references to variables that are checked for nullability in the condition of an 'if' statement or conditional expression but not used inside that 'if' statement. Usually this either means that the check is unnecessary or that the variable is not referenced inside the 'if' statement by mistake. Example: 'void test(Integer i) {\n if (i != null) { // here 'i' is not used inside 'if' statement\n System.out.println();\n }\n }'", - "markdown": "Reports references to variables that are checked for nullability in the condition of an `if` statement or conditional expression but not used inside that `if` statement.\n\n\nUsually this either means that\nthe check is unnecessary or that the variable is not referenced inside the\n`if` statement by mistake.\n\n**Example:**\n\n\n void test(Integer i) {\n if (i != null) { // here 'i' is not used inside 'if' statement\n System.out.println();\n }\n }\n" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "VariableNotUsedInsideIf", - "cweIds": [ - 563 - ], + "suppressToolId": "UnnecessarySemicolon", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17717,8 +17627,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -17730,19 +17640,19 @@ ] }, { - "id": "CollectionAddAllCanBeReplacedWithConstructor", + "id": "JavadocBlankLines", "shortDescription": { - "text": "Redundant 'Collection.addAll()' call" + "text": "Blank line should be replaced with

to break lines" }, "fullDescription": { - "text": "Reports 'Collection.addAll()' and 'Map.putAll()' calls immediately after an instantiation of a collection using a no-arg constructor. Such constructs can be replaced with a single call to a parametrized constructor, which simplifies the code. Also, for some collections the replacement might be more performant. Example: 'Set set = new HashSet<>();\n set.addAll(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));' After the quick-fix is applied: 'Set set = new HashSet<>(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));' The JDK collection classes are supported by default. Additionally, you can specify other classes using the Classes to check panel.", - "markdown": "Reports `Collection.addAll()` and `Map.putAll()` calls immediately after an instantiation of a collection using a no-arg constructor.\n\nSuch constructs can be replaced with a single call to a parametrized constructor, which simplifies the code. Also, for some collections the replacement\nmight be more performant.\n\n**Example:**\n\n\n Set set = new HashSet<>();\n set.addAll(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));\n\nAfter the quick-fix is applied:\n\n\n Set set = new HashSet<>(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));\n\n\nThe JDK collection classes are supported by default.\nAdditionally, you can specify other classes using the **Classes to check** panel." + "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 (

). 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 *

\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 (\\).\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 *

\n * Does absolutely nothing\n */\n void foo() {}\n }\n\nNew in 2022.1" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CollectionAddAllCanBeReplacedWithConstructor", + "suppressToolId": "JavadocBlankLines", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17750,8 +17660,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -17763,19 +17673,19 @@ ] }, { - "id": "MultipleReturnPointsPerMethod", + "id": "TypeParameterExtendsFinalClass", "shortDescription": { - "text": "Method with multiple return points" + "text": "Type parameter extends 'final' class" }, "fullDescription": { - "text": "Reports methods whose number of 'return' points exceeds the specified maximum. Methods with too many 'return' points may be confusing and hard to refactor. A 'return' point is either a 'return' statement or a falling through the bottom of a 'void' method or constructor. Example: The method below is reported if only two 'return' statements are allowed: 'void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user)) {\n user.setId(getId());\n return;\n } else if (cond2(user)) {\n if (cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }\n }' Consider rewriting the method so it becomes easier to understand: 'void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user) || cond2(user) && cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }' Configure the inspection: Use the Return point limit field to specify the maximum allowed number of 'return' points for a method. Use the Ignore guard clauses option to ignore guard clauses. A guard clause is an 'if' statement that contains only a 'return' statement Use the Ignore for 'equals()' methods option to ignore 'return' points inside 'equals()' methods.", - "markdown": "Reports methods whose number of `return` points exceeds the specified maximum. Methods with too many `return` points may be confusing and hard to refactor.\n\nA `return` point is either a `return` statement or a falling through the bottom of a\n`void` method or constructor.\n\n**Example:**\n\nThe method below is reported if only two `return` statements are allowed:\n\n\n void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user)) {\n user.setId(getId());\n return;\n } else if (cond2(user)) {\n if (cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }\n }\n\nConsider rewriting the method so it becomes easier to understand:\n\n\n void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user) || cond2(user) && cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }\n\nConfigure the inspection:\n\n* Use the **Return point limit** field to specify the maximum allowed number of `return` points for a method.\n* Use the **Ignore guard clauses** option to ignore guard clauses. A guard clause is an `if` statement that contains only a `return` statement\n* Use the **Ignore for 'equals()' methods** option to ignore `return` points inside `equals()` methods." + "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 list; // Warning: the Integer class is a final class\n }' After the quick-fix is applied: 'void foo() {\n List list;\n }' This inspection depends on the Java feature 'Generics', which is available since Java 5.", + "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 list; // Warning: the Integer class is a final class\n }\n\nAfter the quick-fix is applied:\n\n\n void foo() {\n List list;\n }\n\nThis inspection depends on the Java feature 'Generics', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MethodWithMultipleReturnPoints", + "suppressToolId": "TypeParameterExtendsFinalClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17783,8 +17693,8 @@ "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -17796,22 +17706,19 @@ ] }, { - "id": "SuspiciousMethodCalls", + "id": "UtilityClassWithPublicConstructor", "shortDescription": { - "text": "Suspicious collection method call" + "text": "Utility class with 'public' constructor" }, "fullDescription": { - "text": "Reports method calls on parameterized collections, where the actual argument type does not correspond to the collection's elements type. Example: 'List list = getListOfElements();\n list.remove(\"\"); // remove is highlighted' In the inspection settings, you can disable warnings for potentially correct code like the following: 'public boolean accept(Map map, Object key) {\n return map.containsKey(key);\n }'", - "markdown": "Reports method calls on parameterized collections, where the actual argument type does not correspond to the collection's elements type.\n\n**Example:**\n\n\n List list = getListOfElements();\n list.remove(\"\"); // remove is highlighted\n\n\nIn the inspection settings, you can disable warnings for potentially correct code like the following:\n\n\n public boolean accept(Map map, Object key) {\n return map.containsKey(key);\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousMethodCalls", - "cweIds": [ - 628 - ], + "suppressToolId": "UtilityClassWithPublicConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17819,8 +17726,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -17832,19 +17739,19 @@ ] }, { - "id": "ForwardCompatibility", + "id": "TrivialIf", "shortDescription": { - "text": "Forward compatibility" + "text": "Redundant 'if' statement" }, "fullDescription": { - "text": "Reports Java code constructs that may fail to compile in future Java versions. The following problems are reported: Uses of 'assert', 'enum' or '_' as an identifier Uses of the 'var', 'yield', or 'record' restricted identifier as a type name Unqualified calls to methods named 'yield' Modifiers on the 'requires java.base' statement inside of 'module-info.java' Redundant semicolons between import statements Example: '// This previously legal class does not compile with Java 14,\n // as 'yield' became a restricted identifier.\n public class yield {}' Fixing these issues timely may simplify migration to future Java versions.", - "markdown": "Reports Java code constructs that may fail to compile in future Java versions.\n\nThe following problems are reported:\n\n* Uses of `assert`, `enum` or `_` as an identifier\n* Uses of the `var`, `yield`, or `record` restricted identifier as a type name\n* Unqualified calls to methods named `yield`\n* Modifiers on the `requires java.base` statement inside of `module-info.java`\n* Redundant semicolons between import statements\n\n**Example:**\n\n\n // This previously legal class does not compile with Java 14,\n // as 'yield' became a restricted identifier.\n public class yield {} \n\nFixing these issues timely may simplify migration to future Java versions." + "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, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ForwardCompatibility", + "suppressToolId": "RedundantIfStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17852,8 +17759,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level issues", - "index": 147, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -17865,28 +17772,28 @@ ] }, { - "id": "DiamondCanBeReplacedWithExplicitTypeArguments", + "id": "InstanceGuardedByStatic", "shortDescription": { - "text": "Diamond can be replaced with explicit type arguments" + "text": "Instance member guarded by static field" }, "fullDescription": { - "text": "Reports instantiation of generic classes in which the <> symbol (diamond) is used instead of type parameters. The quick-fix replaces <> (diamond) with explicit type parameters. Example: 'List list = new ArrayList<>()' After the quick-fix is applied: 'List list = new ArrayList()' Diamond operation appeared in Java 7. This inspection can help to downgrade for backward compatibility with earlier Java versions.", - "markdown": "Reports instantiation of generic classes in which the **\\<\\>** symbol (diamond) is used instead of type parameters.\n\nThe quick-fix replaces **\\<\\>** (diamond) with explicit type parameters.\n\nExample:\n\n List list = new ArrayList<>()\n\nAfter the quick-fix is applied:\n\n List list = new ArrayList()\n\n\n*Diamond operation* appeared in Java 7.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions." + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "DiamondCanBeReplacedWithExplicitTypeArguments", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "InstanceGuardedByStatic", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Concurrency annotation issues", + "index": 100, "toolComponent": { "name": "QDJVM" } @@ -17898,19 +17805,19 @@ ] }, { - "id": "UseOfProcessBuilder", + "id": "BooleanMethodIsAlwaysInverted", "shortDescription": { - "text": "Use of 'java.lang.ProcessBuilder' class" + "text": "Boolean method is always inverted" }, "fullDescription": { - "text": "Reports uses of 'java.lang.ProcessBuilder', which might be unportable between operating systems because paths to executables, environment variables, command-line arguments and their escaping might vary depending on the OS.", - "markdown": "Reports uses of `java.lang.ProcessBuilder`, which might be unportable between operating systems because paths to executables, environment variables, command-line arguments and their escaping might vary depending on the OS." + "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": "UseOfProcessBuilder", + "suppressToolId": "BooleanMethodIsAlwaysInverted", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17918,8 +17825,8 @@ "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Java/Data flow", + "index": 65, "toolComponent": { "name": "QDJVM" } @@ -17931,19 +17838,19 @@ ] }, { - "id": "JavaRequiresAutoModule", + "id": "AutoCloseableResource", "shortDescription": { - "text": "Dependencies on automatic modules" + "text": "AutoCloseable used without 'try'-with-resources" }, "fullDescription": { - "text": "Reports usages of automatic modules in a 'requires' directive. An automatic module is unreliable since it can depend on the types on the class path, and its name and exported packages can change if it's converted into an explicit module. Corresponds to '-Xlint:requires-automatic' and '-Xlint:requires-transitive-automatic' Javac options. The first option increases awareness of when automatic modules are used. The second warns the authors of a module that they're putting the users of that module at risk by establishing implied readability to an automatic module. Example: '//module-info.java\n module org.printer {\n requires transitive drivers.corp.org; // reported in case 'drivers.corp.org' is an automatic module\n }' Use the Highlight only transitive dependencies option to warn only about transitive dependencies. This inspection depends on the Java feature 'Modules', which is available since Java 9.", - "markdown": "Reports usages of automatic modules in a `requires` directive.\n\nAn automatic\nmodule is unreliable since it can depend on the types on the class path,\nand its name and exported packages can change if it's\nconverted into an explicit module.\n\nCorresponds to `-Xlint:requires-automatic` and `-Xlint:requires-transitive-automatic` Javac options.\nThe first option increases awareness of when automatic modules are used.\nThe second warns the authors of a module that they're putting the users of that module at risk by establishing implied readability to an automatic module.\n\n**Example:**\n\n\n //module-info.java\n module org.printer {\n requires transitive drivers.corp.org; // reported in case 'drivers.corp.org' is an automatic module\n }\n\n\nUse the **Highlight only transitive dependencies** option to warn only about transitive dependencies.\n\nThis inspection depends on the Java feature 'Modules', which is available since Java 9." + "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. This inspection depends on the Java feature 'Try-with-resources', which is available since Java 7.", + "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.\n\nThis inspection depends on the Java feature 'Try-with-resources', which is available since Java 7." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "requires-transitive-automatic", + "suppressToolId": "resource", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -17951,8 +17858,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 9", - "index": 87, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -17964,28 +17871,28 @@ ] }, { - "id": "ExcessiveRangeCheck", + "id": "SingleStatementInBlock", "shortDescription": { - "text": "Excessive range check" + "text": "Code block contains single statement" }, "fullDescription": { - "text": "Reports condition chains in which a value range is checked and these condition chains can be simplified to a single check. The quick-fix replaces a condition chain with a simplified expression: Example: 'x > 2 && x < 4' After the quick-fix is applied: 'x == 3' Example: 'arr.length == 0 || arr.length > 1' After the quick-fix is applied: 'arr.length != 1' New in 2019.1", - "markdown": "Reports condition chains in which a value range is checked and these condition chains can be simplified to a single check.\n\nThe quick-fix replaces a condition chain with a simplified expression:\n\nExample:\n\n\n x > 2 && x < 4\n\nAfter the quick-fix is applied:\n\n\n x == 3\n\nExample:\n\n\n arr.length == 0 || arr.length > 1\n\nAfter the quick-fix is applied:\n\n\n arr.length != 1\n\nNew in 2019.1" + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ExcessiveRangeCheck", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SingleStatementInBlock", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -17997,19 +17904,19 @@ ] }, { - "id": "StringConcatenation", + "id": "TestCaseWithConstructor", "shortDescription": { - "text": "String concatenation" + "text": "TestCase with non-trivial constructors" }, "fullDescription": { - "text": "Reports 'String' concatenations. Concatenation might be incorrect in an internationalized environment and could be replaced by usages of 'java.text.MessageFormat' or similar classes. Example: 'String getMessage(String string, int number) {\n return string + number;\n }'", - "markdown": "Reports `String` concatenations. Concatenation might be incorrect in an internationalized environment and could be replaced by usages of `java.text.MessageFormat` or similar classes.\n\n**Example:**\n\n\n String getMessage(String string, int number) {\n return string + number;\n }\n" + "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": "StringConcatenation", + "suppressToolId": "JUnitTestCaseWithNonTrivialConstructors", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18017,8 +17924,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "JVM languages/Test frameworks", + "index": 123, "toolComponent": { "name": "QDJVM" } @@ -18030,28 +17937,28 @@ ] }, { - "id": "ClassCanBeRecord", + "id": "ReadObjectAndWriteObjectPrivate", "shortDescription": { - "text": "Class can be record class" + "text": "'readObject()' or 'writeObject()' not declared 'private'" }, "fullDescription": { - "text": "Reports classes that can be converted record classes. Record classes focus on modeling immutable data rather than extensible behavior. Automatic implicit implementation of data-driven methods, such as 'equals()' and accessors, helps to reduce boilerplate code. Note that not every class can be a record class. Here are some of the restrictions: The class must have no subclasses. All non-static fields in the class must be final. Initializers, generic constructors, and native methods must not be present. For a full description of record classes, refer to the Java Language Specification. Example: 'class Point {\n private final double x;\n private final double y;\n\n Point(double x, double y) {\n this.x = x;\n this.y = y;\n }\n\n double getX() {\n return x;\n }\n\n double getY() {\n return y;\n }\n }' After the quick-fix is applied: 'record Point(int x, int y) {\n }' Enable the Suggest renaming accessor methods option to rename 'getX()'/'isX()' accessors to 'x()' automatically. Use the If members become more accessible option to specify what to do when conversion will make members more accessible: Choose Do not suggest conversion option to not convert when members would become more accessible. Choose Show conflicts view option to show the affected members and ask to continue. In batch mode conversion will not be suggested. Choose Convert silently option to increase accessibility silently when needed. Use the Suppress conversion if class is annotated by list to exclude classes from conversion when annotated by annotations matching the specified patterns. This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.3", - "markdown": "Reports classes that can be converted record classes.\n\nRecord classes focus on modeling immutable data rather than extensible behavior.\nAutomatic implicit implementation of data-driven methods, such as `equals()` and accessors, helps to reduce boilerplate code.\n\n\nNote that not every class can be a record class. Here are some of the restrictions:\n\n* The class must have no subclasses.\n* All non-static fields in the class must be final.\n* Initializers, generic constructors, and native methods must not be present.\n\nFor a full description of record classes, refer to the\n[Java Language Specification](https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-8.10).\n\nExample:\n\n\n class Point {\n private final double x;\n private final double y;\n\n Point(double x, double y) {\n this.x = x;\n this.y = y;\n }\n\n double getX() {\n return x;\n }\n\n double getY() {\n return y;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n record Point(int x, int y) {\n }\n\nEnable the **Suggest renaming accessor methods** option to rename `getX()`/`isX()` accessors to `x()` automatically.\n\n\nUse the **If members become more accessible** option to specify what to do when conversion will make members more accessible:\n\n* Choose **Do not suggest conversion** option to not convert when members would become more accessible.\n* Choose **Show conflicts view** option to show the affected members and ask to continue. In batch mode conversion will not be suggested.\n* Choose **Convert silently** option to increase accessibility silently when needed.\n\nUse the **Suppress conversion if class is annotated by** list to exclude classes from conversion when annotated by annotations matching the specified patterns.\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.3" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "ClassCanBeRecord", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NonPrivateSerializationMethod", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 16", - "index": 188, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -18063,19 +17970,19 @@ ] }, { - "id": "ConstantAssertArgument", + "id": "RedundantFileCreation", "shortDescription": { - "text": "Constant assert argument" + "text": "Redundant 'File' instance creation" }, "fullDescription": { - "text": "Reports constant arguments in 'assertTrue()', 'assertFalse()', 'assertNull()', and 'assertNotNull()' calls. Calls to these methods with constant arguments will either always succeed or always fail. Such statements can easily be left over after refactoring and are probably not intended. Example: 'assertNotNull(\"foo\");'", - "markdown": "Reports constant arguments in `assertTrue()`, `assertFalse()`, `assertNull()`, and `assertNotNull()` calls.\n\n\nCalls to these methods with\nconstant arguments will either always succeed or always fail.\nSuch statements can easily be left over after refactoring and are probably not intended.\n\n**Example:**\n\n\n assertNotNull(\"foo\");\n" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "ConstantAssertArgument", + "suppressToolId": "RedundantFileCreation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18083,8 +17990,8 @@ "relationships": [ { "target": { - "id": "Java/Test frameworks", - "index": 130, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -18096,19 +18003,19 @@ ] }, { - "id": "RuntimeExec", + "id": "PointlessBooleanExpression", "shortDescription": { - "text": "Call to 'Runtime.exec()'" + "text": "Pointless boolean expression" }, "fullDescription": { - "text": "Reports calls to 'Runtime.exec()' or any of its variants. Calls to 'Runtime.exec()' are inherently unportable.", - "markdown": "Reports calls to `Runtime.exec()` or any of its variants. Calls to `Runtime.exec()` are inherently unportable." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CallToRuntimeExec", + "suppressToolId": "PointlessBooleanExpression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18116,8 +18023,8 @@ "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -18129,19 +18036,19 @@ ] }, { - "id": "StaticInitializerReferencesSubClass", + "id": "ListenerMayUseAdapter", "shortDescription": { - "text": "Static initializer references subclass" + "text": "Class may extend adapter instead of implementing listener" }, "fullDescription": { - "text": "Reports classes that refer to their subclasses in static initializers or static fields. Such references can cause JVM-level deadlocks in multithreaded environment, when one thread tries to load the superclass and another thread tries to load the subclass at the same time. Example: 'class Parent {\n static final Child field = new Child();\n }\n class Child extends Parent { }'", - "markdown": "Reports classes that refer to their subclasses in static initializers or static fields.\n\nSuch references can cause JVM-level deadlocks in multithreaded environment, when one thread tries to load the superclass\nand another thread tries to load the subclass at the same time.\n\n**Example:**\n\n\n class Parent {\n static final Child field = new Child();\n }\n class Child extends Parent { }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StaticInitializerReferencesSubClass", + "suppressToolId": "ListenerMayUseAdapter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18149,8 +18056,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -18162,28 +18069,28 @@ ] }, { - "id": "MissingDeprecatedAnnotationOnScheduledForRemovalApi", + "id": "ExpressionComparedToItself", "shortDescription": { - "text": "Missing '@Deprecated' annotation on scheduled for removal API" + "text": "Expression is compared to itself" }, "fullDescription": { - "text": "Reports declarations marked with '@ApiStatus.ScheduledForRemoval' without '@Deprecated'. Example: '@ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }' After the quick-fix is applied the result looks like: '@Deprecated\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }'", - "markdown": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` without `@Deprecated`.\n\nExample:\n\n\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n\nAfter the quick-fix is applied the result looks like:\n\n\n @Deprecated\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n" + "text": "Reports comparisons where left and right operand represent the identical expression. While sometimes comparison of an expression with itself could be intended, in most cases they are the result of an oversight. Example: '// Probably left.getLength() == right.getLength() was intended\n boolean result = left.getLength() == left.getLength();' To ignore comparisons that may produce side effects, use the Ignore conditions with side effects option. Disabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations. Example: 'native int unknownMethod();\n \n ...\n \n if (unknownMethod() > unknownMethod()) {\n System.out.println(\"Got it\");\n }' Due to possible side effects of 'unknownMethod()' (on the example), the warning will only be triggered if the Ignore conditions with side effects option is disabled. New in 2024.2", + "markdown": "Reports comparisons where left and right operand represent the identical expression. While sometimes comparison of an expression with itself could be intended, in most cases they are the result of an oversight.\n\nExample:\n\n\n // Probably left.getLength() == right.getLength() was intended\n boolean result = left.getLength() == left.getLength();\n\n\nTo ignore comparisons that may produce side effects, use the **Ignore conditions with side effects** option.\nDisabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations.\n\nExample:\n\n\n native int unknownMethod();\n \n ...\n \n if (unknownMethod() > unknownMethod()) {\n System.out.println(\"Got it\");\n }\n\nDue to possible side effects of `unknownMethod()` (on the example), the warning will only be\ntriggered if the **Ignore conditions with side effects** option is disabled.\n\nNew in 2024.2" }, "defaultConfiguration": { "enabled": true, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "MissingDeprecatedAnnotationOnScheduledForRemovalApi", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "ExpressionComparedToItself", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -18195,19 +18102,19 @@ ] }, { - "id": "ConstantDeclaredInAbstractClass", + "id": "RefusedBequest", "shortDescription": { - "text": "Constant declared in 'abstract' class" + "text": "Method does not call super method" }, "fullDescription": { - "text": "Reports constants ('public static final' fields) declared in abstract classes. Some coding standards require declaring constants in interfaces instead.", - "markdown": "Reports constants (`public static final` fields) declared in abstract classes.\n\nSome coding standards require declaring constants in interfaces instead." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ConstantDeclaredInAbstractClass", + "suppressToolId": "MethodDoesntCallSuperMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18215,8 +18122,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -18228,22 +18135,19 @@ ] }, { - "id": "SubtractionInCompareTo", + "id": "UnnecessaryReturn", "shortDescription": { - "text": "Subtraction in 'compareTo()'" + "text": "Unnecessary 'return' statement" }, "fullDescription": { - "text": "Reports subtraction in 'compareTo()' methods and methods implementing 'java.util.Comparator.compare()'. While it is a common idiom to use the results of integer subtraction as the result of a 'compareTo()' method, this construct may cause subtle and difficult bugs in cases of integer overflow. Comparing the integer values directly and returning '-1', '0', or '1' is a better practice in most cases. Subtraction on floating point values that is immediately cast to integral type is also reported because precision loss is possible due to rounding. The inspection doesn't report when it's statically determined that value ranges are limited, and overflow never occurs. Additionally, subtraction on 'int' numbers greater than or equal to '0' will never overflow. Therefore, this inspection tries not to warn in those cases. Methods that always return zero or greater can be marked with the 'javax.annotation.Nonnegative' annotation or specified in this inspection's options. Example: 'class DoubleHolder implements Comparable {\n double d;\n public int compareTo(DoubleHolder that) {\n return (int)(this.d - that.d);\n }\n }' A no-warning example because 'String.length()' is known to be non-negative: 'class A implements Comparable {\n final String s = \"\";\n public int compareTo(A a) {\n return s.length() - a.s.length();\n }\n }' Use the options to list methods that are safe to use inside a subtraction. Methods are safe when they return an 'int' value that is always greater than or equal to '0'.", - "markdown": "Reports subtraction in `compareTo()` methods and methods implementing `java.util.Comparator.compare()`.\n\n\nWhile it is a common idiom to\nuse the results of integer subtraction as the result of a `compareTo()`\nmethod, this construct may cause subtle and difficult bugs in cases of integer overflow.\nComparing the integer values directly and returning `-1`, `0`, or `1` is a better practice in most cases.\n\n\nSubtraction on floating point values that is immediately cast to integral type is also reported because precision loss is possible due to\nrounding.\n\n\nThe inspection doesn't report when it's statically determined that value ranges are limited, and overflow never occurs.\nAdditionally, subtraction on `int` numbers greater than or equal to `0` will never overflow.\nTherefore, this inspection tries not to warn in those cases.\n\n\nMethods that always return zero or greater can be marked with the\n`javax.annotation.Nonnegative` annotation or specified in this inspection's options.\n\n**Example:**\n\n\n class DoubleHolder implements Comparable {\n double d;\n public int compareTo(DoubleHolder that) {\n return (int)(this.d - that.d);\n }\n }\n\nA no-warning example because `String.length()` is known to be non-negative:\n\n\n class A implements Comparable {\n final String s = \"\";\n public int compareTo(A a) {\n return s.length() - a.s.length();\n }\n }\n\n\nUse the options to list methods that are safe to use inside a subtraction.\nMethods are safe when they return an `int` value that is always greater than or equal to `0`." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "SubtractionInCompareTo", - "cweIds": [ - 682 - ], + "suppressToolId": "UnnecessaryReturnStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18251,8 +18155,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -18264,19 +18168,19 @@ ] }, { - "id": "ConnectionResource", + "id": "PublicInnerClass", "shortDescription": { - "text": "Connection opened but not safely closed" + "text": "'public' nested class" }, "fullDescription": { - "text": "Reports Java ME 'javax.microedition.io.Connection' 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. Example: 'void example() throws IOException {\n Connection c = Connector.open(\"foo\");\n }'", - "markdown": "Reports Java ME `javax.microedition.io.Connection` 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.\n\n**Example:**\n\n\n void example() throws IOException {\n Connection c = Connector.open(\"foo\");\n }\n" + "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": "ConnectionOpenedButNotSafelyClosed", + "suppressToolId": "PublicInnerClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18284,8 +18188,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -18297,19 +18201,19 @@ ] }, { - "id": "BooleanVariableAlwaysNegated", + "id": "NonFinalGuard", "shortDescription": { - "text": "Boolean variable is always inverted" + "text": "Non-final '@GuardedBy' field" }, "fullDescription": { - "text": "Reports boolean variables or fields which are always negated when their value is used. Example: 'void m() {\n boolean b = true; //boolean variable 'b' is always inverted\n System.out.println(!b);\n }'", - "markdown": "Reports boolean variables or fields which are always negated when their value is used.\n\nExample:\n\n\n void m() {\n boolean b = true; //boolean variable 'b' is always inverted\n System.out.println(!b);\n }\n" + "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": "BooleanVariableAlwaysNegated", + "suppressToolId": "NonFinalGuard", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18317,8 +18221,8 @@ "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Java/Concurrency annotation issues", + "index": 100, "toolComponent": { "name": "QDJVM" } @@ -18330,19 +18234,23 @@ ] }, { - "id": "ExtendsAnnotation", + "id": "CollectionAddedToSelf", "shortDescription": { - "text": "Class extends annotation interface" + "text": "Collection added to itself" }, "fullDescription": { - "text": "Reports classes declared as an implementation or extension of an annotation interface. While it is legal to extend an annotation interface, it is often done by accident, and the result can't be used as an annotation. This inspection depends on the Java feature 'Annotations', which is available since Java 5.", - "markdown": "Reports classes declared as an implementation or extension of an annotation interface.\n\nWhile it is legal to extend an annotation interface, it is often done by accident,\nand the result can't be used as an annotation.\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." + "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": "ClassExplicitlyAnnotation", + "suppressToolId": "CollectionAddedToSelf", + "cweIds": [ + 664, + 688 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18350,8 +18258,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -18363,19 +18271,19 @@ ] }, { - "id": "unused", + "id": "UnnecessarySuperQualifier", "shortDescription": { - "text": "Unused declaration" + "text": "Unnecessary 'super' qualifier" }, "fullDescription": { - "text": "Reports classes, methods, or fields that are not used or unreachable from the entry points. An entry point can be a main method, tests, classes from outside the specified scope, classes accessible from 'module-info.java', and so on. It is possible to configure custom entry points by using name patterns or annotations. Example: 'public class Department {\n private Organization myOrganization;\n }' In this example, 'Department' explicitly references 'Organization' but if 'Department' class itself is unused, then inspection will report both classes. The inspection also reports parameters that are not used by their methods and all method implementations and overriders, as well as local variables that are declared but not used. Note: Some unused members may not be reported during in-editor code highlighting. For performance reasons, a non-private member is checked only when its name rarely occurs in the project. To see all results, run the inspection by selecting Code | Inspect Code or Code | Analyze Code | Run Inspection by Name from the main menu. Use the visibility settings below to configure members to be reported. For example, configuring report 'private' methods only means that 'public' methods of 'private' inner class will be reported but 'protected' methods of top level class will be ignored. Use the entry points tab to configure entry points to be considered during the inspection run. You can add entry points manually when inspection results are ready. If your code uses unsupported frameworks, there are several options: If the framework relies on annotations, use the Annotations... button to configure the framework's annotations. If the framework doesn't rely on annotations, try to configure class name patterns that are expected by the framework. This way the annotated code accessible by the framework internals will be treated as used.", - "markdown": "Reports classes, methods, or fields that are not used or unreachable from the entry points.\n\nAn entry point can be a main method, tests, classes from outside the specified scope, classes accessible from\n`module-info.java`, and so on. It is possible to configure custom entry points by using name patterns or annotations.\n\n**Example:**\n\n\n public class Department {\n private Organization myOrganization;\n }\n\nIn this example, `Department` explicitly references `Organization` but if `Department` class itself is unused, then inspection will report both classes.\n\n\nThe inspection also reports parameters that are not used by their methods and all method implementations and overriders, as well as local\nvariables that are declared but not used.\n\n\n**Note:** Some unused members may not be reported during in-editor code highlighting. For performance reasons, a non-private member is\nchecked only when its name rarely occurs in the project.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the visibility settings below to configure members to be reported. For example, configuring report `private` methods only means\nthat `public` methods of `private` inner class will be reported but `protected` methods of top level class\nwill be ignored.\n\n\nUse the **entry points** tab to configure entry points to be considered during the inspection run.\n\nYou can add entry points manually when inspection results are ready.\n\nIf your code uses unsupported frameworks, there are several options:\n\n* If the framework relies on annotations, use the **Annotations...** button to configure the framework's annotations.\n* If the framework doesn't rely on annotations, try to configure class name patterns that are expected by the framework.\n\nThis way the annotated code accessible by the framework internals will be treated as used." + "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": "unused", + "suppressToolId": "UnnecessarySuperQualifier", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18383,8 +18291,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -18396,19 +18304,19 @@ ] }, { - "id": "SuspiciousGetterSetter", + "id": "EqualsOnSuspiciousObject", "shortDescription": { - "text": "Suspicious getter/setter" + "text": "'equals()' called on classes which don't override it" }, "fullDescription": { - "text": "Reports getter or setter methods that access a field that is not expected by its name. For example, when 'getY()' returns the 'x' field. Usually, it might be a copy-paste error. Example: 'class Point {\n private int x;\n private int y;\n\n public void setX(int x) { // Warning: setter 'setX()' assigns field 'y'\n this.y = x;\n }\n\n public int getY() { // Warning: getter 'getY()' returns field 'x'\n return x;\n }\n }' Use the checkbox below to report situations when a field in the class has a name that matches a name of a getter or a setter.", - "markdown": "Reports getter or setter methods that access a field that is not expected by its name. For example, when `getY()` returns the `x` field. Usually, it might be a copy-paste error.\n\n**Example:**\n\n class Point {\n private int x;\n private int y;\n\n public void setX(int x) { // Warning: setter 'setX()' assigns field 'y'\n this.y = x;\n }\n\n public int getY() { // Warning: getter 'getY()' returns field 'x'\n return x;\n }\n }\n\n\nUse the checkbox below to report situations when a field in the class has a name that matches a name of a getter or a setter." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousGetterSetter", + "suppressToolId": "EqualsOnSuspiciousObject", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18416,8 +18324,8 @@ "relationships": [ { "target": { - "id": "Java/JavaBeans issues", - "index": 141, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -18429,22 +18337,19 @@ ] }, { - "id": "MismatchedStringCase", + "id": "UseOfPropertiesAsHashtable", "shortDescription": { - "text": "Mismatched case in 'String' operation" + "text": "Use of 'Properties' object as a 'Hashtable'" }, "fullDescription": { - "text": "Reports 'String' method calls that always return the same value ('-1' or 'false') because a lowercase character is searched in an uppercase-only string or vice versa. Reported methods include 'equals', 'startsWith', 'endsWith', 'contains', 'indexOf', and 'lastIndexOf'. Example: if (columnName.toLowerCase().equals(\"ID\")) {...}\n New in 2019.3", - "markdown": "Reports `String` method calls that always return the same value (`-1` or `false`) because a lowercase character is searched in an uppercase-only string or vice versa.\n\nReported methods include `equals`, `startsWith`, `endsWith`, `contains`,\n`indexOf`, and `lastIndexOf`.\n\n**Example:**\n\n```\n if (columnName.toLowerCase().equals(\"ID\")) {...}\n```\n\nNew in 2019.3" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MismatchedStringCase", - "cweIds": [ - 597 - ], + "suppressToolId": "UseOfPropertiesAsHashtable", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18465,19 +18370,19 @@ ] }, { - "id": "AssignmentToNull", + "id": "MethodCoupling", "shortDescription": { - "text": "'null' assignment" + "text": "Overly coupled method" }, "fullDescription": { - "text": "Reports variables that are assigned to 'null' outside a declaration. The main purpose of 'null' in Java is to denote uninitialized reference variables. In rare cases, assigning a variable explicitly to 'null' is useful to aid garbage collection. However, using 'null' to denote a missing, not specified, or invalid value or a not found element is considered bad practice and may make your code more prone to 'NullPointerExceptions'. Instead, consider defining a sentinel object with the intended semantics or use library types like 'Optional' to denote the absence of a value. Example: 'Integer convert(String s) {\n Integer value;\n try {\n value = Integer.parseInt(s);\n } catch (NumberFormatException e) {\n // Warning: null is used to denote an 'invalid value'\n value = null;\n }\n return value;\n }' Use the Ignore assignments to fields option to ignore assignments to fields.", - "markdown": "Reports variables that are assigned to `null` outside a declaration.\n\nThe main purpose of `null` in Java is to denote uninitialized\nreference variables. In rare cases, assigning a variable explicitly to `null`\nis useful to aid garbage collection. However, using `null` to denote a missing, not specified, or invalid value or a not\nfound element is considered bad practice and may make your code more prone to `NullPointerExceptions`.\nInstead, consider defining a sentinel object with the intended semantics\nor use library types like `Optional` to denote the absence of a value.\n\n**Example:**\n\n\n Integer convert(String s) {\n Integer value;\n try {\n value = Integer.parseInt(s);\n } catch (NumberFormatException e) {\n // Warning: null is used to denote an 'invalid value'\n value = null;\n }\n return value;\n }\n\n\nUse the **Ignore assignments to fields** option to ignore assignments to fields." + "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": "AssignmentToNull", + "suppressToolId": "OverlyCoupledMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18485,8 +18390,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -18498,19 +18403,19 @@ ] }, { - "id": "NonSynchronizedMethodOverridesSynchronizedMethod", + "id": "AccessToStaticFieldLockedOnInstance", "shortDescription": { - "text": "Unsynchronized method overrides 'synchronized' method" + "text": "Access to 'static' field locked on instance data" }, "fullDescription": { - "text": "Reports non-'synchronized' methods overriding 'synchronized' methods. The overridden method will not be automatically synchronized if the superclass method is declared as 'synchronized'. This may result in unexpected race conditions when using the subclass. Example: 'class Super {\n synchronized void process() {}\n }\n class Sub extends Super {\n // Unsynchronized method 'process()' overrides synchronized method\n void process() {}\n }'", - "markdown": "Reports non-`synchronized` methods overriding `synchronized` methods.\n\n\nThe overridden method will not be automatically synchronized if the superclass method\nis declared as `synchronized`. This may result in unexpected race conditions when using the subclass.\n\n**Example:**\n\n\n class Super {\n synchronized void process() {}\n }\n class Sub extends Super {\n // Unsynchronized method 'process()' overrides synchronized method\n void process() {}\n } \n" + "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": "NonSynchronizedMethodOverridesSynchronizedMethod", + "suppressToolId": "AccessToStaticFieldLockedOnInstance", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18531,28 +18436,28 @@ ] }, { - "id": "WaitCalledOnCondition", + "id": "VariableTypeCanBeExplicit", "shortDescription": { - "text": "'wait()' called on 'java.util.concurrent.locks.Condition' object" + "text": "Variable type can be explicit" }, "fullDescription": { - "text": "Reports calls to 'wait()' made on a 'java.util.concurrent.locks.Condition' object. This is probably a programming error, and some variant of the 'await()' method was intended instead. Example: 'void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.wait();\n }\n }' Good code would look like this: 'void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.await();\n }\n }'", - "markdown": "Reports calls to `wait()` made on a `java.util.concurrent.locks.Condition` object. This is probably a programming error, and some variant of the `await()` method was intended instead.\n\n**Example:**\n\n\n void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.wait();\n }\n }\n\nGood code would look like this:\n\n\n void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.await();\n }\n }\n" + "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\";' This inspection depends on the Java feature 'Local variable type inference', which is available since Java 10.", + "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\nThis inspection depends on the Java feature 'Local variable type inference', which is available since Java 10." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "WaitCalledOnCondition", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "VariableTypeCanBeExplicit", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Java language level migration aids/Java 10", + "index": 160, "toolComponent": { "name": "QDJVM" } @@ -18564,19 +18469,19 @@ ] }, { - "id": "ProtectedMemberInFinalClass", + "id": "Java8ListSort", "shortDescription": { - "text": "'protected' member in 'final' class" + "text": "'Collections.sort()' can be replaced with 'List.sort()'" }, "fullDescription": { - "text": "Reports 'protected' members in 'final'classes. Since 'final' classes cannot be inherited, marking the method as 'protected' may be confusing. It is better to declare such members as 'private' or package-visible instead. Example: 'record Bar(int a, int b) {\n protected int sum() { \n return a + b;\n }\n}'\n After the quick-fix is applied: 'record Bar(int a, int b) {\n int sum() { \n return a + b;\n }\n}' As shown in the example, a class can be marked as 'final' explicitly or implicitly.", - "markdown": "Reports `protected` members in `final`classes.\n\nSince `final` classes cannot be inherited, marking the method as `protected`\nmay be confusing. It is better to declare such members as `private` or package-visible instead.\n\n**Example:**\n\n record Bar(int a, int b) {\n protected int sum() { \n return a + b;\n }\n }\n\nAfter the quick-fix is applied:\n\n record Bar(int a, int b) {\n int sum() { \n return a + b;\n }\n }\n\nAs shown in the example, a class can be marked as `final` explicitly or implicitly." + "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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8.", + "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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ProtectedMemberInFinalClass", + "suppressToolId": "Java8ListSort", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18584,8 +18489,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -18597,19 +18502,19 @@ ] }, { - "id": "TooBroadCatch", + "id": "ComparatorCombinators", "shortDescription": { - "text": "Overly broad 'catch' block" + "text": "'Comparator' combinator can be used" }, "fullDescription": { - "text": "Reports 'catch' blocks with parameters that are more generic than the exception thrown by the corresponding 'try' block. Example: 'try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (Exception ex) { // warning: 'catch' of 'Exception' is too broad, masking exceptions 'RuntimeException'\n return defaultFilePath;\n }' After the quick-fix is applied: 'try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (RuntimeException ex) {\n return defaultFilePath;\n }' Configure the inspection: 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 which hide others but are themselves thrown option to ignore any exceptions that hide other exceptions but still may be thrown and thus are technically not overly broad.", - "markdown": "Reports `catch` blocks with parameters that are more generic than the exception thrown by the corresponding `try` block.\n\n**Example:**\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (Exception ex) { // warning: 'catch' of 'Exception' is too broad, masking exceptions 'RuntimeException'\n return defaultFilePath;\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (RuntimeException ex) {\n return defaultFilePath;\n }\n\nConfigure the inspection:\n\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 which hide others but are themselves thrown** option to ignore any exceptions that hide other exceptions but still may be thrown and thus are technically not overly broad." + "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));' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "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\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OverlyBroadCatchBlock", + "suppressToolId": "ComparatorCombinators", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18617,8 +18522,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -18630,28 +18535,28 @@ ] }, { - "id": "DanglingJavadoc", + "id": "EqualsReplaceableByObjectsCall", "shortDescription": { - "text": "Dangling Javadoc comment" + "text": "'equals()' expression replaceable by 'Objects.equals()' expression" }, "fullDescription": { - "text": "Reports Javadoc comments that don't belong to any class, method or field. The Javadoc tool ignores dangling Javadoc comments and doesn't include them in the HTML documentation it generates. Example: 'class A {\n /**\n * Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }' A quick-fix is available to delete such comments completely or convert them into a block comment. After the quick-fix is applied: 'class A {\n /*\n Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }' Use the Ignore file header comment in JavaDoc format option to ignore comments at the beginning of Java files. These are usually copyright messages.", - "markdown": "Reports Javadoc comments that don't belong to any class, method or field. The Javadoc tool ignores dangling Javadoc comments and doesn't include them in the HTML documentation it generates.\n\n**Example:**\n\n\n class A {\n /**\n * Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }\n\nA quick-fix is available to delete such comments completely or convert them into a block comment. After the quick-fix is applied:\n\n\n class A {\n /*\n Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }\n\nUse the **Ignore file header comment in JavaDoc format** option to ignore comments at the beginning of Java files.\nThese are usually copyright messages." + "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 depends on the Java feature 'java.util.Objects API', which is available since Java 7.", + "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 depends on the Java feature 'java.util.Objects API', which is available since Java 7." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "DanglingJavadoc", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "EqualsReplaceableByObjectsCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Java language level migration aids/Java 7", + "index": 161, "toolComponent": { "name": "QDJVM" } @@ -18663,19 +18568,19 @@ ] }, { - "id": "HibernateResource", + "id": "AbstractMethodCallInConstructor", "shortDescription": { - "text": "Hibernate resource opened but not safely closed" + "text": "Abstract method called during object construction" }, "fullDescription": { - "text": "Reports calls to the 'openSession()' method if the returned 'org.hibernate.Session' resource is not safely closed. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'void doHibernateQuery(SessionFactory factory) {\n Session session = factory.openSession(); //warning\n session.createQuery(\"...\");\n }' Use the following options to configure the inspection: Whether a 'org.hibernate.Session' 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 calls to the `openSession()` method if the returned `org.hibernate.Session` resource is not safely closed.\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 doHibernateQuery(SessionFactory factory) {\n Session session = factory.openSession(); //warning\n session.createQuery(\"...\");\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a `org.hibernate.Session` 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." + "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": "HibernateResourceOpenedButNotSafelyClosed", + "suppressToolId": "AbstractMethodCallInConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18683,8 +18588,8 @@ "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -18696,28 +18601,28 @@ ] }, { - "id": "UnnecessaryInitCause", + "id": "TailRecursion", "shortDescription": { - "text": "Unnecessary call to 'Throwable.initCause()'" + "text": "Tail recursion" }, "fullDescription": { - "text": "Reports calls to 'Throwable.initCause()' where an exception constructor also takes a 'Throwable cause' argument. In this case, the 'initCause()' call can be removed and its argument can be added to the call to the exception's constructor. Example: 'try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\");\n wrapper.initCause(ex); // Unnecessary call to 'Throwable.initCause()'\n throw wrapper;\n }' A quick-fix is available to pass the cause argument to the constructor. After the quick-fix is applied: 'try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\", ex);\n throw wrapper;\n }'", - "markdown": "Reports calls to `Throwable.initCause()` where an exception constructor also takes a `Throwable cause` argument.\n\nIn this case, the `initCause()` call can be removed and its argument can be added to the call to the exception's constructor.\n\n**Example:**\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\");\n wrapper.initCause(ex); // Unnecessary call to 'Throwable.initCause()'\n throw wrapper;\n }\n\nA quick-fix is available to pass the cause argument to the constructor. After the quick-fix is applied:\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\", ex);\n throw wrapper;\n }\n \n" + "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": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "UnnecessaryInitCause", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "TailRecursion", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -18729,19 +18634,19 @@ ] }, { - "id": "ComparisonOfShortAndChar", + "id": "StringEqualsEmptyString", "shortDescription": { - "text": "Comparison of 'short' and 'char' values" + "text": "'String.equals()' can be replaced with 'String.isEmpty()'" }, "fullDescription": { - "text": "Reports equality comparisons between 'short' and 'char' values. Such comparisons may cause subtle bugs because while both values are 2-byte long, 'short' values are signed, and 'char' values are unsigned. Example: 'if (Character.MAX_VALUE == shortValue()) {} //never can be true'", - "markdown": "Reports equality comparisons between `short` and `char` values.\n\nSuch comparisons may cause subtle bugs because while both values are 2-byte long, `short` values are\nsigned, and `char` values are unsigned.\n\n**Example:**\n\n\n if (Character.MAX_VALUE == shortValue()) {} //never can be true\n" + "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, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ComparisonOfShortAndChar", + "suppressToolId": "StringEqualsEmptyString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18749,8 +18654,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -18762,28 +18667,28 @@ ] }, { - "id": "ArrayCanBeReplacedWithEnumValues", + "id": "PreviewFeature", "shortDescription": { - "text": "Array can be replaced with enum values" + "text": "Preview Feature warning" }, "fullDescription": { - "text": "Reports arrays of enum constants that can be replaced with a call to 'EnumType.values()'. Usually, when updating such an enum, you have to update the array as well. However, if you use 'EnumType.values()' instead, no modifications are required. Example: 'enum States {\n NOT_RUN, IN_PROGRESS, FINISHED;\n }\n \n handleStates(new States[] {NOT_RUN, IN_PROGRESS, FINISHED});' After the quick-fix is applied: 'handleStates(States.values());' New in 2019.1", - "markdown": "Reports arrays of enum constants that can be replaced with a call to `EnumType.values()`.\n\nUsually, when updating such an enum, you have to update the array as well. However, if you use `EnumType.values()`\ninstead, no modifications are required.\n\nExample:\n\n\n enum States {\n NOT_RUN, IN_PROGRESS, FINISHED;\n }\n \n handleStates(new States[] {NOT_RUN, IN_PROGRESS, FINISHED});\n\nAfter the quick-fix is applied:\n\n\n handleStates(States.values());\n\nNew in 2019.1" + "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": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ArrayCanBeReplacedWithEnumValues", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "preview", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Compiler issues", + "index": 162, "toolComponent": { "name": "QDJVM" } @@ -18795,19 +18700,19 @@ ] }, { - "id": "WaitNotifyNotInSynchronizedContext", + "id": "TooBroadThrows", "shortDescription": { - "text": "'wait()' or 'notify()' is not in synchronized context" + "text": "Overly broad 'throws' clause" }, "fullDescription": { - "text": "Reports calls to 'wait()', 'notify()', and 'notifyAll()' that are not made inside a corresponding synchronized statement or synchronized method. Calling these methods on an object without holding a lock on that object causes 'IllegalMonitorStateException'. Such a construct is not necessarily an error, as the necessary lock may be acquired before the containing method is called, but it's worth looking at. Example: 'class Sync {\n private final Object lock = new Object();\n\n void test() throws InterruptedException {\n synchronized (this) {\n lock.wait(); // 'lock.wait()' is not synchronized on 'lock'\n }\n }\n }'", - "markdown": "Reports calls to `wait()`, `notify()`, and `notifyAll()` that are not made inside a corresponding synchronized statement or synchronized method.\n\n\nCalling these methods on an object\nwithout holding a lock on that object causes `IllegalMonitorStateException`.\nSuch a construct is not necessarily an error, as the necessary lock may be acquired before\nthe containing method is called, but it's worth looking at.\n\n**Example:**\n\n\n class Sync {\n private final Object lock = new Object();\n\n void test() throws InterruptedException {\n synchronized (this) {\n lock.wait(); // 'lock.wait()' is not synchronized on 'lock'\n }\n }\n }\n" + "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": "WaitNotifyWhileNotSynced", + "suppressToolId": "OverlyBroadThrowsClause", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18815,8 +18720,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -18828,28 +18733,28 @@ ] }, { - "id": "DollarSignInName", + "id": "ImplicitSubclassInspection", "shortDescription": { - "text": "Use of '$' in identifier" + "text": "Final declaration can't be overridden at runtime" }, "fullDescription": { - "text": "Reports variables, methods, and classes with dollar signs ('$') in their names. While such names are legal Java, their use outside of generated java code is strongly discouraged. Example: 'class SalaryIn${}' Rename quick-fix is suggested only in the editor.", - "markdown": "Reports variables, methods, and classes with dollar signs (`$`) in their names. While such names are legal Java, their use outside of generated java code is strongly discouraged.\n\n**Example:**\n\n\n class SalaryIn${}\n\nRename quick-fix is suggested only in the editor." + "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": false, - "level": "warning", + "enabled": true, + "level": "error", "parameters": { - "suppressToolId": "DollarSignInName", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ImplicitSubclassInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -18861,21 +18766,21 @@ ] }, { - "id": "DynamicRegexReplaceableByCompiledPattern", + "id": "ObjectEqualsCanBeEquality", "shortDescription": { - "text": "Dynamic regular expression can be replaced by compiled 'Pattern'" + "text": "'equals()' call can be replaced with '=='" }, "fullDescription": { - "text": "Reports calls to the regular expression methods (such as 'matches()' or 'split()') of 'java.lang.String' using constant arguments. Such calls may be profitably replaced with a 'private static final Pattern' field so that the regular expression does not have to be compiled each time it is used. Example: 'text.replaceAll(\"abc\", replacement);' After the quick-fix is applied: 'private static final Pattern ABC = Pattern.compile(\"abc\", Pattern.LITERAL);\n ABC.matcher(text).replaceAll(Matcher.quoteReplacement(replacement));'", - "markdown": "Reports calls to the regular expression methods (such as `matches()` or `split()`) of `java.lang.String` using constant arguments.\n\n\nSuch calls may be profitably replaced with a `private static final Pattern` field\nso that the regular expression does not have to be compiled each time it is used.\n\n**Example:**\n\n\n text.replaceAll(\"abc\", replacement);\n\nAfter the quick-fix is applied:\n\n\n private static final Pattern ABC = Pattern.compile(\"abc\", Pattern.LITERAL);\n ABC.matcher(text).replaceAll(Matcher.quoteReplacement(replacement));\n" + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "DynamicRegexReplaceableByCompiledPattern", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ObjectEqualsCanBeEquality", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ @@ -18894,19 +18799,22 @@ ] }, { - "id": "EmptyInitializer", + "id": "JDBCPrepareStatementWithNonConstantString", "shortDescription": { - "text": "Empty class initializer" + "text": "Call to 'Connection.prepare*()' with non-constant string" }, "fullDescription": { - "text": "Reports empty class initializer blocks.", - "markdown": "Reports empty class initializer blocks." + "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": "EmptyClassInitializer", + "suppressToolId": "JDBCPrepareStatementWithNonConstantString", + "cweIds": [ + 89 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18914,8 +18822,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -18927,19 +18835,23 @@ ] }, { - "id": "UnnecessaryBreak", + "id": "SystemProperties", "shortDescription": { - "text": "Unnecessary 'break' statement" + "text": "Access of system properties" }, "fullDescription": { - "text": "Reports any unnecessary 'break' statements. An 'break' statement is unnecessary if no other statements are executed after it has been removed. Example: 'switch (e) {\n case A -> {\n System.out.println(\"A\");\n break; // reports 'break' statement is unnecessary\n }\n default -> {\n System.out.println(\"Default\");\n break; // reports 'break' statement is unnecessary\n }\n }'", - "markdown": "Reports any unnecessary `break` statements.\n\nAn `break` statement is unnecessary if no other statements are executed after it has been removed.\n\n**Example:**\n\n\n switch (e) {\n case A -> {\n System.out.println(\"A\");\n break; // reports 'break' statement is unnecessary\n }\n default -> {\n System.out.println(\"Default\");\n break; // reports 'break' statement is unnecessary\n }\n }\n" + "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": "UnnecessaryBreak", + "suppressToolId": "AccessOfSystemProperties", + "cweIds": [ + 250, + 668 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18947,8 +18859,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -18960,19 +18872,19 @@ ] }, { - "id": "RawUseOfParameterizedType", + "id": "InvalidComparatorMethodReference", "shortDescription": { - "text": "Raw use of parameterized class" + "text": "Invalid method reference used for 'Comparator'" }, "fullDescription": { - "text": "Reports generic classes with omitted type parameters. Such raw use of generic types is valid in Java, but it defeats the purpose of type parameters and may mask bugs. This inspection mirrors the 'rawtypes' warning of 'javac'. Examples: '//warning: Raw use of parameterized class 'List'\nList list = new ArrayList();\n//list of strings was created but integer is accepted as well\nlist.add(1);' '//no warning as it's impossible to provide type arguments during array creation\nIntFunction[]> fun = List[]::new;' Configure the inspection: Use the Ignore construction of new objects option to ignore raw types used in object construction. Use the Ignore type casts option to ignore raw types used in type casts. Use the Ignore where a type parameter would not compile option to ignore the cases when a type parameter fails to compile (for example, when creating an array or overriding a library method). Use the Ignore parameter types of overriding methods option to ignore type parameters used in parameters of overridden methods. Use the Ignore when automatic quick-fix is not available option to ignore the cases when a quick-fix is not available. This inspection depends on the Java feature 'Generics', which is available since Java 5.", - "markdown": "Reports generic classes with omitted type parameters. Such *raw* use of generic types is valid in Java, but it defeats the purpose of type parameters and may mask bugs. This inspection mirrors the `rawtypes` warning of `javac`.\n\n**Examples:**\n\n\n //warning: Raw use of parameterized class 'List'\n List list = new ArrayList();\n //list of strings was created but integer is accepted as well\n list.add(1);\n\n\n //no warning as it's impossible to provide type arguments during array creation\n IntFunction[]> fun = List[]::new;\n\nConfigure the inspection:\n\n* Use the **Ignore construction of new objects** option to ignore raw types used in object construction.\n* Use the **Ignore type casts** option to ignore raw types used in type casts.\n* Use the **Ignore where a type parameter would not compile** option to ignore the cases when a type parameter fails to compile (for example, when creating an array or overriding a library method).\n* Use the **Ignore parameter types of overriding methods** option to ignore type parameters used in parameters of overridden methods.\n* Use the **Ignore when automatic quick-fix is not available** option to ignore the cases when a quick-fix is not available.\n\nThis inspection depends on the Java feature 'Generics', which is available since Java 5." + "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 ints = foo();\n ints.sort(Math::min);' After the quick-fix is applied: 'ArrayList 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 ints = foo();\n ints.sort(Math::min);\n\nAfter the quick-fix is applied:\n\n\n ArrayList ints = foo();\n ints.sort(Comparator.reverseOrder());\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "rawtypes", + "suppressToolId": "InvalidComparatorMethodReference", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -18980,8 +18892,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -18993,19 +18905,19 @@ ] }, { - "id": "PublicConstructorInNonPublicClass", + "id": "ToArrayCallWithZeroLengthArrayArgument", "shortDescription": { - "text": "'public' constructor in non-public class" + "text": "'Collection.toArray()' call style" }, "fullDescription": { - "text": "Reports 'public' constructors in non-'public' classes. Usually, there is no reason for creating a 'public' constructor in a class with a lower access level. Please note, however, that this inspection changes the behavior of some reflection calls. In particular, 'Class.getConstructor()' won't be able to find the updated constructor ('Class.getDeclaredConstructor()' should be used instead). Do not use the inspection if your code or code of some used frameworks relies on constructor accessibility via 'getConstructor()'. Example: 'class House {\n public House() {}\n }' After the quick-fix is applied: 'class House {\n House() {}\n }'", - "markdown": "Reports `public` constructors in non-`public` classes.\n\nUsually, there is no reason for creating a `public` constructor in a class with a lower access level.\nPlease note, however, that this inspection changes the behavior of some reflection calls. In particular,\n`Class.getConstructor()` won't be able to find the updated constructor\n(`Class.getDeclaredConstructor()` should be used instead). Do not use the inspection if your code\nor code of some used frameworks relies on constructor accessibility via `getConstructor()`.\n\n**Example:**\n\n\n class House {\n public House() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class House {\n House() {}\n }\n" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PublicConstructorInNonPublicClass", + "suppressToolId": "ToArrayCallWithZeroLengthArrayArgument", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19013,8 +18925,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -19026,19 +18938,19 @@ ] }, { - "id": "ProtectedInnerClass", + "id": "Java9ModuleExportsPackageToItself", "shortDescription": { - "text": "Protected nested class" + "text": "Module exports/opens package to itself" }, "fullDescription": { - "text": "Reports 'protected' nested classes. Example: 'public class Outer {\n protected static class Nested {} // warning\n protected class Inner {} // warning\n protected enum Mode {} // warning depends on the setting\n protected interface I {} // warning depends on the setting\n }' Configure the inspection: Use the Ignore 'protected' inner enums option to ignore 'protected' inner enums. Use the Ignore 'protected' inner interfaces option to ignore 'protected' inner interfaces.", - "markdown": "Reports `protected` nested classes.\n\n**Example:**\n\n\n public class Outer {\n protected static class Nested {} // warning\n protected class Inner {} // warning\n protected enum Mode {} // warning depends on the setting\n protected interface I {} // warning depends on the setting\n }\n\nConfigure the inspection:\n\n* Use the **Ignore 'protected' inner enums** option to ignore `protected` inner enums.\n* Use the **Ignore 'protected' inner interfaces** option to ignore `protected` inner interfaces." + "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 depends on the Java feature 'Modules', which is available since Java 9.", + "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 depends on the Java feature 'Modules', which is available since Java 9." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ProtectedInnerClass", + "suppressToolId": "Java9ModuleExportsPackageToItself", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19046,8 +18958,8 @@ "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -19059,28 +18971,28 @@ ] }, { - "id": "UnqualifiedStaticUsage", + "id": "LoggerInitializedWithForeignClass", "shortDescription": { - "text": "Unqualified static access" + "text": "Logger initialized with foreign class" }, "fullDescription": { - "text": "Reports usage of static members that is not qualified with the class name. This is legal if the static member is in the same class, but may be confusing. Example: '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 }' After the quick-fix is applied: '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 }' Use the inspection settings to toggle the reporting for the following items: static fields access 'void bar() { System.out.println(x); }' calls to static methods 'void bar() { foo(); }' 'static void baz() { foo(); }' You can also configure the inspection to only report static member usage from a non-static context. In the above example, 'static void baz() { foo(); }' will not be reported.", - "markdown": "Reports usage of static members that is not qualified with the class name.\n\n\nThis is legal if the static member is in\nthe same class, but may be confusing.\n\n**Example:**\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\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.foo();\n System.out.println(Foo.x);\n }\n\n static void baz() { Foo.foo(); }\n }\n\nUse the inspection settings to toggle the reporting for the following items:\n\n*\n static fields access \n\n `void bar() { System.out.println(x); }`\n\n*\n calls to static methods \n\n `void bar() { foo(); }` \n\n `static void baz() { foo(); }`\n\n\nYou can also configure the inspection to only report static member usage from a non-static context.\nIn the above example, `static void baz() { foo(); }` will not be reported." + "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", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "UnqualifiedStaticUsage", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LoggerInitializedWithForeignClass", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Logging", + "index": 119, "toolComponent": { "name": "QDJVM" } @@ -19092,19 +19004,19 @@ ] }, { - "id": "ExternalizableWithoutPublicNoArgConstructor", + "id": "MarkerInterface", "shortDescription": { - "text": "'Externalizable' class without 'public' no-arg constructor" + "text": "Marker interface" }, "fullDescription": { - "text": "Reports 'Externalizable' classes without a public no-argument constructor. When an 'Externalizable' object is reconstructed, an instance is created using the public no-arg constructor before the 'readExternal' method called. If a public no-arg constructor is not available, a 'java.io.InvalidClassException' will be thrown at runtime.", - "markdown": "Reports `Externalizable` classes without a public no-argument constructor.\n\nWhen an `Externalizable` object is reconstructed, an instance is created using the public\nno-arg constructor before the `readExternal` method called. If a public\nno-arg constructor is not available, a `java.io.InvalidClassException` will be\nthrown at runtime." + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ExternalizableWithoutPublicNoArgConstructor", + "suppressToolId": "MarkerInterface", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19112,8 +19024,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -19125,19 +19037,22 @@ ] }, { - "id": "StaticGuardedByInstance", + "id": "SortedCollectionWithNonComparableKeys", "shortDescription": { - "text": "Static member guarded by instance field or this" + "text": "Sorted collection with non-comparable elements" }, "fullDescription": { - "text": "Reports '@GuardedBy' annotations on 'static' fields or methods in which the guard is either a non-static field or 'this'. Guarding a static element with a non-static element may result in excessive concurrency, multiple threads may be able to access the guarded field simultaneously by locking in different object contexts. Example: 'private ReadWriteLock lock = new ReentrantReadWriteLock();\n\n @GuardedBy(\"lock\")\n public static void bar() {\n // ...\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 `static` fields or methods in which the guard is either a non-static field or `this`.\n\nGuarding a static element with a non-static element may result in\nexcessive concurrency, multiple threads may be able to access the guarded field simultaneously by locking in different object contexts.\n\nExample:\n\n\n private ReadWriteLock lock = new ReentrantReadWriteLock();\n\n @GuardedBy(\"lock\")\n public static void bar() {\n // ...\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`" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "StaticGuardedByInstance", + "suppressToolId": "SortedCollectionWithNonComparableKeys", + "cweIds": [ + 697 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19145,8 +19060,8 @@ "relationships": [ { "target": { - "id": "Java/Concurrency annotation issues", - "index": 100, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -19158,28 +19073,28 @@ ] }, { - "id": "ManualArrayCopy", + "id": "CommentedOutCode", "shortDescription": { - "text": "Manual array copy" + "text": "Commented out code" }, "fullDescription": { - "text": "Reports manual copying of array contents that can be replaced with a call to 'System.arraycopy()'. Example: 'for (int i = 0; i < array.length; i++) {\n newArray[i] = array[i];\n }' After the quick-fix is applied: 'System.arraycopy(array, 0, newArray, 0, array.length);'", - "markdown": "Reports manual copying of array contents that can be replaced with a call to `System.arraycopy()`.\n\n**Example:**\n\n\n for (int i = 0; i < array.length; i++) {\n newArray[i] = array[i];\n }\n\nAfter the quick-fix is applied:\n\n\n System.arraycopy(array, 0, newArray, 0, array.length);\n" + "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": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ManualArrayCopy", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "CommentedOutCode", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -19191,19 +19106,19 @@ ] }, { - "id": "StaticPseudoFunctionalStyleMethod", + "id": "ClassWithoutLogger", "shortDescription": { - "text": "Guava pseudo-functional call can be converted to Stream API call" + "text": "Class without logger" }, "fullDescription": { - "text": "Reports usages of Guava pseudo-functional code when 'Java Stream API' is available. Though 'Guava Iterable API' provides functionality similar to 'Java Streams API', it's slightly different and may miss some features. Especially, primitive-specialized stream variants like 'IntStream' are more performant than generic variants. Example: 'List transformedIterable = Iterables.transform(someList, someTransformFunction);//warning: Pseudo functional style code' After the quick-fix is applied: 'List transformedIterable = someList.stream().map(someTransformFunction).collect(Collectors.toList());' Note: Code semantics can be changed; for example, Guava's 'Iterable.transform' produces a lazy-evaluated iterable, but the replacement is eager-evaluated. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports usages of Guava pseudo-functional code when `Java Stream API` is available.\n\nThough `Guava Iterable API` provides functionality similar to `Java Streams API`, it's slightly different and\nmay miss some features.\nEspecially, primitive-specialized stream variants like `IntStream` are more performant than generic variants.\n\n**Example:**\n\n\n List transformedIterable = Iterables.transform(someList, someTransformFunction);//warning: Pseudo functional style code\n\nAfter the quick-fix is applied:\n\n List transformedIterable = someList.stream().map(someTransformFunction).collect(Collectors.toList());\n\n\n**Note:** Code semantics can be changed; for example, Guava's `Iterable.transform` produces a lazy-evaluated iterable,\nbut the replacement is eager-evaluated.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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": "StaticPseudoFunctionalStyleMethod", + "suppressToolId": "ClassWithoutLogger", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19211,8 +19126,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Logging", + "index": 119, "toolComponent": { "name": "QDJVM" } @@ -19224,28 +19139,28 @@ ] }, { - "id": "ControlFlowStatementWithoutBraces", + "id": "ReturnOfInnerClass", "shortDescription": { - "text": "Control flow statement without braces" + "text": "Return of instance of anonymous, local or inner class" }, "fullDescription": { - "text": "Reports any 'if', 'while', 'do', or 'for' statements without braces. Some code styles, e.g. the Google Java Style guide, require braces for all control statements. When adding further statements to control statements without braces, it is important not to forget adding braces. When commenting out a line of code, it is also necessary to be more careful when not using braces, to not inadvertently make the next statement part of the control flow statement. Always using braces makes inserting or commenting out a line of code safer. It's likely the goto fail vulnerability would not have happened, if an always use braces code style was used. Control statements with braces make the control flow easier to see, without relying on, possibly incorrect, indentation. Example: 'class Strange {\n void x(boolean one, boolean two) {\n if(one)\n if(two)\n foo();\n else\n bar();\n }\n\n void foo() {}\n void bar() {}\n }' The quick-fix wraps the statement body with braces: 'class Strange {\n void x(boolean one, boolean two) {\n if(one) {\n if(two) {\n foo();\n } else {\n bar();\n }\n }\n }\n\n void foo() {}\n void bar() {}\n }'", - "markdown": "Reports any `if`, `while`, `do`, or `for` statements without braces. Some code styles, e.g. the [Google Java Style guide](https://google.github.io/styleguide/javaguide.html), require braces for all control statements.\n\n\nWhen adding further statements to control statements without braces, it is important not to forget adding braces.\nWhen commenting out a line of code, it is also necessary to be more careful when not using braces,\nto not inadvertently make the next statement part of the control flow statement.\nAlways using braces makes inserting or commenting out a line of code safer.\n\n\nIt's likely the [goto fail vulnerability](https://www.imperialviolet.org/2014/02/22/applebug.html) would not have happened,\nif an always use braces code style was used.\nControl statements with braces make the control flow easier to see, without relying on, possibly incorrect, indentation.\n\nExample:\n\n\n class Strange {\n void x(boolean one, boolean two) {\n if(one)\n if(two)\n foo();\n else\n bar();\n }\n\n void foo() {}\n void bar() {}\n }\n\nThe quick-fix wraps the statement body with braces:\n\n\n class Strange {\n void x(boolean one, boolean two) {\n if(one) {\n if(two) {\n foo();\n } else {\n bar();\n }\n }\n }\n\n void foo() {}\n void bar() {}\n }\n" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "ControlFlowStatementWithoutBraces", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ReturnOfInnerClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -19257,19 +19172,19 @@ ] }, { - "id": "NonFinalFieldInEnum", + "id": "AnonymousClassComplexity", "shortDescription": { - "text": "Non-final field in 'enum'" + "text": "Overly complex anonymous class" }, "fullDescription": { - "text": "Reports non-final fields in enumeration types. Non-final fields introduce global mutable state, which is generally considered undesirable. Example: 'enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public String str;\n\n Enum(String str) {\n this.str = str;\n }\n }' After the quick-fix is applied: 'enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public final String str;\n\n Enum(String str) {\n this.str = str;\n }\n }' Use the `Ignore fields that cannot be made 'final'` option to only warn on fields that can be made final using the quick-fix.", - "markdown": "Reports non-final fields in enumeration types. Non-final fields introduce global mutable state, which is generally considered undesirable.\n\n**Example:**\n\n\n enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public String str;\n\n Enum(String str) {\n this.str = str;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public final String str;\n\n Enum(String str) {\n this.str = str;\n }\n }\n\nUse the \\`Ignore fields that cannot be made 'final'\\` option to only warn on fields that can be made final using the quick-fix." + "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": "NonFinalFieldInEnum", + "suppressToolId": "OverlyComplexAnonymousInnerClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19277,8 +19192,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -19290,19 +19205,19 @@ ] }, { - "id": "LengthOneStringInIndexOf", + "id": "WaitWithoutCorrespondingNotify", "shortDescription": { - "text": "Single character string argument in 'String.indexOf()' call" + "text": "'wait()' without corresponding 'notify()'" }, "fullDescription": { - "text": "Reports single character strings being used as an argument in 'String.indexOf()' and 'String.lastIndexOf()' calls. A quick-fix is suggested to replace such string literals with equivalent character literals, gaining some performance enhancement. Example: 'return s.indexOf(\"x\");' After the quick-fix is applied: 'return s.indexOf('x');'", - "markdown": "Reports single character strings being used as an argument in `String.indexOf()` and `String.lastIndexOf()` calls.\n\nA quick-fix is suggested to replace such string literals with equivalent character literals, gaining some performance enhancement.\n\n**Example:**\n\n\n return s.indexOf(\"x\");\n\nAfter the quick-fix is applied:\n\n\n return s.indexOf('x');\n" + "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": "SingleCharacterStringConcatenation", + "suppressToolId": "WaitWithoutCorrespondingNotify", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19310,8 +19225,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -19323,22 +19238,19 @@ ] }, { - "id": "MisspelledEquals", + "id": "UseOfAWTPeerClass", "shortDescription": { - "text": "'equal()' instead of 'equals()'" + "text": "Use of AWT peer class" }, "fullDescription": { - "text": "Reports declarations of 'equal()' with a single parameter. Normally, this is a typo and 'equals()' is actually intended. A quick-fix is suggested to rename the method to 'equals'. Example: 'class Main {\n public boolean equal(Object obj) {\n return true;\n }\n }' After the quick-fix is applied: 'class Main {\n public boolean equals(Object obj) {\n return true;\n }\n }'", - "markdown": "Reports declarations of `equal()` with a single parameter. Normally, this is a typo and `equals()` is actually intended.\n\nA quick-fix is suggested to rename the method to `equals`.\n\n**Example:**\n\n\n class Main {\n public boolean equal(Object obj) {\n return true;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n public boolean equals(Object obj) {\n return true;\n }\n }\n" + "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": "MisspelledEquals", - "cweIds": [ - 697 - ], + "suppressToolId": "UseOfAWTPeerClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19346,8 +19258,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -19359,28 +19271,28 @@ ] }, { - "id": "EnumClass", + "id": "RedundantExplicitVariableType", "shortDescription": { - "text": "Enumerated class" + "text": "Local variable type can be omitted" }, "fullDescription": { - "text": "Reports enum classes. Such statements are not supported in Java 1.4 and earlier JVM.", - "markdown": "Reports **enum** classes. Such statements are not supported in Java 1.4 and earlier JVM." + "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 }' This inspection depends on the Java feature 'Local variable type inference', which is available since Java 10.", + "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\n\nThis inspection depends on the Java feature 'Local variable type inference', which is available since Java 10." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "EnumClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RedundantExplicitVariableType", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Java language level issues", - "index": 147, + "id": "Java/Java language level migration aids/Java 10", + "index": 160, "toolComponent": { "name": "QDJVM" } @@ -19392,19 +19304,19 @@ ] }, { - "id": "TrivialFunctionalExpressionUsage", + "id": "SerializableWithUnconstructableAncestor", "shortDescription": { - "text": "Trivial usage of functional expression" + "text": "Serializable class with unconstructable ancestor" }, "fullDescription": { - "text": "Reports functional interface methods calls that are directly invoked on the definition of the lambda, method reference, or anonymous class. Such method calls can be replaced with the body of the functional interface implementation. Example: 'boolean contains(List names, String name) {\n return ((Predicate)x -> {\n return names.contains(x);\n }).test(name);\n }' When the quick-fix is applied, the method call changes to: 'boolean contains(List names, String name) {\n return names.contains(name);\n }'", - "markdown": "Reports functional interface methods calls that are directly invoked on the definition of the lambda, method reference, or anonymous class. Such method calls can be replaced with the body of the functional interface implementation.\n\n**Example:**\n\n\n boolean contains(List names, String name) {\n return ((Predicate)x -> {\n return names.contains(x);\n }).test(name);\n }\n\nWhen the quick-fix is applied, the method call changes to:\n\n\n boolean contains(List names, String name) {\n return names.contains(name);\n }\n" + "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": "TrivialFunctionalExpressionUsage", + "suppressToolId": "SerializableClassWithUnconstructableAncestor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19412,8 +19324,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -19425,19 +19337,19 @@ ] }, { - "id": "AnonymousHasLambdaAlternative", + "id": "ExcessiveLambdaUsage", "shortDescription": { - "text": "Anonymous type has shorter lambda alternative" + "text": "Excessive lambda usage" }, "fullDescription": { - "text": "Reports anonymous classes which could be transformed to a constructor or a factory method call with a lambda expression argument. The following classes are reported by this inspection: Anonymous classes extending 'ThreadLocal' which have an 'initialValue()' method (can be replaced with 'ThreadLocal.withInitial') Anonymous classes extending 'Thread' which have a 'run()' method (can be replaced with 'new Thread(Runnable)' Example: 'new Thread() {\n @Override\n public void run() {\n System.out.println(\"Hello from thread!\");\n }\n }.start();' After the quick-fix is applied: 'new Thread(() -> {\n System.out.println(\"Hello from thread!\");\n }).start();' This inspection depends on the Java feature 'ThreadLocal.withInitial()', which is available since Java 8.", - "markdown": "Reports anonymous classes which could be transformed to a constructor or a factory method call with a lambda expression argument.\n\nThe following classes are reported by this inspection:\n\n* Anonymous classes extending `ThreadLocal` which have an `initialValue()` method (can be replaced with `ThreadLocal.withInitial`)\n* Anonymous classes extending `Thread` which have a `run()` method (can be replaced with `new Thread(Runnable)`\n\nExample:\n\n\n new Thread() {\n @Override\n public void run() {\n System.out.println(\"Hello from thread!\");\n }\n }.start();\n\nAfter the quick-fix is applied:\n\n\n new Thread(() -> {\n System.out.println(\"Hello from thread!\");\n }).start();\n\nThis inspection depends on the Java feature 'ThreadLocal.withInitial()', which is available since Java 8." + "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)' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8. 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\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.\n\nNew in 2017.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AnonymousHasLambdaAlternative", + "suppressToolId": "ExcessiveLambdaUsage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19445,8 +19357,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -19458,19 +19370,19 @@ ] }, { - "id": "ExtendsThread", + "id": "ParameterHidingMemberVariable", "shortDescription": { - "text": "Class directly extends 'Thread'" + "text": "Parameter hides field" }, "fullDescription": { - "text": "Reports classes that directly extend 'java.lang.Thread'. It is usually recommended to prefer composition over inheritance to create more reusable code that is easier to modify later. Example: 'class MainThread extends Thread {\n }'", - "markdown": "Reports classes that directly extend `java.lang.Thread`. It is usually recommended to prefer composition over inheritance to create more reusable code that is easier to modify later.\n\n**Example:**\n\n\n class MainThread extends Thread {\n }\n" + "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": "ClassExplicitlyExtendsThread", + "suppressToolId": "ParameterHidesMemberVariable", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19478,8 +19390,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -19491,28 +19403,28 @@ ] }, { - "id": "SimplifyOptionalCallChains", + "id": "LambdaBodyCanBeCodeBlock", "shortDescription": { - "text": "Optional call chain can be simplified" + "text": "Lambda body can be code block" }, "fullDescription": { - "text": "Reports Optional call chains that can be simplified. Here are several examples of possible simplifications: 'optional.map(x -> true).orElse(false)' → 'optional.isPresent()' 'optional.map(x -> Optional.of(x.trim())).orElseGet(Optional::empty)' → 'optional.map(String::trim)' 'optional.map(x -> (String)x).orElse(null)' → '(String) optional.orElse(null)' 'Optional.ofNullable(optional.orElse(null))' → 'optional' 'val = optional.orElse(null); val != null ? val : defaultExpr' → 'optional.orElse(defaultExpr)' 'val = optional.orElse(null); if(val != null) expr(val)' → 'optional.ifPresent(val -> expr(val))' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2017.2", - "markdown": "Reports **Optional** call chains that can be simplified. Here are several examples of possible simplifications:\n\n* `optional.map(x -> true).orElse(false)` → `optional.isPresent()`\n* `optional.map(x -> Optional.of(x.trim())).orElseGet(Optional::empty)` → `optional.map(String::trim)`\n* `optional.map(x -> (String)x).orElse(null)` → `(String) optional.orElse(null)`\n* `Optional.ofNullable(optional.orElse(null))` → `optional`\n* `val = optional.orElse(null); val != null ? val : defaultExpr ` → `optional.orElse(defaultExpr)`\n* `val = optional.orElse(null); if(val != null) expr(val) ` → `optional.ifPresent(val -> expr(val))`\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2017.2" + "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}' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "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\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SimplifyOptionalCallChains", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LambdaBodyCanBeCodeBlock", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -19524,19 +19436,19 @@ ] }, { - "id": "RandomDoubleForRandomInteger", + "id": "CustomSecurityManager", "shortDescription": { - "text": "Using 'Random.nextDouble()' to get random integer" + "text": "Custom 'SecurityManager'" }, "fullDescription": { - "text": "Reports calls to 'java.util.Random.nextDouble()' that are used to create a positive integer number by multiplying the call by a factor and casting to an integer. For generating a random positive integer in a range, 'java.util.Random.nextInt(int)' is simpler and more efficient. Example: 'int getRandomInt() {\n return (int) ((new Random()).nextDouble() * SIZE);\n }'\n After the quick-fix is applied: 'int getRandomInt() {\n return (new Random()).nextInt(SIZE);\n }'", - "markdown": "Reports calls to `java.util.Random.nextDouble()` that are used to create a positive integer number by multiplying the call by a factor and casting to an integer.\n\n\nFor generating a random positive integer in a range,\n`java.util.Random.nextInt(int)` is simpler and more efficient.\n\n**Example:**\n\n\n int getRandomInt() {\n return (int) ((new Random()).nextDouble() * SIZE);\n }\n \nAfter the quick-fix is applied:\n\n\n int getRandomInt() {\n return (new Random()).nextInt(SIZE);\n }\n" + "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": "UsingRandomNextDoubleForRandomInteger", + "suppressToolId": "CustomSecurityManager", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19544,8 +19456,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -19557,22 +19469,19 @@ ] }, { - "id": "SuspiciousArrayCast", + "id": "TimeToString", "shortDescription": { - "text": "Suspicious array cast" + "text": "Call to 'Time.toString()'" }, "fullDescription": { - "text": "Reports suspicious array casts. An array cast is considered suspicious when it casts to a more specific array type. Such a cast is legal at compile time but may fail with a 'ClassCastException' at runtime. Example: 'Number[] numbers = new Number[]{1L, 2L, 4L};\n Long[] longs = (Long[])numbers;'", - "markdown": "Reports suspicious array casts. An array cast is considered suspicious when it casts to a more specific array type. Such a cast is legal at compile time but may fail with a `ClassCastException` at runtime.\n\n**Example:**\n\n\n Number[] numbers = new Number[]{1L, 2L, 4L};\n Long[] longs = (Long[])numbers;\n" + "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": "SuspiciousArrayCast", - "cweIds": [ - 704 - ], + "suppressToolId": "CallToTimeToString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19580,8 +19489,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -19593,28 +19502,31 @@ ] }, { - "id": "ZeroLengthArrayInitialization", + "id": "ObjectEquality", "shortDescription": { - "text": "Zero-length array allocation" + "text": "Object comparison using '==', instead of 'equals()'" }, "fullDescription": { - "text": "Reports allocations of arrays with known lengths of zero. Since array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly allocate new ones. Such sharing may provide useful optimizations in the program runtime or footprint. Note that the inspection does not report zero-length arrays allocated as static final fields, since those arrays are assumed to be used for implementing array sharing.", - "markdown": "Reports allocations of arrays with known lengths of zero.\n\n\nSince array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly\nallocate new ones. Such sharing may provide useful optimizations in the program runtime or footprint.\n\n\nNote that the inspection does not report zero-length arrays allocated as static final fields,\nsince those arrays are assumed to be used for implementing array sharing." + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ZeroLengthArrayAllocation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ObjectEquality", + "cweIds": [ + 480 + ], + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -19626,28 +19538,28 @@ ] }, { - "id": "DivideByZero", + "id": "PatternVariablesCanBeReplacedWithCast", "shortDescription": { - "text": "Division by zero" + "text": "Using 'instanceof' with patterns" }, "fullDescription": { - "text": "Reports division by zero or remainder by zero. Such expressions will produce an 'Infinity', '-Infinity' or 'NaN' result for doubles or floats, and will throw an 'ArithmeticException' for integers. When the expression has a 'NaN' result, the fix suggests replacing the division expression with the 'NaN' constant.", - "markdown": "Reports division by zero or remainder by zero. Such expressions will produce an `Infinity`, `-Infinity` or `NaN` result for doubles or floats, and will throw an `ArithmeticException` for integers.\n\nWhen the expression has a `NaN` result, the fix suggests replacing the division expression with the `NaN` constant." + "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": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "divzero", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "PatternVariablesCanBeReplacedWithCast", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -19659,19 +19571,19 @@ ] }, { - "id": "MissingSerialAnnotation", + "id": "ManualArrayToCollectionCopy", "shortDescription": { - "text": "'@Serial' annotation can be used" + "text": "Manual array to collection copy" }, "fullDescription": { - "text": "Reports methods and fields in the 'Serializable' and 'Externalizable' classes that are suitable to be annotated with the 'java.io.Serial' annotation. The quick-fix adds the annotation. Example: 'class Main implements Serializable {\n private static final long serialVersionUID = 7874493593505141603L;\n\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' After the quick-fix is applied: 'class Main implements Serializable {\n @Serial\n private static final long serialVersionUID = 7874493593505141603L;\n\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' Example: 'class Main implements Externalizable {\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }' After the quick-fix is applied: 'class Main implements Externalizable {\n @Serial\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }' For more information about all possible cases, refer to the Javadoc of the 'java.io.Serial' class. This inspection depends on the Java feature '@Serial annotation', which is available since Java 14. New in 2020.3", - "markdown": "Reports methods and fields in the `Serializable` and `Externalizable` classes that are suitable to be annotated with the `java.io.Serial` annotation. The quick-fix adds the annotation.\n\n**Example:**\n\n\n class Main implements Serializable {\n private static final long serialVersionUID = 7874493593505141603L;\n\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Main implements Serializable {\n @Serial\n private static final long serialVersionUID = 7874493593505141603L;\n\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\n**Example:**\n\n\n class Main implements Externalizable {\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Main implements Externalizable {\n @Serial\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }\n\nFor more information about all possible cases, refer to the Javadoc of the `java.io.Serial` class.\n\nThis inspection depends on the Java feature '@Serial annotation', which is available since Java 14.\n\nNew in 2020.3" + "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 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 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 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 list, String[] arr) {\n Collections.addAll(list, arr);\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MissingSerialAnnotation", + "suppressToolId": "ManualArrayToCollectionCopy", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19679,8 +19591,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -19692,28 +19604,28 @@ ] }, { - "id": "StringConcatenationMissingWhitespace", + "id": "SwitchLabeledRuleCanBeCodeBlock", "shortDescription": { - "text": "Whitespace may be missing in string concatenation" + "text": "Labeled switch rule can have code block" }, "fullDescription": { - "text": "Reports string concatenations with missing whitespaces, that is where the left-hand side ends with a Unicode letter or digit and the right-hand side starts with a Unicode letter or digit. Example: 'String sql = \"SELECT column\" +\n \"FROM table\";' Use the Ignore concatenations with variable strings option to only report when both the left and right side of the concatenation are literals.", - "markdown": "Reports string concatenations with missing whitespaces, that is where the left-hand side ends with a Unicode letter or digit and the right-hand side starts with a Unicode letter or digit.\n\n**Example:**\n\n\n String sql = \"SELECT column\" +\n \"FROM table\";\n\n\nUse the **Ignore concatenations with variable strings** option to only report\nwhen both the left and right side of the concatenation are literals." + "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 };' This inspection depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14. 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\nThis inspection depends on the Java feature 'Enhanced 'switch' blocks', which is available since Java 14.\n\nNew in 2019.1" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "StringConcatenationMissingWhitespace", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SwitchLabeledRuleCanBeCodeBlock", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -19725,19 +19637,19 @@ ] }, { - "id": "StandardVariableNames", + "id": "JavaReflectionMemberAccess", "shortDescription": { - "text": "Standard variable names" + "text": "Reflective access to non-existent or not visible class member" }, "fullDescription": { - "text": "Reports variables with 'standard' names that do not correspond to their types. Such names may be confusing. There are the following standard names for specific types: i, j, k, m, n - 'int' f - 'float' d - 'double' b - 'byte' c, ch - 'char' l - 'long' s, str - 'String' Rename quick-fix is suggested only in the editor. Use the option to ignore parameter names which are identical to the parameter name from a direct super method.", - "markdown": "Reports variables with 'standard' names that do not correspond to their types. Such names may be confusing. There are the following standard names for specific types:\n\n* i, j, k, m, n - `int`\n* f - `float`\n* d - `double`\n* b - `byte`\n* c, ch - `char`\n* l - `long`\n* s, str - `String`\n\nRename quick-fix is suggested only in the editor.\n\n\nUse the option to ignore parameter names which are identical to the parameter name from a direct super method." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "StandardVariableNames", + "suppressToolId": "JavaReflectionMemberAccess", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19745,8 +19657,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Reflective access", + "index": 131, "toolComponent": { "name": "QDJVM" } @@ -19758,28 +19670,28 @@ ] }, { - "id": "DeconstructionCanBeUsed", + "id": "ObviousNullCheck", "shortDescription": { - "text": "Record pattern can be used" + "text": "Null-check method is called with obviously non-null argument" }, "fullDescription": { - "text": "Reports patterns that can be replaced with record patterns. Example: 'record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point p) {\n int x = p.x();\n int y = p.y();\n System.out.println(x + y);\n }\n }' After the quick-fix is applied: 'record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point(int x, int y)) {\n System.out.println(x + y);\n }\n }' This inspection depends on the Java feature 'Pattern guards and record patterns', which is available since Java 21. New in 2023.1", - "markdown": "Reports patterns that can be replaced with record patterns.\n\nExample:\n\n\n record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point p) {\n int x = p.x();\n int y = p.y();\n System.out.println(x + y);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point(int x, int y)) {\n System.out.println(x + y);\n }\n }\n\nThis inspection depends on the Java feature 'Pattern guards and record patterns', which is available since Java 21.\n\nNew in 2023.1" + "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": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "DeconstructionCanBeUsed", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ObviousNullCheck", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 21", - "index": 195, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -19791,19 +19703,19 @@ ] }, { - "id": "ExceptionFromCatchWhichDoesntWrap", + "id": "SerialVersionUIDNotStaticFinal", "shortDescription": { - "text": "'throw' inside 'catch' block which ignores the caught exception" + "text": "'serialVersionUID' field not declared 'private static final long'" }, "fullDescription": { - "text": "Reports exceptions that are thrown from inside 'catch' blocks but do not \"wrap\" the caught exception. When an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information, such as stack frames and line numbers. Example: '...\n catch (IOException e) {\n closeAllConnections();\n throw new ConnectException(\"Connection problem.\"); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'\n }' Configure the inspection: Use the Ignore if result of exception method call is used option to indicate whether the inspection should ignore exceptions whose argument is the result of a method call on the original exception, such as 'getMessage()'. Use the Ignore if thrown exception cannot wrap an exception option to ignore 'throw' statements that throw exceptions without a constructor that accepts a 'Throwable' cause.", - "markdown": "Reports exceptions that are thrown from inside `catch` blocks but do not \"wrap\" the caught exception.\n\nWhen an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information,\nsuch as stack frames and line numbers.\n\n**Example:**\n\n\n ...\n catch (IOException e) {\n closeAllConnections();\n throw new ConnectException(\"Connection problem.\"); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'\n }\n\nConfigure the inspection:\n\n* Use the **Ignore if result of exception method call is used** option to indicate whether the inspection should ignore exceptions whose argument is the result of a method call on the original exception, such as `getMessage()`.\n* Use the **Ignore if thrown exception cannot wrap an exception** option to ignore `throw` statements that throw exceptions without a constructor that accepts a `Throwable` cause." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ThrowInsideCatchBlockWhichIgnoresCaughtException", + "suppressToolId": "SerialVersionUIDWithWrongSignature", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19811,8 +19723,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -19824,19 +19736,19 @@ ] }, { - "id": "MethodOnlyUsedFromInnerClass", + "id": "InnerClassOnInterface", "shortDescription": { - "text": "Private method only used from inner class" + "text": "Inner class of interface" }, "fullDescription": { - "text": "Reports 'private' methods which are only called from an inner class of the class containing the method. Such methods can be safely moved into that inner class. Example: 'public class Outer {\n public static void main(String[] args) {\n new Inner().run(args[0]);\n }\n\n static class Inner {\n void run(String arg) {\n // Method isEmpty() is used from Inner class only\n // consider moving it to the Inner class\n if (!isEmpty(arg)) {\n System.out.println(\"Argument is supplied\");\n }\n }\n }\n\n private static boolean isEmpty(String s) {\n return s != null && s.trim().isEmpty();\n }\n}' Use the first checkbox below to ignore 'private' methods which are called from an anonymous or local class. Use the third checkbox to only report 'static' methods.", - "markdown": "Reports `private` methods which are only called from an inner class of the class containing the method. Such methods can be safely moved into that inner class.\n\nExample:\n\n\n public class Outer {\n public static void main(String[] args) {\n new Inner().run(args[0]);\n }\n\n static class Inner {\n void run(String arg) {\n // Method isEmpty() is used from Inner class only\n // consider moving it to the Inner class\n if (!isEmpty(arg)) {\n System.out.println(\"Argument is supplied\");\n }\n }\n }\n\n private static boolean isEmpty(String s) {\n return s != null && s.trim().isEmpty();\n }\n }\n\n\nUse the first checkbox below to ignore `private`\nmethods which are called from an anonymous or local class.\n\n\nUse the third checkbox to only report `static` methods." + "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": "MethodOnlyUsedFromInnerClass", + "suppressToolId": "InnerClassOfInterface", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19844,8 +19756,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -19857,19 +19769,19 @@ ] }, { - "id": "ComparisonToNaN", + "id": "PublicFieldAccessedInSynchronizedContext", "shortDescription": { - "text": "Comparison to 'Double.NaN' or 'Float.NaN'" + "text": "Non-private field accessed in 'synchronized' context" }, "fullDescription": { - "text": "Reports any comparisons to 'Double.NaN' or 'Float.NaN'. Such comparisons are never meaningful, as NaN is not equal to anything, including itself. Use the 'Double.isNaN()' or 'Float.isNaN()' methods instead. Example: 'if (x == Double.NaN) {...}' After the quick-fix is applied: 'if (Double.isNaN(x)) {...}'", - "markdown": "Reports any comparisons to `Double.NaN` or `Float.NaN`. Such comparisons are never meaningful, as NaN is not equal to anything, including itself. Use the `Double.isNaN()` or `Float.isNaN()` methods instead.\n\n**Example:**\n\n\n if (x == Double.NaN) {...}\n\nAfter the quick-fix is applied:\n\n\n if (Double.isNaN(x)) {...}\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ComparisonToNaN", + "suppressToolId": "NonPrivateFieldAccessedInSynchronizedContext", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19877,8 +19789,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -19890,28 +19802,28 @@ ] }, { - "id": "MultiCatchCanBeSplit", + "id": "UnusedLabel", "shortDescription": { - "text": "Multi-catch can be split into separate catch blocks" + "text": "Unused label" }, "fullDescription": { - "text": "Reports multi-'catch' sections and suggests splitting them into separate 'catch' blocks. Example: 'try {\n int i = getIndex();\n } catch (NullPointerException|IndexOutOfBoundsException e) {\n e.printStackTrace();\n }' After the quick-fix is applied: 'try {\n int i = getIndex();\n } catch (NullPointerException e) {\n e.printStackTrace();\n } catch (IndexOutOfBoundsException e) {\n e.printStackTrace();\n }' This inspection depends on the Java feature 'Multi-catches', which is available since Java 7.", - "markdown": "Reports multi-`catch` sections and suggests splitting them into separate `catch` blocks.\n\nExample:\n\n\n try {\n int i = getIndex();\n } catch (NullPointerException|IndexOutOfBoundsException e) {\n e.printStackTrace();\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n int i = getIndex();\n } catch (NullPointerException e) {\n e.printStackTrace();\n } catch (IndexOutOfBoundsException e) {\n e.printStackTrace();\n }\n\nThis inspection depends on the Java feature 'Multi-catches', which is available since Java 7." + "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": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MultiCatchCanBeSplit", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "UnusedLabel", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -19923,19 +19835,19 @@ ] }, { - "id": "ResultSetIndexZero", + "id": "ForeachStatement", "shortDescription": { - "text": "Use of index 0 in JDBC ResultSet" + "text": "Enhanced 'for' statement" }, "fullDescription": { - "text": "Reports attempts to access column 0 of 'java.sql.ResultSet' or 'java.sql.PreparedStatement'. For historical reasons, columns of 'java.sql.ResultSet' and 'java.sql.PreparedStatement' are numbered starting with 1, rather than with 0, and accessing column 0 is a common error in JDBC programming. Example: 'String getName(ResultSet rs) {\n return rs.getString(0);\n }'", - "markdown": "Reports attempts to access column 0 of `java.sql.ResultSet` or `java.sql.PreparedStatement`. For historical reasons, columns of `java.sql.ResultSet` and `java.sql.PreparedStatement` are numbered starting with **1** , rather than with **0** , and accessing column 0 is a common error in JDBC programming.\n\n**Example:**\n\n\n String getName(ResultSet rs) {\n return rs.getString(0);\n }\n" + "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 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 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": "UseOfIndexZeroInJDBCResultSet", + "suppressToolId": "ForeachStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19943,8 +19855,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Java language level issues", + "index": 147, "toolComponent": { "name": "QDJVM" } @@ -19956,19 +19868,19 @@ ] }, { - "id": "ConditionCoveredByFurtherCondition", + "id": "OptionalUsedAsFieldOrParameterType", "shortDescription": { - "text": "Condition is covered by further condition" + "text": "'Optional' used as field or parameter type" }, "fullDescription": { - "text": "Reports conditions that become redundant as they are completely covered by a subsequent condition. For example, in the 'value != -1 && value > 0' condition, the first part is redundant: if it's false, then the second part is also false. Or in a condition like 'obj != null && obj instanceof String', the null-check is redundant as 'instanceof' operator implies non-nullity. New in 2018.3", - "markdown": "Reports conditions that become redundant as they are completely covered by a subsequent condition.\n\nFor example, in the `value != -1 && value > 0` condition, the first part is redundant:\nif it's false, then the second part is also false.\nOr in a condition like `obj != null && obj instanceof String`,\nthe null-check is redundant as `instanceof` operator implies non-nullity.\n\nNew in 2018.3" + "text": "Reports any cases in which 'java.util.Optional', '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 name; // Optional field\n\n // Optional parameter\n void setName(Optional name) {\n this.name = name;\n }\n }'", + "markdown": "Reports any cases in which `java.util.Optional`, `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 name; // Optional field\n\n // Optional parameter\n void setName(Optional name) {\n this.name = name;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConditionCoveredByFurtherCondition", + "suppressToolId": "OptionalUsedAsFieldOrParameterType", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -19976,8 +19888,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -19989,19 +19901,24 @@ ] }, { - "id": "PatternVariableHidesField", + "id": "ReplaceAllDot", "shortDescription": { - "text": "Pattern variable hides field" + "text": "Suspicious regex expression argument" }, "fullDescription": { - "text": "Reports pattern variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the pattern variable when using the identically named field is intended. A quick-fix is suggested to rename the variable. Example: 'class Pointless {\n Point p = new Point();\n\n public void test(Object a) {\n if (a instanceof Point p) {\n System.out.print(\"a is a point (\" + p.x + \", \" + p.y + ')');\n } else {\n System.out.print(\"p is a point (\" + p.x + \", \" + p.y + ')');\n }\n }\n }' New in 2022.2", - "markdown": "Reports pattern variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the pattern variable when using the identically named field is intended.\n\n\nA quick-fix is suggested to rename the variable.\n\n**Example:**\n\n\n class Pointless {\n Point p = new Point();\n\n public void test(Object a) {\n if (a instanceof Point p) {\n System.out.print(\"a is a point (\" + p.x + \", \" + p.y + ')');\n } else {\n System.out.print(\"p is a point (\" + p.x + \", \" + p.y + ')');\n }\n }\n }\n\nNew in 2022.2" + "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": "PatternVariableHidesField", + "suppressToolId": "SuspiciousRegexArgument", + "cweIds": [ + 20, + 185, + 628 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20009,8 +19926,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -20022,28 +19939,28 @@ ] }, { - "id": "JoinDeclarationAndAssignmentJava", + "id": "ForCanBeForeach", "shortDescription": { - "text": "Assignment can be joined with declaration" + "text": "'for' loop can be replaced with enhanced for loop" }, "fullDescription": { - "text": "Reports variable assignments that can be joined with a variable declaration. Example: 'int x;\n x = 1;' The quick-fix converts the assignment into an initializer: 'int x = 1;' New in 2018.3", - "markdown": "Reports variable assignments that can be joined with a variable declaration.\n\nExample:\n\n\n int x;\n x = 1;\n\nThe quick-fix converts the assignment into an initializer:\n\n\n int x = 1;\n\nNew in 2018.3" + "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 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 depends on the Java feature 'For-each loops', which is available since Java 5.", + "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 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 depends on the Java feature 'For-each loops', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "JoinDeclarationAndAssignmentJava", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ForLoopReplaceableByForEach", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -20055,19 +19972,19 @@ ] }, { - "id": "InnerClassVariableHidesOuterClassVariable", + "id": "PackageVisibleField", "shortDescription": { - "text": "Inner class field hides outer class field" + "text": "Package-visible field" }, "fullDescription": { - "text": "Reports inner class fields named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the field from the inner class when using the identically named field of a surrounding class is intended. A quick-fix is suggested to rename the inner class field. Example: 'class Outer {\n private String name;\n\n class Inner {\n private String name;\n }\n }' Use the option to choose whether this inspection should report all name clashes, or only clashes with fields that are visible from the inner class.", - "markdown": "Reports inner class fields named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the field from the inner class when using the identically named field of a surrounding class is intended.\n\nA quick-fix is suggested to rename the inner class field.\n\n**Example:**\n\n\n class Outer {\n private String name;\n\n class Inner {\n private String name;\n }\n }\n\n\nUse the option to choose whether this inspection should report all name clashes,\nor only clashes with fields that are visible from the inner class." + "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": "InnerClassFieldHidesOuterClassField", + "suppressToolId": "PackageVisibleField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20075,8 +19992,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -20088,28 +20005,28 @@ ] }, { - "id": "MISSORTED_IMPORTS", + "id": "InstantiationOfUtilityClass", "shortDescription": { - "text": "Missorted imports" + "text": "Instantiation of utility class" }, "fullDescription": { - "text": "Reports 'import' statements which are not arranged according to the current code style (see Settings|Editor|Code Style). Example: 'import java.util.List;\n import java.util.ArrayList;\n\n public class Example {\n List list = new ArrayList();\n }' After the \"Optimize Imports\" quick fix is applied: 'import java.util.ArrayList;\n import java.util.List;\n\n public class Example {\n List list = new ArrayList();\n }'", - "markdown": "Reports `import` statements which are not arranged according to the current code style (see Settings\\|Editor\\|Code Style).\n\n**Example:**\n\n\n import java.util.List;\n import java.util.ArrayList;\n\n public class Example {\n List list = new ArrayList();\n }\n\nAfter the \"Optimize Imports\" quick fix is applied:\n\n\n import java.util.ArrayList;\n import java.util.List;\n\n public class Example {\n List list = new ArrayList();\n }\n" + "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": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "MISSORTED_IMPORTS", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "InstantiationOfUtilityClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Imports", - "index": 24, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -20121,19 +20038,19 @@ ] }, { - "id": "UnnecessaryModifier", + "id": "TrailingWhitespacesInTextBlock", "shortDescription": { - "text": "Unnecessary modifier" + "text": "Trailing whitespace in text block" }, "fullDescription": { - "text": "Reports redundant modifiers and suggests to remove them. The resulting code will be shorter, but the behaviour and meaning will remain the same. Example 1: '// all code is implicitly strictfp under Java 17 and higher\n strictfp class X {\n\n // inner enums are implicitly static\n static enum Inner {\n A, B, C\n }\n\n // inner records are implicitly static\n static record R() {\n }\n }' Example 2: 'final record R() {\n // all records are implicitly final\n }' Example 3: '// all interfaces are implicitly abstract\n abstract interface Printer {\n\n // all interface members are implicitly public\n public int size();\n\n // all inner classes of interfaces are implicitly static\n static class Inner {}\n }'", - "markdown": "Reports redundant modifiers and suggests to remove them. The resulting code will be shorter, but the behaviour and meaning will remain the same.\n\n**Example 1:**\n\n\n // all code is implicitly strictfp under Java 17 and higher\n strictfp class X {\n\n // inner enums are implicitly static\n static enum Inner {\n A, B, C\n }\n\n // inner records are implicitly static\n static record R() {\n }\n }\n\n**Example 2:**\n\n\n final record R() {\n // all records are implicitly final\n }\n\n**Example 3:**\n\n\n // all interfaces are implicitly abstract\n abstract interface Printer {\n\n // all interface members are implicitly public\n public int size();\n\n // all inner classes of interfaces are implicitly static\n static class Inner {}\n }\n" + "text": "Reports text blocks with trailing whitespace characters. Trailing whitespace is considered incidental and will be stripped away by the Java compiler. This inspection depends on the Java feature 'Text block literals', which is available since Java 15. 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 depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2021.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryModifier", + "suppressToolId": "TrailingWhitespacesInTextBlock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20154,19 +20071,19 @@ ] }, { - "id": "NonThreadSafeLazyInitialization", + "id": "NewClassNamingConvention", "shortDescription": { - "text": "Unsafe lazy initialization of 'static' field" + "text": "Class naming convention" }, "fullDescription": { - "text": "Reports 'static' variables that are lazily initialized in a non-thread-safe manner. Lazy initialization of 'static' variables should be done with an appropriate synchronization construct to prevent different threads from performing conflicting initialization. When applicable, a quick-fix, which introduces the lazy initialization holder class idiom, is suggested. This idiom makes use of the fact that the JVM guarantees that a class will not be initialized until it is used. Example: 'class X {\n private static List list;\n\n public List getList() {\n if (list == null) {\n list = List.of(\"one\", \"two\", \"tree\");\n }\n return list;\n }\n }' After the quick-fix is applied: 'class X {\n private static final class ListHolder {\n static final List list = List.of(\"one\", \"two\", \"tree\");\n }\n\n public List getList() {\n return ListHolder.list;\n }\n }'", - "markdown": "Reports `static` variables that are lazily initialized in a non-thread-safe manner.\n\nLazy initialization of `static` variables should be done with an appropriate synchronization construct\nto prevent different threads from performing conflicting initialization.\n\nWhen applicable, a quick-fix, which introduces the\n[lazy initialization holder class idiom](https://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom), is suggested.\nThis idiom makes use of the fact that the JVM guarantees that a class will not be initialized until it is used.\n\n**Example:**\n\n\n class X {\n private static List list;\n\n public List getList() {\n if (list == null) {\n list = List.of(\"one\", \"two\", \"tree\");\n }\n return list;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n private static final class ListHolder {\n static final List list = List.of(\"one\", \"two\", \"tree\");\n }\n\n public List getList() {\n return ListHolder.list;\n }\n }\n" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "NonThreadSafeLazyInitialization", + "suppressToolId": "NewClassNamingConvention", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20174,8 +20091,8 @@ "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Java/Naming conventions/Class", + "index": 80, "toolComponent": { "name": "QDJVM" } @@ -20187,28 +20104,28 @@ ] }, { - "id": "ConditionalCanBePushedInsideExpression", + "id": "UseCompareMethod", "shortDescription": { - "text": "Conditional can be pushed inside branch expression" + "text": "'compare()' method can be used to compare numbers" }, "fullDescription": { - "text": "Reports conditional expressions with 'then' and else branches that are similar enough so that the expression can be moved inside. This action shortens the code. Example: 'double g(int a, int b) {\n return a == b ? Math.cos(0) : Math.cos(1);\n }' After the quick-fix is applied: 'double g(int a, int b) {\n return Math.cos(a == b ? 0 : 1);\n }' New in 2017.2", - "markdown": "Reports conditional expressions with `then` and else branches that are similar enough so that the expression can be moved inside. This action shortens the code.\n\nExample:\n\n\n double g(int a, int b) {\n return a == b ? Math.cos(0) : Math.cos(1);\n }\n\nAfter the quick-fix is applied:\n\n\n double g(int a, int b) {\n return Math.cos(a == b ? 0 : 1);\n }\n\nNew in 2017.2" + "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": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ConditionalCanBePushedInsideExpression", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "UseCompareMethod", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Java language level migration aids", + "index": 70, "toolComponent": { "name": "QDJVM" } @@ -20220,28 +20137,28 @@ ] }, { - "id": "CloneInNonCloneableClass", + "id": "MoveFieldAssignmentToInitializer", "shortDescription": { - "text": "'clone()' method in non-Cloneable class" + "text": "Field assignment can be moved to initializer" }, "fullDescription": { - "text": "Reports classes that override the 'clone()' method but don't implement the 'Cloneable' interface. This usually represents a programming error. Use the Only warn on 'public' clone methods option to ignore methods that aren't 'public'. For classes designed to be inherited, you may choose to override 'clone()' and declare it as 'protected' without implementing the 'Cloneable' interface and decide whether to implement the 'Cloneable' interface in subclasses.", - "markdown": "Reports classes that override the `clone()` method but don't implement the `Cloneable` interface. This usually represents a programming error.\n\n\nUse the **Only warn on 'public' clone methods** option to ignore methods that aren't `public`.\n\nFor classes designed to be inherited, you may choose to override `clone()` and declare it as `protected`\nwithout implementing the `Cloneable` interface and decide whether to implement the `Cloneable` interface in subclasses." + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CloneInNonCloneableClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MoveFieldAssignmentToInitializer", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Cloning issues", - "index": 116, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -20253,19 +20170,23 @@ ] }, { - "id": "Java8ListReplaceAll", + "id": "StringConcatenationInFormatCall", "shortDescription": { - "text": "Loop can be replaced with 'List.replaceAll()'" + "text": "String concatenation as argument to 'format()' call" }, "fullDescription": { - "text": "Reports loops which can be collapsed into a single 'List.replaceAll()' call. Example: 'for (int i = 0; i < strings.size(); i++) {\n String str = strings.get(i).toLowerCase();\n strings.set(i, str);\n }' After the quick-fix is applied: 'strings.replaceAll(String::toLowerCase);' This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8. New in 2022.1", - "markdown": "Reports loops which can be collapsed into a single `List.replaceAll()` call.\n\n**Example:**\n\n\n for (int i = 0; i < strings.size(); i++) {\n String str = strings.get(i).toLowerCase();\n strings.set(i, str);\n }\n\nAfter the quick-fix is applied:\n\n\n strings.replaceAll(String::toLowerCase);\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.\n\nNew in 2022.1" + "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": "Java8ListReplaceAll", + "suppressToolId": "StringConcatenationInFormatCall", + "cweIds": [ + 116, + 134 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20273,8 +20194,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -20286,19 +20207,19 @@ ] }, { - "id": "BigDecimalLegacyMethod", + "id": "WaitWhileHoldingTwoLocks", "shortDescription": { - "text": "'BigDecimal' legacy method called" + "text": "'wait()' while holding two locks" }, "fullDescription": { - "text": "Reports calls to 'BigDecimal.divide()' or 'BigDecimal.setScale()' that use integer constants to specify the rounding mode. Since JDK 1.5, consider using methods that take the 'RoundingMode' 'enum' parameter instead. Example: 'new BigDecimal(\"42\").setScale(2, BigDecimal.ROUND_FLOOR);' After the quick-fix is applied: 'new BigDecimal(\"42\").setScale(2, RoundingMode.FLOOR);'", - "markdown": "Reports calls to `BigDecimal.divide()` or `BigDecimal.setScale()` that use integer constants to specify the rounding mode. Since JDK 1.5, consider using methods that take the `RoundingMode` `enum` parameter instead.\n\n**Example:**\n\n new BigDecimal(\"42\").setScale(2, BigDecimal.ROUND_FLOOR);\n\nAfter the quick-fix is applied:\n\n new BigDecimal(\"42\").setScale(2, RoundingMode.FLOOR);\n" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "BigDecimalLegacyMethod", + "suppressToolId": "WaitWhileHoldingTwoLocks", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20306,8 +20227,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -20319,19 +20240,19 @@ ] }, { - "id": "MissingPackageInfo", + "id": "SerializableInnerClassWithNonSerializableOuterClass", "shortDescription": { - "text": "Missing 'package-info.java'" + "text": "Serializable non-'static' inner class with non-Serializable outer class" }, "fullDescription": { - "text": "Reports packages that contain classes but do not contain the 'package-info.java' or 'package.html' files and are, thus, missing the package documentation. The quick-fix creates an initial 'package-info.java' file.", - "markdown": "Reports packages that contain classes but do not contain the `package-info.java` or `package.html` files and are, thus, missing the package documentation.\n\nThe quick-fix creates an initial `package-info.java` file." + "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": "MissingPackageInfo", + "suppressToolId": "SerializableInnerClassWithNonSerializableOuterClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20339,8 +20260,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -20352,19 +20273,22 @@ ] }, { - "id": "UnnecessaryConstructor", + "id": "SuspiciousListRemoveInLoop", "shortDescription": { - "text": "Redundant no-arg constructor" + "text": "Suspicious 'List.remove()' in loop" }, "fullDescription": { - "text": "Reports unnecessary constructors. A constructor is unnecessary if it is the only constructor of a class, has no parameters, has the same access modifier as its containing class, and does not perform any initialization except explicitly or implicitly calling the superclass constructor without arguments. Such a constructor can be safely removed as it will be generated by the compiler even if not specified. Example: 'public class Foo {\n public Foo() {}\n }' After the quick-fix is applied: 'public class Foo {}' Use the inspection settings to ignore unnecessary constructors that have an annotation.", - "markdown": "Reports unnecessary constructors.\n\n\nA constructor is unnecessary if it is the only constructor of a class, has no parameters,\nhas the same access modifier as its containing class,\nand does not perform any initialization except explicitly or implicitly calling the superclass constructor without arguments.\nSuch a constructor can be safely removed as it will be generated by the compiler even if not specified.\n\n**Example:**\n\n\n public class Foo {\n public Foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n public class Foo {}\n\n\nUse the inspection settings to ignore unnecessary constructors that have an annotation." + "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 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 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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantNoArgConstructor", + "suppressToolId": "SuspiciousListRemoveInLoop", + "cweIds": [ + 129 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20372,8 +20296,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -20385,19 +20309,19 @@ ] }, { - "id": "StringBufferField", + "id": "NegativeIntConstantInLongContext", "shortDescription": { - "text": "'StringBuilder' field" + "text": "Negative int hexadecimal constant in long context" }, "fullDescription": { - "text": "Reports fields of type 'java.lang.StringBuffer' or 'java.lang.StringBuilder'. Such fields can grow without limit and are often the cause of memory leaks. Example: 'public class Example {\n private StringBuilder builder = new StringBuilder();\n\n }'", - "markdown": "Reports fields of type `java.lang.StringBuffer` or `java.lang.StringBuilder`. Such fields can grow without limit and are often the cause of memory leaks.\n\n**Example:**\n\n\n public class Example {\n private StringBuilder builder = new StringBuilder();\n\n }\n" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "StringBufferField", + "suppressToolId": "NegativeIntConstantInLongContext", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20405,8 +20329,8 @@ "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -20418,19 +20342,19 @@ ] }, { - "id": "RedundantMethodOverride", + "id": "WhileLoopSpinsOnField", "shortDescription": { - "text": "Method is identical to its super method" + "text": "'while' loop spins on field" }, "fullDescription": { - "text": "Reports methods that are identical to their super methods. Such methods have the same signature as their super method and either have an identical body or only their body consists only of a call to the super method. These methods are redundant and can be removed. Use the first checkbox below to run the inspection for the methods that override library methods. Checking library methods may slow down the inspection. Use the second checkbox below to ignore methods that only delegate calls to their super methods.", - "markdown": "Reports methods that are identical to their super methods. Such methods have the same signature as their super method and either have an identical body or only their body consists only of a call to the super method. These methods are redundant and can be removed.\n\n\nUse the first checkbox below to run the inspection for the methods that override library methods.\nChecking library methods may slow down the inspection.\n\n\nUse the second checkbox below to ignore methods that only delegate calls to their super methods." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantMethodOverride", + "suppressToolId": "WhileLoopSpinsOnField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20438,8 +20362,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -20451,19 +20375,19 @@ ] }, { - "id": "ClassNameSameAsAncestorName", + "id": "DefaultAnnotationParam", "shortDescription": { - "text": "Class name same as ancestor name" + "text": "Default annotation parameter value" }, "fullDescription": { - "text": "Reports classes that have the same name as one of their superclasses, while their fully qualified names remain different. Such class names may be very confusing. Example: 'package util;\n abstract class Iterable implements java.lang.Iterable {}' A quick-fix that renames such classes is available only in the editor.", - "markdown": "Reports classes that have the same name as one of their superclasses, while their fully qualified names remain different. Such class names may be very confusing.\n\n**Example:**\n\n\n package util;\n abstract class Iterable implements java.lang.Iterable {}\n\nA quick-fix that renames such classes is available only in the editor." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "ClassNameSameAsAncestorName", + "suppressToolId": "DefaultAnnotationParam", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20471,8 +20395,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Class", - "index": 80, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -20484,19 +20408,19 @@ ] }, { - "id": "ContinueStatementWithLabel", + "id": "SynchronizeOnLock", "shortDescription": { - "text": "'continue' statement with label" + "text": "Synchronization on a 'Lock' object" }, "fullDescription": { - "text": "Reports 'continue' statements with labels. Labeled 'continue' statements complicate refactoring and can be confusing. Example: 'void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) continue outer;\n handleChar(ch);\n }\n }\n }'", - "markdown": "Reports `continue` statements with labels.\n\nLabeled `continue` statements complicate refactoring and can be confusing.\n\nExample:\n\n\n void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) continue outer;\n handleChar(ch);\n }\n }\n }\n" + "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": "ContinueStatementWithLabel", + "suppressToolId": "SynchroniziationOnLockObject", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20504,8 +20428,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -20517,19 +20441,19 @@ ] }, { - "id": "SimplifiableBooleanExpression", + "id": "BadExceptionCaught", "shortDescription": { - "text": "Simplifiable boolean expression" + "text": "Prohibited 'Exception' caught" }, "fullDescription": { - "text": "Reports boolean expressions that can be simplified. Example: 'void f(boolean foo, boolean bar) {\n boolean b = !(foo ^ bar);\n }' After the quick-fix is applied: 'void f(boolean foo, boolean bar) {\n boolean b = foo == bar;\n }' Example: 'void f(boolean foo, boolean bar) {\n boolean b = (foo && bar) || !foo;\n }' After the quick-fix is applied: 'void f(boolean foo, boolean bar) {\n boolean b = !foo || bar;\n }'", - "markdown": "Reports boolean expressions that can be simplified.\n\nExample:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = !(foo ^ bar);\n }\n\nAfter the quick-fix is applied:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = foo == bar;\n }\n\nExample:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = (foo && bar) || !foo;\n }\n \nAfter the quick-fix is applied:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = !foo || bar;\n }\n \n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SimplifiableBooleanExpression", + "suppressToolId": "ProhibitedExceptionCaught", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20537,41 +20461,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, - "toolComponent": { - "name": "QDJVM" - } - }, - "kinds": [ - "superset" - ] - } - ] - }, - { - "id": "JavaExistingMethodCanBeUsed", - "shortDescription": { - "text": "Copy of existing static method body" - }, - "fullDescription": { - "text": "Reports fragments of Java code which are identical to the existing static methods suggesting to reuse these static methods. Reusing existing methods makes code shorter and more readable. Example: 'static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n \n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n List lines = Files.readAllLines(p);\n return lines.stream().map(String::trim).toList();\n }' Here, the second method is quite similar to the first one, and the first one can be reused in its implementation. After the quick-fix is applied, the result will look like this: 'static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n\n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n return readFileAndTrim(p);\n }' New in 2024.1", - "markdown": "Reports fragments of Java code which are identical to the existing static methods suggesting to reuse these static methods. Reusing existing methods makes code shorter and more readable.\n\nExample:\n\n\n static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n \n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n List lines = Files.readAllLines(p);\n return lines.stream().map(String::trim).toList();\n }\n\nHere, the second method is quite similar to the first one, and the first one can be reused in its implementation. After the quick-fix is applied, the result will look like this:\n\n\n static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n\n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n return readFileAndTrim(p);\n }\n\nNew in 2024.1" - }, - "defaultConfiguration": { - "enabled": false, - "level": "note", - "parameters": { - "suppressToolId": "JavaExistingMethodCanBeUsed", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" - } - }, - "relationships": [ - { - "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -20583,19 +20474,19 @@ ] }, { - "id": "SignalWithoutCorrespondingAwait", + "id": "InstanceofCatchParameter", "shortDescription": { - "text": "'signal()' without corresponding 'await()'" + "text": "'instanceof' on 'catch' parameter" }, "fullDescription": { - "text": "Reports calls to 'Condition.signal()' or 'Condition.signalAll()' for which no call to a corresponding 'Condition.await()' can be found. Only calls that target fields of the current class are reported by this inspection. Example: 'class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n isEmpty.signal(); // warning: Call to 'signal()' without corresponding 'await()'\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n // isEmpty.await();\n // ...\n }\n }'", - "markdown": "Reports calls to `Condition.signal()` or `Condition.signalAll()` for which no call to a corresponding `Condition.await()` can be found.\n\nOnly calls that target fields of the current class are reported by this inspection.\n\n**Example:**\n\n\n class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n isEmpty.signal(); // warning: Call to 'signal()' without corresponding 'await()'\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n // isEmpty.await();\n // ...\n }\n }\n" + "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": "SignalWithoutCorrespondingAwait", + "suppressToolId": "InstanceofCatchParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20603,8 +20494,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -20616,28 +20507,28 @@ ] }, { - "id": "FoldExpressionIntoStream", + "id": "RedundantScheduledForRemovalAnnotation", "shortDescription": { - "text": "Expression can be folded into Stream chain" + "text": "Redundant @ScheduledForRemoval annotation" }, "fullDescription": { - "text": "Reports expressions with a repeating pattern that could be replaced with Stream API or a 'String.join()' call. Example: 'boolean allStartWith(String a, String b, String c, String d, String prefix) {\n return a.startsWith(prefix) && b.startsWith(prefix) && c.startsWith(prefix) && d.startsWith(prefix);\n }' After the quick-fix is applied: 'boolean foo(String a, String b, String c, String d, String prefix) {\n return Stream.of(a, b, c, d).allMatch(s -> s.startsWith(prefix));\n }' Example: 'String joinAll(String a, String b, String c, String d) {\n return a + \",\" + b + \",\" + c + \",\" + d;\n }' After the quick-fix is applied: 'String joinAll(String a, String b, String c, String d) {\n return String.join(\",\", a, b, c, d);\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2018.2", - "markdown": "Reports expressions with a repeating pattern that could be replaced with *Stream API* or a `String.join()` call.\n\nExample:\n\n\n boolean allStartWith(String a, String b, String c, String d, String prefix) {\n return a.startsWith(prefix) && b.startsWith(prefix) && c.startsWith(prefix) && d.startsWith(prefix);\n }\n\nAfter the quick-fix is applied:\n\n\n boolean foo(String a, String b, String c, String d, String prefix) {\n return Stream.of(a, b, c, d).allMatch(s -> s.startsWith(prefix));\n }\n\nExample:\n\n\n String joinAll(String a, String b, String c, String d) {\n return a + \",\" + b + \",\" + c + \",\" + d;\n }\n\nAfter the quick-fix is applied:\n\n\n String joinAll(String a, String b, String c, String d) {\n return String.join(\",\", a, b, c, d);\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2018.2" + "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": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "FoldExpressionIntoStream", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "RedundantScheduledForRemovalAnnotation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -20649,19 +20540,23 @@ ] }, { - "id": "SerializableDeserializableClassInSecureContext", + "id": "OptionalGetWithoutIsPresent", "shortDescription": { - "text": "Serializable class in secure context" + "text": "Optional.get() is called without isPresent() check" }, "fullDescription": { - "text": "Reports classes that may be serialized or deserialized. A class may be serialized if it supports the 'Serializable' interface, and its 'readObject()' and 'writeObject()' methods are not defined to always throw an exception. Serializable classes may be dangerous in code intended for secure use. Example: 'class DeserializableClass implements Serializable { // the class doesn't contain 'writeObject()' method throwing an exception\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n}' After the quick-fix is applied: 'class DeserializableClass implements Serializable {\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n\n private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {\n throw new java.io.NotSerializableException(\"DeserializableClass\");\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. Note that it still may be more secure to add 'readObject()' and 'writeObject()' methods which always throw an exception, instead of ignoring those classes. Whether to ignore serializable anonymous classes.", - "markdown": "Reports classes that may be serialized or deserialized.\n\n\nA class may be serialized if it supports the `Serializable` interface,\nand its `readObject()` and `writeObject()` methods are not defined to always\nthrow an exception. Serializable classes may be dangerous in code intended for secure use.\n\n**Example:**\n\n\n class DeserializableClass implements Serializable { // the class doesn't contain 'writeObject()' method throwing an exception\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class DeserializableClass implements Serializable {\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n\n private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {\n throw new java.io.NotSerializableException(\"DeserializableClass\");\n }\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. Note that it still may be more secure to add `readObject()` and `writeObject()` methods which always throw an exception, instead of ignoring those classes.\n* Whether to ignore serializable anonymous classes." + "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 list) {\n final Optional optional =\n list.stream().filter(x -> x > 10).findFirst();\n final Integer result = optional.get(); // problem here\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "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 list) {\n final Optional optional =\n list.stream().filter(x -> x > 10).findFirst();\n final Integer result = optional.get(); // problem here\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SerializableDeserializableClassInSecureContext", + "suppressToolId": "OptionalGetWithoutIsPresent", + "cweIds": [ + 252, + 476 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20669,8 +20564,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -20682,19 +20577,19 @@ ] }, { - "id": "JavaModuleNaming", + "id": "OnDemandImport", "shortDescription": { - "text": "Java module name contradicts the convention" + "text": "'*' import" }, "fullDescription": { - "text": "Reports cases when a module name contradicts Java Platform Module System recommendations. One of the recommendations is to avoid using digits at the end of module names. Example: 'module foo1.bar2 {}'", - "markdown": "Reports cases when a module name contradicts Java Platform Module System recommendations.\n\nOne of the [recommendations](http://mail.openjdk.org/pipermail/jpms-spec-experts/2017-March/000659.html)\nis to avoid using digits at the end of module names.\n\n**Example:**\n\n\n module foo1.bar2 {}\n" + "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": "JavaModuleNaming", + "suppressToolId": "OnDemandImport", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20702,8 +20597,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Imports", + "index": 24, "toolComponent": { "name": "QDJVM" } @@ -20715,19 +20610,19 @@ ] }, { - "id": "UnaryPlus", + "id": "FallthruInSwitchStatement", "shortDescription": { - "text": "Unary plus" + "text": "Fallthrough in 'switch' statement" }, "fullDescription": { - "text": "Reports usages of the '+' unary operator. The unary plus is usually a null operation, and its presence might represent a coding error. For example, in a combination with the increment operator (like in '+++') or with the equal operator (like in '=+'). Example: 'void unaryPlus(int i) {\n int x = + +i;\n }' The following quick fixes are suggested: Remove '+' operators before the 'i' variable: 'void unaryPlus(int i) {\n int x = i;\n }' Replace '+' operators with the prefix increment operator: 'void unaryPlus(int i) {\n int x = ++i;\n }' Use the checkbox below to report unary pluses that are used together with a binary or another unary expression. It means the inspection will not report situations when a unary plus expression is used in array initializer expressions or as a method argument.", - "markdown": "Reports usages of the `+` unary operator. The unary plus is usually a null operation, and its presence might represent a coding error. For example, in a combination with the increment operator (like in `+++`) or with the equal operator (like in `=+`).\n\n**Example:**\n\n\n void unaryPlus(int i) {\n int x = + +i;\n }\n\nThe following quick fixes are suggested:\n\n* Remove `+` operators before the `i` variable:\n\n\n void unaryPlus(int i) {\n int x = i;\n }\n\n* Replace `+` operators with the prefix increment operator:\n\n\n void unaryPlus(int i) {\n int x = ++i;\n }\n\n\nUse the checkbox below to report unary pluses that are used together with a binary or another unary expression.\nIt means the inspection will not report situations when a unary plus expression is used in array\ninitializer expressions or as a method argument." + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnaryPlus", + "suppressToolId": "fallthrough", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20735,7 +20630,7 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", + "id": "Java/Control flow issues", "index": 31, "toolComponent": { "name": "QDJVM" @@ -20748,19 +20643,19 @@ ] }, { - "id": "ConstructorCount", + "id": "OptionalIsPresent", "shortDescription": { - "text": "Class with too many constructors" + "text": "Non functional style 'Optional.isPresent()' usage" }, "fullDescription": { - "text": "Reports classes whose number of constructors exceeds the specified maximum. Classes with too many constructors are prone to initialization errors, and often modeling such a class as multiple subclasses is preferable. Configure the inspection: Use the Constructor count limit field to specify the maximum allowed number of constructors in a class. Use the Ignore deprecated constructors option to avoid adding deprecated constructors to the total count.", - "markdown": "Reports classes whose number of constructors exceeds the specified maximum.\n\nClasses with too many constructors are prone to initialization errors, and often modeling such a class as multiple subclasses is preferable.\n\nConfigure the inspection:\n\n* Use the **Constructor count limit** field to specify the maximum allowed number of constructors in a class.\n* Use the **Ignore deprecated constructors** option to avoid adding deprecated constructors to the total count." + "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 depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "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 depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassWithTooManyConstructors", + "suppressToolId": "OptionalIsPresent", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20768,8 +20663,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -20781,19 +20676,22 @@ ] }, { - "id": "MethodOverloadsParentMethod", + "id": "RedundantOperationOnEmptyContainer", "shortDescription": { - "text": "Possibly unintended overload of method from superclass" + "text": "Redundant operation on empty container" }, "fullDescription": { - "text": "Reports instance methods with the same name and the same number of parameters as a method in a superclass, but where at least one of the parameters is of a different incompatible type. In this case, the method in a subclass will be overloading the method from the superclass instead of overriding it. If it is unintended, it may result in latent bugs. Example: 'public class Foo {\n void foo(int x) {}\n }\n\n public class Bar extends Foo {\n void foo(Number x) {} // Method 'foo()' overloads a compatible method of a superclass,\n // when overriding might have been intended\n }' Use the option to choose whether the inspection should also report cases where parameter types are not compatible.", - "markdown": "Reports instance methods with the same name and the same number of parameters as a method in a superclass, but where at least one of the parameters is of a different incompatible type.\n\n\nIn this case, the method in a subclass will be overloading the method from the superclass\ninstead of overriding it. If it is unintended, it may result in latent bugs.\n\n**Example:**\n\n\n public class Foo {\n void foo(int x) {}\n }\n\n public class Bar extends Foo {\n void foo(Number x) {} // Method 'foo()' overloads a compatible method of a superclass,\n // when overriding might have been intended\n }\n\n\nUse the option to choose whether the inspection should also report cases where parameter types are not compatible." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MethodOverloadsMethodOfSuperclass", + "suppressToolId": "RedundantOperationOnEmptyContainer", + "cweIds": [ + 561 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20801,8 +20699,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -20814,19 +20712,19 @@ ] }, { - "id": "IncrementDecrementUsedAsExpression", + "id": "AtomicFieldUpdaterNotStaticFinal", "shortDescription": { - "text": "Result of '++' or '--' used" + "text": "'AtomicFieldUpdater' field not declared 'static final'" }, "fullDescription": { - "text": "Reports increment or decrement 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. The quick-fix extracts the increment or decrement operation to a separate expression statement. Example: 'int i = 10;\n while (i-- > 0) {\n System.out.println(i);\n }' After the quick-fix is applied: 'int i = 10;\n while (i > 0) {\n i--;\n System.out.println(i);\n }\n i--;'", - "markdown": "Reports increment or decrement 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.\n\nThe quick-fix extracts the increment or decrement operation to a separate expression statement.\n\n**Example:**\n\n\n int i = 10;\n while (i-- > 0) {\n System.out.println(i);\n }\n\nAfter the quick-fix is applied:\n\n\n int i = 10;\n while (i > 0) {\n i--;\n System.out.println(i);\n }\n i--;\n" + "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

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
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
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
idFieldUpdater = AtomicIntegerFieldUpdater.newUpdater(Main.class, \"id\");\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ValueOfIncrementOrDecrementUsed", + "suppressToolId": "AtomicFieldUpdaterNotStaticFinal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20834,8 +20732,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -20847,19 +20745,19 @@ ] }, { - "id": "DisjointPackage", + "id": "Java8MapForEach", "shortDescription": { - "text": "Package with disjoint dependency graph" + "text": "Map.forEach() can be used" }, "fullDescription": { - "text": "Reports packages whose classes can be separated into mutually independent subsets. Such disjoint packages indicate ad-hoc packaging or a lack of conceptual cohesion. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", - "markdown": "Reports packages whose classes can be separated into mutually independent subsets.\n\nSuch disjoint packages indicate ad-hoc packaging or a lack of conceptual cohesion.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor." + "text": "Suggests replacing 'for(Entry entry : map.entrySet()) {...}' or 'map.entrySet().forEach(entry -> ...)' with 'map.forEach((key, value) -> ...)'. Example 'void print(Map 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 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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8. 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 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 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 depends on the Java feature 'Lambda methods in collections', which is available since Java 8.\n\nNew in 2017.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DisjointPackage", + "suppressToolId": "Java8MapForEach", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20867,8 +20765,8 @@ "relationships": [ { "target": { - "id": "Java/Packaging issues", - "index": 44, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -20880,19 +20778,19 @@ ] }, { - "id": "UpperCaseFieldNameNotConstant", + "id": "RecordStoreResource", "shortDescription": { - "text": "Non-constant field with upper-case name" + "text": "'RecordStore' opened but not safely closed" }, "fullDescription": { - "text": "Reports non-'static' non-'final' fields whose names are all in upper case. Such fields may cause confusion by breaking a common naming convention and are often used by mistake. Example: 'public static int THE_ANSWER = 42; //a warning here: final modifier is missing' A quick-fix that renames such fields is available only in the editor.", - "markdown": "Reports non-`static` non-`final` fields whose names are all in upper case.\n\nSuch fields may cause confusion by breaking a common naming convention and\nare often used by mistake.\n\n**Example:**\n\n\n public static int THE_ANSWER = 42; //a warning here: final modifier is missing\n\nA quick-fix that renames such fields is available only in the editor." + "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": "NonConstantFieldWithUpperCaseName", + "suppressToolId": "RecordStoreOpenedButNotSafelyClosed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20900,8 +20798,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -20913,28 +20811,28 @@ ] }, { - "id": "MethodMayBeSynchronized", + "id": "ObjectsEqualsCanBeSimplified", "shortDescription": { - "text": "Method with single 'synchronized' block can be replaced with 'synchronized' method" + "text": "'Objects.equals()' can be replaced with 'equals()'" }, "fullDescription": { - "text": "Reports methods whose body contains a single 'synchronized' statement. A lock expression for this 'synchronized' statement must be equal to 'this' for instance methods or '[ClassName].class' for static methods. To improve readability of such methods, you can remove the 'synchronized' wrapper and mark the method as 'synchronized'. Example: 'public int generateInt(int x) {\n synchronized (this) {\n return 1;\n }\n }' After the quick-fix is applied: 'public synchronized int generateInt(int x) {\n return 1;\n }'", - "markdown": "Reports methods whose body contains a single `synchronized` statement. A lock expression for this `synchronized` statement must be equal to `this` for instance methods or `[ClassName].class` for static methods.\n\n\nTo improve readability of such methods,\nyou can remove the `synchronized` wrapper and mark the method as `synchronized`.\n\n**Example:**\n\n\n public int generateInt(int x) {\n synchronized (this) {\n return 1;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public synchronized int generateInt(int x) {\n return 1;\n }\n" + "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);' This inspection depends on the Java feature 'java.util.Objects API', which is available since Java 7. 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\nThis inspection depends on the Java feature 'java.util.Objects API', which is available since Java 7.\n\nNew in 2018.3" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "MethodMayBeSynchronized", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ObjectsEqualsCanBeSimplified", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -20946,28 +20844,28 @@ ] }, { - "id": "Convert2streamapi", + "id": "ClassLoaderInstantiation", "shortDescription": { - "text": "Loop can be collapsed with Stream API" + "text": "'ClassLoader' instantiation" }, "fullDescription": { - "text": "Reports loops which can be replaced with stream API calls using lambda expressions. Such a replacement changes the style from imperative to more functional and makes the code more compact. Example: 'boolean check(List data) {\n for (String e : data) {\n String trimmed = e.trim();\n if (!trimmed.startsWith(\"xyz\")) {\n return false;\n }\n }\n return true;\n }' After the quick-fix is applied: 'boolean check(List data) {\n return data.stream().map(String::trim).allMatch(trimmed -> trimmed.startsWith(\"xyz\"));\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports loops which can be replaced with stream API calls using lambda expressions.\n\nSuch a replacement changes the style from imperative to more functional and makes the code more compact.\n\nExample:\n\n\n boolean check(List data) {\n for (String e : data) {\n String trimmed = e.trim();\n if (!trimmed.startsWith(\"xyz\")) {\n return false;\n }\n }\n return true;\n }\n\nAfter the quick-fix is applied:\n\n\n boolean check(List data) {\n return data.stream().map(String::trim).allMatch(trimmed -> trimmed.startsWith(\"xyz\"));\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "Convert2streamapi", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ClassLoaderInstantiation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -20979,19 +20877,19 @@ ] }, { - "id": "SerialPersistentFieldsWithWrongSignature", + "id": "NativeMethods", "shortDescription": { - "text": "'serialPersistentFields' field not declared 'private static final ObjectStreamField[]'" + "text": "Native method" }, "fullDescription": { - "text": "Reports 'Serializable' classes whose 'serialPersistentFields' field is not declared as 'private static final ObjectStreamField[]'. If a 'serialPersistentFields' field is not declared with those modifiers, the serialization behavior will be as if the field was not declared at all. Example: 'class List implements Serializable {\n private List next;\n\n ObjectStreamField[] serialPersistentFields = {new ObjectStreamField(\"next\", List.class)};\n\n }'", - "markdown": "Reports `Serializable` classes whose `serialPersistentFields` field is not declared as `private static final ObjectStreamField[]`.\n\n\nIf a `serialPersistentFields` field is not declared with those modifiers,\nthe serialization behavior will be as if the field was not declared at all.\n\n**Example:**\n\n\n class List implements Serializable {\n private List next;\n\n ObjectStreamField[] serialPersistentFields = {new ObjectStreamField(\"next\", List.class)};\n\n }\n" + "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": "SerialPersistentFieldsWithWrongSignature", + "suppressToolId": "NativeMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -20999,8 +20897,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -21012,21 +20910,21 @@ ] }, { - "id": "ComparatorResultComparison", + "id": "EqualsWithItself", "shortDescription": { - "text": "Suspicious usage of compare method" + "text": "'equals()' called on itself" }, "fullDescription": { - "text": "Reports comparisons of the result of 'Comparator.compare()' or 'Comparable.compareTo()' calls with non-zero constants. By contract, these methods can return any integer (not just -1, 0 or 1), so comparing against particular numbers is bad practice. Some widely used comparison methods (e.g. 'String.compareTo()') actually return values outside the [-1..1] range, and such a comparison may cause incorrect program behavior. Example: 'void validate(String s1, String s2) {\n // Comparing to 1 is incorrect\n if (s1.compareTo(s2) == 1) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }' After the quick-fix is applied: 'void validate(String s1, String s2) {\n if (s1.compareTo(s2) > 0) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }' New in 2017.2", - "markdown": "Reports comparisons of the result of `Comparator.compare()` or `Comparable.compareTo()` calls with non-zero constants. By contract, these methods can return any integer (not just -1, 0 or 1), so comparing against particular numbers is bad practice. Some widely used comparison methods (e.g. `String.compareTo()`) actually return values outside the \\[-1..1\\] range, and such a comparison may cause incorrect program behavior.\n\nExample:\n\n\n void validate(String s1, String s2) {\n // Comparing to 1 is incorrect\n if (s1.compareTo(s2) == 1) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void validate(String s1, String s2) {\n if (s1.compareTo(s2) > 0) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }\n\nNew in 2017.2" + "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": "ComparatorResultComparison", + "suppressToolId": "EqualsWithItself", "cweIds": [ - 253 + 571 ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" @@ -21048,19 +20946,19 @@ ] }, { - "id": "ListIndexOfReplaceableByContains", + "id": "ClassInheritanceDepth", "shortDescription": { - "text": "'List.indexOf()' expression can be replaced with 'contains()'" + "text": "Class too deep in inheritance tree" }, "fullDescription": { - "text": "Reports any 'List.indexOf()' expressions that can be replaced with the 'List.contains()' method. Example: 'boolean hasEmptyString(List list) {\n // Warning: can be simplified\n return list.indexOf(\"\") >= 0;\n }' The provided quick-fix replaces the 'indexOf' call with the 'contains' call: 'boolean hasEmptyString(List list) {\n // Quick-fix is applied\n return list.contains(\"\");\n }'", - "markdown": "Reports any `List.indexOf()` expressions that can be replaced with the `List.contains()` method.\n\nExample:\n\n\n boolean hasEmptyString(List list) {\n // Warning: can be simplified\n return list.indexOf(\"\") >= 0;\n }\n\nThe provided quick-fix replaces the `indexOf` call with the `contains` call:\n\n\n boolean hasEmptyString(List list) {\n // Quick-fix is applied\n return list.contains(\"\");\n }\n" + "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": "ListIndexOfReplaceableByContains", + "suppressToolId": "ClassTooDeepInInheritanceTree", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21068,8 +20966,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -21081,28 +20979,28 @@ ] }, { - "id": "NonStrictComparisonCanBeEquality", + "id": "MarkedForRemoval", "shortDescription": { - "text": "Non-strict inequality '>=' or '<=' can be replaced with '=='" + "text": "Usage of API marked for removal" }, "fullDescription": { - "text": "Reports inequality conditions that, according to data flow analysis, can be satisfied only for a single operand value. Such conditions could be replaced with equality conditions to make the code clearer. Example: 'if (x >= 10) {\n ...\n if (x <= 10) { // can be replaced with 'x == 10'\n }\n }' New in 2022.2", - "markdown": "Reports inequality conditions that, according to data flow analysis, can be satisfied only for a single operand value. Such conditions could be replaced with equality conditions to make the code clearer.\n\nExample:\n\n\n if (x >= 10) {\n ...\n if (x <= 10) { // can be replaced with 'x == 10'\n }\n }\n\nNew in 2022.2" + "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": false, - "level": "note", + "level": "error", "parameters": { - "suppressToolId": "NonStrictComparisonCanBeEquality", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "removal", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -21114,28 +21012,28 @@ ] }, { - "id": "UnnecessaryParentheses", + "id": "NestedConditionalExpression", "shortDescription": { - "text": "Unnecessary parentheses" + "text": "Nested conditional expression" }, "fullDescription": { - "text": "Reports any instance of unnecessary parentheses. Parentheses are considered unnecessary if the evaluation order of an expression remains unchanged after you remove the parentheses. Example: 'int n = 3 + (9 * 8);' After quick-fix is applied: 'int n = 3 + 9 * 8;' Configure the inspection: Use the Ignore clarifying parentheses option to ignore parentheses that help clarify a binary expression. Parentheses are clarifying if the parenthesized expression is an 'instanceof' expression that is a part of a larger expression or has a different operator than the parent expression. Use the Ignore parentheses around the condition of conditional expressions option to ignore any parentheses around the condition of conditional expressions. Some coding standards specify that all such conditions must be surrounded by parentheses. Use the Ignore parentheses around single no formal type lambda parameter option to ignore parentheses around a single lambda parameter within a lambda expression.", - "markdown": "Reports any instance of unnecessary parentheses.\n\nParentheses are considered unnecessary if the evaluation order of an expression remains\nunchanged after you remove the parentheses.\n\nExample:\n\n\n int n = 3 + (9 * 8);\n\nAfter quick-fix is applied:\n\n\n int n = 3 + 9 * 8;\n\nConfigure the inspection:\n\n* Use the **Ignore clarifying parentheses** option to ignore parentheses that help clarify a binary expression. Parentheses are clarifying if the parenthesized expression is an `instanceof` expression that is a part of a larger expression or has a different operator than the parent expression.\n* Use the **Ignore parentheses around the condition of conditional expressions** option to ignore any parentheses around the condition of conditional expressions. Some coding standards specify that all such conditions must be surrounded by parentheses.\n* Use the **Ignore parentheses around single no formal type lambda parameter** option to ignore parentheses around a single lambda parameter within a lambda expression." + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryParentheses", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "NestedConditionalExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -21147,22 +21045,19 @@ ] }, { - "id": "SuspiciousToArrayCall", + "id": "WhileCanBeForeach", "shortDescription": { - "text": "Suspicious 'Collection.toArray()' call" + "text": "'while' loop can be replaced with enhanced 'for' loop" }, "fullDescription": { - "text": "Reports suspicious calls to 'Collection.toArray()'. The following types of calls are considered suspicious: when the type of the array argument is not the same as the array type to which the result is casted. when the type of the array argument does not match the type parameter in the collection declaration. Example: 'void m1(List list) {\n Number[] ns = (Number[]) list.toArray(new String[0]);\n}\n\nvoid m2(List list) {\n Number[] ns = list.toArray(new String[0]);\n}'", - "markdown": "Reports suspicious calls to `Collection.toArray()`.\n\nThe following types of calls are considered suspicious:\n\n* when the type of the array argument is not the same as the array type to which the result is casted.\n* when the type of the array argument does not match the type parameter in the collection declaration.\n\n**Example:**\n\n\n void m1(List list) {\n Number[] ns = (Number[]) list.toArray(new String[0]);\n }\n\n void m2(List list) {\n Number[] ns = list.toArray(new String[0]);\n }\n" + "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 depends on the Java feature 'For-each loops', which is available since Java 5.", + "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 depends on the Java feature 'For-each loops', which is available since Java 5." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousToArrayCall", - "cweIds": [ - 704 - ], + "suppressToolId": "WhileLoopReplaceableByForEach", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21170,8 +21065,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -21183,19 +21078,19 @@ ] }, { - "id": "StringToUpperWithoutLocale", + "id": "ImplicitNumericConversion", "shortDescription": { - "text": "Call to 'String.toUpperCase()' or 'toLowerCase()' without locale" + "text": "Implicit numeric conversion" }, "fullDescription": { - "text": "Reports 'toUpperCase()' or 'toLowerCase()' calls on 'String' objects that do not specify a 'java.util.Locale'. In these cases the default system locale is used, which can cause problems in an internationalized environment. For example the code '\"i\".toUpperCase().equals(\"I\")' returns 'false' in the Turkish and Azerbaijani locales, where the dotted and dotless 'i' are separate letters. Calling 'toUpperCase()' on an English string containing an 'i', when running in a Turkish locale, will return incorrect results. Alternatively, when dealing with strings that should be treated as locale-independent, like HTML tags, this can lead to errors.", - "markdown": "Reports `toUpperCase()` or `toLowerCase()` calls on `String` objects that do not specify a `java.util.Locale`. In these cases the default system locale is used, which can cause problems in an internationalized environment.\n\n\nFor example the code `\"i\".toUpperCase().equals(\"I\")` returns `false` in the Turkish and Azerbaijani locales, where\nthe dotted and dotless 'i' are separate letters. Calling `toUpperCase()` on an English string containing an 'i', when running\nin a Turkish locale, will return incorrect results. Alternatively, when dealing with strings that should be treated as locale-independent,\nlike HTML tags, this can lead to errors." + "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": "StringToUpperCaseOrToLowerCaseWithoutLocale", + "suppressToolId": "ImplicitNumericConversion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21203,8 +21098,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -21216,19 +21111,19 @@ ] }, { - "id": "ExplicitToImplicitClassMigration", + "id": "BulkFileAttributesRead", "shortDescription": { - "text": "Explicit class declaration can be converted into implicitly declared class" + "text": "Bulk 'Files.readAttributes()' call can be used" }, "fullDescription": { - "text": "Reports ordinary classes, which can be converted into implicitly declared classes Example: 'public class Sample {\n public static void main(String[] args) {\n System.out.println(\"Hello, world!\");\n }\n }' After the quick-fix is applied: 'public static void main(String[] args) {\n System.out.println(\"Hello, world!\");\n }' This inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview. New in 2024.1", - "markdown": "Reports ordinary classes, which can be converted into implicitly declared classes\n\n**Example:**\n\n\n public class Sample {\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 static void main(String[] args) {\n System.out.println(\"Hello, world!\");\n }\n\nThis inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview.\n\nNew in 2024.1" + "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": "ExplicitToImplicitClassMigration", + "suppressToolId": "BulkFileAttributesRead", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21236,8 +21131,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 21", - "index": 195, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -21249,19 +21144,22 @@ ] }, { - "id": "NestedMethodCall", + "id": "NotNullFieldNotInitialized", "shortDescription": { - "text": "Nested method call" + "text": "@NotNull field is not initialized" }, "fullDescription": { - "text": "Reports method calls used as parameters to another method call. The quick-fix introduces a variable to make the code simpler and easier to debug. Example: 'public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int x = f(y());\n }' After the quick-fix is applied: 'public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int y = y();\n int x = f(y);\n }' Use the inspection options to toggle the reporting of: method calls in field initializers calls to static methods calls to simple getters", - "markdown": "Reports method calls used as parameters to another method call.\n\nThe quick-fix introduces a variable to make the code simpler and easier to debug.\n\n**Example:**\n\n\n public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int x = f(y());\n }\n\nAfter the quick-fix is applied:\n\n\n public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int y = y();\n int x = f(y);\n }\n\n\nUse the inspection options to toggle the reporting of:\n\n* method calls in field initializers\n* calls to static methods\n* calls to simple getters" + "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.", + "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." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NestedMethodCall", + "suppressToolId": "NotNullFieldNotInitialized", + "cweIds": [ + 476 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21269,8 +21167,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Probable bugs/Nullability problems", + "index": 172, "toolComponent": { "name": "QDJVM" } @@ -21282,19 +21180,19 @@ ] }, { - "id": "ClassWithTooManyTransitiveDependents", + "id": "OverlyComplexBooleanExpression", "shortDescription": { - "text": "Class with too many transitive dependents" + "text": "Overly complex boolean expression" }, "fullDescription": { - "text": "Reports a class on which too many other classes are directly or indirectly dependent. Any modification to such a class may require changing many other classes, which may be expensive. Only top-level classes are reported. Use the Maximum number of transitive dependents field to specify the maximum allowed number of direct or indirect dependents 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 a class on which too many other classes are directly or indirectly dependent.\n\nAny modification to such a class may require changing many other classes, which may be expensive.\n\nOnly top-level classes are reported.\n\nUse the **Maximum number of transitive dependents** field to specify the maximum allowed number of direct or indirect dependents\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." + "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": "ClassWithTooManyTransitiveDependents", + "suppressToolId": "OverlyComplexBooleanExpression", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21302,8 +21200,8 @@ "relationships": [ { "target": { - "id": "Java/Dependency issues", - "index": 146, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -21315,19 +21213,19 @@ ] }, { - "id": "CompareToUsesNonFinalVariable", + "id": "NotifyCalledOnCondition", "shortDescription": { - "text": "Non-final field referenced in 'compareTo()'" + "text": "'notify()' or 'notifyAll()' called on 'java.util.concurrent.locks.Condition' object" }, "fullDescription": { - "text": "Reports access to a non-'final' field inside a 'compareTo()' implementation. Such access may result in 'compareTo()' returning different results at different points in the object's lifecycle, which may in turn cause problems when using the standard collections classes, for example 'java.util.TreeSet'. A quick-fix to make the field 'final' is available only when there is no write access to the field, otherwise no fixes are suggested. Example: 'class Foo implements Comparable{\n private int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }' After the quick-fix is applied: 'class Foo implements Comparable{\n private final int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }'", - "markdown": "Reports access to a non-`final` field inside a `compareTo()` implementation.\n\n\nSuch access may result in `compareTo()`\nreturning different results at different points in the object's lifecycle, which may in turn cause problems when\nusing the standard collections classes, for example `java.util.TreeSet`.\n\n\nA quick-fix to make the field `final` is available\nonly when there is no write access to the field, otherwise no fixes are suggested.\n\n**Example:**\n\n\n class Foo implements Comparable{\n private int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo implements Comparable{\n private final int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }\n" + "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": "CompareToUsesNonFinalVariable", + "suppressToolId": "NotifyCalledOnCondition", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21335,8 +21233,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -21348,19 +21246,19 @@ ] }, { - "id": "JavacQuirks", + "id": "NewMethodNamingConvention", "shortDescription": { - "text": "Javac quirks" + "text": "Method naming convention" }, "fullDescription": { - "text": "Reports known Javac issues, performance problems, and incompatibilities. For example, type inference may be slow when it has to process many nested calls. The following code triggers a warning, as the vararg method call has 50+ poly arguments: 'Arrays.asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));' The quick-fix adds explicit type arguments, which makes compilation and IDE processing much faster: '//noinspection RedundantTypeArguments\n Arrays.>asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));'", - "markdown": "Reports known Javac issues, performance problems, and incompatibilities. For example, type inference may be slow when it has to process many nested calls.\n\nThe following code triggers a warning, as the vararg method call has 50+ poly arguments:\n\n\n Arrays.asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));\n\nThe quick-fix adds explicit type arguments, which makes compilation and IDE processing much faster:\n\n\n //noinspection RedundantTypeArguments\n Arrays.>asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JavacQuirks", + "suppressToolId": "NewMethodNamingConvention", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21368,8 +21266,8 @@ "relationships": [ { "target": { - "id": "Java/Compiler issues", - "index": 162, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -21381,19 +21279,19 @@ ] }, { - "id": "SwitchStatement", + "id": "OverlyStrongTypeCast", "shortDescription": { - "text": "'switch' statement" + "text": "Overly strong type cast" }, "fullDescription": { - "text": "Reports 'switch' statements. 'switch' statements often (but not always) indicate a poor object-oriented design. Example: 'switch (i) {\n // code\n }'", - "markdown": "Reports `switch` statements.\n\n`switch` statements often (but not always) indicate a poor object-oriented design.\n\nExample:\n\n\n switch (i) {\n // code\n }\n" + "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": "SwitchStatement", + "suppressToolId": "OverlyStrongTypeCast", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21401,8 +21299,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -21414,19 +21312,19 @@ ] }, { - "id": "StringBufferReplaceableByString", + "id": "JavaLangImport", "shortDescription": { - "text": "'StringBuilder' can be replaced with 'String'" + "text": "Unnecessary import from the 'java.lang' package" }, "fullDescription": { - "text": "Reports usages of 'StringBuffer', 'StringBuilder', or 'StringJoiner' which can be replaced with a single 'String' concatenation. Using 'String' concatenation makes the code shorter and simpler. This inspection only reports when the suggested replacement does not result in significant performance drawback on modern JVMs. In many cases, 'String' concatenation may perform better. Example: 'StringBuilder result = new StringBuilder();\n result.append(\"i = \");\n result.append(i);\n result.append(\";\");\n return result.toString();' After the quick-fix is applied: 'String result = \"i = \" + i + \";\";\n return result;'", - "markdown": "Reports usages of `StringBuffer`, `StringBuilder`, or `StringJoiner` which can be replaced with a single `String` concatenation.\n\nUsing `String` concatenation\nmakes the code shorter and simpler.\n\n\nThis inspection only reports when the suggested replacement does not result in significant\nperformance drawback on modern JVMs. In many cases, `String` concatenation may perform better.\n\n**Example:**\n\n\n StringBuilder result = new StringBuilder();\n result.append(\"i = \");\n result.append(i);\n result.append(\";\");\n return result.toString();\n\nAfter the quick-fix is applied:\n\n\n String result = \"i = \" + i + \";\";\n return result;\n" + "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": "StringBufferReplaceableByString", + "suppressToolId": "JavaLangImport", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21434,8 +21332,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Imports", + "index": 24, "toolComponent": { "name": "QDJVM" } @@ -21447,19 +21345,19 @@ ] }, { - "id": "SourceToSinkFlow", + "id": "UtilityClass", "shortDescription": { - "text": "Non-safe string is passed to safe method" + "text": "Utility class" }, "fullDescription": { - "text": "Reports cases when a non-safe object is passed to a method with a parameter marked with '@Untainted' annotations, returned from annotated methods or assigned to annotated fields, parameters, or local variables. Kotlin 'set' and 'get' methods for fields are not supported as entry points. A safe object (in the same class) is: a string literal, interface instance, or enum object a result of a call of a method that is marked as '@Untainted' a private field, which is assigned only with a string literal and has a safe initializer a final field, which has a safe initializer local variable or parameter that are marked as '@Untainted' and are not assigned from non-safe objects This field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable. Also static final fields are considered as safe. The analysis is performed only inside one file. To process dependencies from other classes, use options. The analysis extends to private or static methods and has a limit of depth propagation. Example: 'void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n if (b) s1 = s;\n sink(s);\n }\n\n String sink(@Untainted String s) {}'\n Here we do not have non-safe string assignments to 's' so a warning is not produced. On the other hand: 'void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n s1 = foo();\n if (b) s = s1;\n sink(s); // warning here\n }\n\n String foo();\n\n String sink(@Untainted String s) {}'\n Here we have a warning since 's1' has an unknown state after 'foo' call result assignment. New in 2021.2", - "markdown": "Reports cases when a non-safe object is passed to a method with a parameter marked with `@Untainted` annotations, returned from annotated methods or assigned to annotated fields, parameters, or local variables. Kotlin `set` and `get` methods for fields are not supported as entry points.\n\n\nA safe object (in the same class) is:\n\n* a string literal, interface instance, or enum object\n* a result of a call of a method that is marked as `@Untainted`\n* a private field, which is assigned only with a string literal and has a safe initializer\n* a final field, which has a safe initializer\n* local variable or parameter that are marked as `@Untainted` and are not assigned from non-safe objects\nThis field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable.\n\nAlso static final fields are considered as safe.\n\n\nThe analysis is performed only inside one file. To process dependencies from other classes, use options.\nThe analysis extends to private or static methods and has a limit of depth propagation.\n\n\nExample:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n if (b) s1 = s;\n sink(s);\n }\n\n String sink(@Untainted String s) {}\n\n\nHere we do not have non-safe string assignments to `s` so a warning is not produced. On the other hand:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n s1 = foo();\n if (b) s = s1;\n sink(s); // warning here\n }\n\n String foo();\n\n String sink(@Untainted String s) {}\n\n\nHere we have a warning since `s1` has an unknown state after `foo` call result assignment.\n\nNew in 2021.2" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "tainting", + "suppressToolId": "UtilityClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21467,8 +21365,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -21480,28 +21378,28 @@ ] }, { - "id": "RecordCanBeClass", + "id": "ClassNameDiffersFromFileName", "shortDescription": { - "text": "Record can be converted to class" + "text": "Class name differs from file name" }, "fullDescription": { - "text": "Reports record classes and suggests converting them to ordinary classes. This inspection makes it possible to move a Java record to a codebase using an earlier Java version by applying the quick-fix to this record. Note that the resulting class is not completely equivalent to the original record: The resulting class no longer extends 'java.lang.Record', so 'instanceof Record' returns 'false'. Reflection methods like 'Class.isRecord()' and 'Class.getRecordComponents()' produce different results. The generated 'hashCode()' implementation may produce a different result because the formula to calculate record 'hashCode' is deliberately not specified. Record serialization mechanism differs from that of an ordinary class. Refer to Java Object Serialization Specification for details. Example: 'record Point(int x, int y) {}' After the quick-fix is applied: 'final class Point {\n private final int x;\n private final int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n public int x() { return x; }\n\n public int y() { return y; }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == this) return true;\n if (obj == null || obj.getClass() != this.getClass()) return false;\n var that = (Point)obj;\n return this.x == that.x &&\n this.y == that.y;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(x, y);\n }\n\n @Override\n public String toString() {\n return \"Point[\" +\n \"x=\" + x + \", \" +\n \"y=\" + y + ']';\n }\n }' This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.3", - "markdown": "Reports record classes and suggests converting them to ordinary classes.\n\nThis inspection makes it possible to move a Java record to a codebase using an earlier Java version\nby applying the quick-fix to this record.\n\n\nNote that the resulting class is not completely equivalent to the original record:\n\n* The resulting class no longer extends `java.lang.Record`, so `instanceof Record` returns `false`.\n* Reflection methods like `Class.isRecord()` and `Class.getRecordComponents()` produce different results.\n* The generated `hashCode()` implementation may produce a different result because the formula to calculate record `hashCode` is deliberately not specified.\n* Record serialization mechanism differs from that of an ordinary class. Refer to *Java Object Serialization Specification* for details.\n\nExample:\n\n\n record Point(int x, int y) {}\n\nAfter the quick-fix is applied:\n\n\n final class Point {\n private final int x;\n private final int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n public int x() { return x; }\n\n public int y() { return y; }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == this) return true;\n if (obj == null || obj.getClass() != this.getClass()) return false;\n var that = (Point)obj;\n return this.x == that.x &&\n this.y == that.y;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(x, y);\n }\n\n @Override\n public String toString() {\n return \"Point[\" +\n \"x=\" + x + \", \" +\n \"y=\" + y + ']';\n }\n }\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.3" + "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": "note", + "level": "warning", "parameters": { - "suppressToolId": "RecordCanBeClass", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ClassNameDiffersFromFileName", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -21513,19 +21411,19 @@ ] }, { - "id": "MalformedFormatString", + "id": "IndexOfReplaceableByContains", "shortDescription": { - "text": "Malformed format string" + "text": "'String.indexOf()' expression can be replaced with 'contains()'" }, "fullDescription": { - "text": "Reports format strings that don't comply with the standard Java syntax. By default, the inspection considers a compile-time constant a format string if it's used as an argument to the corresponding methods on 'java.util.Formatter', 'java.lang.String', 'java.io.PrintWriter' or 'java.io.PrintStream'. Example: 'String.format(\"x = %d, y = %d\", 42);' Use the inspection settings to mark additional classes and methods as related to string formatting. As an alternative, you can use the 'org.intellij.lang.annotations.PrintFormat' annotation to mark the format string method parameter. In this case, the format arguments parameter must immediately follow the format string and be the last method parameter. Example: 'void myFormatMethod(int mode, @PrintFormat String formatString, Object... args) {...}' Methods annotated in this way will also be recognized by this inspection.", - "markdown": "Reports format strings that don't comply with the standard Java syntax.\n\nBy default, the inspection considers a compile-time constant a format string if it's used as an argument to the corresponding methods on\n`java.util.Formatter`, `java.lang.String`, `java.io.PrintWriter` or `java.io.PrintStream`.\n\n**Example:**\n\n\n String.format(\"x = %d, y = %d\", 42);\n\nUse the inspection settings to mark additional classes and methods as related to string formatting.\n\nAs an alternative, you can use the `org.intellij.lang.annotations.PrintFormat` annotation\nto mark the format string method parameter. In this case,\nthe format arguments parameter must immediately follow the format string and be the last method parameter. Example:\n\n\n void myFormatMethod(int mode, @PrintFormat String formatString, Object... args) {...}\n\n\nMethods annotated in this way will also be recognized by this inspection." + "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, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MalformedFormatString", + "suppressToolId": "IndexOfReplaceableByContains", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21533,8 +21431,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -21546,28 +21444,28 @@ ] }, { - "id": "ThreadYield", + "id": "StringConcatenationArgumentToLogCall", "shortDescription": { - "text": "Call to 'Thread.yield()'" + "text": "Non-constant string concatenation as argument to logging call" }, "fullDescription": { - "text": "Reports calls to 'Thread.yield()'. The behavior of 'yield()' is non-deterministic and platform-dependent, and it is rarely appropriate to use this method. Its use should be combined with detailed profiling and benchmarking to ensure that it actually has the desired effect. Example: 'public static void main(String[] args) {\n Runnable r = () -> {\n for (int i = 0; i < 10; i++) {\n System.out.println(i);\n Thread.yield();\n }\n };\n new Thread(r).start();\n new Thread(r).start();\n }'", - "markdown": "Reports calls to `Thread.yield()`.\n\n\nThe behavior of `yield()` is non-deterministic and platform-dependent, and it is rarely appropriate to use this method.\nIts use should be combined with detailed profiling and benchmarking to ensure that it actually has the desired effect.\n\n**Example:**\n\n\n public static void main(String[] args) {\n Runnable r = () -> {\n for (int i = 0; i < 10; i++) {\n System.out.println(i);\n Thread.yield();\n }\n };\n new Thread(r).start();\n new Thread(r).start();\n }\n" + "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", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "CallToThreadYield", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "StringConcatenationArgumentToLogCall", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Logging", + "index": 119, "toolComponent": { "name": "QDJVM" } @@ -21579,28 +21477,28 @@ ] }, { - "id": "LambdaCanBeMethodCall", + "id": "OptionalContainsCollection", "shortDescription": { - "text": "Lambda can be replaced with method call" + "text": "'Optional' contains array or collection" }, "fullDescription": { - "text": "Reports lambda expressions which can be replaced with a call to a JDK method. For example, an expression 'x -> x' of type 'Function' can be replaced with a 'Function.identity()' call. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8. New in 2017.1", - "markdown": "Reports lambda expressions which can be replaced with a call to a JDK method.\n\nFor example, an expression `x -> x` of type `Function`\ncan be replaced with a `Function.identity()` call.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.\n\nNew in 2017.1" + "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> foo() {\n return Optional.empty();\n }' This code could look like: 'List foo() {\n return List.of();\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "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> foo() {\n return Optional.empty();\n }\n\nThis code could look like:\n\n\n List foo() {\n return List.of();\n }\n \nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "LambdaCanBeMethodCall", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "OptionalContainsCollection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -21612,22 +21510,19 @@ ] }, { - "id": "EndlessStream", + "id": "InterfaceMethodClashesWithObject", "shortDescription": { - "text": "Non-short-circuit operation consumes infinite stream" + "text": "Interface method clashes with method in 'Object'" }, "fullDescription": { - "text": "Reports non-short-circuit operations consuming an infinite stream. Such operations can be completed only by throwing an exception. Example: 'Stream.iterate(0, i -> i + 1).collect(Collectors.toList())' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports non-short-circuit operations consuming an infinite stream. Such operations can be completed only by throwing an exception.\n\nExample:\n\n\n Stream.iterate(0, i -> i + 1).collect(Collectors.toList())\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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": "EndlessStream", - "cweIds": [ - 835 - ], + "suppressToolId": "InterfaceMethodClashesWithObject", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21635,8 +21530,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -21648,19 +21543,19 @@ ] }, { - "id": "Singleton", + "id": "SimplifiableAssertion", "shortDescription": { - "text": "Singleton" + "text": "Simplifiable assertion" }, "fullDescription": { - "text": "Reports singleton classes. Singleton classes are declared in a way that only one instance of the class can ever be instantiated. Singleton classes complicate testing, and their presence may indicate a lack of object-oriented design. Example: 'class Singleton {\n private static final Singleton ourInstance = new Singleton();\n\n private Singleton() {\n }\n\n public Singleton getInstance() {\n return ourInstance;\n }\n }'", - "markdown": "Reports singleton classes.\n\nSingleton classes are declared in a way that only one instance of the class can ever be instantiated. Singleton classes complicate testing,\nand their presence may indicate a lack of object-oriented design.\n\n**Example:**\n\n\n class Singleton {\n private static final Singleton ourInstance = new Singleton();\n\n private Singleton() {\n }\n\n public Singleton getInstance() {\n return ourInstance;\n }\n }\n" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "Singleton", + "suppressToolId": "SimplifiableAssertion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21668,8 +21563,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Test frameworks", + "index": 130, "toolComponent": { "name": "QDJVM" } @@ -21681,19 +21576,25 @@ ] }, { - "id": "NonFinalUtilityClass", + "id": "LoadLibraryWithNonConstantString", "shortDescription": { - "text": "Utility class is not 'final'" + "text": "Call to 'System.loadLibrary()' with non-constant string" }, "fullDescription": { - "text": "Reports utility classes that aren't 'final' or 'abstract'. Utility classes have all fields and methods declared as 'static'. Making them 'final' prevents them from being accidentally subclassed. Example: 'public class UtilityClass {\n public static void foo() {}\n }' After the quick-fix is applied: 'public final class UtilityClass {\n public static void foo() {}\n }'", - "markdown": "Reports utility classes that aren't `final` or `abstract`.\n\nUtility classes have all fields and methods declared as `static`.\nMaking them `final` prevents them from being accidentally subclassed.\n\n**Example:**\n\n\n public class UtilityClass {\n public static void foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n public final class UtilityClass {\n public static void foo() {}\n }\n" + "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": "NonFinalUtilityClass", + "suppressToolId": "LoadLibraryWithNonConstantString", + "cweIds": [ + 114, + 494, + 676, + 829 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21701,8 +21602,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -21714,19 +21615,19 @@ ] }, { - "id": "FuseStreamOperations", + "id": "StaticMethodOnlyUsedInOneClass", "shortDescription": { - "text": "Subsequent steps can be fused into Stream API chain" + "text": "Static member only used from one other class" }, "fullDescription": { - "text": "Detects transformations outside a Stream API chain that could be incorporated into it. Example: 'List list = stream.collect(Collectors.toList());\n list.sort(null);\n return list.toArray(new String[list.size()]);' After the conversion: 'return stream.sorted().toArray(String[]::new);' Note that sometimes the converted stream chain may replace explicit 'ArrayList' with 'Collectors.toList()' or explicit 'HashSet' with 'Collectors.toSet()'. The current library implementation uses these collections internally. However, this approach is not very reliable and might change in the future altering the semantics of your code. If you are concerned about it, use the Do not suggest 'toList()' or 'toSet()' collectors option to suggest 'Collectors.toCollection()' instead of 'toList' and 'toSet' collectors. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Detects transformations outside a Stream API chain that could be incorporated into it.\n\nExample:\n\n\n List list = stream.collect(Collectors.toList());\n list.sort(null);\n return list.toArray(new String[list.size()]);\n\nAfter the conversion:\n\n\n return stream.sorted().toArray(String[]::new);\n\n\nNote that sometimes the converted stream chain may replace explicit `ArrayList` with `Collectors.toList()` or explicit\n`HashSet` with `Collectors.toSet()`. The current library implementation uses these collections internally. However,\nthis approach is not very reliable and might change in the future altering the semantics of your code.\n\nIf you are concerned about it, use the **Do not suggest 'toList()' or 'toSet()' collectors** option to suggest\n`Collectors.toCollection()` instead of `toList` and `toSet` collectors.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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": "FuseStreamOperations", + "suppressToolId": "StaticMethodOnlyUsedInOneClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21734,8 +21635,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -21747,19 +21648,19 @@ ] }, { - "id": "DefaultNotLastCaseInSwitch", + "id": "RedundantEscapeInRegexReplacement", "shortDescription": { - "text": "'default' not last case in 'switch'" + "text": "Redundant escape in regex replacement string" }, "fullDescription": { - "text": "Reports 'switch' statements or expressions in which the 'default' branch is positioned before another case. Such a construct is unnecessarily confusing. A quick-fix is provided to move the 'default' branch to the last position, if possible. Example: 'switch (n) {\n default:\n System.out.println();\n break;\n case 1:\n break;\n }' After the quick-fix is applied: 'switch (n) {\n case 1:\n break;\n default:\n System.out.println();\n break;\n }'", - "markdown": "Reports `switch` statements or expressions in which the `default` branch is positioned before another case. Such a construct is unnecessarily confusing. A quick-fix is provided to move the `default` branch to the last position, if possible.\n\n**Example:**\n\n\n switch (n) {\n default:\n System.out.println();\n break;\n case 1:\n break;\n }\n\nAfter the quick-fix is applied:\n\n\n switch (n) {\n case 1:\n break;\n default:\n System.out.println();\n break;\n }\n" + "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, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DefaultNotLastCaseInSwitch", + "suppressToolId": "RedundantEscapeInRegexReplacement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21767,8 +21668,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -21780,19 +21681,19 @@ ] }, { - "id": "NullThrown", + "id": "SynchronizedOnLiteralObject", "shortDescription": { - "text": "'null' thrown" + "text": "Synchronization on an object initialized with a literal" }, "fullDescription": { - "text": "Reports 'null' literals that are used as the argument of a 'throw' statement. Such constructs produce a 'java.lang.NullPointerException' that usually should not be thrown programmatically.", - "markdown": "Reports `null` literals that are used as the argument of a `throw` statement.\n\nSuch constructs produce a `java.lang.NullPointerException` that usually should not be thrown programmatically." + "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": "NullThrown", + "suppressToolId": "SynchronizedOnLiteralObject", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21800,8 +21701,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -21813,19 +21714,19 @@ ] }, { - "id": "LocalCanBeFinal", + "id": "Java9ReflectionClassVisibility", "shortDescription": { - "text": "Local variable or parameter can be 'final'" + "text": "Reflective access across modules issues" }, "fullDescription": { - "text": "Reports parameters or local variables that may have the 'final' modifier added to their declaration. Example: 'ArrayList list = new ArrayList();\n fill(list);\n return list;' After the quick-fix is applied: 'final ArrayList list = new ArrayList();\n fill(list);\n return list;' Use the inspection's options to define whether parameters or local variables should be reported.", - "markdown": "Reports parameters or local variables that may have the `final` modifier added to their declaration.\n\nExample:\n\n\n ArrayList list = new ArrayList();\n fill(list);\n return list;\n\nAfter the quick-fix is applied:\n\n\n final ArrayList list = new ArrayList();\n fill(list);\n return list;\n\n\nUse the inspection's options to define whether parameters or local variables should be reported." + "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 depends on the Java feature 'Modules', which is available since Java 9.", + "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 depends on the Java feature 'Modules', which is available since Java 9." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "LocalCanBeFinal", + "suppressToolId": "Java9ReflectionClassVisibility", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21833,8 +21734,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Reflective access", + "index": 131, "toolComponent": { "name": "QDJVM" } @@ -21846,19 +21747,19 @@ ] }, { - "id": "FieldMayBeStatic", + "id": "CharsetObjectCanBeUsed", "shortDescription": { - "text": "Field can be made 'static'" + "text": "Standard 'Charset' object can be used" }, "fullDescription": { - "text": "Reports instance variables that can safely be made 'static'. A field can be static if it is declared 'final' and initialized with a constant. Example: 'public final String str = \"sample\";' The inspection does not report final fields that can be implicitly written. Use the \"Annotations\" button to modify the list of annotations that assume implicit field write.", - "markdown": "Reports instance variables that can safely be made `static`. A field can be static if it is declared `final` and initialized with a constant.\n\n**Example:**\n\n\n public final String str = \"sample\";\n\n\nThe inspection does not report final fields that can be implicitly written. Use the \"Annotations\" button to modify\nthe list of annotations that assume implicit field write." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "FieldMayBeStatic", + "suppressToolId": "CharsetObjectCanBeUsed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21866,8 +21767,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -21879,19 +21780,19 @@ ] }, { - "id": "ArrayEquals", + "id": "UseOfSunClasses", "shortDescription": { - "text": "'equals()' called on array" + "text": "Use of 'sun.*' classes" }, "fullDescription": { - "text": "Reports 'equals()' calls that compare two arrays. Calling 'equals()' on an array compares identity and is equivalent to using '=='. Use 'Arrays.equals()' to compare the contents of two arrays, or 'Arrays.deepEquals()' for multi-dimensional arrays. Example: 'void sample(int[] first, int[] second){\n if (first.equals(second)) return;\n }' After the quick-fix is applied: 'void sample(int[] first, int[] second){\n if (Arrays.equals(first, second)) return;\n }'", - "markdown": "Reports `equals()` calls that compare two arrays.\n\nCalling `equals()` on an array compares identity and is equivalent to using `==`.\nUse `Arrays.equals()` to compare the contents of two arrays, or `Arrays.deepEquals()` for\nmulti-dimensional arrays.\n\n**Example:**\n\n\n void sample(int[] first, int[] second){\n if (first.equals(second)) return;\n }\n\nAfter the quick-fix is applied:\n\n\n void sample(int[] first, int[] second){\n if (Arrays.equals(first, second)) return;\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ArrayEquals", + "suppressToolId": "UseOfSunClasses", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21899,8 +21800,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -21912,19 +21813,19 @@ ] }, { - "id": "ProblematicVarargsMethodOverride", + "id": "RedundantCast", "shortDescription": { - "text": "Non-varargs method overrides varargs method" + "text": "Redundant type cast" }, "fullDescription": { - "text": "Reports methods that override a variable arity (a.k.a. varargs) method but replace the variable arity parameter with an array parameter. Though this code is valid, it may be confusing and should be avoided.", - "markdown": "Reports methods that override a variable arity (a.k.a. varargs) method but replace the variable arity parameter with an array parameter. Though this code is valid, it may be confusing and should be avoided." + "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 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 l, Object o) {\n l.remove((String)o);\n } \n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ProblematicVarargsMethodOverride", + "suppressToolId": "RedundantCast", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21932,8 +21833,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -21945,28 +21846,28 @@ ] }, { - "id": "MisspelledHeader", + "id": "AnonymousInnerClass", "shortDescription": { - "text": "Unknown or misspelled header name" + "text": "Anonymous class can be replaced with inner class" }, "fullDescription": { - "text": "Reports any unknown and probably misspelled header names and provides possible variants.", - "markdown": "Reports any unknown and probably misspelled header names and provides possible variants." + "text": "Reports anonymous classes. Occasionally replacing anonymous classes with inner classes can lead to more readable and maintainable code. Some code standards discourage anonymous classes. Example: 'class Example {\n public static void main(String[] args) {\n new Thread() {\n public void run() {\n work()\n }\n\n private void work() {}\n }.start();\n }\n }' After the quick-fix is applied: 'class Example {\n public static void main(String[] args) {\n new MyThread().start();\n }\n\n private static class MyThread extends Thread {\n public void run() {\n work();\n }\n\n private void work() {}\n }\n }'", + "markdown": "Reports anonymous classes.\n\nOccasionally replacing anonymous classes with inner classes can lead to more readable and maintainable code.\nSome code standards discourage anonymous classes.\n\n**Example:**\n\n\n class Example {\n public static void main(String[] args) {\n new Thread() {\n public void run() {\n work()\n }\n\n private void work() {}\n }.start();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n public static void main(String[] args) {\n new MyThread().start();\n }\n\n private static class MyThread extends Thread {\n public void run() {\n work();\n }\n\n private void work() {}\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "MisspelledHeader", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AnonymousInnerClass", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Manifest", - "index": 117, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -21978,19 +21879,19 @@ ] }, { - "id": "AtomicFieldUpdaterIssues", + "id": "SimplifyCollector", "shortDescription": { - "text": "Inconsistent 'AtomicFieldUpdater' declaration" + "text": "Simplifiable collector" }, "fullDescription": { - "text": "Reports issues with 'AtomicLongFieldUpdater', 'AtomicIntegerFieldUpdater', or 'AtomicReferenceFieldUpdater' fields (the 'java.util.concurrent.atomic' package). The reported issues are identical to the runtime problems that can happen with atomic field updaters: specified field not found, specified field not accessible, specified field has a wrong type, and so on. Examples: 'class A {\n private static volatile int value = 0;\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater((A.class), \"value\"); // warning: Field 'value' has 'static' modifier\n }' 'class B {\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater(B.class, \"value\"); // warning: No field named 'value' found in class 'B'\n }'", - "markdown": "Reports issues with `AtomicLongFieldUpdater`, `AtomicIntegerFieldUpdater`, or `AtomicReferenceFieldUpdater` fields (the `java.util.concurrent.atomic` package).\n\nThe reported issues are identical to the runtime problems that can happen with atomic field updaters:\nspecified field not found, specified field not accessible, specified field has a wrong type, and so on.\n\n**Examples:**\n\n*\n\n\n class A {\n private static volatile int value = 0;\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater((A.class), \"value\"); // warning: Field 'value' has 'static' modifier\n }\n \n*\n\n\n class B {\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater(B.class, \"value\"); // warning: No field named 'value' found in class 'B'\n }\n \n" + "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 depends on the Java feature 'Stream and Optional API', which is available since Java 8. 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 depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2017.1" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AtomicFieldUpdaterIssues", + "suppressToolId": "SimplifyCollector", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -21998,8 +21899,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -22011,19 +21912,19 @@ ] }, { - "id": "PackageNamingConvention", + "id": "MultipleTopLevelClassesInFile", "shortDescription": { - "text": "Package naming convention" + "text": "Multiple top level classes in single file" }, "fullDescription": { - "text": "Reports packages whose names are either too short, too long, or do not follow the specified regular expression pattern. Example: 'package io;' Use the options to specify the minimum and maximum length of the package name as well as a regular expression that matches valid package names (regular expressions are in standard 'java.util.regex' format).", - "markdown": "Reports packages whose names are either too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:**\n\n\n package io;\n\n\nUse the options to specify the minimum and maximum length of the package name\nas well as a regular expression that matches valid package names\n(regular expressions are in standard `java.util.regex` format)." + "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": "PackageNamingConvention", + "suppressToolId": "MultipleTopLevelClassesInFile", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22031,8 +21932,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -22044,23 +21945,19 @@ ] }, { - "id": "ThrowableNotThrown", + "id": "IteratorNextDoesNotThrowNoSuchElementException", "shortDescription": { - "text": "'Throwable' not thrown" + "text": "'Iterator.next()' which can't throw 'NoSuchElementException'" }, "fullDescription": { - "text": "Reports instantiations of 'Throwable' or its subclasses, where the created 'Throwable' is never actually thrown. Additionally, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the result of the method call is not thrown. Calls to methods annotated with the Error Prone's or AssertJ's '@CanIgnoreReturnValue' annotation will not be reported. Example: 'void check(String s) {\n if (s == null) {\n new NullPointerException(\"s\");\n }\n // ...\n }'", - "markdown": "Reports instantiations of `Throwable` or its subclasses, where the created `Throwable` is never actually thrown. Additionally, this inspection reports method calls that return instances of `Throwable` or its subclasses, when the result of the method call is not thrown.\n\nCalls to methods annotated with the Error Prone's or AssertJ's `@CanIgnoreReturnValue` annotation will not be reported.\n\n**Example:**\n\n\n void check(String s) {\n if (s == null) {\n new NullPointerException(\"s\");\n }\n // ...\n }\n" + "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 {\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 {\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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ThrowableNotThrown", - "cweIds": [ - 390, - 703 - ], + "suppressToolId": "IteratorNextCanNotThrowNoSuchElementException", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22081,19 +21978,23 @@ ] }, { - "id": "CapturingCleaner", + "id": "IncorrectMessageFormat", "shortDescription": { - "text": "Cleaner captures object reference" + "text": "Incorrect 'MessageFormat' pattern" }, "fullDescription": { - "text": "Reports 'Runnable' passed to a 'Cleaner.register()' capturing reference being registered. If the reference is captured, it will never be phantom reachable and the cleaning action will never be invoked. Possible sources of this problem: Lambda using non-static methods, fields, or 'this' itself Non-static inner class (anonymous or not) always captures this reference in java up to 18 version Instance method reference Access to outer class non-static members from non-static inner class Sample of code that will be reported: 'int fileDescriptor;\n Cleaner.Cleanable cleanable = Cleaner.create().register(this, () -> {\n System.out.println(\"adsad\");\n //this is captured via fileDescriptor\n fileDescriptor = 0;\n });' This inspection only reports if the language level of the project or module is 9 or higher. New in 2018.1", - "markdown": "Reports `Runnable` passed to a `Cleaner.register()` capturing reference being registered. If the reference is captured, it will never be phantom reachable and the cleaning action will never be invoked.\n\nPossible sources of this problem:\n\n* Lambda using non-static methods, fields, or `this` itself\n* Non-static inner class (anonymous or not) always captures this reference in java up to 18 version\n* Instance method reference\n* Access to outer class non-static members from non-static inner class\n\nSample of code that will be reported:\n\n\n int fileDescriptor;\n Cleaner.Cleanable cleanable = Cleaner.create().register(this, () -> {\n System.out.println(\"adsad\");\n //this is captured via fileDescriptor\n fileDescriptor = 0;\n });\n\nThis inspection only reports if the language level of the project or module is 9 or higher.\n\nNew in 2018.1" + "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": "CapturingCleaner", + "suppressToolId": "IncorrectMessageFormat", + "cweIds": [ + 628, + 707 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22114,19 +22015,19 @@ ] }, { - "id": "ThreadStartInConstruction", + "id": "SuspiciousTernaryOperatorInVarargsCall", "shortDescription": { - "text": "Call to 'Thread.start()' during object construction" + "text": "Suspicious ternary operator in varargs method call" }, "fullDescription": { - "text": "Reports calls to 'start()' on 'java.lang.Thread' or any of its subclasses during object construction. While occasionally useful, such constructs should be avoided due to inheritance issues. Subclasses of a class that launches a thread during the object construction will not have finished any initialization logic of their own before the thread has launched. This inspection does not report if the class that starts a thread is declared 'final'. Example: 'class MyThread extends Thread {\n MyThread() {\n start();\n }\n }'", - "markdown": "Reports calls to `start()` on `java.lang.Thread` or any of its subclasses during object construction.\n\n\nWhile occasionally useful, such constructs should be avoided due to inheritance issues.\nSubclasses of a class that launches a thread during the object construction will not have finished\nany initialization logic of their own before the thread has launched.\n\nThis inspection does not report if the class that starts a thread is declared `final`.\n\n**Example:**\n\n\n class MyThread extends Thread {\n MyThread() {\n start();\n }\n }\n" + "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 }' This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5. 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\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.\n\nNew in 2020.3" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CallToThreadStartDuringObjectConstruction", + "suppressToolId": "SuspiciousTernaryOperatorInVarargsCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22134,8 +22035,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -22147,19 +22048,19 @@ ] }, { - "id": "SwitchStatementWithTooManyBranches", + "id": "SerializableInnerClassHasSerialVersionUIDField", "shortDescription": { - "text": "Maximum 'switch' branches" + "text": "Serializable non-static inner class without 'serialVersionUID'" }, "fullDescription": { - "text": "Reports 'switch' statements or expressions with too many 'case' labels. Such a long switch statement may be confusing and should probably be refactored. Sometimes, it is not a problem (for example, a domain is very complicated and has enums with a lot of constants). Example: 'switch (x) {\n case 1 -> {}\n case 2 -> {}\n case 3 -> {}\n case 4 -> {}\n case 5 -> {}\n case 6 -> {}\n case 7 -> {}\n case 8 -> {}\n case 9 -> {}\n case 10 -> {}\n case 11,12,13 -> {}\n default -> {}\n }' Use the Maximum number of branches field to specify the maximum number of 'case' labels expected.", - "markdown": "Reports `switch` statements or expressions with too many `case` labels.\n\nSuch a long switch statement may be confusing and should probably be refactored.\nSometimes, it is not a problem (for example, a domain is very complicated and has enums with a lot of constants).\n\nExample:\n\n\n switch (x) {\n case 1 -> {}\n case 2 -> {}\n case 3 -> {}\n case 4 -> {}\n case 5 -> {}\n case 6 -> {}\n case 7 -> {}\n case 8 -> {}\n case 9 -> {}\n case 10 -> {}\n case 11,12,13 -> {}\n default -> {}\n }\n\nUse the **Maximum number of branches** field to specify the maximum number of `case` labels expected." + "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": "SwitchStatementWithTooManyBranches", + "suppressToolId": "SerializableNonStaticInnerClassWithoutSerialVersionUID", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22167,8 +22068,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -22180,19 +22081,19 @@ ] }, { - "id": "LoopConditionNotUpdatedInsideLoop", + "id": "ParameterNameDiffersFromOverriddenParameter", "shortDescription": { - "text": "Loop variable not updated inside loop" + "text": "Parameter name differs from parameter in overridden or overloaded method" }, "fullDescription": { - "text": "Reports any variables and parameters that are used in a loop condition and are not updated inside the loop. Such variables and parameters are usually used by mistake as they may cause an infinite loop if they are executed. Example: 'void loopDoesNotLoop(boolean b) {\n while (b) {\n System.out.println();\n break;\n }\n }' Configure the inspection: Use the Ignore possible non-local changes option to disable this inspection if the condition can be updated indirectly (e.g. via the called method or concurrently from another thread).", - "markdown": "Reports any variables and parameters that are used in a loop condition and are not updated inside the loop.\n\nSuch variables and parameters are usually used by mistake as they\nmay cause an infinite loop if they are executed.\n\nExample:\n\n\n void loopDoesNotLoop(boolean b) {\n while (b) {\n System.out.println();\n break;\n }\n }\n\nConfigure the inspection:\n\n\nUse the **Ignore possible non-local changes** option to disable this inspection\nif the condition can be updated indirectly (e.g. via the called method or concurrently from another thread)." + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LoopConditionNotUpdatedInsideLoop", + "suppressToolId": "ParameterNameDiffersFromOverriddenParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22200,8 +22101,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -22213,19 +22114,19 @@ ] }, { - "id": "DoubleCheckedLocking", + "id": "OctalLiteral", "shortDescription": { - "text": "Double-checked locking" + "text": "Octal integer" }, "fullDescription": { - "text": "Reports double-checked locking. Double-checked locking tries to initialize a field on demand and in a thread-safe manner, while avoiding the cost of synchronization. Unfortunately it is not thread-safe when used on a field that is not declared 'volatile'. When using Java 1.4 or earlier, double-checked locking doesn't work even with a 'volatile' field. Read the article linked above for a detailed explanation of the problem. Example of incorrect double-checked locking: 'class Foo {\n private Helper helper = null;\n public Helper getHelper() {\n if (helper == null)\n synchronized(this) {\n if (helper == null) helper = new Helper();\n }\n return helper;\n }\n }\n // other functions and members...\n }'", - "markdown": "Reports [double-checked locking](https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html).\n\n\nDouble-checked locking tries to initialize a field on demand and in a thread-safe manner, while avoiding the cost of synchronization.\nUnfortunately it is not thread-safe when used on a field that is not declared `volatile`.\nWhen using Java 1.4 or earlier, double-checked locking doesn't work even with a `volatile` field.\nRead the article linked above for a detailed explanation of the problem.\n\nExample of incorrect double-checked locking:\n\n\n class Foo {\n private Helper helper = null;\n public Helper getHelper() {\n if (helper == null)\n synchronized(this) {\n if (helper == null) helper = new Helper();\n }\n return helper;\n }\n }\n // other functions and members...\n }\n" + "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": "DoubleCheckedLocking", + "suppressToolId": "OctalInteger", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22233,8 +22134,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -22246,19 +22147,19 @@ ] }, { - "id": "MisspelledMethodName", + "id": "ReadWriteStringCanBeUsed", "shortDescription": { - "text": "Method names differing only by case" + "text": "'Files.readString()' or 'Files.writeString()' can be used" }, "fullDescription": { - "text": "Reports cases in which multiple methods of a class have the names that differ only by case. Such names may be very confusing. Example: 'public int hashcode() { // reported, should be hashCode probably?\n return 0;\n }' A quick-fix that renames such methods is available only in the editor. Use the Ignore methods overriding/implementing a super method option to ignore methods overriding or implementing a method from the superclass.", - "markdown": "Reports cases in which multiple methods of a class have the names that differ only by case. Such names may be very confusing.\n\n**Example:**\n\n\n public int hashcode() { // reported, should be hashCode probably?\n return 0;\n }\n\nA quick-fix that renames such methods is available only in the editor.\n\nUse the **Ignore methods overriding/implementing a super method** option to ignore methods overriding or implementing a method from\nthe superclass." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "MethodNamesDifferingOnlyByCase", + "suppressToolId": "ReadWriteStringCanBeUsed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22266,8 +22167,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Java/Java language level migration aids/Java 11", + "index": 178, "toolComponent": { "name": "QDJVM" } @@ -22279,19 +22180,19 @@ ] }, { - "id": "NonSerializableObjectBoundToHttpSession", + "id": "CyclomaticComplexity", "shortDescription": { - "text": "Non-serializable object bound to 'HttpSession'" + "text": "Overly complex method" }, "fullDescription": { - "text": "Reports objects of classes not implementing 'java.io.Serializable' used as arguments to 'javax.servlet.http.HttpSession.setAttribute()' or 'javax.servlet.http.HttpSession.putValue()'. Such objects will not be serialized if the 'HttpSession' is passivated or migrated, and may result in difficult-to-diagnose bugs. This inspection assumes objects of the types 'java.util.Collection' and 'java.util.Map' to be 'Serializable', unless type parameters are non-'Serializable'. Example: 'void foo(HttpSession session) {\n session.setAttribute(\"foo\", new NonSerializable());\n }\n static class NonSerializable {}'", - "markdown": "Reports objects of classes not implementing `java.io.Serializable` used as arguments to `javax.servlet.http.HttpSession.setAttribute()` or `javax.servlet.http.HttpSession.putValue()`.\n\n\nSuch objects will not be serialized if the `HttpSession` is passivated or migrated,\nand may result in difficult-to-diagnose bugs.\n\n\nThis inspection assumes objects of the types `java.util.Collection` and\n`java.util.Map` to be `Serializable`,\nunless type parameters are non-`Serializable`.\n\n**Example:**\n\n\n void foo(HttpSession session) {\n session.setAttribute(\"foo\", new NonSerializable());\n }\n static class NonSerializable {}\n" + "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": "NonSerializableObjectBoundToHttpSession", + "suppressToolId": "OverlyComplexMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22299,8 +22200,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -22312,19 +22213,19 @@ ] }, { - "id": "ThreadLocalNotStaticFinal", + "id": "AwaitNotInLoop", "shortDescription": { - "text": "'ThreadLocal' field not declared 'static final'" + "text": "'await()' not called in loop" }, "fullDescription": { - "text": "Reports fields of type 'java.lang.ThreadLocal' that are not declared 'static final'. In the most common case, a 'java.lang.ThreadLocal' instance associates state with a thread. A non-static non-final 'java.lang.ThreadLocal' field associates state with an instance-thread combination. This is usually unnecessary and quite often is a bug that can cause memory leaks and incorrect behavior. A quick-fix is suggested to make the field 'static final'. Example: 'private ThreadLocal tl = ThreadLocal.withInitial(() -> Boolean.TRUE);'", - "markdown": "Reports fields of type `java.lang.ThreadLocal` that are not declared `static final`.\n\n\nIn the most common case, a `java.lang.ThreadLocal` instance associates state with a thread.\nA non-static non-final `java.lang.ThreadLocal` field associates state with an instance-thread combination.\nThis is usually unnecessary and quite often is a bug that can cause memory leaks and incorrect behavior.\n\n\nA quick-fix is suggested to make the field `static final`.\n\n\n**Example:**\n\n\n private ThreadLocal tl = ThreadLocal.withInitial(() -> Boolean.TRUE);\n" + "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": "ThreadLocalNotStaticFinal", + "suppressToolId": "AwaitNotInLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22345,19 +22246,19 @@ ] }, { - "id": "AccessStaticViaInstance", + "id": "StaticVariableUninitializedUse", "shortDescription": { - "text": "Access static member via instance reference" + "text": "Static field used before initialization" }, "fullDescription": { - "text": "Reports references to 'static' methods and fields via a class instance rather than the class itself. Even though referring to static members via instance variables is allowed by The Java Language Specification, this makes the code confusing as the reader may think that the result of the method depends on the instance. The quick-fix replaces the instance variable with the class name. Example: 'String s1 = s.valueOf(0);' After the quick-fix is applied: 'String s = String.valueOf(0);'", - "markdown": "Reports references to `static` methods and fields via a class instance rather than the class itself.\n\nEven though referring to static members via instance variables is allowed by The Java Language Specification,\nthis makes the code confusing as the reader may think that the result of the method depends on the instance.\n\nThe quick-fix replaces the instance variable with the class name.\n\nExample:\n\n\n String s1 = s.valueOf(0);\n\nAfter the quick-fix is applied:\n\n\n String s = String.valueOf(0);\n" + "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": "AccessStaticViaInstance", + "suppressToolId": "StaticVariableUsedBeforeInitialization", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22365,8 +22266,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -22378,19 +22279,19 @@ ] }, { - "id": "CallToNativeMethodWhileLocked", + "id": "CyclicClassDependency", "shortDescription": { - "text": "Call to a 'native' method while locked" + "text": "Cyclic class dependency" }, "fullDescription": { - "text": "Reports calls 'native' methods within a 'synchronized' block or method. When possible, it's better to keep calls to 'native' methods out of the synchronized context because such calls cause an expensive context switch and may lead to performance issues. Example: 'native void nativeMethod();\n\n void example(){\n synchronized (lock){\n nativeMethod();//warning\n }\n }'", - "markdown": "Reports calls `native` methods within a `synchronized` block or method.\n\n\nWhen possible, it's better to keep calls to `native` methods out of the synchronized context\nbecause such calls cause an expensive context switch and may lead to performance issues.\n\n**Example:**\n\n\n native void nativeMethod();\n\n void example(){\n synchronized (lock){\n nativeMethod();//warning\n }\n }\n" + "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": "CallToNativeMethodWhileLocked", + "suppressToolId": "CyclicClassDependency", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22398,8 +22299,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Dependency issues", + "index": 146, "toolComponent": { "name": "QDJVM" } @@ -22411,28 +22312,28 @@ ] }, { - "id": "Dependency", + "id": "StringBufferReplaceableByStringBuilder", "shortDescription": { - "text": "Illegal package dependencies" + "text": "'StringBuffer' may be 'StringBuilder'" }, "fullDescription": { - "text": "Reports illegal dependencies between scopes according to the dependency rules given. Dependency rules can be used to prohibit usage from a scope to another scope. Use the Configure dependency rules button below to customize validation rules.", - "markdown": "Reports illegal dependencies between scopes according to the dependency rules given. Dependency rules can be used to prohibit usage from a scope to another scope.\n\nUse the **Configure dependency rules** button below to customize validation rules." + "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": "error", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "Dependency", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "StringBufferMayBeStringBuilder", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -22444,19 +22345,19 @@ ] }, { - "id": "NestingDepth", + "id": "SynchronizedMethod", "shortDescription": { - "text": "Overly nested method" + "text": "'synchronized' method" }, "fullDescription": { - "text": "Reports methods whose body contain too deeply nested statements. Methods with too deep statement nesting may be confusing and are a good sign that refactoring may be necessary. Use the Nesting depth limit field to specify the maximum allowed nesting depth for a method.", - "markdown": "Reports methods whose body contain too deeply nested statements.\n\nMethods with too deep statement\nnesting may be confusing and are a good sign that refactoring may be necessary.\n\nUse the **Nesting depth limit** field to specify the maximum allowed nesting depth for a method." + "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": "OverlyNestedMethod", + "suppressToolId": "SynchronizedMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22464,8 +22365,8 @@ "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -22477,19 +22378,19 @@ ] }, { - "id": "RedundantExplicitChronoField", + "id": "AbstractMethodWithMissingImplementations", "shortDescription": { - "text": "Calls of 'java.time' methods with explicit 'ChronoField' or 'ChronoUnit' arguments can be simplified" + "text": "Abstract method with missing implementations" }, "fullDescription": { - "text": "Reports 'java.time' method calls with 'java.time.temporal.ChronoField' and 'java.time.temporal.ChronoUnit' as arguments when these calls can be replaced with calls of more specific methods. Example: 'LocalTime localTime = LocalTime.now();\nint minute = localTime.get(ChronoField.MINUTE_OF_HOUR);' After the quick-fix is applied: 'LocalTime localTime = LocalTime.now();\nint minute = localTime.getMinute();' New in 2023.2", - "markdown": "Reports `java.time` method calls with `java.time.temporal.ChronoField` and `java.time.temporal.ChronoUnit` as arguments when these calls can be replaced with calls of more specific methods.\n\nExample:\n\n\n LocalTime localTime = LocalTime.now();\n int minute = localTime.get(ChronoField.MINUTE_OF_HOUR);\n\nAfter the quick-fix is applied:\n\n\n LocalTime localTime = LocalTime.now();\n int minute = localTime.getMinute();\n\nNew in 2023.2" - }, + "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": "RedundantExplicitChronoField", + "suppressToolId": "AbstractMethodWithMissingImplementations", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22497,8 +22398,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -22510,22 +22411,19 @@ ] }, { - "id": "WriteOnlyObject", + "id": "Convert2MethodRef", "shortDescription": { - "text": "Write-only object" + "text": "Lambda can be replaced with method reference" }, "fullDescription": { - "text": "Reports objects that are modified but never queried. The inspection relies on the method mutation contract, which could be inferred or pre-annotated for some library methods. This inspection does not report collections, maps, and string builders, as these types are reported by other more precise inspections. Example: 'AtomicReference ref = new AtomicReference<>();\n ref.set(\"hello\"); // ref is never used again' Use the Ignore impure constructors option to control whether to process objects created by constructor or method whose purity is not known. Unchecking the option may introduce some false-positives if the object reference is intentionally leaked during the construction. New in 2021.2", - "markdown": "Reports objects that are modified but never queried.\n\nThe inspection relies on the method mutation contract, which could be inferred\nor pre-annotated for some library methods. This inspection does not report collections, maps, and string builders, as these types\nare reported by other more precise inspections.\n\nExample:\n\n\n AtomicReference ref = new AtomicReference<>();\n ref.set(\"hello\"); // ref is never used again\n\n\nUse the **Ignore impure constructors** option to control whether to process objects created by constructor or method whose purity is not known.\nUnchecking the option may introduce some false-positives if the object reference is intentionally leaked during the construction.\n**New in 2021.2**" + "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 depends on the following Java features: Lambda expressions Method references These features are available since Java 8.", + "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 depends on the following Java features:\n\n* Lambda expressions\n* Method references\n\nThese features are available since Java 8." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "WriteOnlyObject", - "cweIds": [ - 563 - ], + "suppressToolId": "Convert2MethodRef", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22533,8 +22431,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -22546,19 +22444,19 @@ ] }, { - "id": "SocketResource", + "id": "ClassOnlyUsedInOnePackage", "shortDescription": { - "text": "Socket opened but not safely closed" + "text": "Class only used from one other package" }, "fullDescription": { - "text": "Reports socket resources that are not safely closed. Socket resources reported by this inspection include 'java.net.Socket', 'java.net.DatagramSocket', and 'java.net.ServerSocket'. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'byte[] getMessage(ServerSocket socket) throws IOException {\n Socket client = socket.accept(); //socket is not closed\n return client.getInputStream().readAllBytes();\n }' Use the following options to configure the inspection: Whether a socket 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 socket resources that are not safely closed. Socket resources reported by this inspection include `java.net.Socket`, `java.net.DatagramSocket`, and `java.net.ServerSocket`.\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 byte[] getMessage(ServerSocket socket) throws IOException {\n Socket client = socket.accept(); //socket is not closed\n return client.getInputStream().readAllBytes();\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a socket 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." + "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": "SocketOpenedButNotSafelyClosed", + "suppressToolId": "ClassOnlyUsedInOnePackage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22566,8 +22464,8 @@ "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Java/Packaging issues", + "index": 46, "toolComponent": { "name": "QDJVM" } @@ -22579,19 +22477,19 @@ ] }, { - "id": "TypeParameterHidesVisibleType", + "id": "SuppressionAnnotation", "shortDescription": { - "text": "Type parameter hides visible type" + "text": "Inspection suppression annotation" }, "fullDescription": { - "text": "Reports type parameters that have the same names as the visible types in the current scope. Such parameter names may be confusing. Example: 'abstract class MyList extends AbstractList {\n private List elements;\n // type parameter 'T' hides type parameter 'T'\n public T[] toArray(T[] array) {\n return elements.toArray(array);\n }\n}'", - "markdown": "Reports type parameters that have the same names as the visible types in the current scope. Such parameter names may be confusing.\n\nExample:\n\n\n abstract class MyList extends AbstractList {\n private List elements;\n // type parameter 'T' hides type parameter 'T'\n public T[] toArray(T[] array) {\n return elements.toArray(array);\n }\n }\n" + "text": "Reports comments or annotations suppressing inspections. This inspection can be useful when leaving suppressions intentionally for further review. Example: '@SuppressWarnings(\"unused\")\nstatic Stream 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 stringProvider() {\n return Stream.of(\"foo\", \"bar\");\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "TypeParameterHidesVisibleType", + "suppressToolId": "SuppressionAnnotation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22599,8 +22497,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -22612,19 +22510,19 @@ ] }, { - "id": "StringTokenizerDelimiter", + "id": "UnnecessaryToStringCall", "shortDescription": { - "text": "Duplicated delimiters in 'StringTokenizer'" + "text": "Unnecessary call to 'toString()'" }, "fullDescription": { - "text": "Reports 'StringTokenizer()' constructor calls or 'nextToken()' method calls that contain duplicate characters in the delimiter argument. Example: 'void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }' After the quick-fix is applied: 'void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }'", - "markdown": "Reports `StringTokenizer()` constructor calls or `nextToken()` method calls that contain duplicate characters in the delimiter argument.\n\n**Example:**\n\n\n void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }\n" + "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. Removing redundant 'toString()' calls can occasionally even improve performance and reduce object allocations. 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. Removing the explicit 'toString()' in these cases will change the runtime semantics from throwing a 'NullPointException' to silently accepting the value when it is '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,\nand the explicit call to `toString()` is not needed.\nRemoving redundant `toString()` calls can occasionally even improve performance and reduce object allocations.\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.\nRemoving the explicit `toString()` in these cases will change the runtime semantics\nfrom throwing a `NullPointException` to silently accepting the value when it is `null`." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StringTokenizerDelimiter", + "suppressToolId": "UnnecessaryToStringCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22632,8 +22530,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -22645,19 +22543,19 @@ ] }, { - "id": "MaskedAssertion", + "id": "SynchronizeOnNonFinalField", "shortDescription": { - "text": "Assertion is suppressed by 'catch'" + "text": "Synchronization on a non-final field" }, "fullDescription": { - "text": "Reports 'assert' statements and test framework assertions that are suppressed by a surrounding catch block. Such assertions will never fail, as the thrown 'AssertionError' will be caught and silently ignored. Example 1: 'void javaAssertion() {\n try {\n ...\n assert 1 == 2;\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }' Example 2: '@Test\n void testWithAssertJ() {\n try {\n ...\n assertThat(1).as(\"test\").isEqualTo(2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }' Example 3: '@Test\n void testWithJunit() {\n try {\n ...\n assertEquals(1, 2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }' New in 2020.3", - "markdown": "Reports `assert` statements and test framework assertions that are suppressed by a surrounding catch block. Such assertions will never fail, as the thrown `AssertionError` will be caught and silently ignored.\n\n**Example 1:**\n\n\n void javaAssertion() {\n try {\n ...\n assert 1 == 2;\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }\n\n**Example 2:**\n\n\n @Test\n void testWithAssertJ() {\n try {\n ...\n assertThat(1).as(\"test\").isEqualTo(2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }\n\n**Example 3:**\n\n\n @Test\n void testWithJunit() {\n try {\n ...\n assertEquals(1, 2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }\n\nNew in 2020.3" + "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": "MaskedAssertion", + "suppressToolId": "SynchronizeOnNonFinalField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22665,8 +22563,8 @@ "relationships": [ { "target": { - "id": "Java/Test frameworks", - "index": 130, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -22678,28 +22576,28 @@ ] }, { - "id": "ReflectionForUnavailableAnnotation", + "id": "ReturnSeparatedFromComputation", "shortDescription": { - "text": "Reflective access to a source-only annotation" + "text": "'return' separated from the result computation" }, "fullDescription": { - "text": "Reports attempts to reflectively check for the presence of a non-runtime annotation. Using 'Class.isAnnotationPresent()' to test for an annotation whose retention policy is set to 'SOURCE' or 'CLASS' (the default) will always have a negative result. This mistake is easy to overlook. Example: '{\n getClass().isAnnotationPresent(SourceAnnotation.class); //always false\n }\n\n @Retention(RetentionPolicy.SOURCE)\n @interface SourceAnnotation {}' This inspection depends on the Java feature 'Annotations', which is available since Java 5.", - "markdown": "Reports attempts to reflectively check for the presence of a non-runtime annotation.\n\nUsing `Class.isAnnotationPresent()` to test for an annotation\nwhose retention policy is set to `SOURCE` or `CLASS`\n(the default) will always have a negative result. This mistake is easy to overlook.\n\n**Example:**\n\n\n {\n getClass().isAnnotationPresent(SourceAnnotation.class); //always false\n }\n\n @Retention(RetentionPolicy.SOURCE)\n @interface SourceAnnotation {}\n\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." + "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": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ReflectionForUnavailableAnnotation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReturnSeparatedFromComputation", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -22711,19 +22609,22 @@ ] }, { - "id": "InstantiatingObjectToGetClassObject", + "id": "ArrayObjectsEquals", "shortDescription": { - "text": "Instantiating object to get 'Class' object" + "text": "Use of shallow or 'Objects' methods with arrays" }, "fullDescription": { - "text": "Reports code that instantiates a class to get its class object. It is more performant to access the class object directly by name. Example: 'Class c = new Sample().getClass();' After the quick-fix is applied: 'Class c = Sample.class;'", - "markdown": "Reports code that instantiates a class to get its class object.\n\nIt is more performant to access the class object\ndirectly by name.\n\n**Example:**\n\n\n Class c = new Sample().getClass();\n\nAfter the quick-fix is applied:\n\n\n Class c = Sample.class;\n" + "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": "InstantiatingObjectToGetClassObject", + "suppressToolId": "ArrayObjectsEquals", + "cweIds": [ + 480 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22731,8 +22632,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -22744,19 +22645,22 @@ ] }, { - "id": "ClassWithMultipleLoggers", + "id": "EqualsWhichDoesntCheckParameterClass", "shortDescription": { - "text": "Class with multiple loggers" + "text": "'equals()' method which does not check class of parameter" }, "fullDescription": { - "text": "Reports classes that have multiple loggers declared. Ensuring that every class has a single dedicated logger is an important step in providing a unified logging implementation for an application. For example: 'public class Critical {\n protected static final Logger LOG = Logger.getLogger(Critical.class);\n\n protected static final Logger myLogger = Logger.getLogger(getClass());\n }' Use the table below to specify Logger class names. Classes which declare multiple fields that have the type of one of the specified classes will be reported by this inspection.", - "markdown": "Reports classes that have multiple loggers declared. Ensuring that every class has a single dedicated logger is an important step in providing a unified logging implementation for an application.\n\nFor example:\n\n\n public class Critical {\n protected static final Logger LOG = Logger.getLogger(Critical.class);\n\n protected static final Logger myLogger = Logger.getLogger(getClass());\n }\n\n\nUse the table below to specify Logger class names.\nClasses which declare multiple fields that have the type of one of the specified classes will be reported by this inspection." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ClassWithMultipleLoggers", + "suppressToolId": "EqualsWhichDoesntCheckParameterClass", + "cweIds": [ + 697 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22764,8 +22668,8 @@ "relationships": [ { "target": { - "id": "Java/Logging", - "index": 119, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -22777,19 +22681,19 @@ ] }, { - "id": "ShiftOutOfRange", + "id": "UseHashCodeMethodInspection", "shortDescription": { - "text": "Shift operation by inappropriate constant" + "text": "Standard 'hashCode()' method can be used" }, "fullDescription": { - "text": "Reports shift operations where the shift value is a constant outside the reasonable range. Integer shift operations outside the range '0..31' and long shift operations outside the range '0..63' are reported. Shifting by negative or overly large values is almost certainly a coding error. Example: 'int shiftSize = 32;\n // Warning: shift by 32 bits is equivalent to shift by 0 bits, so there's no shift at all.\n int mask = (1 << shiftSize) - 1;'", - "markdown": "Reports shift operations where the shift value is a constant outside the reasonable range.\n\nInteger shift operations outside the range `0..31` and long shift operations outside the\nrange `0..63` are reported. Shifting by negative or overly large values is almost certainly\na coding error.\n\n**Example:**\n\n\n int shiftSize = 32;\n // Warning: shift by 32 bits is equivalent to shift by 0 bits, so there's no shift at all.\n int mask = (1 << shiftSize) - 1;\n" + "text": "Reports bitwise operations that can be replaced with a call to the 'Long.hashCode()' or 'Double.hashCode()' methods. It detects the construct '(int)(x ^ (x >>> 32))' where 'x' is a variable of type 'long' or the result of a previous 'Double.doubleToLongBits()' call. The replacement shortens the code, improving its readability. Example: 'int result = (int)(var ^ (var >>> 32));' After applying the quick-fix: 'int result = Long.hashCode(var);' This inspection only reports if the language level of the project or module is 8 or higher. New in 2024.1", + "markdown": "Reports bitwise operations that can be replaced with a call to the `Long.hashCode()` or `Double.hashCode()` methods. It detects the construct `(int)(x ^ (x >>> 32))` where `x` is a variable of type `long` or the result of a previous `Double.doubleToLongBits()` call. The replacement shortens the code, improving its readability.\n\n**Example:**\n\n\n int result = (int)(var ^ (var >>> 32));\n\nAfter applying the quick-fix:\n\n\n int result = Long.hashCode(var);\n\nThis inspection only reports if the language level of the project or module is 8 or higher.\n\nNew in 2024.1" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ShiftOutOfRange", + "suppressToolId": "UseHashCodeMethodInspection", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22797,8 +22701,8 @@ "relationships": [ { "target": { - "id": "Java/Bitwise operation issues", - "index": 199, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -22810,19 +22714,19 @@ ] }, { - "id": "ThreadRun", + "id": "NumericOverflow", "shortDescription": { - "text": "Call to 'Thread.run()'" + "text": "Numeric overflow" }, "fullDescription": { - "text": "Reports calls to 'run()' on 'java.lang.Thread' or any of its subclasses. While occasionally intended, this is usually a mistake, because 'run()' doesn't start a new thread. To execute the code in a separate thread, 'start()' should be used.", - "markdown": "Reports calls to `run()` on `java.lang.Thread` or any of its subclasses.\n\n\nWhile occasionally intended, this is usually a mistake, because `run()` doesn't start a new thread.\nTo execute the code in a separate thread, `start()` should be used." + "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": "CallToThreadRun", + "suppressToolId": "NumericOverflow", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22830,8 +22734,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -22843,19 +22747,19 @@ ] }, { - "id": "ExtendsThrowable", + "id": "AssignmentToSuperclassField", "shortDescription": { - "text": "Class directly extends 'Throwable'" + "text": "Constructor assigns value to field defined in superclass" }, "fullDescription": { - "text": "Reports classes that directly extend 'java.lang.Throwable'. Extending 'java.lang.Throwable' directly is generally considered bad practice. It is usually enough to extend 'java.lang.RuntimeException', 'java.lang.Exception', or - in special cases - 'java.lang.Error'. Example: 'class EnigmaThrowable extends Throwable {} // warning: Class 'EnigmaThrowable' directly extends 'java.lang.Throwable''", - "markdown": "Reports classes that directly extend `java.lang.Throwable`.\n\nExtending `java.lang.Throwable` directly is generally considered bad practice.\nIt is usually enough to extend `java.lang.RuntimeException`, `java.lang.Exception`, or - in special\ncases - `java.lang.Error`.\n\n**Example:**\n\n\n class EnigmaThrowable extends Throwable {} // warning: Class 'EnigmaThrowable' directly extends 'java.lang.Throwable'\n" + "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": "ExtendsThrowable", + "suppressToolId": "AssignmentToSuperclassField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22863,8 +22767,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -22876,19 +22780,22 @@ ] }, { - "id": "AutoBoxing", + "id": "SuspiciousIndentAfterControlStatement", "shortDescription": { - "text": "Auto-boxing" + "text": "Suspicious indentation after control statement without braces" }, "fullDescription": { - "text": "Reports expressions that are affected by autoboxing conversion (automatic wrapping of primitive values as objects). Try not to use objects instead of primitives. It might significantly affect performance. Example: 'Integer x = 42;' The quick-fix makes the conversion explicit: 'Integer x = Integer.valueOf(42);' AutoBoxing appeared in Java 5. This inspection can help to downgrade for backward compatibility with earlier Java versions.", - "markdown": "Reports expressions that are affected by autoboxing conversion (automatic wrapping of primitive values as objects). Try not to use objects instead of primitives. It might significantly affect performance.\n\n**Example:**\n\n Integer x = 42;\n\nThe quick-fix makes the conversion explicit:\n\n Integer x = Integer.valueOf(42);\n\n\n*AutoBoxing* appeared in Java 5.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AutoBoxing", + "suppressToolId": "SuspiciousIndentAfterControlStatement", + "cweIds": [ + 483 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22896,8 +22803,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -22909,19 +22816,19 @@ ] }, { - "id": "InterfaceNeverImplemented", + "id": "ClassNewInstance", "shortDescription": { - "text": "Interface which has no concrete subclass" + "text": "Unsafe call to 'Class.newInstance()'" }, "fullDescription": { - "text": "Reports interfaces that have no concrete subclasses. Configure the inspection: Use the list below to add annotations. Interfaces declared with one of these annotations will be ignored by the inspection. Use the checkbox below to ignore interfaces that only declare constant fields. Such interfaces may still be usable even without implementations.", - "markdown": "Reports interfaces that have no concrete subclasses.\n\nConfigure the inspection:\n\n* Use the list below to add annotations. Interfaces declared with one of these annotations will be ignored by the inspection.\n* Use the checkbox below to ignore interfaces that only declare constant fields. Such interfaces may still be usable even without implementations." + "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": "InterfaceNeverImplemented", + "suppressToolId": "ClassNewInstance", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22929,8 +22836,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -22942,28 +22849,28 @@ ] }, { - "id": "ThreadDeathRethrown", + "id": "LimitedScopeInnerClass", "shortDescription": { - "text": "'ThreadDeath' not rethrown" + "text": "Local class" }, "fullDescription": { - "text": "Reports 'try' statements that catch 'java.lang.ThreadDeath' and do not rethrow the exception. Example: 'try {\n executeInParallel(request);\n } catch (ThreadDeath ex) { // warning: ThreadDeath 'ex' not rethrown\n return false;\n }'", - "markdown": "Reports `try` statements that catch `java.lang.ThreadDeath` and do not rethrow the exception.\n\n**Example:**\n\n\n try {\n executeInParallel(request);\n } catch (ThreadDeath ex) { // warning: ThreadDeath 'ex' not rethrown\n return false;\n }\n" + "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: 'class Example {\n void test() {\n class Local { // here\n }\n new Local();\n }\n }' After the quick-fix is applied: 'class Example {\n void test() {\n new Local();\n }\n\n private static class Local { // here\n }\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 class Example {\n void test() {\n class Local { // here\n }\n new Local();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n void test() {\n new Local();\n }\n\n private static class Local { // here\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ThreadDeathNotRethrown", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LimitedScopeInnerClass", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -22975,19 +22882,19 @@ ] }, { - "id": "CloneCallsConstructors", + "id": "MultiplyOrDivideByPowerOfTwo", "shortDescription": { - "text": "'clone()' instantiates objects with constructor" + "text": "Multiplication or division by power of two" }, "fullDescription": { - "text": "Reports calls to object constructors inside 'clone()' methods. It is considered good practice to call 'clone()' to instantiate objects inside of a 'clone()' method instead of creating them directly to support later subclassing. This inspection will not report 'clone()' methods declared as 'final' or 'clone()' methods on 'final' classes.", - "markdown": "Reports calls to object constructors inside `clone()` methods.\n\nIt is considered good practice to call `clone()` to instantiate objects inside of a `clone()` method\ninstead of creating them directly to support later subclassing.\nThis inspection will not report\n`clone()` methods declared as `final`\nor `clone()` methods on `final` classes." + "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": "CloneCallsConstructors", + "suppressToolId": "MultiplyOrDivideByPowerOfTwo", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -22995,8 +22902,8 @@ "relationships": [ { "target": { - "id": "Java/Cloning issues", - "index": 116, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -23008,19 +22915,19 @@ ] }, { - "id": "UnnecessaryModuleDependencyInspection", + "id": "MethodCallInLoopCondition", "shortDescription": { - "text": "Unnecessary module dependency" + "text": "Method call in loop condition" }, "fullDescription": { - "text": "Reports dependencies on modules that are not used. The quick-fix safely removes such unused dependencies.", - "markdown": "Reports dependencies on modules that are not used. The quick-fix safely removes such unused dependencies." + "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": "UnnecessaryModuleDependencyInspection", + "suppressToolId": "MethodCallInLoopCondition", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23028,8 +22935,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -23041,19 +22948,19 @@ ] }, { - "id": "ArraysAsListWithZeroOrOneArgument", + "id": "ForLoopReplaceableByWhile", "shortDescription": { - "text": "Call to 'Arrays.asList()' with too few arguments" + "text": "'for' loop may be replaced by 'while' loop" }, "fullDescription": { - "text": "Reports calls to 'Arrays.asList()' with at most one argument. Such calls could be replaced with 'Collections.singletonList()', 'Collections.emptyList()', or 'List.of()' on JDK 9 and later, which will save some memory. In particular, 'Collections.emptyList()' and 'List.of()' with no arguments always return a shared instance, while 'Arrays.asList()' with no arguments creates a new object every time it's called. Note: the lists returned by 'Collections.singletonList()' and 'List.of()' are immutable, while the list returned 'Arrays.asList()' allows calling the 'set()' method. This may break the code in rare cases. Example: 'List empty = Arrays.asList();\n List one = Arrays.asList(\"one\");' After the quick-fix is applied: 'List empty = Collections.emptyList();\n List one = Collections.singletonList(\"one\");'", - "markdown": "Reports calls to `Arrays.asList()` with at most one argument.\n\n\nSuch calls could be replaced\nwith `Collections.singletonList()`, `Collections.emptyList()`,\nor `List.of()` on JDK 9 and later, which will save some memory.\n\nIn particular, `Collections.emptyList()` and `List.of()` with no arguments\nalways return a shared instance,\nwhile `Arrays.asList()` with no arguments creates a new object every time it's called.\n\nNote: the lists returned by `Collections.singletonList()` and `List.of()` are immutable,\nwhile the list returned `Arrays.asList()` allows calling the `set()` method.\nThis may break the code in rare cases.\n\n**Example:**\n\n\n List empty = Arrays.asList();\n List one = Arrays.asList(\"one\");\n\nAfter the quick-fix is applied:\n\n\n List empty = Collections.emptyList();\n List one = Collections.singletonList(\"one\");\n" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "ArraysAsListWithZeroOrOneArgument", + "suppressToolId": "ForLoopReplaceableByWhile", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23061,8 +22968,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -23074,19 +22981,19 @@ ] }, { - "id": "UnstableApiUsage", + "id": "MethodCount", "shortDescription": { - "text": "Unstable API Usage" + "text": "Class with too many methods" }, "fullDescription": { - "text": "Reports usages of an API marked with one of the annotations as unstable. Such an API may be changed or removed in future versions, breaking the code that uses it. The annotations which are used to mark unstable APIs are shown in the list below. By default, the inspection ignores usages of unstable APIs if their declarations are located in sources of the same project. In such cases it'll be possible to update the usages when you change APIs. However, it may be inconvenient if the project is big, so one can switch off the Ignore API declared in this project option to report the usages of unstable APIs declared in both the project sources and libraries.", - "markdown": "Reports usages of an API marked with one of the annotations as unstable. Such an API may be changed or removed in future versions, breaking the code that uses it.\n\nThe annotations which are used to mark unstable APIs are shown in the list below.\n\nBy default, the inspection ignores usages of unstable APIs\nif their declarations are located in sources of the same project. In such cases it'll be possible to update the usages when you change APIs.\nHowever, it may be inconvenient if the project is big, so one can switch off the **Ignore API declared in this project** option to report\nthe usages of unstable APIs declared in both the project sources and libraries." + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnstableApiUsage", + "suppressToolId": "ClassWithTooManyMethods", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23094,8 +23001,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -23107,19 +23014,19 @@ ] }, { - "id": "LambdaUnfriendlyMethodOverload", + "id": "StaticFieldReferenceOnSubclass", "shortDescription": { - "text": "Lambda-unfriendly method overload" + "text": "Static field referenced via subclass" }, "fullDescription": { - "text": "Reports overloaded methods that take functional interfaces with conflicting abstract method signatures. Such overloads introduce ambiguity and require callers to cast lambdas to a specific type or specify lambda parameter types explicitly. It is preferable to give the overloaded methods different names to eliminate ambiguity. Example: 'interface MyExecutor {\n void execute(Supplier supplier);\n void execute(Callable callable);\n }' Here, 'Supplier' and 'Callable' are functional interfaces whose single abstract methods do not take any parameters and return a non-void value. As a result, the type of the lambda cannot be inferred at the call site unless an explicit cast is used.", - "markdown": "Reports overloaded methods that take functional interfaces with conflicting abstract method signatures.\n\nSuch overloads introduce ambiguity and require callers to cast lambdas to a specific type or specify lambda parameter types explicitly.\nIt is preferable to give the overloaded methods different names to eliminate ambiguity.\n\nExample:\n\n\n interface MyExecutor {\n void execute(Supplier supplier);\n void execute(Callable callable);\n }\n\n\nHere, `Supplier` and `Callable` are functional interfaces\nwhose single abstract methods do not take any parameters and return a non-void value.\nAs a result, the type of the lambda cannot be inferred at the call site unless an explicit cast is used." + "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": "LambdaUnfriendlyMethodOverload", + "suppressToolId": "StaticFieldReferencedViaSubclass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23127,8 +23034,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -23140,19 +23047,19 @@ ] }, { - "id": "SerializableRecordContainsIgnoredMembers", + "id": "BlockingMethodInNonBlockingContext", "shortDescription": { - "text": "'record' contains ignored members" + "text": "Possibly blocking call in non-blocking context" }, "fullDescription": { - "text": "Reports serialization methods or fields defined in a 'record' class. Serialization methods include 'writeObject()', 'readObject()', 'readObjectNoData()', 'writeExternal()', and 'readExternal()' and the field 'serialPersistentFields'. These members are not used for the serialization or deserialization of records and therefore unnecessary. Examples: 'record R1() implements Serializable {\n // The field is ignored during record serialization\n @Serial\n private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];\n\n // The method is ignored during record serialization\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }' 'record R2() implements Externalizable {\n // The method is ignored during record serialization\n @Override\n public void writeExternal(ObjectOutput out) throws IOException {\n }\n\n // The method is ignored during record serialization\n @Override\n public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {\n }\n }' This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.3", - "markdown": "Reports serialization methods or fields defined in a `record` class. Serialization methods include `writeObject()`, `readObject()`, `readObjectNoData()`, `writeExternal()`, and `readExternal()` and the field `serialPersistentFields`. These members are not used for the serialization or deserialization of records and therefore unnecessary.\n\n**Examples:**\n\n\n record R1() implements Serializable {\n // The field is ignored during record serialization\n @Serial\n private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];\n\n // The method is ignored during record serialization\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\n\n record R2() implements Externalizable {\n // The method is ignored during record serialization\n @Override\n public void writeExternal(ObjectOutput out) throws IOException {\n }\n\n // The method is ignored during record serialization\n @Override\n public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {\n }\n }\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.3" + "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 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 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": "SerializableRecordContainsIgnoredMembers", + "suppressToolId": "BlockingMethodInNonBlockingContext", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23160,8 +23067,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -23173,28 +23080,32 @@ ] }, { - "id": "UnnecessarilyQualifiedInnerClassAccess", + "id": "IgnoreResultOfCall", "shortDescription": { - "text": "Unnecessarily qualified inner class access" + "text": "Result of method call ignored" }, "fullDescription": { - "text": "Reports any references to inner classes that are unnecessarily qualified with the name of the enclosing class. Such a qualification can be safely removed, which sometimes adds an import for the inner class. Example: 'class X {\n X.Y foo;\n class Y{}\n }' After the quick-fix is applied: 'class X {\n Y foo;\n class Y{}\n }' Use the Ignore references for which an import is needed option to ignore references to inner classes, where removing the qualification adds an import.", - "markdown": "Reports any references to inner classes that are unnecessarily qualified with the name of the enclosing class.\n\nSuch a qualification can be safely removed, which sometimes adds an import for the inner class.\n\nExample:\n\n\n class X {\n X.Y foo;\n class Y{}\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n Y foo;\n class Y{}\n }\n\nUse the **Ignore references for which an import is needed** option to ignore references to inner classes, where\nremoving the qualification adds an import." + "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": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "UnnecessarilyQualifiedInnerClassAccess", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ResultOfMethodCallIgnored", + "cweIds": [ + 252, + 563 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -23206,19 +23117,19 @@ ] }, { - "id": "JavadocLinkAsPlainText", + "id": "AssertBetweenInconvertibleTypes", "shortDescription": { - "text": "Link specified as plain text" + "text": "'assertEquals()' between objects of inconvertible types" }, "fullDescription": { - "text": "Reports plain text links in Javadoc comments. The quick-fix suggests to wrap the link in an '' tag. Example: 'class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }' After the quick-fix is applied: 'class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }' New in 2022.1", - "markdown": "Reports plain text links in Javadoc comments.\n\n\nThe quick-fix suggests to wrap the link in an `` tag.\n\n**Example:**\n\n\n class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }\n\nNew in 2022.1" + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "JavadocLinkAsPlainText", + "suppressToolId": "AssertBetweenInconvertibleTypes", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23226,8 +23137,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "JVM languages/Test frameworks", + "index": 123, "toolComponent": { "name": "QDJVM" } @@ -23239,28 +23150,28 @@ ] }, { - "id": "SharedThreadLocalRandom", + "id": "SwitchExpressionCanBePushedDown", "shortDescription": { - "text": "'ThreadLocalRandom' instance might be shared" + "text": "Common subexpression can be extracted from 'switch'" }, "fullDescription": { - "text": "Reports 'java.util.concurrent.ThreadLocalRandom' instances which might be shared between threads. A 'ThreadLocalRandom' should not be shared between threads because that is not thread-safe. The inspection reports instances that are assigned to a field used as a method argument, or assigned to a local variable and used in anonymous or nested classes as they might get shared between threads. Usages of 'ThreadLocalRandom' should typically look like 'ThreadLocalRandom.current().nextInt(...)' (or 'nextDouble(...)' etc.). When all usages are in this form, 'ThreadLocalRandom' instances cannot be used accidentally by multiple threads. Example: 'class Main {\n void printRandomNumbersAsync() {\n ThreadLocalRandom random = ThreadLocalRandom.current();\n CompletableFuture.supplyAsync(() -> generateNumbers(random))\n .thenAccept(numbers -> System.out.println(Arrays.toString(numbers)));\n }\n\n private int[] generateNumbers(Random random) {\n return random.ints(1000, 0, 100).toArray();\n }\n }' Use the options to list methods that are safe to be passed to 'ThreadLocalRandom' instances as an argument. It's possible to use regular expressions for method names.", - "markdown": "Reports `java.util.concurrent.ThreadLocalRandom` instances which might be shared between threads.\n\n\nA `ThreadLocalRandom` should not be shared between threads because that is not thread-safe.\nThe inspection reports instances that are assigned to a field used as a method argument,\nor assigned to a local variable and used in anonymous or nested classes as they might get shared between threads.\n\n\nUsages of `ThreadLocalRandom` should typically look like `ThreadLocalRandom.current().nextInt(...)`\n(or `nextDouble(...)` etc.).\nWhen all usages are in this form, `ThreadLocalRandom` instances cannot be used accidentally by multiple threads.\n\n**Example:**\n\n\n class Main {\n void printRandomNumbersAsync() {\n ThreadLocalRandom random = ThreadLocalRandom.current();\n CompletableFuture.supplyAsync(() -> generateNumbers(random))\n .thenAccept(numbers -> System.out.println(Arrays.toString(numbers)));\n }\n\n private int[] generateNumbers(Random random) {\n return random.ints(1000, 0, 100).toArray();\n }\n }\n \n\nUse the options to list methods that are safe to be passed to `ThreadLocalRandom` instances as an argument.\nIt's possible to use regular expressions for method names." + "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. This inspection depends on the Java feature ''switch' expressions', which is available since Java 14. 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\nThis inspection depends on the Java feature ''switch' expressions', which is available since Java 14.\n\nNew in 2022.3" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SharedThreadLocalRandom", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "SwitchExpressionCanBePushedDown", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -23272,28 +23183,28 @@ ] }, { - "id": "WhileCanBeDoWhile", + "id": "ConfusingElse", "shortDescription": { - "text": "'while' can be replaced with 'do while'" + "text": "Redundant 'else'" }, "fullDescription": { - "text": "Reports 'while' loops that could be more effectively written as 'do-while' loops. There are 'while' loops where the code just before the loop is identical to the code in the body of the loop. Replacing with a 'do-while' loop removes the duplicated code. For 'while' loops without such duplicated code, the quick fix is offered in the editor as well, but without highlighting. Example: 'foo();\n while (x) {\n foo();\n }' Can be replaced with: 'do {\n foo();\n } while (x);' New in 2024.1", - "markdown": "Reports `while` loops that could be more effectively written as `do-while` loops.\nThere are `while` loops where the code just before the loop is identical to the code in the body of the loop.\nReplacing with a `do-while` loop removes the duplicated code.\nFor `while` loops without such duplicated code, the quick fix is offered in the editor as well, but without highlighting.\n\n**Example:**\n\n\n foo();\n while (x) {\n foo();\n }\n\nCan be replaced with:\n\n\n do {\n foo();\n } while (x);\n\n\nNew in 2024.1" + "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, + "enabled": false, "level": "note", "parameters": { - "suppressToolId": "WhileCanBeDoWhile", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConfusingElseBranch", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { "id": "Java/Control flow issues", - "index": 30, + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -23305,19 +23216,19 @@ ] }, { - "id": "AbstractMethodOverridesConcreteMethod", + "id": "InnerClassReferencedViaSubclass", "shortDescription": { - "text": "Abstract method overrides concrete method" + "text": "Inner class referenced via subclass" }, "fullDescription": { - "text": "Reports 'abstract' methods that override concrete super methods. Methods overridden from 'java.lang.Object' are not reported by this inspection.", - "markdown": "Reports `abstract` methods that override concrete super methods.\n\nMethods overridden from `java.lang.Object` are not reported by this inspection." + "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": "AbstractMethodOverridesConcreteMethod", + "suppressToolId": "InnerClassReferencedViaSubclass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23325,8 +23236,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -23338,19 +23249,19 @@ ] }, { - "id": "CodeBlock2Expr", + "id": "ChannelResource", "shortDescription": { - "text": "Statement lambda can be replaced with expression lambda" + "text": "'Channel' opened but not safely closed" }, "fullDescription": { - "text": "Reports lambda expressions with code block bodies when expression-style bodies can be used instead. The result of the conversion is shorter and more clear. Example: 'Comparable c = o -> {return 0;};' After the quick-fix is applied: 'Comparable c = o -> 0;' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "markdown": "Reports lambda expressions with code block bodies when expression-style bodies can be used instead. The result of the conversion is shorter and more clear.\n\nExample:\n\n\n Comparable c = o -> {return 0;};\n\nAfter the quick-fix is applied:\n\n\n Comparable c = o -> 0;\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "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": "CodeBlock2Expr", + "suppressToolId": "ChannelOpenedButNotSafelyClosed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23358,8 +23269,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -23371,28 +23282,28 @@ ] }, { - "id": "SimplifyForEach", + "id": "ScheduledThreadPoolExecutorWithZeroCoreThreads", "shortDescription": { - "text": "Simplifiable forEach() call" + "text": "'ScheduledThreadPoolExecutor' with zero core threads" }, "fullDescription": { - "text": "Reports 'forEach()' calls that can be replaced with a more concise method or from which intermediate steps can be extracted. Example: 'List findNStrings(List list, int n) {\n List other = new ArrayList<>();\n list.forEach(s -> {\n if(s.length() > n) other.add(s);\n });\n return other;\n }' After the quick-fix is applied: 'List findNStrings(List list, int n) {\n List other = list.stream()\n .filter(s -> s.length() > n)\n .collect(Collectors.toList());\n return other;\n }' This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8. New in 2017.3", - "markdown": "Reports `forEach()` calls that can be replaced with a more concise method or from which intermediate steps can be extracted.\n\n**Example:**\n\n\n List findNStrings(List list, int n) {\n List other = new ArrayList<>();\n list.forEach(s -> {\n if(s.length() > n) other.add(s);\n });\n return other;\n }\n\nAfter the quick-fix is applied:\n\n\n List findNStrings(List list, int n) {\n List other = list.stream()\n .filter(s -> s.length() > n)\n .collect(Collectors.toList());\n return other;\n }\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.\n\nNew in 2017.3" + "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": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "SimplifyForEach", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ScheduledThreadPoolExecutorWithZeroCoreThreads", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -23404,28 +23315,28 @@ ] }, { - "id": "Since15", + "id": "JavaEmptyModuleInfoFile", "shortDescription": { - "text": "Usages of API which isn't available at the configured language level" + "text": "Empty 'module-info.java' file" }, "fullDescription": { - "text": "Reports usages of the API that is unavailable at the configured language level. This inspection does 3 things: Highlight usage of generified classes when the language level is below Java 7. Highlight when default methods are not overridden and the language level is below Java 8. Highlight usage of API when the language level is lower than marked using the '@since' tag in the documentation. Use the Forbid API usages option to forbid usages of the API in respect to the project or custom language level.", - "markdown": "Reports usages of the API that is unavailable at the configured language level. This inspection does 3 things:\n\n* Highlight usage of generified classes when the language level is below Java 7.\n* Highlight when default methods are not overridden and the language level is below Java 8.\n* Highlight usage of API when the language level is lower than marked using the `@since` tag in the documentation.\n\n\nUse the **Forbid API usages** option to forbid usages of the API in respect to the project or custom language level." + "text": "Reports an empty 'module-info.java' file, indicating unresolved module dependencies. Automatically adds necessary 'requires' statements by inspecting imports. To suppress this warning, you may write any comment inside the module statement body, like this: 'module module.name {\n // no dependencies\n}' Quick Fix: Fill in module dependencies fills in missing 'requires' based on source code imports. New in 2024.1", + "markdown": "Reports an empty `module-info.java` file, indicating unresolved module dependencies. Automatically adds necessary `requires` statements by inspecting imports. To suppress this warning, you may write any comment inside the module statement body, like this:\n\n\n module module.name {\n // no dependencies\n }\n\n**Quick Fix:** *Fill in module dependencies* fills in missing `requires` based on source code imports. New in 2024.1" }, "defaultConfiguration": { - "enabled": false, - "level": "error", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "Since15", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "JavaEmptyModuleInfoFile", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -23437,28 +23348,28 @@ ] }, { - "id": "RedundantFieldInitialization", + "id": "ClassMayBeInterface", "shortDescription": { - "text": "Redundant field initialization" + "text": "Abstract 'class' may be 'interface'" }, "fullDescription": { - "text": "Reports fields explicitly initialized to their default values. Example: 'class Foo {\n int foo = 0;\n List bar = null;\n }' After the quick-fix is applied: 'class Foo {\n int foo;\n List bar;\n }' Use the inspection settings to only report explicit 'null' initialization, for example: 'class Foo {\n int foo = 0; // no warning\n List bar = null; // redundant field initialization warning\n }'", - "markdown": "Reports fields explicitly initialized to their default values.\n\n**Example:**\n\n\n class Foo {\n int foo = 0;\n List bar = null;\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n int foo;\n List bar;\n }\n\n\nUse the inspection settings to only report explicit `null` initialization, for example:\n\n\n class Foo {\n int foo = 0; // no warning\n List bar = null; // redundant field initialization warning\n }\n" + "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": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "RedundantFieldInitialization", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ClassMayBeInterface", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -23470,19 +23381,19 @@ ] }, { - "id": "ReadObjectInitialization", + "id": "UnnecessaryCallToStringValueOf", "shortDescription": { - "text": "Instance field may not be initialized by 'readObject()'" + "text": "Unnecessary conversion to 'String'" }, "fullDescription": { - "text": "Reports fields that are not guaranteed to be initialized after the object is deserialized by the 'readObject()' method. The inspection doesn't report transient fields. Note: This inspection uses a very conservative control flow algorithm, and may incorrectly report fields as uninitialized. Example: 'class DataObject implements Serializable {\n String s; // s is not initialized in readObject\n int i;\n\n private void readObject(ObjectInputStream stream) throws IOException {\n i = stream.readInt();\n }\n}'", - "markdown": "Reports fields that are not guaranteed to be initialized after the object is deserialized by the `readObject()` method.\n\nThe inspection doesn't report transient fields.\n\n\nNote: This inspection uses a very conservative control flow algorithm, and may incorrectly report fields\nas uninitialized.\n\n**Example:**\n\n\n class DataObject implements Serializable {\n String s; // s is not initialized in readObject\n int i;\n\n private void readObject(ObjectInputStream stream) throws IOException {\n i = stream.readInt();\n }\n }\n" + "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": false, "level": "warning", "parameters": { - "suppressToolId": "InstanceVariableMayNotBeInitializedByReadObject", + "suppressToolId": "UnnecessaryCallToStringValueOf", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23490,8 +23401,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -23503,19 +23414,19 @@ ] }, { - "id": "NonAtomicOperationOnVolatileField", + "id": "StringReplaceableByStringBuffer", "shortDescription": { - "text": "Non-atomic operation on 'volatile' field" + "text": "Non-constant 'String' can be replaced with 'StringBuilder'" }, "fullDescription": { - "text": "Reports non-atomic operations on volatile fields. An example of a non-atomic operation is updating the field using the increment operator. As the operation involves read and write, and other modifications may happen in between, data may become corrupted. The operation can be made atomic by surrounding it with a 'synchronized' block or using one of the classes from the 'java.util.concurrent.atomic' package. Example: 'private volatile int v = 1;\n\n void foo() {\n v = 2 * v;\n }'", - "markdown": "Reports non-atomic operations on volatile fields.\n\n\nAn example of a non-atomic operation is updating the field using the increment operator.\nAs the operation involves read and write, and other modifications may happen in between, data may become corrupted.\nThe operation can be made atomic by surrounding it with a `synchronized` block or\nusing one of the classes from the `java.util.concurrent.atomic` package.\n\n**Example:**\n\n\n private volatile int v = 1;\n\n void foo() {\n v = 2 * v;\n }\n" + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonAtomicOperationOnVolatileField", + "suppressToolId": "NonConstantStringShouldBeStringBuffer", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23523,8 +23434,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -23536,19 +23447,19 @@ ] }, { - "id": "QuestionableName", + "id": "FinallyBlockCannotCompleteNormally", "shortDescription": { - "text": "Questionable name" + "text": "'finally' block which can not complete normally" }, "fullDescription": { - "text": "Reports variables, methods, or classes with questionable, not really descriptive names. Such names do not help to understand the code, and most probably were created as a temporary thing but were forgotten afterwards. Example: 'int aa = 42;' Rename quick-fix is suggested only in the editor. Use the option to list names that should be reported.", - "markdown": "Reports variables, methods, or classes with questionable, not really descriptive names. Such names do not help to understand the code, and most probably were created as a temporary thing but were forgotten afterwards.\n\n**Example:**\n\n\n int aa = 42;\n\nRename quick-fix is suggested only in the editor.\n\n\nUse the option to list names that should be reported." + "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": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "QuestionableName", + "suppressToolId": "finally", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23556,8 +23467,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -23569,19 +23480,19 @@ ] }, { - "id": "UNCHECKED_WARNING", + "id": "ConstantOnWrongSideOfComparison", "shortDescription": { - "text": "Unchecked warning" + "text": "Constant on wrong side of comparison" }, "fullDescription": { - "text": "Reports code on which an unchecked warning will be issued by the javac compiler. Every unchecked warning may potentially trigger 'ClassCastException' at runtime. Example: 'List items = Arrays.asList(\"string\", \"string\");\n List numbers = Collections.unmodifiableList(items); // unchecked assignment'", - "markdown": "Reports code on which an unchecked warning will be issued by the javac compiler. Every unchecked warning may potentially trigger `ClassCastException` at runtime.\n\nExample:\n\n\n List items = Arrays.asList(\"string\", \"string\");\n List numbers = Collections.unmodifiableList(items); // unchecked assignment\n" + "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": "unchecked", + "suppressToolId": "ConstantOnWrongSideOfComparison", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23589,8 +23500,8 @@ "relationships": [ { "target": { - "id": "Java/Compiler issues", - "index": 162, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -23602,19 +23513,19 @@ ] }, { - "id": "RedundantLengthCheck", + "id": "UnnecessarilyQualifiedStaticallyImportedElement", "shortDescription": { - "text": "Redundant array length check" + "text": "Unnecessarily qualified statically imported element" }, "fullDescription": { - "text": "Reports unnecessary array length checks followed by array iteration. When array length is zero, the iteration will be skipped anyway, so there's no need to check length explicitly. Example: 'void f(String[] array) {\n if (array.length != 0) { // unnecessary check\n for (String str : array) {\n System.out.println(str);\n }\n }\n }' A quick-fix is suggested to unwrap or remove the length check: 'void f(String[] array) {\n for (String str : array) {\n System.out.println(str);\n }\n }' New in 2022.3", - "markdown": "Reports unnecessary array length checks followed by array iteration. When array length is zero, the iteration will be skipped anyway, so there's no need to check length explicitly.\n\nExample:\n\n\n void f(String[] array) {\n if (array.length != 0) { // unnecessary check\n for (String str : array) {\n System.out.println(str);\n }\n }\n }\n\nA quick-fix is suggested to unwrap or remove the length check:\n\n\n void f(String[] array) {\n for (String str : array) {\n System.out.println(str);\n }\n }\n\nNew in 2022.3" + "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": "RedundantLengthCheck", + "suppressToolId": "UnnecessarilyQualifiedStaticallyImportedElement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23622,8 +23533,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -23635,30 +23546,19 @@ ] }, { - "id": "DataFlowIssue", + "id": "ObjectToString", "shortDescription": { - "text": "Nullability and data flow problems" + "text": "Call to default 'toString()'" }, "fullDescription": { - "text": "Reports code constructs that always violate nullability contracts, may throw exceptions, or are just redundant, based on data flow analysis. Examples: 'if (array.length < index) {\n System.out.println(array[index]);\n} // Array index is always out of bounds\n\nif (str == null) System.out.println(\"str is null\");\nSystem.out.println(str.trim());\n// the last statement may throw an NPE\n\n@NotNull\nInteger square(@Nullable Integer input) {\n // the method contract is violated\n return input == null ? null : input * input;\n}' The inspection behavior may be controlled by a number of annotations, such as nullability annotations, '@Contract' annotation, '@Range' annotation and so on. Configure the inspection: Use the Suggest @Nullable annotation for methods/fields/parameters where nullable values are used option to warn when a nullable value is passed as an argument to a method with a non-annotated parameter, stored into non-annotated field, or returned from a non-annotated method. In this case, the inspection will suggest propagating the '@Nullable' annotation. You can also configure nullability annotations using the Configure Annotations button. Use the Treat non-annotated members and parameters as @Nullable option to assume that non-annotated members can be null, so they must not be used in non-null context. Use the Report not-null required parameter with null-literal argument usages option to report method parameters that cannot be null (e.g. immediately dereferenced in the method body), but there are call sites where a 'null' literal is passed. Use the Report nullable methods that always return a non-null value option to report methods that are annotated as '@Nullable', but always return non-null value. In this case, it's suggested that you change the annotation to '@NotNull'. Use the Ignore assert statements option to control how the inspection treats 'assert' statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode). Use the Report problems that happen only on some code paths option to control whether to report problems that may happen only on some code path. If this option is disabled, warnings like exception is possible will not be reported. The inspection will report only warnings like exception will definitely occur. This mode may greatly reduce the number of false-positives, especially if the code is not consistently annotated with nullability and contract annotations. That is why it can be useful for finding the most important problems in legacy code bases. Before IntelliJ IDEA 2022.3, this inspection was part of the \"Constant Conditions & Exceptions\" inspection. Now, it is split into two inspections: \"Constant Values\" and \"Nullability and data flow problems\".", - "markdown": "Reports code constructs that always violate nullability contracts, may throw exceptions, or are just redundant, based on data flow analysis.\n\nExamples:\n\n if (array.length < index) {\n System.out.println(array[index]);\n } // Array index is always out of bounds\n\n if (str == null) System.out.println(\"str is null\");\n System.out.println(str.trim());\n // the last statement may throw an NPE\n\n @NotNull\n Integer square(@Nullable Integer input) {\n // the method contract is violated\n return input == null ? null : input * input;\n }\n\n\nThe inspection behavior may be controlled by a number of annotations, such as\n[nullability](https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html) annotations,\n[@Contract](https://www.jetbrains.com/help/idea/contract-annotations.html) annotation,\n`@Range` annotation and so on.\n\nConfigure the inspection:\n\n* Use the **Suggest @Nullable annotation for methods/fields/parameters where nullable values are used** option to warn when a nullable value is passed as an argument to a method with a non-annotated parameter, stored into non-annotated field, or returned from a non-annotated method. In this case, the inspection will suggest propagating the `@Nullable` annotation. You can also configure nullability annotations using the **Configure Annotations** button.\n* Use the **Treat non-annotated members and parameters as @Nullable** option to assume that non-annotated members can be null, so they must not be used in non-null context.\n* Use the **Report not-null required parameter with null-literal argument usages** option to report method parameters that cannot be null (e.g. immediately dereferenced in the method body), but there are call sites where a `null` literal is passed.\n* Use the **Report nullable methods that always return a non-null value** option to report methods that are annotated as `@Nullable`, but always return non-null value. In this case, it's suggested that you change the annotation to `@NotNull`.\n* Use the **Ignore assert statements** option to control how the inspection treats `assert` statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode).\n* Use the **Report problems that happen only on some code paths** option to control whether to report problems that may happen only on some code path. If this option is disabled, warnings like *exception is possible* will not be reported. The inspection will report only warnings like *exception will definitely occur*. This mode may greatly reduce the number of false-positives, especially if the code is not consistently annotated with nullability and contract annotations. That is why it can be useful for finding the most important problems in legacy code bases.\n\n\nBefore IntelliJ IDEA 2022.3, this inspection was part of the \"Constant Conditions \\& Exceptions\" inspection.\nNow, it is split into two inspections:\n\"Constant Values\" and \"Nullability and data flow problems\"." + "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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DataFlowIssue", - "cweIds": [ - 129, - 252, - 253, - 394, - 395, - 476, - 570, - 571, - 690 - ], + "suppressToolId": "ObjectToString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23679,19 +23579,19 @@ ] }, { - "id": "ParameterCanBeLocal", + "id": "UseOfJDBCDriverClass", "shortDescription": { - "text": "Value passed as parameter never read" + "text": "Use of concrete JDBC driver class" }, "fullDescription": { - "text": "Reports redundant method parameters that can be replaced with local variables. If all local usages of a parameter are preceded by assignments to that parameter, the parameter can be removed and its usages replaced with local variables. It makes no sense to have such a parameter, as values that are passed to it are overwritten. Usually, the problem appears as a result of refactoring. Example: 'void test(int p) {\n p = 1;\n System.out.print(p);\n }' After the quick-fix is applied: 'void test() {\n int p = 1;\n System.out.print(p);\n }'", - "markdown": "Reports redundant method parameters that can be replaced with local variables.\n\nIf all local usages of a parameter are preceded by assignments to that parameter, the\nparameter can be removed and its usages replaced with local variables.\nIt makes no sense to have such a parameter, as values that are passed to it are overwritten.\nUsually, the problem appears as a result of refactoring.\n\nExample:\n\n\n void test(int p) {\n p = 1;\n System.out.print(p);\n }\n\nAfter the quick-fix is applied:\n\n\n void test() {\n int p = 1;\n System.out.print(p);\n }\n" + "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": "ParameterCanBeLocal", + "suppressToolId": "UseOfJDBCDriverClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23699,8 +23599,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -23712,19 +23612,19 @@ ] }, { - "id": "SwitchStatementDensity", + "id": "JDBCResource", "shortDescription": { - "text": "'switch' statement with too low of a branch density" + "text": "JDBC resource opened but not safely closed" }, "fullDescription": { - "text": "Reports 'switch' statements or expressions with a too low ratio of switch labels to executable statements. Such 'switch' statements may be confusing and should probably be refactored. Example: 'switch (i) { // one case and 5 executable statements -> 20% density\n case 1:\n System.out.println(\"1\");\n System.out.println(\"2\");\n System.out.println(\"3\");\n System.out.println(\"4\");\n System.out.println(\"5\");\n break;\n }' Use the Minimum density of branches field to specify the allowed ratio of the switch labels to executable statements.", - "markdown": "Reports `switch` statements or expressions with a too low ratio of switch labels to executable statements.\n\nSuch `switch` statements\nmay be confusing and should probably be refactored.\n\nExample:\n\n\n switch (i) { // one case and 5 executable statements -> 20% density\n case 1:\n System.out.println(\"1\");\n System.out.println(\"2\");\n System.out.println(\"3\");\n System.out.println(\"4\");\n System.out.println(\"5\");\n break;\n }\n\n\nUse the **Minimum density of branches** field to specify the allowed ratio of the switch labels to executable statements." + "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": "SwitchStatementDensity", + "suppressToolId": "JDBCResourceOpenedButNotSafelyClosed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23732,8 +23632,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -23745,28 +23645,28 @@ ] }, { - "id": "MismatchedJavadocCode", + "id": "LoggingSimilarMessage", "shortDescription": { - "text": "Mismatch between Javadoc and code" + "text": "Non-distinguishable logging calls" }, "fullDescription": { - "text": "Reports parts of method specification written in English that contradict with the method declaration. This includes: Method specified to return 'true' or 'false' but its return type is not boolean. Method specified to return 'null' but it's annotated as '@NotNull' or its return type is primitive. Method specified to return list but its return type is set or array. And so on. Example: '/**\n * @return true if user is found, false otherwise\n */\n User findUser(String name);' Note that false-positives are possible, as this inspection tries to interpret a human language. However, if the inspection reports incorrectly, it's still possible that the description is confusing and should be rewritten. New in 2022.3", - "markdown": "Reports parts of method specification written in English that contradict with the method declaration. This includes:\n\n* Method specified to return `true` or `false` but its return type is not boolean.\n* Method specified to return `null` but it's annotated as `@NotNull` or its return type is primitive.\n* Method specified to return list but its return type is set or array.\n* And so on.\n\n**Example:**\n\n\n /**\n * @return true if user is found, false otherwise\n */\n User findUser(String name);\n\n\nNote that false-positives are possible, as this inspection tries to interpret a human language. However, if the inspection reports\nincorrectly, it's still possible that the description is confusing and should be rewritten.\n\n\nNew in 2022.3" + "text": "Reports SLF4J, Log4j2 logging calls in one class, such as 'logger.info(\"message: {}\", key)' with similar log messages. These calls can be non-distinguishable from each other, and this introduces difficulties to understand where a certain log message is coming from. Example (for Java): 'private static void request1(String text) {\n log.info(\"Message: {}\", text); //similar call\n doSomething1();\n }\n\n private static void request2(int i) {\n log.info(\"Message: {}\", i); //similar call\n doSomething2();\n }' Use the Minimum length of a similar sequence option to set the minimum length of similar sequences after which calls will be reported Use the Do not report calls with the 'error' log level option to ignore messages with `error` log level and when there is an exception. It may be useful to hide the warnings, because call sites can still be located using stack traces New in 2024.1", + "markdown": "Reports SLF4J, Log4j2 logging calls in one class, such as `logger.info(\"message: {}\", key)` with similar log messages. These calls can be non-distinguishable from each other, and this introduces difficulties to understand where a certain log message is coming from.\n\n**Example (for Java):**\n\n\n private static void request1(String text) {\n log.info(\"Message: {}\", text); //similar call\n doSomething1();\n }\n\n private static void request2(int i) {\n log.info(\"Message: {}\", i); //similar call\n doSomething2();\n }\n\n* Use the **Minimum length of a similar sequence** option to set the minimum length of similar sequences after which calls will be reported\n* Use the **Do not report calls with the 'error' log level** option to ignore messages with \\`error\\` log level and when there is an exception. It may be useful to hide the warnings, because call sites can still be located using stack traces\n\nNew in 2024.1" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "MismatchedJavadocCode", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LoggingSimilarMessage", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "JVM languages/Logging", + "index": 52, "toolComponent": { "name": "QDJVM" } @@ -23778,28 +23678,28 @@ ] }, { - "id": "SimplifiableAnnotation", + "id": "IfCanBeAssertion", "shortDescription": { - "text": "Simplifiable annotation" + "text": "Statement can be replaced with 'assert' or 'Objects.requireNonNull'" }, "fullDescription": { - "text": "Reports annotations that can be simplified to their single-element or marker shorthand form. Problems reported: Redundant 'value=' in annotation name-value pairs Redundant braces around array values that contain only a single value Redundant whitespace between the @-sign and the name of annotations Redundant whitespace between annotation names and parameter lists Redundant parentheses in annotations without any parameters Example: '@interface Foo { String[] value(); }\n\n @ Foo({\"foo\"})\n public String name;' After the quick-fix is applied: '@interface Foo { String[] value(); }\n\n @Foo(\"foo\")\n public String name;'", - "markdown": "Reports annotations that can be simplified to their single-element or marker shorthand form.\n\n\nProblems reported:\n\n* Redundant `value=` in annotation name-value pairs\n* Redundant braces around array values that contain only a single value\n* Redundant whitespace between the @-sign and the name of annotations\n* Redundant whitespace between annotation names and parameter lists\n* Redundant parentheses in annotations without any parameters\n\n**Example:**\n\n\n @interface Foo { String[] value(); }\n\n @ Foo({\"foo\"})\n public String name;\n\nAfter the quick-fix is applied:\n\n\n @interface Foo { String[] value(); }\n\n @Foo(\"foo\")\n public String name;\n" + "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. This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", + "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.\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "SimplifiableAnnotation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "IfCanBeAssertion", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -23811,19 +23711,19 @@ ] }, { - "id": "Guava", + "id": "JavadocDeclaration", "shortDescription": { - "text": "Guava's functional primitives can be replaced with Java" + "text": "Javadoc declaration problems" }, "fullDescription": { - "text": "Reports usages of Guava's functional primitives that can be migrated to standard Java API calls. For example, the inspection reports usages of classes and interfaces like 'FluentIterable', 'Optional', 'Function', 'Predicate', or 'Supplier'. Example: 'ImmutableList results = FluentIterable.from(List.of(1, 2, 3)).transform(Object::toString).toList();' After the quick-fix is applied: 'List results = List.of(1, 2, 3).stream().map(Object::toString).collect(Collectors.toList());' The quick-fix may change the semantics. Some lazily evaluated Guava iterables can be transformed to eagerly evaluated. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports usages of Guava's functional primitives that can be migrated to standard Java API calls.\n\nFor example, the inspection reports usages of classes and interfaces like `FluentIterable`, `Optional`, `Function`,\n`Predicate`, or `Supplier`.\n\nExample:\n\n\n ImmutableList results = FluentIterable.from(List.of(1, 2, 3)).transform(Object::toString).toList();\n\nAfter the quick-fix is applied:\n\n\n List results = List.of(1, 2, 3).stream().map(Object::toString).collect(Collectors.toList());\n\n\nThe quick-fix may change the semantics. Some lazily evaluated Guava iterables can be transformed to eagerly evaluated.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "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": false, "level": "warning", "parameters": { - "suppressToolId": "Guava", + "suppressToolId": "JavadocDeclaration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23831,8 +23731,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -23844,19 +23744,19 @@ ] }, { - "id": "NoopMethodInAbstractClass", + "id": "AssignmentToMethodParameter", "shortDescription": { - "text": "No-op method in 'abstract' class" + "text": "Assignment to method parameter" }, "fullDescription": { - "text": "Reports no-op (for \"no operation\") methods in 'abstract' classes. It is usually a better design to make such methods 'abstract' themselves so that classes inheriting these methods provide their implementations. Example: 'abstract class Test {\n protected void doTest() {\n }\n }'", - "markdown": "Reports no-op (for \"no operation\") methods in `abstract` classes.\n\nIt is usually a better\ndesign to make such methods `abstract` themselves so that classes inheriting these\nmethods provide their implementations.\n\n**Example:**\n\n\n abstract class Test {\n protected void doTest() {\n }\n }\n" + "text": "Reports assignment to, or modification of method parameters. Although occasionally intended, this construct may be confusing and is therefore prohibited in some Java projects. The quick-fix adds a declaration of a new variable. Example: 'void printTrimmed(String s) {\n s = s.trim();\n System.out.println(s);\n }' After the quick-fix is applied: 'void printTrimmed(String s) {\n String trimmed = s.trim();\n System.out.println(trimmed);\n }' Use the Ignore if assignment is a transformation of the original parameter option to ignore assignments that modify the parameter value based on its previous value.", + "markdown": "Reports assignment to, or modification of method parameters.\n\nAlthough occasionally intended, this construct may be confusing\nand is therefore prohibited in some Java projects.\n\nThe quick-fix adds a declaration of a new variable.\n\n**Example:**\n\n\n void printTrimmed(String s) {\n s = s.trim();\n System.out.println(s);\n }\n\nAfter the quick-fix is applied:\n\n\n void printTrimmed(String s) {\n String trimmed = s.trim();\n System.out.println(trimmed);\n }\n\n\nUse the **Ignore if assignment is a transformation of the original parameter** option to ignore assignments that modify\nthe parameter value based on its previous value." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NoopMethodInAbstractClass", + "suppressToolId": "AssignmentToMethodParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23864,8 +23764,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -23877,19 +23777,19 @@ ] }, { - "id": "OverridableMethodCallDuringObjectConstruction", + "id": "LocalVariableHidingMemberVariable", "shortDescription": { - "text": "Overridable method called during object construction" + "text": "Local variable hides field" }, "fullDescription": { - "text": "Reports calls to overridable 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 Methods are overridable if they are not declared as 'final', 'static', or 'private'. Package-local methods are considered safe, even though they are overridable. Such calls may result in subtle bugs, as object initialization may happen before the method call. Example: 'class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n }' This inspection shares the functionality with the following inspections: Abstract 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 overridable 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* Methods are overridable if they are not declared as `final`, `static`, or `private`. Package-local methods are considered safe, even though they are overridable. Such calls may result in subtle bugs, as object initialization may happen before the method call.\n* **Example:**\n\n\n class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n }\n\n* This inspection shares the functionality with the following inspections:\n * Abstract method called during object construction\n * Overridden method called during object construction\n* Only one inspection should be enabled at once to prevent warning duplication." + "text": "Reports local variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the variable where the identically named field is intended. A quick-fix is suggested to rename the variable. Example: 'public class Foo {\n public Object foo;\n\n void bar() {\n Object o = new Object() {\n void baz() {\n Object foo; // Local variable 'foo' hides field in class 'Foo'\n }\n };\n }\n }' You can configure the following options for this inspection: Ignore non-accessible fields - ignore local variables named identically to superclass fields that are not visible (for example, because they are private). Ignore local variables in a static context hiding non-static fields - for example when the local variable is inside a static method or inside a method which is inside a static inner class.", + "markdown": "Reports local variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the variable where the identically named field is intended.\n\nA quick-fix is suggested to rename the variable.\n\n**Example:**\n\n\n public class Foo {\n public Object foo;\n\n void bar() {\n Object o = new Object() {\n void baz() {\n Object foo; // Local variable 'foo' hides field in class 'Foo'\n }\n };\n }\n }\n\n\nYou can configure the following options for this inspection:\n\n1. **Ignore non-accessible fields** - ignore local variables named identically to superclass fields that are not visible (for example, because they are private).\n2. **Ignore local variables in a static context hiding non-static fields** - for example when the local variable is inside a static method or inside a method which is inside a static inner class." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OverridableMethodCallDuringObjectConstruction", + "suppressToolId": "LocalVariableHidesMemberVariable", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23897,8 +23797,8 @@ "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -23910,19 +23810,19 @@ ] }, { - "id": "ImplicitCallToSuper", + "id": "UnnecessaryTemporaryOnConversionToString", "shortDescription": { - "text": "Implicit call to 'super()'" + "text": "Unnecessary temporary object in conversion to 'String'" }, "fullDescription": { - "text": "Reports constructors that do not begin with a call to \"super\" constructor or another constructor of the same class. Such constructors can be thought of as implicitly beginning with a call to 'super()'. Some coding standards prefer that such calls to 'super()' be made explicitly. Example: 'class Foo {\n Foo() {}\n }' After the quick-fix is applied: 'class Foo {\n Foo() {\n super();\n }\n }' Use the inspection settings to ignore classes extending directly from 'Object'. For instance: 'class Foo {\n Foo() {} // Not reported\n }\n\n class Bar extends Foo {\n Bar() {} // Implicit call to 'super()'\n }'", - "markdown": "Reports constructors that do not begin with a call to \"super\" constructor or another constructor of the same class.\n\nSuch constructors can be thought of as implicitly beginning with a\ncall to `super()`. Some coding standards prefer that such calls to\n`super()` be made explicitly.\n\n**Example:**\n\n\n class Foo {\n Foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n Foo() {\n super();\n }\n }\n\n\nUse the inspection settings to ignore classes extending directly from `Object`.\nFor instance:\n\n\n class Foo {\n Foo() {} // Not reported\n }\n\n class Bar extends Foo {\n Bar() {} // Implicit call to 'super()'\n }\n" + "text": "Reports unnecessary creation of temporary objects when converting from a primitive type to 'String'. Example: 'String foo = new Integer(3).toString();' After the quick-fix is applied: 'String foo = Integer.toString(3);'", + "markdown": "Reports unnecessary creation of temporary objects when converting from a primitive type to `String`.\n\n**Example:**\n\n\n String foo = new Integer(3).toString();\n\nAfter the quick-fix is applied:\n\n\n String foo = Integer.toString(3);\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ImplicitCallToSuper", + "suppressToolId": "UnnecessaryTemporaryOnConversionToString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23930,8 +23830,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -23943,19 +23843,19 @@ ] }, { - "id": "MissingDeprecatedAnnotation", + "id": "InterfaceMayBeAnnotatedFunctional", "shortDescription": { - "text": "Missing '@Deprecated' annotation" + "text": "Interface may be annotated as '@FunctionalInterface'" }, "fullDescription": { - "text": "Reports module declarations, classes, fields, or methods that have the '@deprecated' Javadoc tag but do not have the '@java.lang.Deprecated' annotation. Example: '/**\n * @deprecated use {@code example()} instead\n */\n void sample(){ }' After the quick-fix is applied: '/**\n * @deprecated use {@code example()} instead\n */\n @Deprecated\n void sample(){ }' Use the checkbox below to report members annotated with '@Deprecated' without an explanation in a Javadoc '@deprecated' tag. This inspection depends on the Java feature 'Annotations', which is available since Java 5.", - "markdown": "Reports module declarations, classes, fields, or methods that have the `@deprecated` Javadoc tag but do not have the `@java.lang.Deprecated` annotation.\n\n**Example:**\n\n\n /**\n * @deprecated use {@code example()} instead\n */\n void sample(){ }\n\nAfter the quick-fix is applied:\n\n\n /**\n * @deprecated use {@code example()} instead\n */\n @Deprecated\n void sample(){ }\n\n\nUse the checkbox below to report members annotated with `@Deprecated` without\nan explanation in a Javadoc `@deprecated` tag.\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." + "text": "Reports interfaces that can be annotated with '@FunctionalInterface'. Annotating an interface with '@FunctionalInterface' indicates that the interface is functional and no more 'abstract' methods can be added to it. Example: 'interface FileProcessor {\n void execute(File file);\n }' After the quick-fix is applied: '@FunctionalInterface\n interface FileProcessor {\n void execute(File file);\n }' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "markdown": "Reports interfaces that can be annotated with `@FunctionalInterface`.\n\nAnnotating an interface with `@FunctionalInterface` indicates that the interface\nis functional and no more `abstract` methods can be added to it.\n\n**Example:**\n\n\n interface FileProcessor {\n void execute(File file);\n }\n\nAfter the quick-fix is applied:\n\n\n @FunctionalInterface\n interface FileProcessor {\n void execute(File file);\n }\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MissingDeprecatedAnnotation", + "suppressToolId": "InterfaceMayBeAnnotatedFunctional", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23963,8 +23863,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -23976,19 +23876,19 @@ ] }, { - "id": "StringTemplateMigration", + "id": "BreakStatementWithLabel", "shortDescription": { - "text": "String template can be used" + "text": "'break' statement with label" }, "fullDescription": { - "text": "Reports 'String' concatenations that can be simplified by replacing them with a string template. Example: 'String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are \" + 29 + \" years old.\";' After the quick-fix is applied: 'String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";' This inspection depends on the Java feature 'String templates', which is available since Java 21-preview. New in 2023.3", - "markdown": "Reports `String` concatenations that can be simplified by replacing them with a string template.\n\n**Example:**\n\n\n String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are \" + 29 + \" years old.\";\n\nAfter the quick-fix is applied:\n\n\n String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";\n\nThis inspection depends on the Java feature 'String templates', which is available since Java 21-preview.\n\nNew in 2023.3" + "text": "Reports 'break' statements with labels. Labeled 'break' statements complicate refactoring and can be confusing. Example: 'void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) break outer;\n handleChar(ch);\n }\n }\n }'", + "markdown": "Reports `break` statements with labels.\n\nLabeled `break` statements complicate refactoring and can be confusing.\n\nExample:\n\n\n void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) break outer;\n handleChar(ch);\n }\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StringTemplateMigration", + "suppressToolId": "BreakStatementWithLabel", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -23996,8 +23896,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 21", - "index": 195, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -24009,28 +23909,28 @@ ] }, { - "id": "MustAlreadyBeRemovedApi", + "id": "SuspiciousLiteralUnderscore", "shortDescription": { - "text": "API must already be removed" + "text": "Suspicious underscore in number literal" }, "fullDescription": { - "text": "Reports declarations marked with '@ApiStatus.ScheduledForRemoval' that should have been removed in the current version of the declaring library. It compares the specified scheduled removal version with the version that you can set below. Specify the version as a string separated with dots and optionally postfixed with 'alpha', 'beta', 'snapshot', or 'eap'. Examples of valid versions: '1.0', '2.3.1', '2018.1', '7.5-snapshot', '3.0-eap'. Version comparison is intuitive: '1.0 < 2.0', '1.0-eap < 1.0', '2.3-snapshot < 2.3' and so on. For detailed comparison logic, refer to the implementation of VersionComparatorUtil.", - "markdown": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` that should have been removed in the current version of the declaring library.\n\nIt compares the specified scheduled removal version with the version that you can set below.\n\n\nSpecify the version as a string separated with dots and optionally postfixed with\n`alpha`, `beta`, `snapshot`, or `eap`.\n\nExamples of valid versions: `1.0`, `2.3.1`, `2018.1`, `7.5-snapshot`, `3.0-eap`.\n\n\nVersion comparison is intuitive: `1.0 < 2.0`, `1.0-eap < 1.0`, `2.3-snapshot < 2.3` and so on.\nFor detailed comparison logic, refer to the implementation of [VersionComparatorUtil](https://github.com/JetBrains/intellij-community/blob/master/platform/util-rt/src/com/intellij/util/text/VersionComparatorUtil.java)." + "text": "Reports decimal number literals that use the underscore numeric separator with groups where the number of digits is not three. Such literals may contain a typo. This inspection will not warn on literals containing two consecutive underscores. It is also allowed to omit underscores in the fractional part of 'double' and 'float' literals. Example: 'int oneMillion = 1_000_0000;'", + "markdown": "Reports decimal number literals that use the underscore numeric separator with groups where the number of digits is not three. Such literals may contain a typo.\n\nThis inspection will not warn on literals containing two consecutive underscores.\nIt is also allowed to omit underscores in the fractional part of `double` and `float` literals.\n\n**Example:** `int oneMillion = 1_000_0000;`" }, "defaultConfiguration": { - "enabled": true, - "level": "error", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "MustAlreadyBeRemovedApi", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "SuspiciousLiteralUnderscore", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -24042,19 +23942,22 @@ ] }, { - "id": "CachedNumberConstructorCall", + "id": "StringEquality", "shortDescription": { - "text": "Number constructor call with primitive argument" + "text": "String comparison using '==', instead of 'equals()'" }, "fullDescription": { - "text": "Reports instantiations of new 'Long', 'Integer', 'Short', or 'Byte' objects that have a primitive 'long', 'integer', 'short', or 'byte' argument. It is recommended that you use the static method 'valueOf()' introduced in Java 5. By default, this method caches objects for values between -128 and 127 inclusive. Example: 'Integer i = new Integer(1);\n Long l = new Long(1L);' After the quick-fix is applied, the code changes to: 'Integer i = Integer.valueOf(1);\n Long l = Long.valueOf(1L);' This inspection only reports if the language level of the project or module is 5 or higher Use the Ignore new number expressions with a String argument option to ignore calls to number constructors with a 'String' argument. Use the Report only when constructor is @Deprecated option to only report calls to deprecated constructors. 'Long', 'Integer', 'Short' and 'Byte' constructors are deprecated since JDK 9.", - "markdown": "Reports instantiations of new `Long`, `Integer`, `Short`, or `Byte` objects that have a primitive `long`, `integer`, `short`, or `byte` argument.\n\nIt is recommended that you use the static method `valueOf()`\nintroduced in Java 5. By default, this method caches objects for values between -128 and\n127 inclusive.\n\n**Example:**\n\n\n Integer i = new Integer(1);\n Long l = new Long(1L);\n\nAfter the quick-fix is applied, the code changes to:\n\n\n Integer i = Integer.valueOf(1);\n Long l = Long.valueOf(1L);\n\nThis inspection only reports if the language level of the project or module is 5 or higher\n\n\nUse the **Ignore new number expressions with a String argument** option to ignore calls to number constructors with a `String` argument.\n\n\nUse the **Report only when constructor is @Deprecated** option to only report calls to deprecated constructors.\n`Long`, `Integer`, `Short` and `Byte` constructors are deprecated since JDK 9." + "text": "Reports code that uses of == or != to compare strings. These operators determine referential equality instead of comparing content. In most cases, strings should be compared using 'equals()', which does a character-by-character comparison when the strings are different objects. Example: 'void foo(String s, String t) {\n final boolean b = t == s;\n }' If 't' 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(String s, String t) {\n final boolean b = t.equals(s);\n }'", + "markdown": "Reports code that uses of **==** or **!=** to compare strings.\n\n\nThese operators determine referential equality instead of comparing content.\nIn most cases, strings should be compared using `equals()`,\nwhich does a character-by-character comparison when the strings are different objects.\n\n**Example:**\n\n\n void foo(String s, String t) {\n final boolean b = t == s;\n }\n\nIf `t` 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\n void foo(String s, String t) {\n final boolean b = t.equals(s);\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CachedNumberConstructorCall", + "suppressToolId": "StringEquality", + "cweIds": [ + 597 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24062,8 +23965,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -24075,28 +23978,28 @@ ] }, { - "id": "MarkdownDocumentationCommentsMigration", + "id": "StaticCallOnSubclass", "shortDescription": { - "text": "Javadoc comment can be Markdown documentation comment" + "text": "Static method referenced via subclass" }, "fullDescription": { - "text": "Reports Javadoc comments that can be converted to Markdown documentation comments. Example: '/**\n * For blubbering of the florz.\n *\n * Similar to {@link com.deeps.Querp querping} class.\n */\n class FlorzBlubber {\n }' After the quick-fix is applied: '/// For blubbering of the florz.\n /// Similar to [querping][com.deeps.Querp] class.\n class FlorzBlubber {\n }' New in 2024.2", - "markdown": "Reports Javadoc comments that can be converted to Markdown documentation comments.\n\n**Example:**\n\n\n /**\n * For blubbering of the florz.\n *\n * Similar to {@link com.deeps.Querp querping} class.\n */\n class FlorzBlubber {\n }\n\nAfter the quick-fix is applied:\n\n\n /// For blubbering of the florz.\n /// Similar to [querping][com.deeps.Querp] class.\n class FlorzBlubber {\n }\n\nNew in 2024.2" + "text": "Reports static method calls where the call is qualified by a subclass of the declaring class, rather than by the declaring class itself. Java allows such qualification for classes, but such calls may indicate a subtle confusion of inheritance and overriding. Example: 'class Parent {\n public static void print(String str) {}\n }\n class Child extends Parent {}\n\n Child.print(\"Hello, world!\");' After the quick-fix is applied: 'Parent.print(\"Hello, world!\");'", + "markdown": "Reports static method calls 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 for classes, but such calls\nmay indicate a subtle confusion of inheritance and overriding.\n\n**Example:**\n\n\n class Parent {\n public static void print(String str) {}\n }\n class Child extends Parent {}\n\n Child.print(\"Hello, world!\");\n\nAfter the quick-fix is applied:\n\n\n Parent.print(\"Hello, world!\");\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MarkdownDocumentationCommentsMigration", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "StaticMethodReferencedViaSubclass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 23", - "index": 201, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -24108,19 +24011,19 @@ ] }, { - "id": "FieldHidesSuperclassField", + "id": "ReadResolveAndWriteReplaceProtected", "shortDescription": { - "text": "Subclass field hides superclass field" + "text": "'readResolve()' or 'writeReplace()' not declared 'protected'" }, "fullDescription": { - "text": "Reports fields in a derived class that are named identically a field of a superclass. Java fields cannot be overridden in derived classes, so the field in the derived class will hide the field from the superclass. As a result of such naming, you may accidentally use the field of the derived class where the identically named field of a base class is intended. A quick-fix is suggested to rename the field in the derived class. Example: 'class Parent {\n Parent parent;\n}\nclass Child extends Parent {\n Child parent;\n}' You can configure the following options for this inspection: Ignore non-accessible fields - indicates whether this inspection should report all name clashes, or only clashes with fields which are visible from the subclass. Ignore static fields hiding static fields - ignore 'static' fields which hide 'static' fields in base classes.", - "markdown": "Reports fields in a derived class that are named identically a field of a superclass. Java fields cannot be overridden in derived classes, so the field in the derived class will hide the field from the superclass.\n\n\nAs a result of such naming, you may accidentally use the field of the derived class\nwhere the identically named field of a base class is intended.\n\nA quick-fix is suggested to rename the field in the derived class.\n\n**Example:**\n\n class Parent {\n Parent parent;\n }\n class Child extends Parent {\n Child parent;\n }\n\n\nYou can configure the following options for this inspection:\n\n1. **Ignore non-accessible fields** - indicates whether this inspection should report all name clashes, or only clashes with fields which are visible from the subclass.\n2. **Ignore static fields hiding static fields** - ignore `static` fields which hide `static` fields in base classes." + "text": "Reports classes that implement 'java.io.Serializable' where the 'readResolve()' or 'writeReplace()' methods are not declared 'protected'. Declaring 'readResolve()' and 'writeReplace()' methods 'private' can force subclasses to silently ignore them, while declaring them 'public' allows them to be invoked by untrusted code. If the containing class is declared 'final', these methods can be declared 'private'. Example: 'class ClassWithSerialization implements Serializable {\n public Object writeReplace() { // warning: 'writeReplace()' not declared protected\n ...\n }\n }'", + "markdown": "Reports classes that implement `java.io.Serializable` where the `readResolve()` or `writeReplace()` methods are not declared `protected`.\n\n\nDeclaring `readResolve()` and `writeReplace()` methods `private`\ncan force subclasses to silently ignore them, while declaring them\n`public` allows them to be invoked by untrusted code.\n\n\nIf the containing class is declared `final`, these methods can be declared `private`.\n\n**Example:**\n\n\n class ClassWithSerialization implements Serializable {\n public Object writeReplace() { // warning: 'writeReplace()' not declared protected\n ...\n }\n }\n \n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FieldNameHidesFieldInSuperclass", + "suppressToolId": "ReadResolveAndWriteReplaceProtected", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24128,8 +24031,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -24141,19 +24044,19 @@ ] }, { - "id": "SimpleDateFormatWithoutLocale", + "id": "UnnecessaryLabelOnContinueStatement", "shortDescription": { - "text": "'SimpleDateFormat' without locale" + "text": "Unnecessary label on 'continue' statement" }, "fullDescription": { - "text": "Reports instantiations of 'java.util.SimpleDateFormat' or 'java.time.format.DateTimeFormatter' that do not specify a 'java.util.Locale'. These calls will use the platform default locale, which depends on the OS settings. This can lead to surprising behaviour when the code is run on a different platform or the OS settings are changed. 'Example:' 'new SimpleDateFormat(\"yyyy\");\n DateTimeFormatter.ofPattern(\"d/M/y\");'", - "markdown": "Reports instantiations of `java.util.SimpleDateFormat` or `java.time.format.DateTimeFormatter` that do not specify a `java.util.Locale`. These calls will use the platform default locale, which depends on the OS settings. This can lead to surprising behaviour when the code is run on a different platform or the OS settings are changed.\n\n`Example:`\n\n\n new SimpleDateFormat(\"yyyy\");\n DateTimeFormatter.ofPattern(\"d/M/y\");\n" + "text": "Reports 'continue' statements with unnecessary labels. Example: 'LABEL:\n while (a > b) {\n System.out.println(\"Hello\");\n //the code below is the last statement in a loop,\n //so unnecessary label and continue can be removed\n continue LABEL;\n }'", + "markdown": "Reports `continue` statements with unnecessary labels.\n\nExample:\n\n\n LABEL:\n while (a > b) {\n System.out.println(\"Hello\");\n //the code below is the last statement in a loop,\n //so unnecessary label and continue can be removed\n continue LABEL;\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SimpleDateFormatWithoutLocale", + "suppressToolId": "UnnecessaryLabelOnContinueStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24161,8 +24064,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -24174,19 +24077,19 @@ ] }, { - "id": "AnnotationClass", + "id": "ParameterNamingConvention", "shortDescription": { - "text": "Annotation interface" + "text": "Method parameter naming convention" }, "fullDescription": { - "text": "Reports annotation interfaces. Such interfaces are not supported under Java 1.4 and earlier.", - "markdown": "Reports annotation interfaces. Such interfaces are not supported under Java 1.4 and earlier." + "text": "Reports method parameters whose names are too short, too long, or do not follow the specified regular expression pattern. Example: 'void fooBar(int X)' should be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter. Configure the inspection: Use the fields in the Options section to specify the minimum length, maximum length, and a regular expression expected for method parameter names. Specify 0 in order not to check the length of names. Regular expressions should be specified in the standard 'java.util.regex' format.", + "markdown": "Reports method parameters whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:** `void fooBar(int X)`\nshould be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter.\n\nConfigure the inspection:\n\n\nUse the fields in the **Options** section to specify the minimum length, maximum length, and a regular expression expected for\nmethod parameter names. Specify **0** in order not to check the length of names.\n\nRegular expressions should be specified in the standard `java.util.regex` format." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AnnotationClass", + "suppressToolId": "MethodParameterNamingConvention", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24194,8 +24097,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level issues", - "index": 147, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -24207,28 +24110,28 @@ ] }, { - "id": "Finalize", + "id": "MethodCanBeVariableArityMethod", "shortDescription": { - "text": "'finalize()' should not be overridden" + "text": "Method can have varargs parameter" }, "fullDescription": { - "text": "Reports overriding the 'Object.finalize()' method. According to the 'Object.finalize()' documentation: The finalization mechanism is inherently problematic. Finalization can lead to performance issues, deadlocks, and hangs. Errors in finalizers can lead to resource leaks; there is no way to cancel finalization if it is no longer necessary; and no ordering is specified among calls to 'finalize' methods of different objects. Furthermore, there are no guarantees regarding the timing of finalization. The 'finalize' method might be called on a finalizable object only after an indefinite delay, if at all. Configure the inspection: Use the Ignore for trivial 'finalize()' implementations option to ignore 'finalize()' implementations with an empty method body or a body containing only 'if' statements that have a condition which evaluates to 'false' and is a compile-time constant. For performance reasons it can be beneficial to override a non-trivial 'finalize()' with an empty implementation in a subclass. An empty final 'finalize()' implementation can also be used to prevent subclasses from overriding.", - "markdown": "Reports overriding the `Object.finalize()` method.\n\nAccording to the `Object.finalize()` documentation:\n>\n> The finalization mechanism is inherently problematic. Finalization can lead\n> to performance issues, deadlocks, and hangs. Errors in finalizers can lead\n> to resource leaks; there is no way to cancel finalization if it is no longer\n> necessary; and no ordering is specified among calls to `finalize`\n> methods of different objects. Furthermore, there are no guarantees regarding\n> the timing of finalization. The `finalize` method might be called\n> on a finalizable object only after an indefinite delay, if at all.\n\nConfigure the inspection:\n\n* Use the **Ignore for trivial 'finalize()' implementations** option to ignore `finalize()` implementations with an empty method body or a body containing only `if` statements that have a condition which evaluates to `false` and is a compile-time constant. For performance reasons it can be beneficial to override a non-trivial `finalize()` with an empty implementation in a subclass. An empty final `finalize()` implementation can also be used to prevent subclasses from overriding." + "text": "Reports methods that can be converted to variable arity methods. Example: 'void process(String name, Object[] objects);' After the quick-fix is applied: 'void process(String name, Object... objects);' This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.", + "markdown": "Reports methods that can be converted to variable arity methods.\n\n**Example:**\n\n\n void process(String name, Object[] objects);\n\nAfter the quick-fix is applied:\n\n\n void process(String name, Object... objects);\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "FinalizeDeclaration", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MethodCanBeVariableArityMethod", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Finalization", - "index": 75, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -24240,19 +24143,19 @@ ] }, { - "id": "PointlessArithmeticExpression", + "id": "AbstractClassNeverImplemented", "shortDescription": { - "text": "Pointless arithmetic expression" + "text": "Abstract class which has no concrete subclass" }, "fullDescription": { - "text": "Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying by zero or one, and division by one. Such expressions may be the result of automated refactorings and they are unlikely to be what the developer intended to do. The quick-fix simplifies such expressions. Example: 'void f(int a) {\n int x = a - a;\n int y = a + 0;\n int res = x / x;\n }' After the quick-fix is applied: 'void f(int a) {\n int x = 0;\n int y = a;\n int res = 1;\n }' Note that in rare cases, the suggested replacement might not be completely equivalent to the original code for all possible inputs. For example, the inspection suggests replacing 'x / x' with '1'. However, if 'x' is zero, the original code throws 'ArithmeticException' or results in 'NaN'. Also, if 'x' is 'NaN', then the result is also 'NaN'. It's very unlikely that such behavior is intended.", - "markdown": "Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying by zero or one, and division by one.\n\nSuch expressions may be the result of automated refactorings and they are unlikely to be what the developer intended to do.\n\nThe quick-fix simplifies such expressions.\n\n**Example:**\n\n\n void f(int a) {\n int x = a - a;\n int y = a + 0;\n int res = x / x;\n }\n\nAfter the quick-fix is applied:\n\n\n void f(int a) {\n int x = 0;\n int y = a;\n int res = 1;\n }\n\n\nNote that in rare cases, the suggested replacement might not be completely equivalent to the original code\nfor all possible inputs. For example, the inspection suggests replacing `x / x` with `1`.\nHowever, if `x` is zero, the original code throws `ArithmeticException` or results in `NaN`.\nAlso, if `x` is `NaN`, then the result is also `NaN`. It's very unlikely that such behavior is intended." + "text": "Reports 'abstract' classes that have no concrete subclasses.", + "markdown": "Reports `abstract` classes that have no concrete subclasses." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PointlessArithmeticExpression", + "suppressToolId": "AbstractClassNeverImplemented", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24260,8 +24163,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -24273,28 +24176,28 @@ ] }, { - "id": "OverlyLargePrimitiveArrayInitializer", + "id": "StreamToLoop", "shortDescription": { - "text": "Overly large initializer for array of primitive type" + "text": "Stream API call chain can be replaced with loop" }, "fullDescription": { - "text": "Reports array initializer expressions for primitive arrays that contain too many elements. Such initializers may result in overly large class files because code must be generated to initialize each array element. In memory or bandwidth constrained environments, it may be more efficient to load large arrays of primitives from resource files. 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. Use the option to specify the maximum number of elements to allow in primitive array initializers.", - "markdown": "Reports array initializer expressions for primitive arrays that contain too many elements. Such initializers may result in overly large class files because code must be generated to initialize each array element. In memory or bandwidth constrained environments, it may be more efficient to load large arrays of primitives from resource files.\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\nUse the option to specify the maximum number of elements to allow in primitive array initializers." + "text": "Reports Stream API chains, 'Iterable.forEach()', and 'Map.forEach()' calls that can be automatically converted into classical loops. This can help to downgrade for backward compatibility with earlier Java versions. Example: 'String joinNonEmpty(List list) {\n return list.stream() // Stream can be converted to loop\n .filter(s -> !s.isEmpty())\n .map(String::trim)\n .collect(Collectors.joining(\", \"));\n }' After the quick-fix is applied: 'String joinNonEmpty(List list) {\n StringJoiner joiner = new StringJoiner(\", \");\n for (String s : list) {\n if (!s.isEmpty()) {\n String trim = s.trim();\n joiner.add(trim);\n }\n }\n return joiner.toString();\n }' Note that sometimes this inspection might cause slight semantic changes. Special care should be taken when it comes to short-circuiting, as it's not specified how many elements will be actually read when the stream short-circuits. Configure the inspection: Use the Iterate unknown Stream sources via Stream.iterator() option to suggest conversions for streams with unrecognized source. In this case, iterator will be created from the stream. For example, when checkbox is selected, the conversion will be suggested here: 'List handles = ProcessHandle.allProcesses().collect(Collectors.toList());' In this case, the result will be as follows: 'List handles = new ArrayList<>();\n for (Iterator it = ProcessHandle.allProcesses().iterator(); it.hasNext(); ) {\n ProcessHandle allProcess = it.next();\n handles.add(allProcess);\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2017.1", + "markdown": "Reports Stream API chains, `Iterable.forEach()`, and `Map.forEach()` calls that can be automatically converted into classical loops. This can help to downgrade for backward compatibility with earlier Java versions.\n\n**Example:**\n\n\n String joinNonEmpty(List list) {\n return list.stream() // Stream can be converted to loop\n .filter(s -> !s.isEmpty())\n .map(String::trim)\n .collect(Collectors.joining(\", \"));\n }\n\nAfter the quick-fix is applied:\n\n\n String joinNonEmpty(List list) {\n StringJoiner joiner = new StringJoiner(\", \");\n for (String s : list) {\n if (!s.isEmpty()) {\n String trim = s.trim();\n joiner.add(trim);\n }\n }\n return joiner.toString();\n }\n\n\nNote that sometimes this inspection might cause slight semantic changes.\nSpecial care should be taken when it comes to short-circuiting, as it's not specified how many elements will be actually read when\nthe stream short-circuits.\n\nConfigure the inspection:\n\nUse the **Iterate unknown Stream sources via Stream.iterator()** option to suggest conversions for streams with unrecognized source.\nIn this case, iterator will be created from the stream.\nFor example, when checkbox is selected, the conversion will be suggested here:\n\n\n List handles = ProcessHandle.allProcesses().collect(Collectors.toList());\n\nIn this case, the result will be as follows:\n\n\n List handles = new ArrayList<>();\n for (Iterator it = ProcessHandle.allProcesses().iterator(); it.hasNext(); ) {\n ProcessHandle allProcess = it.next();\n handles.add(allProcess);\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2017.1" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OverlyLargePrimitiveArrayInitializer", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "StreamToLoop", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -24306,19 +24209,19 @@ ] }, { - "id": "ObjectNotify", + "id": "NotifyWithoutCorrespondingWait", "shortDescription": { - "text": "Call to 'notify()' instead of 'notifyAll()'" + "text": "'notify()' without corresponding 'wait()'" }, "fullDescription": { - "text": "Reports calls to 'Object.notify()'. While occasionally useful, in almost all cases 'Object.notifyAll()' is a better choice because calling 'Object.notify()' may lead to deadlocks. See Doug Lea's Concurrent Programming in Java for a discussion.", - "markdown": "Reports calls to `Object.notify()`. While occasionally useful, in almost all cases `Object.notifyAll()` is a better choice because calling `Object.notify()` may lead to deadlocks. See Doug Lea's *Concurrent Programming in Java* for a discussion." + "text": "Reports calls to 'Object.notify()' or 'Object.notifyAll()' for which no call to a corresponding 'Object.wait()' can be found. Only calls that target fields of the current class are reported by this inspection. Example: 'synchronized (synList) {\n synList.notify(); //synList.wait() is never called\n }'", + "markdown": "Reports calls to `Object.notify()` or `Object.notifyAll()` for which no call to a corresponding `Object.wait()` can be found.\n\nOnly calls that target fields of the current class are reported by this inspection.\n\n**Example:**\n\n\n synchronized (synList) {\n synList.notify(); //synList.wait() is never called\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToNotifyInsteadOfNotifyAll", + "suppressToolId": "NotifyWithoutCorrespondingWait", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24339,19 +24242,19 @@ ] }, { - "id": "InstanceVariableUninitializedUse", + "id": "ClassInitializerMayBeStatic", "shortDescription": { - "text": "Instance field used before initialization" + "text": "Class initializer may be 'static'" }, "fullDescription": { - "text": "Reports instance variables that are read before initialization. The inspection ignores equality checks with 'null'. Example: 'class Foo {\n int bar;\n\n Foo() {\n System.out.println(bar);\n }\n }' Note that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables reported as initialized will always be initialized. Use the Ignore if annotated by option to specify special annotations. The inspection will ignore fields annotated with one of these annotations. Use the Ignore primitive fields option to ignore uninitialized primitive fields.", - "markdown": "Reports instance variables that are read before initialization.\n\nThe inspection ignores equality checks with `null`.\n\n**Example:**\n\n\n class Foo {\n int bar;\n\n Foo() {\n System.out.println(bar);\n }\n }\n\nNote that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables\nreported as initialized will always be initialized.\n\nUse the **Ignore if annotated by** option to specify special annotations. The inspection will ignore fields\nannotated with one of these annotations.\n\nUse the **Ignore primitive fields** option to ignore uninitialized primitive fields." + "text": "Reports instance initializers which may be made 'static'. An instance initializer may be static if it does not reference any of its class' non-static members. Static initializers are executed once the class is resolved, while instance initializers are executed on each instantiation of the class. This inspection doesn't report instance empty initializers and initializers in anonymous classes. Example: 'class A {\n public static String CONSTANT;\n {\n CONSTANT = \"Hello\";\n }\n }' After the quick-fix is applied: 'class A {\n public static String CONSTANT;\n static {\n CONSTANT = \"Hello\"; //now initialized only once per class\n }\n }'", + "markdown": "Reports instance initializers which may be made `static`.\n\n\nAn instance initializer may be static if it does not reference any of its class' non-static members.\nStatic initializers are executed once the class is resolved,\nwhile instance initializers are executed on each instantiation of the class.\n\nThis inspection doesn't report instance empty initializers and initializers in anonymous classes.\n\n**Example:**\n\n\n class A {\n public static String CONSTANT;\n {\n CONSTANT = \"Hello\";\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n public static String CONSTANT;\n static {\n CONSTANT = \"Hello\"; //now initialized only once per class\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "InstanceVariableUsedBeforeInitialized", + "suppressToolId": "ClassInitializerMayBeStatic", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24359,8 +24262,8 @@ "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -24372,28 +24275,28 @@ ] }, { - "id": "ExpressionMayBeFactorized", + "id": "MagicCharacter", "shortDescription": { - "text": "Expression can be factorized" + "text": "Magic character" }, "fullDescription": { - "text": "Reports expressions that can be factorized, i.e. reorganized to pull out a common factor. This reduces redundancy and could improve the readability of your code. Example: 'a && b || a && c' After the quick-fix is applied: 'a && (b || c)' New in 2021.3", - "markdown": "Reports expressions that can be factorized, i.e. reorganized to pull out a common factor. This reduces redundancy and could improve the readability of your code.\n\n**Example:**\n\n\n a && b || a && c\n\nAfter the quick-fix is applied:\n\n\n a && (b || c)\n\nNew in 2021.3" + "text": "Reports character literals that are used without constant declaration. These characters might result in bad code readability. Also, there might be errors if a character is changed only in one location but not everywhere in code. Example: 'char c = 'c';'", + "markdown": "Reports character literals that are used without constant declaration. These characters might result in bad code readability. Also, there might be errors if a character is changed only in one location but not everywhere in code.\n\n**Example:**\n\n char c = 'c';\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ExpressionMayBeFactorized", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "MagicCharacter", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -24405,19 +24308,19 @@ ] }, { - "id": "ListRemoveInLoop", + "id": "SlowAbstractSetRemoveAll", "shortDescription": { - "text": "'List.remove()' called in loop" + "text": "Call to 'set.removeAll(list)' may work slowly" }, "fullDescription": { - "text": "Reports 'List.remove(index)' called in a loop that can be replaced with 'List.subList().clear()'. The replacement is more efficient for most 'List' implementations when many elements are deleted. Example: 'void removeRange(List list, int from, int to) {\n for (int i = from; i < to; i++) {\n list.remove(from);\n }\n }' After the quick-fix is applied: 'void removeRange(List list, int from, int to) {\n if (to > from) {\n list.subList(from, to).clear();\n }\n }' The quick-fix adds a range check automatically to prevent a possible 'IndexOutOfBoundsException' when the minimal value is bigger than the maximal value. It can be removed if such a situation is impossible in your code. New in 2018.2", - "markdown": "Reports `List.remove(index)` called in a loop that can be replaced with `List.subList().clear()`.\n\nThe replacement\nis more efficient for most `List` implementations when many elements are deleted.\n\nExample:\n\n\n void removeRange(List list, int from, int to) {\n for (int i = from; i < to; i++) {\n list.remove(from);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void removeRange(List list, int from, int to) {\n if (to > from) {\n list.subList(from, to).clear();\n }\n }\n\n\nThe quick-fix adds a range check automatically to prevent a possible `IndexOutOfBoundsException` when the minimal value is bigger\nthan the maximal value. It can be removed if such a situation is impossible in your code.\n\nNew in 2018.2" + "text": "Reports calls to 'java.util.Set.removeAll()' with a 'java.util.List' argument. Such a call can be slow when the size of the argument is greater than or equal to the size of the set, and the set is a subclass of 'java.util.AbstractSet'. In this case, 'List.contains()' is called for each element in the set, which will perform a linear search. Example: 'public void check(String... ss) {\n // possible O(n^2) complexity\n mySet.removeAll(List.of(ss));\n }' After the quick fix is applied: 'public void check(String... ss) {\n // O(n) complexity\n List.of(ss).forEach(mySet::remove);\n }' New in 2020.3", + "markdown": "Reports calls to `java.util.Set.removeAll()` with a `java.util.List` argument.\n\n\nSuch a call can be slow when the size of the argument is greater than or equal to the size of the set,\nand the set is a subclass of `java.util.AbstractSet`.\nIn this case, `List.contains()` is called for each element in the set, which will perform a linear search.\n\n**Example:**\n\n\n public void check(String... ss) {\n // possible O(n^2) complexity\n mySet.removeAll(List.of(ss));\n }\n\nAfter the quick fix is applied:\n\n\n public void check(String... ss) {\n // O(n) complexity\n List.of(ss).forEach(mySet::remove);\n }\n\nNew in 2020.3" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ListRemoveInLoop", + "suppressToolId": "SlowAbstractSetRemoveAll", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24438,28 +24341,28 @@ ] }, { - "id": "MissingOverrideAnnotation", + "id": "ArrayEquality", "shortDescription": { - "text": "Missing '@Override' annotation" + "text": "Array comparison using '==', instead of 'Arrays.equals()'" }, "fullDescription": { - "text": "Reports methods overriding superclass methods but are not annotated with '@java.lang.Override'. Annotating methods with '@java.lang.Override' improves code readability since it shows the intent. In addition, the compiler emits an error when a signature of the overridden method doesn't match the superclass method. Example: 'class X {\n public String toString() {\n return \"hello world\";\n }\n }' After the quick-fix is applied: 'class X {\n @Override\n public String toString() {\n return \"hello world\";\n }\n }' Configure the inspection: Use the Ignore 'equals()', 'hashCode()' and 'toString()' option to ignore these 'java.lang.Object' methods: 'equals()', 'hashCode()', and 'toString()'. The risk that these methods will disappear and your code won't be compiling anymore due to the '@Override' annotation is relatively small. Use the Ignore methods in anonymous classes option to ignore methods in anonymous classes. Disable the Highlight method when its overriding methods do not all have the '@Override' annotation option to only warn on the methods missing an '@Override' annotation, and not on overridden methods where one or more descendants are missing an '@Override' annotation. This inspection depends on the Java feature 'Annotations', which is available since Java 5.", - "markdown": "Reports methods overriding superclass methods but are not annotated with `@java.lang.Override`.\n\n\nAnnotating methods with `@java.lang.Override` improves code readability since it shows the intent.\nIn addition, the compiler emits an error when a signature of the overridden method doesn't match the superclass method.\n\n**Example:**\n\n\n class X {\n public String toString() {\n return \"hello world\";\n }\n }\n \nAfter the quick-fix is applied:\n\n\n class X {\n @Override\n public String toString() {\n return \"hello world\";\n }\n }\n \nConfigure the inspection:\n\n* Use the **Ignore 'equals()', 'hashCode()' and 'toString()'** option to ignore these `java.lang.Object` methods: `equals()`, `hashCode()`, and `toString()`. The risk that these methods will disappear and your code won't be compiling anymore due to the `@Override` annotation is relatively small.\n* Use the **Ignore methods in anonymous classes** option to ignore methods in anonymous classes.\n* Disable the **Highlight method when its overriding methods do not all have the '@Override' annotation** option to only warn on the methods missing an `@Override` annotation, and not on overridden methods where one or more descendants are missing an `@Override` annotation.\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." + "text": "Reports operators '==' and '!=' used to test for array equality. In most cases, testing for the equality of array contents is intended, which can be done with the 'java.util.Arrays.equals()' method. A quick-fix is suggested to replace '==' with 'java.util.Arrays.equals()'. Example: 'void foo(Object[] x, Object[] y) {\n boolean comparison = x == y;\n }' After the quick-fix is applied: 'void foo(Object[] x, Object[] y) {\n boolean comparison = Arrays.equals(x, y);\n }'", + "markdown": "Reports operators `==` and `!=` used to test for array equality. In most cases, testing for the equality of array contents is intended, which can be done with the `java.util.Arrays.equals()` method.\n\n\nA quick-fix is suggested to replace `==` with `java.util.Arrays.equals()`.\n\n**Example:**\n\n\n void foo(Object[] x, Object[] y) {\n boolean comparison = x == y;\n }\n\nAfter the quick-fix is applied:\n\n\n void foo(Object[] x, Object[] y) {\n boolean comparison = Arrays.equals(x, y);\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "override", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ArrayEquality", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -24471,19 +24374,19 @@ ] }, { - "id": "CharUsedInArithmeticContext", + "id": "StaticCollection", "shortDescription": { - "text": "'char' expression used in arithmetic context" + "text": "Static collection" }, "fullDescription": { - "text": "Reports expressions of the 'char' type used in addition or subtraction expressions. Such code is not necessarily an issue but may result in bugs (for example, if a string is expected). Example: 'int a = 'a' + 42;' After the quick-fix is applied: 'int a = (int) 'a' + 42;' For the 'String' context: 'int i1 = 1;\nint i2 = 2;\nSystem.out.println(i2 + '-' + i1 + \" = \" + (i2 - i1));' After the quick-fix is applied: 'System.out.println(i2 + \"-\" + i1 + \" = \" + (i2 - i1));'", - "markdown": "Reports expressions of the `char` type used in addition or subtraction expressions.\n\nSuch code is not necessarily an issue but may result in bugs (for example,\nif a string is expected).\n\n**Example:** `int a = 'a' + 42;`\n\nAfter the quick-fix is applied: `int a = (int) 'a' + 42;`\n\nFor the `String` context:\n\n int i1 = 1;\n int i2 = 2;\n System.out.println(i2 + '-' + i1 + \" = \" + (i2 - i1));\n\nAfter the quick-fix is applied:\n`System.out.println(i2 + \"-\" + i1 + \" = \" + (i2 - i1));`" + "text": "Reports static fields of a 'Collection' type. While it's not necessarily a problem, static collections often cause memory leaks and are therefore prohibited by some coding standards. Example: 'public class Example {\n static List list = new ArrayList<>();\n\n }' Configure the inspection: Use the Ignore weak static collections or maps option to ignore the fields of the 'java.util.WeakHashMap' type.", + "markdown": "Reports static fields of a `Collection` type. While it's not necessarily a problem, static collections often cause memory leaks and are therefore prohibited by some coding standards.\n\n**Example:**\n\n\n public class Example {\n static List list = new ArrayList<>();\n\n }\n\n\nConfigure the inspection:\n\n* Use the **Ignore weak static collections or maps** option to ignore the fields of the `java.util.WeakHashMap` type." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CharUsedInArithmeticContext", + "suppressToolId": "StaticCollection", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24491,8 +24394,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -24504,22 +24407,19 @@ ] }, { - "id": "StringEqualsCharSequence", + "id": "NonExceptionNameEndsWithException", "shortDescription": { - "text": "'String.equals()' called with 'CharSequence' argument" + "text": "Non-exception class name ends with 'Exception'" }, "fullDescription": { - "text": "Reports calls to 'String.equals()' with a 'CharSequence' as the argument. 'String.equals()' can only return 'true' for 'String' arguments. To compare the contents of a 'String' with a non-'String' 'CharSequence' argument, use the 'contentEquals()' method. Example: 'boolean equals(String s, CharSequence ch) {\n return s.equals(ch);\n }' After quick-fix is applied: 'boolean equals(String s, CharSequence ch) {\n return s.contentEquals(ch);\n }' New in 2017.3", - "markdown": "Reports calls to `String.equals()` with a `CharSequence` as the argument.\n\n\n`String.equals()` can only return `true` for `String` arguments.\nTo compare the contents of a `String` with a non-`String` `CharSequence` argument,\nuse the `contentEquals()` method.\n\n**Example:**\n\n\n boolean equals(String s, CharSequence ch) {\n return s.equals(ch);\n }\n\nAfter quick-fix is applied:\n\n\n boolean equals(String s, CharSequence ch) {\n return s.contentEquals(ch);\n }\n\n\nNew in 2017.3" + "text": "Reports non-'exception' classes whose names end with 'Exception'. Such classes may cause confusion by breaking a common naming convention and often indicate that the 'extends Exception' clause is missing. Example: 'public class NotStartedException {}' A quick-fix that renames such classes is available only in the editor.", + "markdown": "Reports non-`exception` classes whose names end with `Exception`.\n\nSuch classes may cause confusion by breaking a common naming convention and\noften indicate that the `extends Exception` clause is missing.\n\n**Example:**\n\n public class NotStartedException {}\n\nA quick-fix that renames such classes is available only in the editor." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StringEqualsCharSequence", - "cweIds": [ - 597 - ], + "suppressToolId": "NonExceptionNameEndsWithException", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24527,8 +24427,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Naming conventions/Class", + "index": 80, "toolComponent": { "name": "QDJVM" } @@ -24540,19 +24440,19 @@ ] }, { - "id": "TestFailedLine", + "id": "SystemGC", "shortDescription": { - "text": "Failed line in test" + "text": "Call to 'System.gc()' or 'Runtime.gc()'" }, "fullDescription": { - "text": "Reports failed method calls or assertions in tests. It helps detect the failed line in code faster and start debugging it immediately. Example: '@Test\n fun foo() {\n assertEquals(1, 0) // highlighted\n }'", - "markdown": "Reports failed method calls or assertions in tests. It helps detect the failed line in code faster and start debugging it immediately.\n\n**Example:**\n\n\n @Test\n fun foo() {\n assertEquals(1, 0) // highlighted\n }\n" + "text": "Reports 'System.gc()' or 'Runtime.gc()' calls. While occasionally useful in testing, explicitly triggering garbage collection via 'System.gc()' is almost never recommended in production code and can result in serious performance issues.", + "markdown": "Reports `System.gc()` or `Runtime.gc()` calls. While occasionally useful in testing, explicitly triggering garbage collection via `System.gc()` is almost never recommended in production code and can result in serious performance issues." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "TestFailedLine", + "suppressToolId": "CallToSystemGC", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24560,8 +24460,8 @@ "relationships": [ { "target": { - "id": "JVM languages/Test frameworks", - "index": 123, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -24573,22 +24473,19 @@ ] }, { - "id": "PublicStaticCollectionField", + "id": "ClassComplexity", "shortDescription": { - "text": "'public static' collection field" + "text": "Overly complex class" }, "fullDescription": { - "text": "Reports modifiable 'public' 'static' Collection fields. Even though they are often used to store collections of constant values, these fields nonetheless represent a security hazard, as their contents may be modified even if the field is declared as 'final'. Example: 'public static final List EVENTS = new ArrayList<>();'\n Use the table in the Options section to specify methods returning unmodifiable collections. 'public' 'static' collection fields initialized with these methods will not be reported.", - "markdown": "Reports modifiable `public` `static` Collection fields.\n\nEven though they are often used to store collections of constant values, these fields nonetheless represent a security\nhazard, as their contents may be modified even if the field is declared as `final`.\n\n**Example:**\n\n\n public static final List EVENTS = new ArrayList<>();\n \n\nUse the table in the **Options** section to specify methods returning unmodifiable collections.\n`public` `static` collection fields initialized with these methods will not be reported." + "text": "Reports 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. Too high complexity indicates that the class should be refactored into several smaller classes. Use the Cyclomatic complexity limit field below to specify the maximum allowed complexity for a class.", + "markdown": "Reports 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\nToo high complexity indicates that the class should be refactored into several smaller classes.\n\nUse the **Cyclomatic complexity limit** field below to specify the maximum allowed complexity for a class." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PublicStaticCollectionField", - "cweIds": [ - 732 - ], + "suppressToolId": "OverlyComplexClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24596,8 +24493,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -24609,19 +24506,23 @@ ] }, { - "id": "ExtendsConcreteCollection", + "id": "OverflowingLoopIndex", "shortDescription": { - "text": "Class explicitly extends a 'Collection' class" + "text": "Loop executes zero or billions of times" }, "fullDescription": { - "text": "Reports classes that extend concrete subclasses of the 'java.util.Collection' or 'java.util.Map' classes. Subclassing concrete collection types is a common yet poor practice. It is considerably more brittle than delegating collection calls.", - "markdown": "Reports classes that extend concrete subclasses of the `java.util.Collection` or `java.util.Map` classes.\n\n\nSubclassing concrete collection types is a common yet poor practice. It is considerably more brittle than delegating collection calls." + "text": "Reports loops that cannot be completed without an index overflow or loops that don't loop at all. It usually happens because of a mistake in the update operation. Example: 'void foo(int s) {\n for (int i = s; i > 12; i++) { // i-- should be here\n System.out.println(i);\n }\n }' New in 2019.1", + "markdown": "Reports loops that cannot be completed without an index overflow or loops that don't loop at all. It usually happens because of a mistake in the update operation.\n\nExample:\n\n\n void foo(int s) {\n for (int i = s; i > 12; i++) { // i-- should be here\n System.out.println(i);\n }\n }\n\nNew in 2019.1" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ClassExtendsConcreteCollection", + "suppressToolId": "OverflowingLoopIndex", + "cweIds": [ + 691, + 835 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24629,8 +24530,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -24642,19 +24543,19 @@ ] }, { - "id": "ObjectInstantiationInEqualsHashCode", + "id": "InnerClassMayBeStatic", "shortDescription": { - "text": "Object instantiation inside 'equals()' or 'hashCode()'" + "text": "Inner class may be 'static'" }, "fullDescription": { - "text": "Reports construction of (temporary) new objects inside 'equals()', 'hashCode()', 'compareTo()', and 'Comparator.compare()' methods. Besides constructor invocations, new objects can also be created by autoboxing or iterator creation inside a 'foreach' statement. This can cause performance problems, for example, when objects are added to a 'Set' or 'Map', where these methods will be called often. The inspection will not report when the objects are created in a 'throw' or 'assert' statement. Example: 'class Person {\n private String name;\n private int age;\n\n public boolean equals(Object o) {\n return Arrays.equals(new Object[] {name, age}, new Object[] {((Foo)o).name, ((Foo)o).age});\n }\n\n public int hashCode() {\n return (name + age).hashCode();\n }\n }' In this example, two additional arrays are created inside 'equals()', usages of 'age' field require boxing, and 'name + age' implicitly creates a new string.", - "markdown": "Reports construction of (temporary) new objects inside `equals()`, `hashCode()`, `compareTo()`, and `Comparator.compare()` methods.\n\n\nBesides constructor invocations, new objects can also be created by autoboxing or iterator creation inside a\n`foreach` statement.\nThis can cause performance problems, for example, when objects are added to a `Set` or `Map`,\nwhere these methods will be called often.\n\n\nThe inspection will not report when the objects are created in a `throw` or `assert` statement.\n\n**Example:**\n\n\n class Person {\n private String name;\n private int age;\n\n public boolean equals(Object o) {\n return Arrays.equals(new Object[] {name, age}, new Object[] {((Foo)o).name, ((Foo)o).age});\n }\n\n public int hashCode() {\n return (name + age).hashCode();\n }\n }\n\n\nIn this example, two additional arrays are created inside `equals()`, usages of `age` field require boxing,\nand `name + age` implicitly creates a new string." + "text": "Reports inner classes that can be made 'static'. A 'static' inner class does not keep an implicit reference to its enclosing instance. When using Java 17 or before, this prevents a common cause of memory leaks and uses less memory per instance of the class. Example: 'public class Outer {\n class Inner { // not static\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }' After the quick-fix is applied: 'public class Outer {\n static class Inner {\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }'", + "markdown": "Reports inner classes that can be made `static`.\n\nA `static` inner class does not keep an implicit reference to its enclosing instance.\nWhen using Java 17 or before,\nthis prevents a common cause of memory leaks and uses less memory per instance of the class.\n\n**Example:**\n\n\n public class Outer {\n class Inner { // not static\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Outer {\n static class Inner {\n public void foo() {\n bar(\"x\");\n }\n\n private void bar(String string) {}\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ObjectInstantiationInEqualsHashCode", + "suppressToolId": "InnerClassMayBeStatic", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24662,8 +24563,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -24675,19 +24576,19 @@ ] }, { - "id": "UnconditionalWait", + "id": "Java9UndeclaredServiceUsage", "shortDescription": { - "text": "Unconditional 'wait()' call" + "text": "Usage of service not declared in 'module-info'" }, "fullDescription": { - "text": "Reports 'wait()' being called unconditionally within a synchronized context. Normally, 'wait()' is used to block a thread until some condition is true. If 'wait()' is called unconditionally, it often indicates that the condition was checked before a lock was acquired. In that case a data race may occur, with the condition becoming true between the time it was checked and the time the lock was acquired. While constructs found by this inspection are not necessarily incorrect, they are certainly worth examining. Example: 'class Bar {\n void foo() throws InterruptedException {\n synchronized (this) {\n wait(); // warning\n }\n }\n }'", - "markdown": "Reports `wait()` being called unconditionally within a synchronized context.\n\n\nNormally, `wait()` is used to block a thread until some condition is true. If\n`wait()` is called unconditionally, it often indicates that the condition was\nchecked before a lock was acquired. In that case a data race may occur, with the condition\nbecoming true between the time it was checked and the time the lock was acquired.\n\n\nWhile constructs found by this inspection are not necessarily incorrect, they are certainly worth examining.\n\n**Example:**\n\n\n class Bar {\n void foo() throws InterruptedException {\n synchronized (this) {\n wait(); // warning\n }\n }\n }\n" + "text": "Reports situations in which a service is loaded with 'java.util.ServiceLoader' but it isn't declared with the 'uses' clause in the 'module-info.java' file and suggests inserting it. This inspection depends on the Java feature 'Modules', which is available since Java 9. New in 2018.1", + "markdown": "Reports situations in which a service is loaded with `java.util.ServiceLoader` but it isn't declared with the `uses` clause in the `module-info.java` file and suggests inserting it.\n\nThis inspection depends on the Java feature 'Modules', which is available since Java 9.\n\nNew in 2018.1" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnconditionalWait", + "suppressToolId": "Java9UndeclaredServiceUsage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24695,8 +24596,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -24708,19 +24609,19 @@ ] }, { - "id": "MethodOverridesInaccessibleMethodOfSuper", + "id": "SetReplaceableByEnumSet", "shortDescription": { - "text": "Method overrides inaccessible method of superclass" + "text": "'Set' can be replaced with 'EnumSet'" }, "fullDescription": { - "text": "Reports methods with the same signature as an inaccessible method of a superclass, for example, a private method, or a package-private method of a superclass in another package. Such method names may be confusing because the method in the subclass may look like an override when in fact it hides the inaccessible method of the superclass. Moreover, if the visibility of the method in the superclass changes later, it may either silently change the semantics of the subclass or cause a compilation error. A quick-fix is suggested to rename the method. Example: 'public class Super {\n private void test() {\n }\n }\n\n public class Sub extends Super {\n void test() { // making 'Super.test()' public causes a compilation error\n // making 'Super.test()' package-private makes 'Sub.test()' an override\n }\n }'", - "markdown": "Reports methods with the same signature as an inaccessible method of a superclass, for example, a private method, or a package-private method of a superclass in another package.\n\n\nSuch method names may be confusing because the method in the subclass may look like an override when in fact\nit hides the inaccessible method of the superclass.\nMoreover, if the visibility of the method in the superclass changes later,\nit may either silently change the semantics of the subclass or cause a compilation error.\n\nA quick-fix is suggested to rename the method.\n\n**Example:**\n\n\n public class Super {\n private void test() {\n }\n }\n\n public class Sub extends Super {\n void test() { // making 'Super.test()' public causes a compilation error\n // making 'Super.test()' package-private makes 'Sub.test()' an override\n }\n }\n" + "text": "Reports instantiations of 'java.util.Set' objects whose content types are enumerated classes. Such 'Set' objects can be replaced with 'java.util.EnumSet' objects. 'EnumSet' implementations can be much more efficient compared to other sets, as the underlying data structure is a bit vector. Use the quick-fix to replace the initializer with a call to 'EnumSet.noneOf()'. This quick-fix is not available when the type of the variable is a sub-class of 'Set'. Example: 'enum MyEnum { FOO, BAR; }\n\n Set enums = new HashSet();' After the quick-fix is applied: 'enum MyEnum { FOO, BAR; }\n\n Set enums = EnumSet.noneOf(MyEnum.class);'", + "markdown": "Reports instantiations of `java.util.Set` objects whose content types are enumerated classes. Such `Set` objects can be replaced with `java.util.EnumSet` objects.\n\n\n`EnumSet` implementations can be much more efficient compared to\nother sets, as the underlying data structure is a bit vector. Use the quick-fix to replace the initializer with a call to\n`EnumSet.noneOf()`. This quick-fix is not available when the type of the variable is a sub-class of `Set`.\n\n**Example:**\n\n\n enum MyEnum { FOO, BAR; }\n\n Set enums = new HashSet();\n\nAfter the quick-fix is applied:\n\n\n enum MyEnum { FOO, BAR; }\n\n Set enums = EnumSet.noneOf(MyEnum.class);\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MethodOverridesInaccessibleMethodOfSuper", + "suppressToolId": "SetReplaceableByEnumSet", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24728,8 +24629,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -24741,19 +24642,19 @@ ] }, { - "id": "IntLiteralMayBeLongLiteral", + "id": "CallToSimpleSetterInClass", "shortDescription": { - "text": "Cast to 'long' can be 'long' literal" + "text": "Call to simple setter from within class" }, "fullDescription": { - "text": "Reports 'int' literal expressions that are immediately cast to 'long'. Such literal expressions can be replaced with equivalent 'long' literals. Example: 'Long l = (long)42;' After the quick-fix is applied: 'Long l = 42L;'", - "markdown": "Reports `int` literal expressions that are immediately cast to `long`.\n\nSuch literal expressions can be replaced with equivalent `long` literals.\n\n**Example:**\n\n Long l = (long)42;\n\nAfter the quick-fix is applied:\n\n Long l = 42L;\n" + "text": "Reports calls to a simple property setter from within the property's class. A simple property setter is defined as one which simply assigns the value of its parameter to a field, and does no other calculations. Such simple setter calls can be safely inlined. Some coding standards also suggest against the use of simple setters for code clarity reasons. Example: 'class Foo {\n private int index;\n public Foo(int idx) {\n setIndex(idx);\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }' After the quick-fix is applied: 'class Foo {\n private int index;\n public Foo(int idx) {\n index = idx;\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }' Use the following options to configure the inspection: Whether to only report setter calls on 'this', not on objects of the same type passed in as a parameter. Whether to ignore non-'private' setters.", + "markdown": "Reports calls to a simple property setter from within the property's class.\n\n\nA simple property setter is defined as one which simply assigns the value of its parameter to a field,\nand does no other calculations. Such simple setter calls can be safely inlined.\nSome coding standards also suggest against the use of simple setters for code clarity reasons.\n\n**Example:**\n\n\n class Foo {\n private int index;\n public Foo(int idx) {\n setIndex(idx);\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n private int index;\n public Foo(int idx) {\n index = idx;\n }\n public void setIndex(int idx) {\n index = idx;\n }\n }\n\nUse the following options to configure the inspection:\n\n* Whether to only report setter calls on `this`, not on objects of the same type passed in as a parameter.\n* Whether to ignore non-`private` setters." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IntLiteralMayBeLongLiteral", + "suppressToolId": "CallToSimpleSetterFromWithinClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24761,8 +24662,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues/Cast", - "index": 139, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -24774,19 +24675,19 @@ ] }, { - "id": "SingleCharacterStartsWith", + "id": "UnnecessaryFinalOnLocalVariableOrParameter", "shortDescription": { - "text": "Single character 'startsWith()' or 'endsWith()'" + "text": "Unnecessary 'final' on local variable or parameter" }, "fullDescription": { - "text": "Reports calls to 'String.startsWith()' and 'String.endsWith()' where single character string literals are passed as an argument. A quick-fix is suggested to replace such calls with more efficiently implemented 'String.charAt()'. However, the performance gain of such change is minimal and the code becomes less readable because of the extra non-zero length check, so it is recommended to apply the quick-fix only inside tight loops. 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: 'boolean startsWithX(String s) {\n return s.startsWith(\"x\");\n }' After the quick-fix is applied: 'boolean startsWithX(String s) {\n return !s.isEmpty() && s.charAt(0) == 'x';\n }'", - "markdown": "Reports calls to `String.startsWith()` and `String.endsWith()` where single character string literals are passed as an argument.\n\n\nA quick-fix is suggested to replace such calls with more efficiently implemented `String.charAt()`.\n\n\nHowever, the performance gain of such change is minimal and the code becomes less readable because of the extra non-zero length check,\nso it is recommended to apply the quick-fix only inside tight loops.\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 boolean startsWithX(String s) {\n return s.startsWith(\"x\");\n }\n\nAfter the quick-fix is applied:\n\n\n boolean startsWithX(String s) {\n return !s.isEmpty() && s.charAt(0) == 'x';\n }\n" + "text": "Reports local variables or parameters unnecessarily declared 'final'. Some coding standards frown upon variables declared 'final' for reasons of terseness. Example: 'class Foo {\n Foo(Object o) {}\n\n void bar(final Object o) {\n new Foo(o);\n }\n }' After the quick-fix is applied: 'class Foo {\n Foo(Object o) {}\n\n void bar(Object o) {\n new Foo(o);\n }\n }' Use the inspection options to toggle the reporting for: local variables parameters (including parameters of 'catch' blocks and enhanced 'for' statements) Also, you can configure the inspection to only report 'final' parameters of 'abstract' or interface methods, which may be considered extra unnecessary as such markings don't affect the implementation of these methods.", + "markdown": "Reports local variables or parameters unnecessarily declared `final`.\n\nSome coding standards frown upon variables declared `final` for reasons of terseness.\n\n**Example:**\n\n\n class Foo {\n Foo(Object o) {}\n\n void bar(final Object o) {\n new Foo(o);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n Foo(Object o) {}\n\n void bar(Object o) {\n new Foo(o);\n }\n }\n\n\nUse the inspection options to toggle the reporting for:\n\n* local variables\n* parameters (including parameters of `catch` blocks and enhanced `for` statements)\n\n\nAlso, you can configure the inspection to only report `final` parameters of `abstract` or interface\nmethods, which may be considered extra unnecessary as such markings don't\naffect the implementation of these methods." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SingleCharacterStartsWith", + "suppressToolId": "UnnecessaryFinalOnLocalVariableOrParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24794,8 +24695,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -24807,19 +24708,19 @@ ] }, { - "id": "UtilityClassCanBeEnum", + "id": "NonBooleanMethodNameMayNotStartWithQuestion", "shortDescription": { - "text": "Utility class can be 'enum'" + "text": "Non-boolean method name must not start with question word" }, "fullDescription": { - "text": "Reports utility classes that can be converted to enums. Some coding style guidelines require implementing utility classes as enums to avoid code coverage issues in 'private' constructors. Example: 'class StringUtils {\n public static final String EMPTY = \"\";\n }' After the quick-fix is applied: 'enum StringUtils {\n ;\n public static final String EMPTY = \"\";\n }' This inspection depends on the Java feature 'Enums', which is available since Java 5.", - "markdown": "Reports utility classes that can be converted to enums.\n\nSome coding style guidelines require implementing utility classes as enums\nto avoid code coverage issues in `private` constructors.\n\n**Example:**\n\n\n class StringUtils {\n public static final String EMPTY = \"\";\n }\n\nAfter the quick-fix is applied:\n\n\n enum StringUtils {\n ;\n public static final String EMPTY = \"\";\n }\n\nThis inspection depends on the Java feature 'Enums', which is available since Java 5." + "text": "Reports non-boolean methods whose names start with a question word. Such method names may be confusing. Non-boolean methods that override library methods are ignored by this inspection. Example: 'public void hasName(String name) {\n assert names.contains(name);\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 the question words that should be used only for boolean methods. Use the Ignore methods with 'java.lang.Boolean' return type option to ignore methods with 'java.lang.Boolean' return type. Use the Ignore methods overriding/implementing a super method option to ignore methods which have supers.", + "markdown": "Reports non-boolean methods whose names start with a question word. Such method names may be confusing.\n\nNon-boolean methods that override library methods are ignored by this inspection.\n\n**Example:**\n\n\n public void hasName(String name) {\n assert names.contains(name);\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 the question words that should be used only for boolean methods.\n* Use the **Ignore methods with 'java.lang.Boolean' return type** option to ignore methods with `java.lang.Boolean` return type.\n* Use the **Ignore methods overriding/implementing a super method** option to ignore methods which have supers." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UtilityClassCanBeEnum", + "suppressToolId": "NonBooleanMethodNameMayNotStartWithQuestion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24827,8 +24728,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -24840,19 +24741,19 @@ ] }, { - "id": "ExtendsObject", + "id": "WeakerAccess", "shortDescription": { - "text": "Class explicitly extends 'Object'" + "text": "Declaration access can be weaker" }, "fullDescription": { - "text": "Reports any classes that are explicitly declared to extend 'java.lang.Object'. Such declaration is redundant and can be safely removed. Example: 'class MyClass extends Object {\n }' The quick-fix removes the redundant 'extends Object' clause: 'class MyClass {\n }'", - "markdown": "Reports any classes that are explicitly declared to extend `java.lang.Object`.\n\nSuch declaration is redundant and can be safely removed.\n\nExample:\n\n\n class MyClass extends Object {\n }\n\nThe quick-fix removes the redundant `extends Object` clause:\n\n\n class MyClass {\n }\n" + "text": "Reports fields, methods or classes that may have their access modifier narrowed down. Example: 'class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n void bar(String x, String y) { } // can be private\n }' After the quick-fix is applied: 'class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n private void bar(String x, String y) { }\n }' Use the inspection's options to define the rules for the modifier change suggestions.", + "markdown": "Reports fields, methods or classes that may have their access modifier narrowed down.\n\nExample:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n void bar(String x, String y) { } // can be private\n }\n\nAfter the quick-fix is applied:\n\n\n class Sample {\n void foo() {\n bar(\"foo\", \"foo\");\n }\n private void bar(String x, String y) { }\n }\n\nUse the inspection's options to define the rules for the modifier change suggestions." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassExplicitlyExtendsObject", + "suppressToolId": "WeakerAccess", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24860,8 +24761,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -24873,28 +24774,28 @@ ] }, { - "id": "ReassignedVariable", + "id": "ReplaceWithJavadoc", "shortDescription": { - "text": "Reassigned variable" + "text": "Comment replaceable with Javadoc" }, "fullDescription": { - "text": "Reports reassigned variables, which complicate reading and understanding the code. Example: 'int value = 2 * (height + width);\n System.out.println(\"perimeter: \" + value);\n\n value = height * width;\n System.out.println(\"area: \" + value);'", - "markdown": "Reports reassigned variables, which complicate reading and understanding the code.\n\nExample:\n\n\n int value = 2 * (height + width);\n System.out.println(\"perimeter: \" + value);\n\n value = height * width;\n System.out.println(\"area: \" + value);\n" + "text": "Reports a regular comment that belongs to a field, method, or class that can be replaced with a Javadoc comment. Example: 'public class Main {\n /*\n * Hello,\n */\n // World!\n void f() {\n }\n }' After the quick-fix is applied: 'public class Main {\n /**\n * Hello,\n * World!\n */\n void f() {\n }\n }'", + "markdown": "Reports a regular comment that belongs to a field, method, or class that can be replaced with a Javadoc comment.\n\n**Example:**\n\n\n public class Main {\n /*\n * Hello,\n */\n // World!\n void f() {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Main {\n /**\n * Hello,\n * World!\n */\n void f() {\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReassignedVariable", - "ideaSeverity": "TEXT ATTRIBUTES", + "suppressToolId": "ReplaceWithJavadoc", + "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -24906,19 +24807,19 @@ ] }, { - "id": "MethodNameSameAsClassName", + "id": "WrapperTypeMayBePrimitive", "shortDescription": { - "text": "Method name same as class name" + "text": "Wrapper type may be primitive" }, "fullDescription": { - "text": "Reports methods that are named identically to their class. While such naming is allowed by the Java language, by convention it is reserved for defining constructors. Using it for methods is probably a mistake or bad practice. Example: 'class MyClass {\n int val;\n\n // Method MyClass named identically to its containing class.\n // Likely, 'void' was added by mistake.\n void MyClass(int val) {\n this.val = val;\n }\n }' When appropriate, a quick-fix converts the method to a constructor: 'class MyClass {\n int val;\n\n MyClass(int val) {\n this.val = val;\n }\n }' Another quick-fix renames the method.", - "markdown": "Reports methods that are named identically to their class. While such naming is allowed by the Java language, by convention it is reserved for defining constructors. Using it for methods is probably a mistake or bad practice.\n\n**Example:**\n\n\n class MyClass {\n int val;\n\n // Method MyClass named identically to its containing class.\n // Likely, 'void' was added by mistake.\n void MyClass(int val) {\n this.val = val;\n }\n }\n\nWhen appropriate, a quick-fix converts the method to a constructor:\n\n\n class MyClass {\n int val;\n\n MyClass(int val) {\n this.val = val;\n }\n }\n\nAnother quick-fix renames the method." + "text": "Reports local variables of wrapper type that are mostly used as primitive types. In some cases, boxing can be source of significant performance penalty, especially in loops. Heuristics are applied to estimate the number of boxing operations. For example, conversions inside loops are considered as much more numerous. Example: 'public void example() {\n Integer value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}' After the quick-fix is applied: 'public void example() {\n int value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}' New in 2018.2", + "markdown": "Reports local variables of wrapper type that are mostly used as primitive types.\n\nIn some cases, boxing can be source of significant performance penalty, especially in loops.\n\nHeuristics are applied to estimate the number of boxing operations. For example, conversions inside loops are considered\nas much more numerous.\n\n**Example:**\n\n public void example() {\n Integer value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}\n\nAfter the quick-fix is applied:\n\n public void example() {\n int value = 12;\n needBox(value);\n for (int i = 0; i < 10; i++) {\n // Loop usages considered as happening more often\n needPrimitive(value);\n }\n }\n\n void needPrimitive(int value) {}\n void needBox(Integer value) {}\n\n\nNew in 2018.2" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MethodNameSameAsClassName", + "suppressToolId": "WrapperTypeMayBePrimitive", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24926,8 +24827,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -24939,19 +24840,22 @@ ] }, { - "id": "LocalVariableNamingConvention", + "id": "EmptyStatementBody", "shortDescription": { - "text": "Local variable naming convention" + "text": "Statement with empty body" }, "fullDescription": { - "text": "Reports local variables whose names are too short, too long, or do not follow the specified regular expression pattern. Example: 'int X = 42;' should be reported if the inspection is enabled with the default settings in which a variable name should start with a lowercase letter. Configure the inspection: Use the fields in the Options section to specify the minimum length, maximum length, and a regular expression expected for local variable names. Specify 0 in order not to check the length of names. Regular expressions should be specified in the standard java.util.regex format. Use checkboxes to ignore 'for'-loop and 'catch' section parameters.", - "markdown": "Reports local variables whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:** `int X = 42;`\nshould be reported if the inspection is enabled with the default settings in which a variable name should start with a lowercase letter.\n\nConfigure the inspection:\n\n\nUse the fields in the **Options** section to specify the minimum length, maximum length, and a regular expression expected for local variable names.\nSpecify **0** in order not to check the length of names. Regular expressions should be specified in the standard **java.util.regex** format.\n\nUse checkboxes to ignore `for`-loop and `catch` section parameters." + "text": "Reports 'if', 'while', 'do', 'for', and 'switch' statements with empty bodies. While occasionally intended, such code is confusing and is often the result of a typo. This inspection is disabled in JSP files.", + "markdown": "Reports `if`, `while`, `do`, `for`, and `switch` statements with empty bodies.\n\nWhile occasionally intended, such code is confusing and is often the result of a typo.\n\nThis inspection is disabled in JSP files." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "LocalVariableNamingConvention", + "suppressToolId": "StatementWithEmptyBody", + "cweIds": [ + 561 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24959,8 +24863,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -24972,19 +24876,19 @@ ] }, { - "id": "UnnecessaryJavaDocLink", + "id": "EmptyFinallyBlock", "shortDescription": { - "text": "Unnecessary Javadoc link" + "text": "Empty 'finally' block" }, "fullDescription": { - "text": "Reports Javadoc '@see', '{@link}', and '{@linkplain}' tags that refer to the method owning the comment, the super method of the method owning the comment, or the class containing the comment. Such links are unnecessary and can be safely removed with this inspection's quick-fix. The quick-fix will remove the entire Javadoc comment if the tag is its only content. Example: 'class Example {\n /**\n * @see Example#method\n */\n public void method() { }\n }' After the quick-fix is applied: 'class Example {\n public void method() { }\n}' Use the checkbox below to ignore inline links ('{@link}' and '{@linkplain}') to super methods. Although a link to all super methods is automatically added by the Javadoc tool, an inline link to the super method may sometimes be needed in texts of the Javadoc comments.", - "markdown": "Reports Javadoc `@see`, `{@link}`, and `{@linkplain}` tags that refer to the method owning the comment, the super method of the method owning the comment, or the class containing the comment.\n\nSuch links are unnecessary and can be safely removed with this inspection's quick-fix. The\nquick-fix will remove the entire Javadoc comment if the tag is its only content.\n\n**Example:**\n\n\n class Example {\n /**\n * @see Example#method\n */\n public void method() { }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n public void method() { }\n }\n\n\nUse the checkbox below to ignore inline links (`{@link}` and `{@linkplain}`)\nto super methods. Although a link to all super methods is automatically added by the\nJavadoc tool, an inline link to the super method may sometimes be needed in texts of the Javadoc comments." + "text": "Reports empty 'finally' blocks. Empty 'finally' blocks usually indicate coding errors. They may also remain after code refactoring and can safely be removed. This inspection doesn't report empty 'finally' blocks found in JSP files. Example: 'try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n\n }' After the quick-fix is applied: 'try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }'", + "markdown": "Reports empty `finally` blocks.\n\nEmpty `finally` blocks usually indicate coding errors. They may also remain after code refactoring and can safely be removed.\n\nThis inspection doesn't report empty `finally` blocks found in JSP files.\n\n**Example:**\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n Files.readString(Paths.get(\"in.txt\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryJavaDocLink", + "suppressToolId": "EmptyFinallyBlock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -24992,8 +24896,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -25005,19 +24909,19 @@ ] }, { - "id": "EmptyTryBlock", + "id": "InconsistentLanguageLevel", "shortDescription": { - "text": "Empty 'try' block" + "text": "Inconsistent language level settings" }, "fullDescription": { - "text": "Reports empty 'try' blocks, including try-with-resources statements. 'try' blocks with comments are considered empty. This inspection doesn't report empty 'try' blocks found in JSP files.", - "markdown": "Reports empty `try` blocks, including try-with-resources statements.\n\n`try` blocks with comments are considered empty.\n\n\nThis inspection doesn't report empty `try` blocks found in JSP files." + "text": "Reports modules which depend on other modules with a higher language level. Such dependencies should be removed or the language level of the module be increased. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", + "markdown": "Reports modules which depend on other modules with a higher language level.\n\nSuch dependencies should be removed or the language level of the module be increased.\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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EmptyTryBlock", + "suppressToolId": "InconsistentLanguageLevel", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25025,8 +24929,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Modularization issues", + "index": 76, "toolComponent": { "name": "QDJVM" } @@ -25038,19 +24942,19 @@ ] }, { - "id": "NestedSwitchStatement", + "id": "EnumerationCanBeIteration", "shortDescription": { - "text": "Nested 'switch' statement" + "text": "Enumeration can be iteration" }, "fullDescription": { - "text": "Reports nested 'switch' statements or expressions. Nested 'switch' statements may result in extremely confusing code. These statements may be extracted to a separate method. Example: 'int res = switch (i) {\n case 0 -> 0;\n default -> switch (i) {\n case 100 -> 0;\n default -> i;\n };\n };'", - "markdown": "Reports nested `switch` statements or expressions.\n\nNested `switch` statements\nmay result in extremely confusing code. These statements may be extracted to a separate method.\n\nExample:\n\n\n int res = switch (i) {\n case 0 -> 0;\n default -> switch (i) {\n case 100 -> 0;\n default -> i;\n };\n };\n" + "text": "Reports calls to 'Enumeration' methods that are used on collections and may be replaced with equivalent 'Iterator' constructs. Example: 'Enumeration keys = map.keys();\n while (keys.hasMoreElements()) {\n String name = keys.nextElement();\n }' After the quick-fix is applied: 'Iterator iterator = map.keySet().iterator();\n while (iterator.hasNext()) {\n String name = iterator.next();\n }'", + "markdown": "Reports calls to `Enumeration` methods that are used on collections and may be replaced with equivalent `Iterator` constructs.\n\n**Example:**\n\n\n Enumeration keys = map.keys();\n while (keys.hasMoreElements()) {\n String name = keys.nextElement();\n }\n\nAfter the quick-fix is applied:\n\n\n Iterator iterator = map.keySet().iterator();\n while (iterator.hasNext()) {\n String name = iterator.next();\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NestedSwitchStatement", + "suppressToolId": "EnumerationCanBeIteration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25058,8 +24962,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Java language level migration aids", + "index": 70, "toolComponent": { "name": "QDJVM" } @@ -25071,19 +24975,19 @@ ] }, { - "id": "CollectionsFieldAccessReplaceableByMethodCall", + "id": "FinalStaticMethod", "shortDescription": { - "text": "Reference to empty collection field can be replaced with method call" + "text": "'static' method declared 'final'" }, "fullDescription": { - "text": "Reports usages of 'java.util.Collections' fields: 'EMPTY_LIST', 'EMPTY_MAP' or 'EMPTY_SET'. These field usages may be replaced with the following method calls: 'emptyList()', 'emptyMap()', or 'emptySet()'. Such method calls prevent unchecked warnings by the compiler because the type parameters can be inferred. Example: 'List emptyList = Collections.EMPTY_LIST;' After the quick-fix is applied: 'List emptyList = Collections.emptyList();' This inspection only reports if the language level of the project or module is 5 or higher.", - "markdown": "Reports usages of `java.util.Collections` fields: `EMPTY_LIST`, `EMPTY_MAP` or `EMPTY_SET`. These field usages may be replaced with the following method calls: `emptyList()`, `emptyMap()`, or `emptySet()`. Such method calls prevent unchecked warnings by the compiler because the type parameters can be inferred.\n\n**Example:**\n\n\n List emptyList = Collections.EMPTY_LIST;\n\nAfter the quick-fix is applied:\n\n\n List emptyList = Collections.emptyList();\n\nThis inspection only reports if the language level of the project or module is 5 or higher." + "text": "Reports static methods that are marked as 'final'. Such code might indicate an error or an incorrect assumption about the effect of the 'final' keyword. Static methods are not subject to runtime polymorphism, so the only purpose of the 'final' keyword used with static methods is to ensure the method will not be hidden in a subclass.", + "markdown": "Reports static methods that are marked as `final`.\n\nSuch code might indicate an error or an incorrect assumption about the effect of the `final` keyword.\nStatic methods are not subject to runtime polymorphism, so the only purpose of the `final` keyword used with static methods\nis to ensure the method will not be hidden in a subclass." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CollectionsFieldAccessReplaceableByMethodCall", + "suppressToolId": "FinalStaticMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25091,8 +24995,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -25104,19 +25008,19 @@ ] }, { - "id": "WaitOrAwaitWithoutTimeout", + "id": "RedundantTypeArguments", "shortDescription": { - "text": "'wait()' or 'await()' without timeout" + "text": "Redundant type arguments" }, "fullDescription": { - "text": "Reports calls to 'Object.wait()' or 'Condition.await()' without specifying a timeout. Such calls may be dangerous in high-availability programs, as failures in one component may result in blockages of the waiting component if 'notify()'/'notifyAll()' or 'signal()'/'signalAll()' never get called. Example: 'void foo(Object bar) throws InterruptedException {\n bar.wait();\n }'", - "markdown": "Reports calls to `Object.wait()` or `Condition.await()` without specifying a timeout.\n\n\nSuch calls may be dangerous in high-availability programs, as failures in one\ncomponent may result in blockages of the waiting component\nif `notify()`/`notifyAll()`\nor `signal()`/`signalAll()` never get called.\n\n**Example:**\n\n\n void foo(Object bar) throws InterruptedException {\n bar.wait();\n }\n" + "text": "Reports calls to parametrized methods with explicit argument types that can be omitted since they will be unambiguously inferred by the compiler. Using redundant type arguments is unnecessary and makes the code less readable. Example: 'List list = Arrays.asList(\"Hello\", \"World\");' A quick-fix is provided to remove redundant type arguments: 'List list = Arrays.asList(\"Hello\", \"World\");'", + "markdown": "Reports calls to parametrized methods with explicit argument types that can be omitted since they will be unambiguously inferred by the compiler.\n\n\nUsing redundant type arguments is unnecessary and makes the code less readable.\n\nExample:\n\n\n List list = Arrays.asList(\"Hello\", \"World\");\n\nA quick-fix is provided to remove redundant type arguments:\n\n\n List list = Arrays.asList(\"Hello\", \"World\");\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "WaitOrAwaitWithoutTimeout", + "suppressToolId": "RedundantTypeArguments", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25124,8 +25028,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -25137,19 +25041,19 @@ ] }, { - "id": "AssertWithSideEffects", + "id": "FieldHasSetterButNoGetter", "shortDescription": { - "text": "'assert' statement with side effects" + "text": "Field has setter but no getter" }, "fullDescription": { - "text": "Reports 'assert' statements that cause side effects. Since assertions can be switched off, these side effects are not guaranteed, which can cause subtle bugs. Common unwanted side effects detected by this inspection are modifications of variables and fields. When methods calls are involved, they are analyzed one level deep. Example: 'assert i++ < 10;' This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", - "markdown": "Reports `assert` statements that cause side effects.\n\n\nSince assertions can be switched off,\nthese side effects are not guaranteed, which can cause subtle bugs. Common unwanted side effects detected by this inspection are\nmodifications of variables and fields. When methods calls are involved, they are analyzed one level deep.\n\n**Example:**\n\n\n assert i++ < 10;\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + "text": "Reports fields that have setter methods but no getter methods. In certain bean containers, when used within the Java beans specification, such fields might be difficult to work with.", + "markdown": "Reports fields that have setter methods but no getter methods.\n\n\nIn certain bean containers, when used within the Java beans specification, such fields might be difficult\nto work with." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AssertWithSideEffects", + "suppressToolId": "FieldHasSetterButNoGetter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25157,8 +25061,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/JavaBeans issues", + "index": 141, "toolComponent": { "name": "QDJVM" } @@ -25170,19 +25074,26 @@ ] }, { - "id": "FinalClass", + "id": "RuntimeExecWithNonConstantString", "shortDescription": { - "text": "Class is closed to inheritance" + "text": "Call to 'Runtime.exec()' with non-constant string" }, "fullDescription": { - "text": "Reports classes that are declared 'final'. Final classes that extend a 'sealed' class or interface are not reported. Such classes can't be inherited and may indicate a lack of object-oriented design. Some coding standards discourage 'final' classes. Example: 'public final class Main {\n }' After the quick-fix is applied: 'public class Main {\n }'", - "markdown": "Reports classes that are declared `final`. Final classes that extend a `sealed` class or interface are not reported. Such classes can't be inherited and may indicate a lack of object-oriented design. Some coding standards discourage `final` classes.\n\n**Example:**\n\n\n public final class Main {\n }\n\nAfter the quick-fix is applied:\n\n\n public class Main {\n }\n" + "text": "Reports calls to 'java.lang.Runtime.exec()' which take a dynamically-constructed string as the command to execute. Constructed execution strings are a common source of security breaches. By default, this inspection ignores compile-time constants. Example: 'String i = getUserInput();\n Runtime runtime = Runtime.getRuntime();\n runtime.exec(\"foo\" + i); // reports warning' 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: 'static final String COMMAND = \"ping \" + getDomainFromUserInput() + \"'\";'", + "markdown": "Reports calls to `java.lang.Runtime.exec()` which take a dynamically-constructed string as the command to execute.\n\n\nConstructed execution strings are a common source of security breaches.\nBy default, this inspection ignores compile-time constants.\n\n**Example:**\n\n\n String i = getUserInput();\n Runtime runtime = Runtime.getRuntime();\n runtime.exec(\"foo\" + i); // reports warning\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 static final String COMMAND = \"ping \" + getDomainFromUserInput() + \"'\";\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FinalClass", + "suppressToolId": "CallToRuntimeExecWithNonConstantString", + "cweIds": [ + 20, + 77, + 78, + 88, + 94 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25190,8 +25101,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -25203,19 +25114,19 @@ ] }, { - "id": "UnnecessaryEmptyArrayUsage", + "id": "ErrorRethrown", "shortDescription": { - "text": "Unnecessary zero length array usage" + "text": "'Error' not rethrown" }, "fullDescription": { - "text": "Reports allocations of arrays with known lengths of zero when there is a constant for that in the class of the array's element type. As zero-length arrays are immutable, you can save memory reusing the same array instance. Example: 'class Item {\n // Public zero-length array constant that can be reused \n public static final Item[] EMPTY_ARRAY = new Item[0];\n }\n class EmptyNode {\n Item[] getChildren() {\n // Unnecessary zero-length array creation\n return new Item[0];\n }\n }' After the quick-fix is applied: 'class EmptyNode {\n Item[] getChildren() {\n return Item.EMPTY_ARRAY;\n }\n }'", - "markdown": "Reports allocations of arrays with known lengths of zero when there is a constant for that in the class of the array's element type. As zero-length arrays are immutable, you can save memory reusing the same array instance.\n\n**Example:**\n\n\n class Item {\n // Public zero-length array constant that can be reused \n public static final Item[] EMPTY_ARRAY = new Item[0];\n }\n class EmptyNode {\n Item[] getChildren() {\n // Unnecessary zero-length array creation\n return new Item[0];\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class EmptyNode {\n Item[] getChildren() {\n return Item.EMPTY_ARRAY;\n }\n }\n" + "text": "Reports 'try' statements that catch 'java.lang.Error' or any of its subclasses and do not rethrow the error. Statements that catch 'java.lang.ThreadDeath' are not reported. Example: 'try {\n executeTests(request);\n }\n catch (OutOfMemoryError ex) { // warning: Error 'ex' not rethrown\n return false;\n }'", + "markdown": "Reports `try` statements that catch `java.lang.Error` or any of its subclasses and do not rethrow the error.\n\nStatements that catch `java.lang.ThreadDeath` are not\nreported.\n\n**Example:**\n\n\n try {\n executeTests(request);\n }\n catch (OutOfMemoryError ex) { // warning: Error 'ex' not rethrown\n return false;\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConstantForZeroLengthArrayAllocation", + "suppressToolId": "ErrorNotRethrown", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25223,8 +25134,8 @@ "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -25236,19 +25147,19 @@ ] }, { - "id": "LiteralAsArgToStringEquals", + "id": "CyclicPackageDependency", "shortDescription": { - "text": "String literal may be 'equals()' qualifier" + "text": "Cyclic package dependency" }, "fullDescription": { - "text": "Reports 'String.equals()' or 'String.equalsIgnoreCase()' calls with a string literal argument. Some coding standards specify that string literals should be the qualifier of 'equals()', rather than argument, thus minimizing 'NullPointerException'-s. A quick-fix is available to exchange the literal and the expression. Example: 'boolean isFoo(String value) {\n return value.equals(\"foo\");\n }' After the quick-fix is applied: 'boolean isFoo(String value) {\n return \"foo\".equals(value);\n }'", - "markdown": "Reports `String.equals()` or `String.equalsIgnoreCase()` calls with a string literal argument.\n\nSome coding standards specify that string literals should be the qualifier of `equals()`, rather than\nargument, thus minimizing `NullPointerException`-s.\n\nA quick-fix is available to exchange the literal and the expression.\n\n**Example:**\n\n\n boolean isFoo(String value) {\n return value.equals(\"foo\");\n }\n\nAfter the quick-fix is applied:\n\n\n boolean isFoo(String value) {\n return \"foo\".equals(value);\n }\n" + "text": "Reports packages that are mutually or cyclically dependent on other packages. 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 packages that are mutually or cyclically dependent on other packages.\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": "LiteralAsArgToStringEquals", + "suppressToolId": "CyclicPackageDependency", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25256,8 +25167,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Dependency issues", + "index": 146, "toolComponent": { "name": "QDJVM" } @@ -25269,28 +25180,32 @@ ] }, { - "id": "DuplicateExpressions", + "id": "UnsatisfiedRange", "shortDescription": { - "text": "Multiple occurrences of the same expression" + "text": "Return value is outside of declared range" }, "fullDescription": { - "text": "Reports multiple equivalent occurrences of the same expression within a method (or constructor, or class initializer) if the result of the expression can be reused. The expression is reported if it's free of side effects and its result is always the same (in terms of 'Object.equals()'). The examples of such expressions are 'a + b', 'Math.max(a, b)', 'a.equals(b)', 's.substring(a,b)'. To make sure the result is always the same, it's verified that the variables used in the expression don't change their values between the occurrences of the expression. Such expressions may contain methods of immutable classes like 'String', 'BigDecimal', and so on, and of utility classes like 'Objects', 'Math' (except 'random()'). The well-known methods, such as 'Object.equals()', 'Object.hashCode()', 'Object.toString()', 'Comparable.compareTo()', and 'Comparator.compare()' are OK as well because they normally don't have any observable side effects. Use the Expression complexity threshold option to specify the minimal expression complexity threshold. Specifying bigger numbers will remove reports on short expressions. 'Path.of' and 'Paths.get' calls are treated as equivalent calls if they have the same arguments. These calls are always reported no matter how complex their arguments are. This behaviour can be tweaked using different complexity threshold. New in 2018.3", - "markdown": "Reports multiple equivalent occurrences of the same expression within a method (or constructor, or class initializer) if the result of the expression can be reused.\n\n\nThe expression is reported if it's free of side effects and its result is always the same (in terms of `Object.equals()`).\nThe examples of such expressions are `a + b`, `Math.max(a, b)`, `a.equals(b)`,\n`s.substring(a,b)`. To make sure the result is always the same, it's verified that the variables used in the expression don't\nchange their values between the occurrences of the expression.\n\n\nSuch expressions may contain methods of immutable classes like `String`, `BigDecimal`, and so on,\nand of utility classes like `Objects`, `Math` (except `random()`).\nThe well-known methods, such as `Object.equals()`, `Object.hashCode()`, `Object.toString()`,\n`Comparable.compareTo()`, and `Comparator.compare()` are OK as well because they normally don't have\nany observable side effects.\n\n\nUse the **Expression complexity threshold** option to specify the minimal expression complexity threshold. Specifying bigger\nnumbers will remove reports on short expressions.\n\n\n`Path.of` and `Paths.get` calls are treated as equivalent calls if they have the same arguments. These calls\nare always reported no matter how complex their arguments are. This behaviour can be tweaked using different complexity threshold.\n\nNew in 2018.3" + "text": "Reports numeric values returned from methods that don't conform to the declared method return range. You can declare method return range using a number of annotations: 'org.jetbrains.annotations.Range' from JetBrains annotations package (specify 'from' and 'to') 'org.checkerframework.common.value.qual.IntRange' from Checker Framework annotations package (specify 'from' and 'to') 'org.checkerframework.checker.index.qual.GTENegativeOne' from Checker Framework annotations package (range is '>= -1') 'org.checkerframework.checker.index.qual.NonNegative' from Checker Framework annotations package (range is '>= 0') 'org.checkerframework.checker.index.qual.Positive' from Checker Framework annotations package (range is '> 0') 'javax.annotation.Nonnegative' from JSR 305 annotations package (range is '>= 0') 'javax.validation.constraints.Min' (specify minimum value) 'javax.validation.constraints.Max' (specify maximum value) Example: '@Range(from = 0, to = Integer.MAX_VALUE) int getValue() {\n // Warning: -1 is outside of declared range\n return -1;\n }' New in 2021.2", + "markdown": "Reports numeric values returned from methods that don't conform to the declared method return range. You can declare method return range using a number of annotations:\n\n* `org.jetbrains.annotations.Range` from JetBrains annotations package (specify 'from' and 'to')\n* `org.checkerframework.common.value.qual.IntRange` from Checker Framework annotations package (specify 'from' and 'to')\n* `org.checkerframework.checker.index.qual.GTENegativeOne` from Checker Framework annotations package (range is '\\>= -1')\n* `org.checkerframework.checker.index.qual.NonNegative` from Checker Framework annotations package (range is '\\>= 0')\n* `org.checkerframework.checker.index.qual.Positive` from Checker Framework annotations package (range is '\\> 0')\n* `javax.annotation.Nonnegative` from JSR 305 annotations package (range is '\\>= 0')\n* `javax.validation.constraints.Min` (specify minimum value)\n* `javax.validation.constraints.Max` (specify maximum value)\n\nExample:\n\n\n @Range(from = 0, to = Integer.MAX_VALUE) int getValue() {\n // Warning: -1 is outside of declared range\n return -1;\n }\n\nNew in 2021.2" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "DuplicateExpressions", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnsatisfiedRange", + "cweIds": [ + 129, + 682 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -25302,19 +25217,22 @@ ] }, { - "id": "BooleanConstructor", + "id": "SystemSetSecurityManager", "shortDescription": { - "text": "Boolean constructor call" + "text": "Call to 'System.setSecurityManager()'" }, "fullDescription": { - "text": "Reports creation of 'Boolean' objects. Constructing new 'Boolean' objects is rarely necessary, and may cause performance problems if done often enough. Also, 'Boolean' constructors are deprecated since Java 9 and could be removed or made inaccessible in future Java versions. Example: 'Boolean b1 = new Boolean(true);\n Boolean b2 = new Boolean(str);' After the quick-fix is applied: 'Boolean b1 = Boolean.TRUE;\n Boolean b2 = Boolean.valueOf(str);'", - "markdown": "Reports creation of `Boolean` objects.\n\n\nConstructing new `Boolean` objects is rarely necessary,\nand may cause performance problems if done often enough. Also, `Boolean`\nconstructors are deprecated since Java 9 and could be removed or made\ninaccessible in future Java versions.\n\n**Example:**\n\n\n Boolean b1 = new Boolean(true);\n Boolean b2 = new Boolean(str);\n\nAfter the quick-fix is applied:\n\n\n Boolean b1 = Boolean.TRUE;\n Boolean b2 = Boolean.valueOf(str);\n" + "text": "Reports calls to 'System.setSecurityManager()'. While often benign, any call to 'System.setSecurityManager()' should be closely examined in any security audit.", + "markdown": "Reports calls to `System.setSecurityManager()`.\n\nWhile often benign, any call to `System.setSecurityManager()` should be closely examined in any security audit." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BooleanConstructorCall", + "suppressToolId": "CallToSystemSetSecurityManager", + "cweIds": [ + 250 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25322,8 +25240,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -25335,28 +25253,28 @@ ] }, { - "id": "TooBroadScope", + "id": "ClassWithTooManyDependencies", "shortDescription": { - "text": "Scope of variable is too broad" + "text": "Class with too many dependencies" }, "fullDescription": { - "text": "Reports any variable declarations that can be moved to a smaller scope. This inspection is especially useful for Pascal style declarations at the beginning of a method. Additionally variables with too broad a scope are also often left behind after refactorings. Example: 'StringBuilder sb = new StringBuilder();\n System.out.println();\n sb.append(1);' After the quick-fix is applied: 'System.out.println();\n StringBuilder sb = new StringBuilder();\n sb.append(1);' Configure the inspection: Use the Only report variables that can be moved into inner blocks option to report only those variables that can be moved inside deeper code blocks. For example, when the option is enabled, the movement will not be suggested for the 'sb' variable above. However, it will be suggested for the following code: 'StringBuilder sb = new StringBuilder(a);\n if (flag) {\n sb.append(1);\n }' Use the Report variables with a new expression as initializer (potentially unsafe) option to report variables that are initialized with a new expression. This makes the inspection potentially unsafe when the constructor has non-local side effects. For example, when the option is enabled, the movement will be suggested for the 'foo' variable: 'class Foo {\n static List fooList = new ArrayList<>();\n String bar;\n\n Foo(String bar) {\n this.bar = bar;\n fooList.add(this);\n }\n\n public static void main(String[] args) {\n // movement is possible even though is unsafe\n Foo foo = new Foo(\"bar\");\n System.out.println(fooList.size());\n System.out.println(foo.bar);\n }\n }'", - "markdown": "Reports any variable declarations that can be moved to a smaller scope.\n\nThis inspection is especially\nuseful for *Pascal style* declarations at the beginning of a method. Additionally variables with too broad a\nscope are also often left behind after refactorings.\n\n**Example:**\n\n\n StringBuilder sb = new StringBuilder();\n System.out.println();\n sb.append(1);\n\nAfter the quick-fix is applied:\n\n\n System.out.println();\n StringBuilder sb = new StringBuilder();\n sb.append(1);\n\nConfigure the inspection:\n\n* Use the **Only report variables that can be moved into inner blocks** option to report only those variables that can be moved inside deeper code blocks. For example, when the option is enabled, the movement will not be suggested for the `sb` variable above. However, it will be suggested for the following code:\n\n\n StringBuilder sb = new StringBuilder(a);\n if (flag) {\n sb.append(1);\n }\n\n* Use the **Report variables with a new expression as initializer\n (potentially unsafe)** option to report variables that are initialized with a new expression. This makes the inspection potentially unsafe when the constructor has non-local side effects. For example, when the option is enabled, the movement will be suggested for the `foo` variable:\n\n\n class Foo {\n static List fooList = new ArrayList<>();\n String bar;\n\n Foo(String bar) {\n this.bar = bar;\n fooList.add(this);\n }\n\n public static void main(String[] args) {\n // movement is possible even though is unsafe\n Foo foo = new Foo(\"bar\");\n System.out.println(fooList.size());\n System.out.println(foo.bar);\n }\n }\n" + "text": "Reports classes that are directly dependent on too many other classes in the project. Modifications to any dependency of such classes may require changing the class, thus making it prone to instability. Only top-level classes are reported. Use the Maximum number of dependencies field to specify the maximum allowed number of 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 dependent on too many other classes in the project.\n\nModifications to any dependency of such classes may require changing the class, thus making it prone to instability.\n\nOnly top-level classes are reported.\n\nUse the **Maximum number of dependencies** field to specify the maximum allowed number of dependencies for 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": "note", + "level": "warning", "parameters": { - "suppressToolId": "TooBroadScope", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ClassWithTooManyDependencies", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Java/Dependency issues", + "index": 146, "toolComponent": { "name": "QDJVM" } @@ -25368,19 +25286,19 @@ ] }, { - "id": "ThrowableSupplierOnlyThrowException", + "id": "ClassWithoutNoArgConstructor", "shortDescription": { - "text": "Throwable supplier never returns a value" + "text": "Class without no-arg constructor" }, "fullDescription": { - "text": "Reports 'Supplier' lambdas in 'Optional.orElseThrow()' calls that throw an exception, instead of returning it. Example: 'optional.orElseThrow(() -> {\n throw new RuntimeException();\n});' After the quick-fix is applied: 'optional.orElseThrow(() -> new RuntimeException());' New in 2023.1", - "markdown": "Reports `Supplier` lambdas in `Optional.orElseThrow()` calls that throw an exception, instead of returning it.\n\n**Example:**\n\n\n optional.orElseThrow(() -> {\n throw new RuntimeException();\n });\n\nAfter the quick-fix is applied:\n\n\n optional.orElseThrow(() -> new RuntimeException());\n\nNew in 2023.1" + "text": "Reports classes without a constructor that takes no arguments (i.e. has no parameters). No-arg constructors are necessary in some contexts. For example, if a class needs to be created using reflection. Example: 'public class Bean {\n private String name;\n\n public Bean(String name) {\n this.name = name;\n }\n }' Use the checkbox below to ignore classes without explicit constructors. The compiler provides a default no-arg constructor to such classes.", + "markdown": "Reports classes without a constructor that takes no arguments (i.e. has no parameters). No-arg constructors are necessary in some contexts. For example, if a class needs to be created using reflection.\n\n**Example:**\n\n\n public class Bean {\n private String name;\n\n public Bean(String name) {\n this.name = name;\n }\n }\n\n\nUse the checkbox below to ignore classes without explicit constructors.\nThe compiler provides a default no-arg constructor to such classes." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ThrowableSupplierOnlyThrowException", + "suppressToolId": "ClassWithoutNoArgConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25388,8 +25306,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/JavaBeans issues", + "index": 141, "toolComponent": { "name": "QDJVM" } @@ -25401,19 +25319,22 @@ ] }, { - "id": "IfStatementMissingBreakInLoop", + "id": "CastConflictsWithInstanceof", "shortDescription": { - "text": "Early loop exit in 'if' condition" + "text": "Cast conflicts with 'instanceof'" }, "fullDescription": { - "text": "Reports loops with an 'if' statement that can end with 'break' without changing the semantics. This prevents redundant loop iterations. Example: 'boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n }\n }' After the quick-fix is applied: 'boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n break;\n }\n }' New in 2019.2", - "markdown": "Reports loops with an `if` statement that can end with `break` without changing the semantics. This prevents redundant loop iterations.\n\n**Example:**\n\n\n boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n break;\n }\n }\n\nNew in 2019.2" + "text": "Reports type cast expressions that are preceded by an 'instanceof' check for a different type. Although this might be intended, such a construct is most likely an error, and will result in a 'java.lang.ClassCastException' at runtime. Example: 'class Main {\n int whenCharSequenceCastToNumber(Object o){\n if (o instanceof CharSequence) {\n return ((Number) o).intValue();\n }\n return 0;\n }\n\n int earlyReturnWhenNotCharSequence(Object o){\n if (!(o instanceof CharSequence)) return 0;\n return ((Number)o).intValue();\n }\n }'", + "markdown": "Reports type cast expressions that are preceded by an `instanceof` check for a different type.\n\n\nAlthough this might be intended, such a construct is most likely an error, and will\nresult in a `java.lang.ClassCastException` at runtime.\n\n**Example:**\n\n\n class Main {\n int whenCharSequenceCastToNumber(Object o){\n if (o instanceof CharSequence) {\n return ((Number) o).intValue();\n }\n return 0;\n }\n\n int earlyReturnWhenNotCharSequence(Object o){\n if (!(o instanceof CharSequence)) return 0;\n return ((Number)o).intValue();\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IfStatementMissingBreakInLoop", + "suppressToolId": "CastConflictsWithInstanceof", + "cweIds": [ + 704 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25421,8 +25342,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -25434,19 +25355,19 @@ ] }, { - "id": "RedundantStreamOptionalCall", + "id": "Contract", "shortDescription": { - "text": "Redundant step in 'Stream' or 'Optional' call chain" + "text": "Contract issues" }, "fullDescription": { - "text": "Reports redundant 'Stream' or 'Optional' calls like 'map(x -> x)', 'filter(x -> true)' or redundant 'sorted()' or 'distinct()' calls. Note that a mapping operation in code like 'streamOfIntegers.map(Integer::valueOf)' works as 'requireNonNull()' check: if the stream contains 'null', it throws a 'NullPointerException', thus it's not absolutely redundant. Disable the Report redundant boxing in Stream.map() option if you do not want such cases to be reported. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports redundant `Stream` or `Optional` calls like `map(x -> x)`, `filter(x -> true)` or redundant `sorted()` or `distinct()` calls.\n\nNote that a mapping operation in code like `streamOfIntegers.map(Integer::valueOf)`\nworks as `requireNonNull()` check:\nif the stream contains `null`, it throws a `NullPointerException`, thus it's not absolutely redundant.\nDisable the **Report redundant boxing in Stream.map()** option if you do not want such cases to be reported.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "text": "Reports issues in method '@Contract' annotations. The types of issues that can be reported are: Errors in contract syntax Contracts that do not conform to the method signature (wrong parameter count) Method implementations that contradict the contract (e.g. return 'true' when the contract says 'false') Example: '// method has no parameters, but contract expects 1\n @Contract(\"_ -> fail\")\n void x() {\n throw new AssertionError();\n }'", + "markdown": "Reports issues in method `@Contract` annotations. The types of issues that can be reported are:\n\n* Errors in contract syntax\n* Contracts that do not conform to the method signature (wrong parameter count)\n* Method implementations that contradict the contract (e.g. return `true` when the contract says `false`)\n\nExample:\n\n\n // method has no parameters, but contract expects 1\n @Contract(\"_ -> fail\")\n void x() {\n throw new AssertionError();\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantStreamOptionalCall", + "suppressToolId": "Contract", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25454,8 +25375,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -25467,19 +25388,19 @@ ] }, { - "id": "ThreadPriority", + "id": "NewExceptionWithoutArguments", "shortDescription": { - "text": "Call to 'Thread.setPriority()'" + "text": "Exception constructor called without arguments" }, "fullDescription": { - "text": "Reports calls to 'Thread.setPriority()'. Modifying priorities of threads is an inherently non-portable operation, as no guarantees are given in the Java specification of how priorities are used in scheduling threads, or even whether they are used at all.", - "markdown": "Reports calls to `Thread.setPriority()`. Modifying priorities of threads is an inherently non-portable operation, as no guarantees are given in the Java specification of how priorities are used in scheduling threads, or even whether they are used at all." + "text": "Reports creation of a exception instance without any arguments specified. When an exception is constructed without any arguments, it contains no information about the problem that occurred, which makes debugging needlessly hard. Example: 'throw new IOException(); // warning: exception without arguments'", + "markdown": "Reports creation of a exception instance without any arguments specified.\n\nWhen an exception is constructed without any arguments, it contains no information about the problem that occurred, which makes\ndebugging needlessly hard.\n\n**Example:**\n\n\n throw new IOException(); // warning: exception without arguments\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToThreadSetPriority", + "suppressToolId": "NewExceptionWithoutArguments", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25487,8 +25408,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -25500,28 +25421,28 @@ ] }, { - "id": "RedundantStringFormatCall", + "id": "EnhancedSwitchBackwardMigration", "shortDescription": { - "text": "Redundant call to 'String.format()'" + "text": "Enhanced 'switch'" }, "fullDescription": { - "text": "Reports calls to methods like 'format()' and 'printf()' that can be safely removed or simplified. Example: 'System.out.println(String.format(\"Total count: %d\", 42));' After the quick-fix is applied: 'System.out.printf(\"Total count: %d%n\", 42);'", - "markdown": "Reports calls to methods like `format()` and `printf()` that can be safely removed or simplified.\n\n**Example:**\n\n\n System.out.println(String.format(\"Total count: %d\", 42));\n\nAfter the quick-fix is applied:\n\n\n System.out.printf(\"Total count: %d%n\", 42);\n" + "text": "Reports enhanced 'switch' statements and expressions. Suggests replacing them with regular 'switch' statements. Example: 'boolean even = switch (condition) {\n case 1, 3, 5, 7, 9 -> false;\n default -> true;\n };' After the quick-fix is applied: 'boolean even;\n switch (condition) {\n case 1:\n case 3:\n case 5:\n case 7:\n case 9:\n even = false;\n break;\n default:\n even = true;\n break;\n}' Enhanced 'switch' appeared in Java 14. This inspection can help to downgrade for backward compatibility with earlier Java versions. New in 2019.1", + "markdown": "Reports enhanced `switch` statements and expressions. Suggests replacing them with regular `switch` statements.\n\n**Example:**\n\n\n boolean even = switch (condition) {\n case 1, 3, 5, 7, 9 -> false;\n default -> true;\n };\n\nAfter the quick-fix is applied:\n\n\n boolean even;\n switch (condition) {\n case 1:\n case 3:\n case 5:\n case 7:\n case 9:\n even = false;\n break;\n default:\n even = true;\n break;\n }\n\n\n*Enhanced* `switch` appeared in Java 14.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions.\n\nNew in 2019.1" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "RedundantStringFormatCall", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "EnhancedSwitchBackwardMigration", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Java language level migration aids/Java 14", + "index": 138, "toolComponent": { "name": "QDJVM" } @@ -25533,19 +25454,19 @@ ] }, { - "id": "NonFinalFieldOfException", + "id": "PackageWithTooManyClasses", "shortDescription": { - "text": "Non-final field of 'Exception' class" + "text": "Package with too many classes" }, "fullDescription": { - "text": "Reports fields in subclasses of 'java.lang.Exception' that are not declared 'final'. Data on exception objects should not be modified because this may result in losing the error context for later debugging and logging. Example: 'public class EditorException extends Exception {\n private String message; // warning: Non-final field 'message' of exception class\n }'", - "markdown": "Reports fields in subclasses of `java.lang.Exception` that are not declared `final`.\n\nData on exception objects should not be modified\nbecause this may result in losing the error context for later debugging and logging.\n\n**Example:**\n\n\n public class EditorException extends Exception {\n private String message; // warning: Non-final field 'message' of exception class\n }\n" + "text": "Reports packages that contain too many classes. Overly large packages may indicate a lack of design clarity. 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 allowed number of classes in a package.", + "markdown": "Reports packages that contain too many classes.\n\nOverly large packages may indicate a lack of design clarity.\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 allowed number of classes in a package." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonFinalFieldOfException", + "suppressToolId": "PackageWithTooManyClasses", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25553,8 +25474,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Packaging issues", + "index": 46, "toolComponent": { "name": "QDJVM" } @@ -25566,28 +25487,28 @@ ] }, { - "id": "PointlessNullCheck", + "id": "LoggingGuardedByCondition", "shortDescription": { - "text": "Unnecessary 'null' check before method call" + "text": "Logging calls guarded by log condition" }, "fullDescription": { - "text": "Reports 'null' checks followed by a method call that will definitely return 'false' when 'null' is passed (e.g. 'Class.isInstance'). Such a check seems excessive as the method call will always return 'false' in this case. Example: 'if (x != null && myClass.isInstance(x)) { ... }' After the quick-fix is applied: 'if (myClass.isInstance(x)) { ... }'", - "markdown": "Reports `null` checks followed by a method call that will definitely return `false` when `null` is passed (e.g. `Class.isInstance`).\n\nSuch a check seems excessive as the method call will always return `false` in this case.\n\n**Example:**\n\n\n if (x != null && myClass.isInstance(x)) { ... }\n\nAfter the quick-fix is applied:\n\n\n if (myClass.isInstance(x)) { ... }\n" + "text": "Reports logging calls surrounded with a guard condition. This inspection can be used to adjust with a custom code style. Example: 'public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }' After a quick-fix is applied: 'public class TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }' This inspection supports Log4j2 and the SLF4J logging frameworks (except builders). New in 2024.2", + "markdown": "Reports logging calls surrounded with a guard condition. This inspection can be used to adjust with a custom code style.\n\n**Example:**\n\n\n public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }\n\nAfter a quick-fix is applied:\n\n\n public class TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n\nThis inspection supports *Log4j2* and the *SLF4J* logging frameworks (except builders).\n\nNew in 2024.2" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "PointlessNullCheck", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LoggingGuardedByCondition", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "JVM languages/Logging", + "index": 52, "toolComponent": { "name": "QDJVM" } @@ -25599,19 +25520,19 @@ ] }, { - "id": "MethodOverridesStaticMethod", + "id": "TryFinallyCanBeTryWithResources", "shortDescription": { - "text": "Method tries to override 'static' method of superclass" + "text": "'try finally' can be replaced with 'try' with resources" }, "fullDescription": { - "text": "Reports 'static' methods with a signature identical to a 'static' method of a superclass. Such a method may look like an override when in fact it hides the method from the superclass because 'static' methods in Java cannot be overridden. Example: 'class Parent {\n static void method(){}\n }\n\n class Example extends Parent {\n static void method(){} //warning\n }'", - "markdown": "Reports `static` methods with a signature identical to a `static` method of a superclass. Such a method may look like an override when in fact it hides the method from the superclass because `static` methods in Java cannot be overridden.\n\n**Example:**\n\n\n class Parent {\n static void method(){}\n }\n\n class Example extends Parent {\n static void method(){} //warning\n }\n" + "text": "Reports 'try'-'finally' statements that can use Java 7 Automatic Resource Management, which is less error-prone. A quick-fix is available to convert a 'try'-'finally' statement into a 'try'-with-resources statement. Example: 'PrintStream printStream = new PrintStream(fileName);\n try {\n printStream.print(true);\n } finally {\n printStream.close();\n }' A quick-fix is provided to pass the cause to a constructor: 'try (PrintStream printStream = new PrintStream(fileName)) {\n printStream.print(true);\n }' This inspection depends on the Java feature 'Try-with-resources', which is available since Java 7.", + "markdown": "Reports `try`-`finally` statements that can use Java 7 Automatic Resource Management, which is less error-prone.\n\nA quick-fix is available to convert a `try`-`finally`\nstatement into a `try`-with-resources statement.\n\n**Example:**\n\n\n PrintStream printStream = new PrintStream(fileName);\n try {\n printStream.print(true);\n } finally {\n printStream.close();\n }\n\nA quick-fix is provided to pass the cause to a constructor:\n\n\n try (PrintStream printStream = new PrintStream(fileName)) {\n printStream.print(true);\n }\n\nThis inspection depends on the Java feature 'Try-with-resources', which is available since Java 7." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MethodOverridesStaticMethodOfSuperclass", + "suppressToolId": "TryFinallyCanBeTryWithResources", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25619,8 +25540,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Java language level migration aids/Java 7", + "index": 161, "toolComponent": { "name": "QDJVM" } @@ -25632,19 +25553,19 @@ ] }, { - "id": "RedundantCompareToJavaTime", + "id": "SamePackageImport", "shortDescription": { - "text": "Expression with 'java.time' 'compareTo()' call can be simplified" + "text": "Unnecessary import from the same package" }, "fullDescription": { - "text": "Reports 'java.time' comparisons with 'compareTo()' calls that can be replaced with 'isAfter()', 'isBefore()' or 'isEqual()' calls. Example: 'LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.compareTo(date2) > 0;' After the quick-fix is applied: 'LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.isAfter(date2);' New in 2022.3", - "markdown": "Reports `java.time` comparisons with `compareTo()` calls that can be replaced with `isAfter()`, `isBefore()` or `isEqual()` calls.\n\nExample:\n\n\n LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.compareTo(date2) > 0;\n\nAfter the quick-fix is applied:\n\n\n LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.isAfter(date2);\n\nNew in 2022.3" + "text": "Reports 'import' statements that refer to the same package as the containing file. Same-package files 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 same package as the containing file.\n\n\nSame-package files are always implicitly imported, so such `import`\nstatements are redundant and confusing.\n\n\nSince IntelliJ IDEA can automatically detect and fix such statements with its **Optimize Imports**\ncommand, this inspection is mostly useful for offline reporting on code bases that you\ndon't intend to change." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantCompareToJavaTime", + "suppressToolId": "SamePackageImport", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25652,8 +25573,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Imports", + "index": 24, "toolComponent": { "name": "QDJVM" } @@ -25665,28 +25586,28 @@ ] }, { - "id": "UnclearBinaryExpression", + "id": "ThreadLocalSetWithNull", "shortDescription": { - "text": "Multiple operators with different precedence" + "text": "'ThreadLocal.set()' with null as an argument" }, "fullDescription": { - "text": "Reports binary, conditional, or 'instanceof' expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: 'int n = 3 + 9 * 8 + 1;' After quick-fix is applied: 'int n = 3 + (9 * 8) + 1;'", - "markdown": "Reports binary, conditional, or `instanceof` expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators.\n\nExample:\n\n\n int n = 3 + 9 * 8 + 1;\n\nAfter quick-fix is applied:\n\n\n int n = 3 + (9 * 8) + 1;\n" + "text": "Reports 'java.lang.ThreadLocal.set()' with null as an argument. This call does not free the resources, and it may cause a memory leak. It may happen because: Firstly, 'ThreadLocal.set(null)' finds a map associated with the current Thread. If there is no such a map, it will be created It sets key and value: 'map.set(this, value)', where 'this' refers to instance of 'ThreadLocal' 'java.lang.ThreadLocal.remove()' should be used to free the resources. Example: 'ThreadLocal threadLocal = new ThreadLocal<>();\n threadLocal.set(null);' After the quick-fix is applied: 'threadLocal.remove();' New in 2023.2", + "markdown": "Reports `java.lang.ThreadLocal.set()` with null as an argument.\n\nThis call does not free the resources, and it may cause a memory leak.\nIt may happen because:\n\n* Firstly, `ThreadLocal.set(null)` finds a map associated with the current Thread. If there is no such a map, it will be created\n* It sets key and value: `map.set(this, value)`, where `this` refers to instance of `ThreadLocal`\n\n`java.lang.ThreadLocal.remove()` should be used to free the resources.\n\nExample:\n\n\n ThreadLocal threadLocal = new ThreadLocal<>();\n threadLocal.set(null);\n\nAfter the quick-fix is applied:\n\n\n threadLocal.remove();\n\nNew in 2023.2" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "note", "parameters": { - "suppressToolId": "UnclearExpression", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ThreadLocalSetWithNull", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -25698,19 +25619,19 @@ ] }, { - "id": "ChainedMethodCall", + "id": "MissingJavadoc", "shortDescription": { - "text": "Chained method calls" + "text": "Missing Javadoc" }, "fullDescription": { - "text": "Reports method calls whose target is another method call. The quick-fix suggests to introduce a local variable. Example: 'class X {\n int foo(File f) {\n return f.getName().length();\n }\n }' After the quick-fix is applied: 'class X {\n int foo(File f) {\n final String name = f.getName();\n return name.length();\n }\n }' Use the inspection options to toggle warnings for the following cases: chained method calls in field initializers, for instance, 'private final int i = new Random().nextInt();' chained method calls operating on the same type, for instance, 'new StringBuilder().append(\"x: \").append(new X()).append(\"y: \").append(new Y()).toString();'.", - "markdown": "Reports method calls whose target is another method call. The quick-fix suggests to introduce a local variable.\n\n**Example:**\n\n\n class X {\n int foo(File f) {\n return f.getName().length();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n int foo(File f) {\n final String name = f.getName();\n return name.length();\n }\n }\n\nUse the inspection options to toggle warnings for the following cases:\n\n*\n chained method calls in field initializers,\n for instance, `private final int i = new Random().nextInt();`\n\n*\n chained method calls operating on the same type,\n for instance, `new StringBuilder().append(\"x: \").append(new X()).append(\"y: \").append(new Y()).toString();`." + "text": "Reports missing Javadoc comments and tags. Example: '/**\n * Missing \"@param\" is reported (if configured).\n */\n public void sample(int param){\n }' The quick-fixes add missing tag or missing Javadoc comment: '/**\n * Missing \"@param\" is reported (if configured).\n * @param param\n */\n public void sample(int param){\n }' Inspection can be configured to ignore deprecated elements or simple accessor methods like 'getField()' or 'setField()'. You can also use options below to configure required tags and minimal required visibility for the specific code elements like method, field, class, package, module.", + "markdown": "Reports missing Javadoc comments and tags.\n\nExample:\n\n\n /**\n * Missing \"@param\" is reported (if configured).\n */\n public void sample(int param){\n }\n\nThe quick-fixes add missing tag or missing Javadoc comment:\n\n\n /**\n * Missing \"@param\" is reported (if configured).\n * @param param\n */\n public void sample(int param){\n }\n\n\nInspection can be configured to ignore deprecated elements or simple accessor methods like `getField()` or `setField()`.\nYou can also use options below to configure required tags and minimal required visibility for the specific code elements like method, field, class, package, module." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ChainedMethodCall", + "suppressToolId": "MissingJavadoc", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25718,8 +25639,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -25731,19 +25652,19 @@ ] }, { - "id": "UtilityClassWithoutPrivateConstructor", + "id": "AwaitWithoutCorrespondingSignal", "shortDescription": { - "text": "Utility class without 'private' constructor" + "text": "'await()' without corresponding 'signal()'" }, "fullDescription": { - "text": "Reports utility classes without 'private' constructors. Utility classes have all fields and methods declared as 'static'. Creating 'private' constructors in utility classes prevents them from being accidentally instantiated. Use the Ignore if annotated by option to specify special annotations. The inspection ignores classes marked with one of these annotations. Use the Ignore classes with only a main method option to ignore classes with no methods other than the main one.", - "markdown": "Reports utility classes without `private` constructors.\n\nUtility classes have all fields and methods declared as `static`. Creating `private`\nconstructors in utility classes prevents them from being accidentally instantiated.\n\n\nUse the **Ignore if annotated by** option to specify special annotations. The inspection ignores classes marked with one of\nthese annotations.\n\n\nUse the **Ignore classes with only a main method** option to ignore classes with no methods other than the main one." + "text": "Reports calls to 'Condition.await()', for which no call to a corresponding 'Condition.signal()' or 'Condition.signalAll()' can be found. Calling 'Condition.await()' in a thread without corresponding 'Condition.signal()' may cause the thread to become disabled until it is interrupted or \"spurious wakeup\" occurs. Only calls that target fields of the current class are reported by this inspection. Example: 'class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n // isEmpty.signal();\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n isEmpty.await(); // 'await()' doesn't contain corresponding 'signal()'/'signalAll()' call\n // ...\n }\n }'", + "markdown": "Reports calls to `Condition.await()`, for which no call to a corresponding `Condition.signal()` or `Condition.signalAll()` can be found.\n\n\nCalling `Condition.await()` in a thread without corresponding `Condition.signal()` may cause the thread\nto become disabled until it is interrupted or \"spurious wakeup\" occurs.\n\nOnly calls that target fields of the current class are reported by this inspection.\n\n**Example:**\n\n\n class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n // isEmpty.signal();\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n isEmpty.await(); // 'await()' doesn't contain corresponding 'signal()'/'signalAll()' call\n // ...\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UtilityClassWithoutPrivateConstructor", + "suppressToolId": "AwaitWithoutCorrespondingSignal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25751,8 +25672,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -25764,19 +25685,19 @@ ] }, { - "id": "ExtendsUtilityClass", + "id": "Java9RedundantRequiresStatement", "shortDescription": { - "text": "Class extends utility class" + "text": "Redundant 'requires' directive in module-info" }, "fullDescription": { - "text": "Reports classes that extend a utility class. A utility class is a non-empty class in which all fields and methods are static. Extending a utility class also allows for inadvertent object instantiation of the utility class, because the constructor cannot be made private in order to allow extension. Configure the inspection: Use the Ignore if overriding class is a utility class option to ignore any classes that override a utility class but are also utility classes themselves.", - "markdown": "Reports classes that extend a utility class.\n\n\nA utility class is a non-empty class in which all fields and methods are static.\nExtending a utility class also allows for inadvertent object instantiation of the\nutility class, because the constructor cannot be made private in order to allow extension.\n\n\nConfigure the inspection:\n\n* Use the **Ignore if overriding class is a utility class** option to ignore any classes that override a utility class but are also utility classes themselves." + "text": "Reports redundant 'requires' directives in Java Platform Module System 'module-info.java' files. A 'requires' directive is redundant when a module 'A' requires a module 'B', but the code in module 'A' doesn't import any packages or classes from 'B'. Furthermore, all modules have an implicitly declared dependence on the 'java.base' module, therefore a 'requires java.base;' directive is always redundant. The quick-fix deletes the redundant 'requires' directive. If the deleted dependency re-exported modules that are actually used, the fix adds a 'requires' directives for these modules. This inspection only reports if the language level of the project or module is 9 or higher. New in 2017.1", + "markdown": "Reports redundant `requires` directives in Java Platform Module System `module-info.java` files. A `requires` directive is redundant when a module `A` requires a module `B`, but the code in module `A` doesn't import any packages or classes from `B`. Furthermore, all modules have an implicitly declared dependence on the `java.base` module, therefore a `requires java.base;` directive is always redundant.\n\n\nThe quick-fix deletes the redundant `requires` directive.\nIf the deleted dependency re-exported modules that are actually used, the fix adds a `requires` directives for these modules.\n\nThis inspection only reports if the language level of the project or module is 9 or higher.\n\nNew in 2017.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ExtendsUtilityClass", + "suppressToolId": "Java9RedundantRequiresStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25784,8 +25705,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -25797,19 +25718,19 @@ ] }, { - "id": "AssertMessageNotString", + "id": "UnnecessaryLocalVariable", "shortDescription": { - "text": "'assert' message is not a string" + "text": "Redundant local variable" }, "fullDescription": { - "text": "Reports 'assert' messages that are not of the 'java.lang.String' type. Using a string provides more information to help diagnose the failure or the assertion reason. Example: 'void foo(List myList) {\n assert myList.isEmpty() : false;\n }' Use the Only warn when the 'assert' message type is 'boolean' or 'java.lang.Boolean' option to only warn when the 'assert' message type is 'boolean' or 'java.lang.Boolean'. A 'boolean' detail message is unlikely to provide additional information about an assertion failure and could result from a mistakenly entered ':' instead of '&'. This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", - "markdown": "Reports `assert` messages that are not of the `java.lang.String` type.\n\nUsing a string provides more information to help diagnose the failure\nor the assertion reason.\n\n**Example:**\n\n\n void foo(List myList) {\n assert myList.isEmpty() : false;\n }\n\n\nUse the **Only warn when the `assert` message type is 'boolean' or 'java.lang.Boolean'** option to only warn when the `assert` message type is `boolean` or `java.lang.Boolean`.\nA `boolean` detail message is unlikely to provide additional information about an assertion failure\nand could result from a mistakenly entered `:` instead of `&`.\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." + "text": "Reports unnecessary local variables that add nothing to the comprehensibility of a method, including: Local variables that are immediately returned. Local variables that are immediately assigned to another variable and then not used. Local variables that always have the same value as another local variable or parameter. Example: 'boolean yes() {\n boolean b = true;\n return b;\n }' After the quick-fix is applied: 'boolean yes() {\n return true;\n }' Configure the inspection: Use the Ignore immediately returned or thrown variables option to ignore immediately returned or thrown variables. Some coding styles suggest using such variables for clarity and ease of debugging. Use the Ignore variables which have an annotation option to ignore annotated variables.", + "markdown": "Reports unnecessary local variables that add nothing to the comprehensibility of a method, including:\n\n* Local variables that are immediately returned.\n* Local variables that are immediately assigned to another variable and then not used.\n* Local variables that always have the same value as another local variable or parameter.\n\n**Example:**\n\n\n boolean yes() {\n boolean b = true;\n return b;\n }\n\nAfter the quick-fix is applied:\n\n\n boolean yes() {\n return true;\n }\n \nConfigure the inspection:\n\n* Use the **Ignore immediately returned or thrown variables** option to ignore immediately returned or thrown variables. Some coding styles suggest using such variables for clarity and ease of debugging.\n* Use the **Ignore variables which have an annotation** option to ignore annotated variables." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AssertMessageNotString", + "suppressToolId": "UnnecessaryLocalVariable", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25817,8 +25738,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Data flow", + "index": 65, "toolComponent": { "name": "QDJVM" } @@ -25830,19 +25751,19 @@ ] }, { - "id": "PatternVariableCanBeUsed", + "id": "BusyWait", "shortDescription": { - "text": "Pattern variable can be used" + "text": "Busy wait" }, "fullDescription": { - "text": "Reports local variable declarations that can be replaced with pattern variables, which are usually more compact. Example: 'if (obj instanceof String) {\n String str = (String) obj;\n System.out.println(str);\n }' Can be replaced with: 'if (obj instanceof String str) {\n System.out.println(str);\n }' This inspection depends on the Java feature 'Patterns in 'instanceof'', which is available since Java 16. New in 2020.1", - "markdown": "Reports local variable declarations that can be replaced with pattern variables, which are usually more compact.\n\n**Example:**\n\n\n if (obj instanceof String) {\n String str = (String) obj;\n System.out.println(str);\n }\n\nCan be replaced with:\n\n\n if (obj instanceof String str) {\n System.out.println(str);\n }\n\nThis inspection depends on the Java feature 'Patterns in 'instanceof'', which is available since Java 16.\n\nNew in 2020.1" + "text": "Reports calls to 'java.lang.Thread.sleep()' that occur inside loops. Such calls are indicative of \"busy-waiting\". Busy-waiting is often inefficient, and may result in unexpected deadlocks as busy-waiting threads do not release locked resources. Example: 'class X {\n volatile int x;\n public void waitX() throws Exception {\n while (x > 0) {\n Thread.sleep(10);//warning: Call to 'Thread.sleep()' in a loop, probably busy-waiting\n }\n }\n }'", + "markdown": "Reports calls to `java.lang.Thread.sleep()` that occur inside loops.\n\nSuch calls\nare indicative of \"busy-waiting\". Busy-waiting is often inefficient, and may result in unexpected deadlocks\nas busy-waiting threads do not release locked resources.\n\n**Example:**\n\n\n class X {\n volatile int x;\n public void waitX() throws Exception {\n while (x > 0) {\n Thread.sleep(10);//warning: Call to 'Thread.sleep()' in a loop, probably busy-waiting\n }\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PatternVariableCanBeUsed", + "suppressToolId": "BusyWait", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25850,8 +25771,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 16", - "index": 188, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -25863,28 +25784,28 @@ ] }, { - "id": "ImplicitToExplicitClassBackwardMigration", + "id": "ForLoopWithMissingComponent", "shortDescription": { - "text": "Implicitly declared class can be replaced with ordinary class" + "text": "'for' loop with missing components" }, "fullDescription": { - "text": "Reports implicitly declared classes and suggests replacing them with regular classes. Example (in file Sample.java): 'public static void main() {\n System.out.println(\"Hello, world!\");\n }' After the quick-fix is applied: 'public class Sample {\n public static void main() {\n System.out.println(\"Hello, world!\");\n }\n}' This inspection can help to downgrade for backward compatibility with earlier Java versions. This inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview. New in 2024.1", - "markdown": "Reports implicitly declared classes and suggests replacing them with regular classes.\n\n**Example (in file Sample.java):**\n\n\n public static void main() {\n System.out.println(\"Hello, world!\");\n }\n\nAfter the quick-fix is applied:\n\n\n public class Sample {\n public static void main() {\n System.out.println(\"Hello, world!\");\n }\n }\n\n\nThis inspection can help to downgrade for backward compatibility with earlier Java versions.\n\nThis inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview.\n\nNew in 2024.1" + "text": "Reports 'for' loops that lack initialization, condition, or update clauses. Some coding styles prohibit such loops. Example: 'for (int i = 0;;i++) {\n // body\n }' Use the Ignore collection iterations option to ignore loops which use an iterator. This is a standard way to iterate over a collection in which the 'for' loop does not have an update clause.", + "markdown": "Reports `for` loops that lack initialization, condition, or update clauses. Some coding styles prohibit such loops.\n\nExample:\n\n\n for (int i = 0;;i++) {\n // body\n }\n\n\nUse the **Ignore collection iterations** option to ignore loops which use an iterator.\nThis is a standard way to iterate over a collection in which the `for` loop does not have an update clause." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ImplicitToExplicitClassBackwardMigration", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ForLoopWithMissingComponent", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 21", - "index": 195, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -25896,19 +25817,19 @@ ] }, { - "id": "AnonymousClassVariableHidesContainingMethodVariable", + "id": "OverwrittenKey", "shortDescription": { - "text": "Anonymous class variable hides variable in containing method" + "text": "Overwritten Map, Set, or array element" }, "fullDescription": { - "text": "Reports fields in an anonymous class that are named identically to local variables or parameters of the containing method or lambda expression. As a result of such naming, you may accidentally use the anonymous class field where the identically named variable or parameter from the containing method is intended. A quick-fix is suggested to rename the field. Example: 'class Test {\n public Test(String value) {\n Object foo = new Object() {\n private String value = \"TEST\";\n public void foo() {\n System.out.println(value); //the field is accessed, not the parameter\n }\n };\n }\n }'", - "markdown": "Reports fields in an anonymous class that are named identically to local variables or parameters of the containing method or lambda expression.\n\n\nAs a result of such naming, you may accidentally use the anonymous class field where\nthe identically named variable or parameter from the containing method is intended.\n\nA quick-fix is suggested to rename the field.\n\n**Example:**\n\n\n class Test {\n public Test(String value) {\n Object foo = new Object() {\n private String value = \"TEST\";\n public void foo() {\n System.out.println(value); //the field is accessed, not the parameter\n }\n };\n }\n }\n" + "text": "Reports code that overwrites a 'Map' key, a 'Set' element, or an array element in a sequence of 'add'/'put' calls or using a Java 9 factory method like 'Set.of' (which will result in runtime exception). This usually occurs due to a copy-paste error. Example: 'map.put(\"A\", 1);\n map.put(\"B\", 2);\n map.put(\"C\", 3);\n map.put(\"D\", 4);\n map.put(\"A\", 5); // duplicating key \"A\", overwrites the previously written entry' New in 2017.3", + "markdown": "Reports code that overwrites a `Map` key, a `Set` element, or an array element in a sequence of `add`/`put` calls or using a Java 9 factory method like `Set.of` (which will result in runtime exception).\n\nThis usually occurs due to a copy-paste error.\n\n**Example:**\n\n\n map.put(\"A\", 1);\n map.put(\"B\", 2);\n map.put(\"C\", 3);\n map.put(\"D\", 4);\n map.put(\"A\", 5); // duplicating key \"A\", overwrites the previously written entry\n\nNew in 2017.3" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AnonymousClassVariableHidesContainingMethodVariable", + "suppressToolId": "OverwrittenKey", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25916,8 +25837,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -25929,28 +25850,28 @@ ] }, { - "id": "MethodRefCanBeReplacedWithLambda", + "id": "AnonymousClassMethodCount", "shortDescription": { - "text": "Method reference can be replaced with lambda" + "text": "Anonymous class with too many methods" }, "fullDescription": { - "text": "Reports method references, like 'MyClass::myMethod' and 'myObject::myMethod', and suggests replacing them with an equivalent lambda expression. Lambda expressions can be easier to modify than method references. Example: 'System.out::println' After the quick-fix is applied: 's -> System.out.println(s)' By default, this inspection does not highlight the code in the editor, but only provides a quick-fix. This inspection depends on the following Java features: Lambda expressions Method references These features are available since Java 8.", - "markdown": "Reports method references, like `MyClass::myMethod` and `myObject::myMethod`, and suggests replacing them with an equivalent lambda expression.\n\nLambda expressions can be easier to modify than method references.\n\nExample:\n\n\n System.out::println\n\nAfter the quick-fix is applied:\n\n\n s -> System.out.println(s)\n\nBy default, this inspection does not highlight the code in the editor, but only provides a quick-fix.\n\nThis inspection depends on the following Java features:\n\n* Lambda expressions\n* Method references\n\nThese features are available since Java 8." + "text": "Reports anonymous inner classes whose method count exceeds the specified maximum. Anonymous classes with numerous methods may be difficult to understand and should be promoted to become named inner classes. Use the Method count limit field to specify the maximum allowed number of methods in an anonymous inner class.", + "markdown": "Reports anonymous inner classes whose method count exceeds the specified maximum.\n\nAnonymous classes with numerous methods may be\ndifficult to understand and should be promoted to become named inner classes.\n\nUse the **Method count limit** field to specify the maximum allowed number of methods in an anonymous inner class." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MethodRefCanBeReplacedWithLambda", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "AnonymousInnerClassWithTooManyMethods", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -25962,19 +25883,19 @@ ] }, { - "id": "NestedSynchronizedStatement", + "id": "OptionalOfNullableMisuse", "shortDescription": { - "text": "Nested 'synchronized' statement" + "text": "Use of Optional.ofNullable with null or not-null argument" }, "fullDescription": { - "text": "Reports nested 'synchronized' statements. It is recommended to avoid nested synchronization if possible, because in some cases it may lead to a deadlock. Example: 'synchronized (lockA){\n //thread 1 is waiting for lockB\n synchronized (lockB){ //warning\n }\n }\n ...\n synchronized (lockB) {\n //thread 2 is waiting for lockA\n synchronized (lockA) { //warning\n }\n }'", - "markdown": "Reports nested `synchronized` statements. It is recommended to avoid nested synchronization if possible, because in some cases it may lead to a deadlock.\n\n**Example:**\n\n\n synchronized (lockA){\n //thread 1 is waiting for lockB\n synchronized (lockB){ //warning\n }\n }\n ...\n synchronized (lockB) {\n //thread 2 is waiting for lockA\n synchronized (lockA) { //warning\n }\n }\n" + "text": "Reports uses of 'Optional.ofNullable()' where always null or always not-null argument is passed. There's no point in using 'Optional.ofNullable()' in this case: either 'Optional.empty()' or 'Optional.of()' should be used to explicitly state the intent of creating an always-empty or always non-empty optional respectively. It's also possible that there's a mistake in 'Optional.ofNullable()' argument, so it should be examined. Example: 'Optional empty = Optional.ofNullable(null); // should be Optional.empty();\nOptional present = Optional.ofNullable(\"value\"); // should be Optional.of(\"value\");' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports uses of `Optional.ofNullable()` where always null or always not-null argument is passed. There's no point in using `Optional.ofNullable()` in this case: either `Optional.empty()` or `Optional.of()` should be used to explicitly state the intent of creating an always-empty or always non-empty optional respectively. It's also possible that there's a mistake in `Optional.ofNullable()` argument, so it should be examined.\n\n\nExample:\n\n\n Optional empty = Optional.ofNullable(null); // should be Optional.empty();\n Optional present = Optional.ofNullable(\"value\"); // should be Optional.of(\"value\"); \n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NestedSynchronizedStatement", + "suppressToolId": "OptionalOfNullableMisuse", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -25982,8 +25903,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -25995,19 +25916,22 @@ ] }, { - "id": "IncorrectDateTimeFormat", + "id": "CastToIncompatibleInterface", "shortDescription": { - "text": "Incorrect 'DateTimeFormat' pattern" + "text": "Cast to incompatible type" }, "fullDescription": { - "text": "Reports incorrect date time format patterns. The following errors are reported: Unsupported pattern letters, like \"TT\" Using reserved characters, like \"#\" Incorrect use of padding Unbalanced brackets Incorrect amount of consecutive pattern letters Examples: 'DateTimeFormatter.ofPattern(\"[][]]\"); // Closing ']' without previous opening '['\n DateTimeFormatter.ofPattern(\"TT\"); // Illegal pattern letter 'T'\n DateTimeFormatter.ofPattern(\"{\"); // Use of reserved character '{'\n DateTimeFormatter.ofPattern(\"MMMMMM\"); // Too many consecutive pattern letters 'M'' New in 2022.3", - "markdown": "Reports incorrect date time format patterns.\n\nThe following errors are reported:\n\n* Unsupported pattern letters, like \"TT\"\n* Using reserved characters, like \"#\"\n* Incorrect use of padding\n* Unbalanced brackets\n* Incorrect amount of consecutive pattern letters\n\nExamples:\n\n\n DateTimeFormatter.ofPattern(\"[][]]\"); // Closing ']' without previous opening '['\n DateTimeFormatter.ofPattern(\"TT\"); // Illegal pattern letter 'T'\n DateTimeFormatter.ofPattern(\"{\"); // Use of reserved character '{'\n DateTimeFormatter.ofPattern(\"MMMMMM\"); // Too many consecutive pattern letters 'M'\n\nNew in 2022.3" + "text": "Reports type cast expressions where the casted expression has a class/interface type that neither extends/implements the cast class/interface type, nor has subclasses that do. Such a construct is likely erroneous, and will throw a 'java.lang.ClassCastException' at runtime. Example: 'interface A {}\n interface Z {}\n static class C {}\n\n void x(C c) {\n if (c instanceof Z) {\n A a = ((A)c); // cast to incompatible interface 'A'\n }\n }'", + "markdown": "Reports type cast expressions where the casted expression has a class/interface type that neither extends/implements the cast class/interface type, nor has subclasses that do.\n\n\nSuch a construct is likely erroneous, and will\nthrow a `java.lang.ClassCastException` at runtime.\n\n**Example:**\n\n\n interface A {}\n interface Z {}\n static class C {}\n\n void x(C c) {\n if (c instanceof Z) {\n A a = ((A)c); // cast to incompatible interface 'A'\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IncorrectDateTimeFormat", + "suppressToolId": "CastToIncompatibleInterface", + "cweIds": [ + 704 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26028,28 +25952,28 @@ ] }, { - "id": "UnnecessaryFullyQualifiedName", + "id": "SimplifiableConditionalExpression", "shortDescription": { - "text": "Unnecessary fully qualified name" + "text": "Simplifiable conditional expression" }, "fullDescription": { - "text": "Reports fully qualified class names that can be shortened. The quick-fix shortens fully qualified names and adds import statements if necessary. Example: 'class ListWrapper {\n java.util.List l;\n }' After the quick-fix is applied: 'import java.util.List;\n class ListWrapper {\n List l;\n }' Configure the inspection: Use the Ignore in Java 9 module statements option to ignore fully qualified names inside the Java 9 'provides' and 'uses' module statements. In Settings | Editor | Code Style | Java | Imports, use the following options to configure the inspection: Use the Insert imports for inner classes option if references to inner classes should be qualified with the outer class. Use the Use fully qualified class names in JavaDoc option to allow fully qualified names in Javadocs.", - "markdown": "Reports fully qualified class names that can be shortened.\n\nThe quick-fix shortens fully qualified names and adds import statements if necessary.\n\nExample:\n\n\n class ListWrapper {\n java.util.List l;\n }\n\nAfter the quick-fix is applied:\n\n\n import java.util.List;\n class ListWrapper {\n List l;\n }\n\nConfigure the inspection:\n\n\nUse the **Ignore in Java 9 module statements** option to ignore fully qualified names inside the Java 9\n`provides` and `uses` module statements.\n\n\nIn [Settings \\| Editor \\| Code Style \\| Java \\| Imports](settings://preferences.sourceCode.Java?JavaDoc%20Inner),\nuse the following options to configure the inspection:\n\n* Use the **Insert imports for inner classes** option if references to inner classes should be qualified with the outer class.\n* Use the **Use fully qualified class names in JavaDoc** option to allow fully qualified names in Javadocs." + "text": "Reports conditional expressions and suggests simplifying them. Examples: 'condition ? true : foo → condition || foo' 'condition ? false : foo → !condition && foo' 'condition ? foo : !foo → condition == foo' 'condition ? true : false → condition' 'a == b ? b : a → a' 'result != null ? result : null → result'", + "markdown": "Reports conditional expressions and suggests simplifying them.\n\nExamples:\n\n condition ? true : foo → condition || foo\n\n condition ? false : foo → !condition && foo\n\n condition ? foo : !foo → condition == foo\n\n condition ? true : false → condition\n\n a == b ? b : a → a\n\n result != null ? result : null → result\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryFullyQualifiedName", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "SimplifiableConditionalExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -26061,19 +25985,19 @@ ] }, { - "id": "NegatedConditional", + "id": "InstanceofIncompatibleInterface", "shortDescription": { - "text": "Conditional expression with negated condition" + "text": "'instanceof' with incompatible type" }, "fullDescription": { - "text": "Reports conditional expressions whose conditions are negated. Flipping the order of the conditional expression branches usually increases the clarity of such statements. Use the Ignore '!= null' comparisons and Ignore '!= 0' comparisons options to ignore comparisons of the form 'obj != null' or 'num != 0'. Since 'obj != null' effectively means \"obj exists\", the meaning of the whole expression does not involve any negation and is therefore easy to understand. The same reasoning applies to 'num != 0' expressions, especially when using bit masks. These forms have the added benefit of mentioning the interesting case first. In most cases, the value for the '== null' branch is 'null' itself, like in the following examples: 'static String getName(Person p) {\n return p != null ? p.getName() : null;\n }\n\n static String getExecutableString(int fileMode) {\n return (fileMode & 0b001001001) != 0 ? \"executable\" : \"non-executable\";\n }'", - "markdown": "Reports conditional expressions whose conditions are negated.\n\nFlipping the order of the conditional expression branches usually increases the clarity of such statements.\n\n\nUse the **Ignore '!= null' comparisons** and **Ignore '!= 0' comparisons** options to ignore comparisons of the form\n`obj != null` or `num != 0`.\nSince `obj != null` effectively means \"obj exists\",\nthe meaning of the whole expression does not involve any negation\nand is therefore easy to understand.\n\n\nThe same reasoning applies to `num != 0` expressions, especially when using bit masks.\n\n\nThese forms have the added benefit of mentioning the interesting case first.\nIn most cases, the value for the `== null` branch is `null` itself,\nlike in the following examples:\n\n\n static String getName(Person p) {\n return p != null ? p.getName() : null;\n }\n\n static String getExecutableString(int fileMode) {\n return (fileMode & 0b001001001) != 0 ? \"executable\" : \"non-executable\";\n }\n" + "text": "Reports 'instanceof' expressions where the expression that is checked has a class/interface type that neither extends/implements the class/interface type on the right-side of the 'instanceof' expression, nor has subclasses that do. Although it could be intended for e.g. library code, such a construct is likely erroneous, because no instance of any class declared in the project could pass this 'instanceof' test. Example: 'class Foo { }\n\n interface Bar { }\n \n class Main {\n void test(Foo f, Bar b) {\n if (f instanceof Bar) { // problem\n System.out.println(\"fail\");\n }\n if (b instanceof Foo) { // problem\n System.out.println(\"fail\");\n }\n }\n }'", + "markdown": "Reports `instanceof` expressions where the expression that is checked has a class/interface type that neither extends/implements the class/interface type on the right-side of the `instanceof` expression, nor has subclasses that do.\n\n\nAlthough it could be intended for e.g. library code, such a construct is likely erroneous,\nbecause no instance of any class declared in the project could pass this `instanceof` test.\n\n**Example:**\n\n\n class Foo { }\n\n interface Bar { }\n \n class Main {\n void test(Foo f, Bar b) {\n if (f instanceof Bar) { // problem\n System.out.println(\"fail\");\n }\n if (b instanceof Foo) { // problem\n System.out.println(\"fail\");\n }\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConditionalExpressionWithNegatedCondition", + "suppressToolId": "InstanceofIncompatibleInterface", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26081,8 +26005,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -26094,19 +26018,19 @@ ] }, { - "id": "BooleanParameter", + "id": "UnqualifiedMethodAccess", "shortDescription": { - "text": "'public' method with 'boolean' parameter" + "text": "Instance method call not qualified with 'this'" }, "fullDescription": { - "text": "Reports public methods that accept a 'boolean' parameter. It's almost always bad practice to add a 'boolean' parameter to a public method (part of an API) if that method is not a setter. When reading code using such a method, it can be difficult to decipher what the 'boolean' stands for without looking at the source or documentation. This problem is also known as the boolean trap. The 'boolean' parameter can often be replaced with an 'enum'. Example: '// Warning: it's hard to understand what the\n // boolean parameters mean when looking at\n // a call to this method\n public boolean setPermission(File f,\n int access,\n boolean enable,\n boolean ownerOnly) {\n // ...\n }' Use the Only report methods with multiple boolean parameters option to warn only when a method contains more than one boolean parameter.", - "markdown": "Reports public methods that accept a `boolean` parameter.\n\nIt's almost always bad practice to add a `boolean` parameter to a public method (part of an API) if that method is not a setter.\nWhen reading code using such a method, it can be difficult to decipher what the `boolean` stands for without looking at\nthe source or documentation.\n\nThis problem is also known as [the boolean trap](https://ariya.io/2011/08/hall-of-api-shame-boolean-trap).\nThe `boolean` parameter can often be replaced with an `enum`.\n\nExample:\n\n\n // Warning: it's hard to understand what the\n // boolean parameters mean when looking at\n // a call to this method\n public boolean setPermission(File f,\n int access,\n boolean enable,\n boolean ownerOnly) {\n // ...\n }\n\n\nUse the **Only report methods with multiple boolean parameters** option to warn only when a method contains more than one boolean parameter." + "text": "Reports calls to non-'static' methods on the same instance that are not qualified with 'this'. Example: 'class Foo {\n void bar() {}\n\n void foo() {\n bar();\n }\n }' After the quick-fix is applied: 'class Foo {\n void bar() {}\n\n void foo() {\n this.bar();\n }\n }'", + "markdown": "Reports calls to non-`static` methods on the same instance that are not qualified with `this`.\n\n**Example:**\n\n\n class Foo {\n void bar() {}\n\n void foo() {\n bar();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n void bar() {}\n\n void foo() {\n this.bar();\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BooleanParameter", + "suppressToolId": "UnqualifiedMethodAccess", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26114,8 +26038,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -26127,19 +26051,19 @@ ] }, { - "id": "TestInProductSource", + "id": "FunctionalExpressionCanBeFolded", "shortDescription": { - "text": "Test in product source" + "text": "Functional expression can be folded" }, "fullDescription": { - "text": "Reports test classes and test methods that are located in production source trees. This most likely a mistake and can result in test code being shipped into production.", - "markdown": "Reports test classes and test methods that are located in production source trees. This most likely a mistake and can result in test code being shipped into production." + "text": "Reports method references or lambda expressions that point to a method of their own functional interface type and hence can be replaced with their qualifiers removing unnecessary object allocation. Example: 'SwingUtilities.invokeLater(r::run);\n SwingUtilities.invokeAndWait(() -> r.run());' After the quick-fix is applied: 'SwingUtilities.invokeLater(r);\n SwingUtilities.invokeAndWait(r);' This inspection reports only if the language level of the project or module is 8 or higher.", + "markdown": "Reports method references or lambda expressions that point to a method of their own functional interface type and hence can be replaced with their qualifiers removing unnecessary object allocation.\n\nExample:\n\n\n SwingUtilities.invokeLater(r::run);\n SwingUtilities.invokeAndWait(() -> r.run());\n\nAfter the quick-fix is applied:\n\n\n SwingUtilities.invokeLater(r);\n SwingUtilities.invokeAndWait(r);\n\nThis inspection reports only if the language level of the project or module is 8 or higher." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "TestInProductSource", + "suppressToolId": "FunctionalExpressionCanBeFolded", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26147,8 +26071,8 @@ "relationships": [ { "target": { - "id": "JVM languages/Test frameworks", - "index": 123, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -26160,22 +26084,19 @@ ] }, { - "id": "CopyConstructorMissesField", + "id": "CustomClassloader", "shortDescription": { - "text": "Copy constructor misses field" + "text": "Custom 'ClassLoader' is declared" }, "fullDescription": { - "text": "Reports copy constructors that don't copy all the fields of the class. 'final' fields with initializers and 'transient' fields are considered unnecessary to copy. Example: 'class Point {\n\n private int x;\n private int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n Point(Point other) {\n // fields x and y are not initialized\n }\n }' New in 2018.1", - "markdown": "Reports copy constructors that don't copy all the fields of the class.\n\n\n`final` fields with initializers and `transient` fields are considered unnecessary to copy.\n\n**Example:**\n\n\n class Point {\n\n private int x;\n private int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n Point(Point other) {\n // fields x and y are not initialized\n }\n }\n\nNew in 2018.1" + "text": "Reports user-defined subclasses of 'java.lang.ClassLoader'. While not necessarily representing a security hole, such classes should be thoroughly inspected for possible security issues.", + "markdown": "Reports user-defined subclasses of `java.lang.ClassLoader`.\n\n\nWhile not necessarily representing a security hole, such classes should be thoroughly\ninspected for possible security issues." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CopyConstructorMissesField", - "cweIds": [ - 665 - ], + "suppressToolId": "CustomClassloader", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26183,8 +26104,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -26196,19 +26117,19 @@ ] }, { - "id": "CastCanBeRemovedNarrowingVariableType", + "id": "UnnecessarySuperConstructor", "shortDescription": { - "text": "Too weak variable type leads to unnecessary cast" + "text": "Unnecessary call to 'super()'" }, "fullDescription": { - "text": "Reports type casts that can be removed if the variable type is narrowed to the cast type. Example: 'Object x = \" string \";\n System.out.println(((String)x).trim());' Here, changing the type of 'x' to 'String' makes the cast redundant. The suggested quick-fix updates the variable type and removes all redundant casts on that variable: 'String x = \" string \";\n System.out.println(x.trim());' New in 2018.2", - "markdown": "Reports type casts that can be removed if the variable type is narrowed to the cast type.\n\nExample:\n\n\n Object x = \" string \";\n System.out.println(((String)x).trim());\n\n\nHere, changing the type of `x` to `String` makes the cast redundant. The suggested quick-fix updates the variable type and\nremoves all redundant casts on that variable:\n\n\n String x = \" string \";\n System.out.println(x.trim());\n\nNew in 2018.2" + "text": "Reports calls to no-arg superclass constructors during object construction. Such calls are unnecessary and may be removed. Example: 'class Foo {\n Foo() {\n super();\n }\n }' After the quick-fix is applied: 'class Foo {\n Foo() {\n }\n }'", + "markdown": "Reports calls to no-arg superclass constructors during object construction.\n\nSuch calls are unnecessary and may be removed.\n\n**Example:**\n\n\n class Foo {\n Foo() {\n super();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n Foo() {\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CastCanBeRemovedNarrowingVariableType", + "suppressToolId": "UnnecessaryCallToSuper", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26216,8 +26137,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -26229,19 +26150,19 @@ ] }, { - "id": "AssignmentToStaticFieldFromInstanceMethod", + "id": "ThisEscapedInConstructor", "shortDescription": { - "text": "Assignment to static field from instance context" + "text": "'this' reference escaped in object construction" }, "fullDescription": { - "text": "Reports assignment to, or modification of 'static' fields from within an instance method. Although legal, such assignments are tricky to do safely and are often a result of marking fields 'static' inadvertently. Example: 'class Counter {\n private static int count = 0;\n\n void increment() {\n // Warning: updating a static field\n // from an instance method\n count++;\n }\n }'", - "markdown": "Reports assignment to, or modification of `static` fields from within an instance method.\n\nAlthough legal, such assignments are tricky to do\nsafely and are often a result of marking fields `static` inadvertently.\n\n**Example:**\n\n\n class Counter {\n private static int count = 0;\n\n void increment() {\n // Warning: updating a static field\n // from an instance method\n count++;\n }\n }\n" + "text": "Reports possible escapes of 'this' during the object initialization. The escapes occur when 'this' is used as a method argument or an object of assignment in a constructor or initializer. Such escapes may result in subtle bugs, as the object is now available in the context where it is not guaranteed to be initialized. Example: 'class Foo {\n {\n System.out.println(this);\n }\n }'", + "markdown": "Reports possible escapes of `this` during the object initialization. The escapes occur when `this` is used as a method argument or an object of assignment in a constructor or initializer. Such escapes may result in subtle bugs, as the object is now available in the context where it is not guaranteed to be initialized.\n\n**Example:**\n\n\n class Foo {\n {\n System.out.println(this);\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AssignmentToStaticFieldFromInstanceMethod", + "suppressToolId": "ThisEscapedInObjectConstruction", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26249,8 +26170,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -26262,19 +26183,19 @@ ] }, { - "id": "AbstractClassWithOnlyOneDirectInheritor", + "id": "IfCanBeSwitch", "shortDescription": { - "text": "Abstract class with a single direct inheritor" + "text": "'if' can be replaced with 'switch'" }, "fullDescription": { - "text": "Reports abstract classes that have precisely one direct inheritor. While such classes may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the abstract class with its inheritor. 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: 'abstract class Base {} // will be reported\n\n class Inheritor extends Base {}'", - "markdown": "Reports abstract classes that have precisely one direct inheritor. While such classes may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the abstract class with its inheritor.\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 abstract class Base {} // will be reported\n\n class Inheritor extends Base {}\n" + "text": "Reports 'if' statements that can be replaced with 'switch' statements. The replacement result is usually shorter and clearer. Example: 'void test(String str) {\n if (str.equals(\"1\")) {\n System.out.println(1);\n } else if (str.equals(\"2\")) {\n System.out.println(2);\n } else if (str.equals(\"3\")) {\n System.out.println(3);\n } else {\n System.out.println(4);\n }\n }' After the quick-fix is applied: 'void test(String str) {\n switch (str) {\n case \"1\" -> System.out.println(1);\n case \"2\" -> System.out.println(2);\n case \"3\" -> System.out.println(3);\n default -> System.out.println(4);\n }\n }' This inspection only reports if the language level of the project or module is 7 or higher. Use the Minimum number of 'if' condition branches field to specify the minimum number of 'if' condition branches for an 'if' statement to have to be reported. Note that the terminal 'else' branch (without 'if') is not counted. Use the Suggest switch on numbers option to enable the suggestion of 'switch' statements on primitive and boxed numbers and characters. Use the Suggest switch on enums option to enable the suggestion of 'switch' statements on 'enum' constants. Use the Only suggest on null-safe expressions option to suggest 'switch' statements that can't introduce a 'NullPointerException' only.", + "markdown": "Reports `if` statements that can be replaced with `switch` statements.\n\nThe replacement result is usually shorter and clearer.\n\n**Example:**\n\n\n void test(String str) {\n if (str.equals(\"1\")) {\n System.out.println(1);\n } else if (str.equals(\"2\")) {\n System.out.println(2);\n } else if (str.equals(\"3\")) {\n System.out.println(3);\n } else {\n System.out.println(4);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void test(String str) {\n switch (str) {\n case \"1\" -> System.out.println(1);\n case \"2\" -> System.out.println(2);\n case \"3\" -> System.out.println(3);\n default -> System.out.println(4);\n }\n }\n \nThis inspection only reports if the language level of the project or module is 7 or higher.\n\nUse the **Minimum number of 'if' condition branches** field to specify the minimum number of `if` condition branches\nfor an `if` statement to have to be reported. Note that the terminal `else` branch (without `if`) is not counted.\n\n\nUse the **Suggest switch on numbers** option to enable the suggestion of `switch` statements on\nprimitive and boxed numbers and characters.\n\n\nUse the **Suggest switch on enums** option to enable the suggestion of `switch` statements on\n`enum` constants.\n\n\nUse the **Only suggest on null-safe expressions** option to suggest `switch` statements that can't introduce a `NullPointerException` only." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AbstractClassWithOnlyOneDirectInheritor", + "suppressToolId": "IfCanBeSwitch", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26282,8 +26203,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Java language level migration aids", + "index": 70, "toolComponent": { "name": "QDJVM" } @@ -26295,22 +26216,19 @@ ] }, { - "id": "UnsecureRandomNumberGeneration", + "id": "NonPublicClone", "shortDescription": { - "text": "Insecure random number generation" + "text": "'clone()' method not 'public'" }, "fullDescription": { - "text": "Reports any uses of 'java.lang.Random' or 'java.lang.Math.random()'. In secure environments, 'java.secure.SecureRandom' is a better choice, since is offers cryptographically secure random number generation. Example: 'long token = new Random().nextLong();'", - "markdown": "Reports any uses of `java.lang.Random` or `java.lang.Math.random()`.\n\n\nIn secure environments,\n`java.secure.SecureRandom` is a better choice, since is offers cryptographically secure\nrandom number generation.\n\n**Example:**\n\n\n long token = new Random().nextLong();\n" + "text": "Reports 'clone()' methods that are 'protected' and not 'public'. When overriding the 'clone()' method from 'java.lang.Object', it is expected to make the method 'public', so that it is accessible from non-subclasses outside the package.", + "markdown": "Reports `clone()` methods that are `protected` and not `public`.\n\nWhen overriding the `clone()` method from `java.lang.Object`, it is expected to make the method `public`,\nso that it is accessible from non-subclasses outside the package." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnsecureRandomNumberGeneration", - "cweIds": [ - 330 - ], + "suppressToolId": "NonPublicClone", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26318,8 +26236,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Cloning issues", + "index": 116, "toolComponent": { "name": "QDJVM" } @@ -26331,22 +26249,22 @@ ] }, { - "id": "NullableProblems", + "id": "InfiniteRecursion", "shortDescription": { - "text": "@NotNull/@Nullable problems" + "text": "Infinite recursion" }, "fullDescription": { - "text": "Reports problems related to nullability annotations. Examples: Overriding methods are not annotated: 'abstract class A {\n @NotNull abstract String m();\n}\nclass B extends A {\n String m() { return \"empty string\"; }\n}' Annotated primitive types: '@NotNull int myFoo;' Both '@Nullable' and '@NotNull' are present on the same member: '@Nullable @NotNull String myFooString;' Collection of nullable elements is assigned into a collection of non-null elements: 'void testList(List<@Nullable String> nullableList) {\n List<@NotNull String> list2 = nullableList;\n}' Use the Configure Annotations button to specify nullability annotations and the checkboxes to fine-tune where the inspection should provide warnings. This inspection only reports if the language level of the project or module is 5 or higher, and nullability annotations are available on the classpath.", - "markdown": "Reports problems related to nullability annotations.\n\n**Examples:**\n\n* Overriding methods are not annotated:\n\n\n abstract class A {\n @NotNull abstract String m();\n }\n class B extends A {\n String m() { return \"empty string\"; }\n }\n \n* Annotated primitive types: `@NotNull int myFoo;`\n* Both `@Nullable` and `@NotNull` are present on the same member: `@Nullable @NotNull String myFooString;`\n* Collection of nullable elements is assigned into a collection of non-null elements:\n\n\n void testList(List<@Nullable String> nullableList) {\n List<@NotNull String> list2 = nullableList;\n }\n \nUse the **Configure Annotations** button to specify nullability annotations and the checkboxes to fine-tune where the inspection should provide warnings.\n\nThis inspection only reports if the language level of the project or module is 5 or higher,\nand nullability annotations are available on the classpath." + "text": "Reports methods that call themselves infinitely unless an exception is thrown. Methods reported by this inspection cannot return normally. While such behavior may be intended, in many cases this is just an oversight. Example: 'int baz() {\n return baz();\n }'", + "markdown": "Reports methods that call themselves infinitely unless an exception is thrown.\n\n\nMethods reported by this inspection cannot return normally.\nWhile such behavior may be intended, in many cases this is just an oversight.\n\n**Example:**\n\n int baz() {\n return baz();\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NullableProblems", + "suppressToolId": "InfiniteRecursion", "cweIds": [ - 476, - 754 + 674, + 835 ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" @@ -26355,8 +26273,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs/Nullability problems", - "index": 174, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -26368,19 +26286,19 @@ ] }, { - "id": "EqualsBetweenInconvertibleTypes", + "id": "DeprecatedIsStillUsed", "shortDescription": { - "text": "'equals()' between objects of inconvertible types" + "text": "Deprecated member is still used" }, "fullDescription": { - "text": "Reports calls to 'equals()' where the target and argument are of incompatible types. While such a call might theoretically be useful, most likely it is a bug. Example: 'new HashSet().equals(new TreeSet());'", - "markdown": "Reports calls to `equals()` where the target and argument are of incompatible types.\n\nWhile such a call might theoretically be useful, most likely it is a bug.\n\n**Example:**\n\n\n new HashSet().equals(new TreeSet());\n" + "text": "Reports deprecated classes, methods, and fields that are used in your code nonetheless. Example: 'class MyCode {\n @Deprecated\n void oldMethod() {}// warning: \"Deprecated member is still used\"\n\n void newMethod() {\n oldMethod(); // forgotten usage\n }\n }' Usages within deprecated elements are ignored. NOTE: Due to performance reasons, a non-private member is checked only when its name rarely occurs in the project.", + "markdown": "Reports deprecated classes, methods, and fields that are used in your code nonetheless.\n\nExample:\n\n\n class MyCode {\n @Deprecated\n void oldMethod() {}// warning: \"Deprecated member is still used\"\n\n void newMethod() {\n oldMethod(); // forgotten usage\n }\n }\n\nUsages within deprecated elements are ignored.\n\n**NOTE:** Due to performance reasons, a non-private member is checked only when its name rarely occurs in the project." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EqualsBetweenInconvertibleTypes", + "suppressToolId": "DeprecatedIsStillUsed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26388,8 +26306,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -26401,19 +26319,19 @@ ] }, { - "id": "DuplicateCondition", + "id": "RedundantComparatorComparing", "shortDescription": { - "text": "Duplicate condition" + "text": "Comparator method can be simplified" }, "fullDescription": { - "text": "Reports duplicate conditions in '&&' and '||' expressions and branches of 'if' statements. While sometimes duplicate conditions are intended, in most cases they are the result of an oversight. Example: 'boolean result = digit1 != digit2 || digit1 != digit2;' To ignore conditions that may produce side effects, use the Ignore conditions with side effects option. Disabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations. Example: 'native boolean unknownMethod();\n \n ...\n \n if (unknownMethod() || unknownMethod()) {\n System.out.println(\"Got it\");\n }' Due to possible side effects of 'unknownMethod()' (on the example), the warning will only be triggered if the Ignore conditions with side effects option is disabled.", - "markdown": "Reports duplicate conditions in `&&` and `||` expressions and branches of `if` statements. While sometimes duplicate conditions are intended, in most cases they are the result of an oversight.\n\nExample:\n\n\n boolean result = digit1 != digit2 || digit1 != digit2;\n\n\nTo ignore conditions that may produce side effects, use the **Ignore conditions with side effects** option.\nDisabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations.\n\nExample:\n\n\n native boolean unknownMethod();\n \n ...\n \n if (unknownMethod() || unknownMethod()) {\n System.out.println(\"Got it\");\n }\n\nDue to possible side effects of `unknownMethod()` (on the example), the warning will only be\ntriggered if the **Ignore conditions with side effects** option is disabled." + "text": "Reports 'Comparator' combinator constructs that can be simplified. Example: 'c.thenComparing(Comparator.comparing(function));\n\n Comparator.comparing(Map.Entry::getKey);\n\n Collections.max(list, Comparator.reverseOrder());' After the quick-fixes are applied: 'c.thenComparing(function)\n\n Map.Entry.comparingByKey()\n\n Collections.min(list, Comparator.naturalOrder());' New in 2018.1", + "markdown": "Reports `Comparator` combinator constructs that can be simplified.\n\nExample:\n\n\n c.thenComparing(Comparator.comparing(function));\n\n Comparator.comparing(Map.Entry::getKey);\n\n Collections.max(list, Comparator.reverseOrder());\n\nAfter the quick-fixes are applied:\n\n\n c.thenComparing(function)\n\n Map.Entry.comparingByKey()\n\n Collections.min(list, Comparator.naturalOrder());\n\nNew in 2018.1" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DuplicateCondition", + "suppressToolId": "RedundantComparatorComparing", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26421,8 +26339,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -26434,19 +26352,22 @@ ] }, { - "id": "SynchronizationOnGetClass", + "id": "VariableNotUsedInsideIf", "shortDescription": { - "text": "Synchronization on 'getClass()'" + "text": "Reference checked for 'null' is not used inside 'if'" }, "fullDescription": { - "text": "Reports synchronization on a call to 'getClass()'. If the class containing the synchronization is subclassed, the subclass will synchronize on a different class object. Usually the call to 'getClass()' can be replaced with a class literal expression, for example 'String.class'. An even better solution is synchronizing on a 'private static final' lock object, access to which can be completely controlled. Example: 'synchronized(getClass()) {}'", - "markdown": "Reports synchronization on a call to `getClass()`.\n\n\nIf the class containing the synchronization is subclassed, the subclass\nwill\nsynchronize on a different class object. Usually the call to `getClass()` can be replaced with a class literal expression, for\nexample `String.class`. An even better solution is synchronizing on a `private static final` lock object, access to\nwhich can be completely controlled.\n\n**Example:**\n\n synchronized(getClass()) {}\n" + "text": "Reports references to variables that are checked for nullability in the condition of an 'if' statement or conditional expression but not used inside that 'if' statement. Usually this either means that the check is unnecessary or that the variable is not referenced inside the 'if' statement by mistake. Example: 'void test(Integer i) {\n if (i != null) { // here 'i' is not used inside 'if' statement\n System.out.println();\n }\n }'", + "markdown": "Reports references to variables that are checked for nullability in the condition of an `if` statement or conditional expression but not used inside that `if` statement.\n\n\nUsually this either means that\nthe check is unnecessary or that the variable is not referenced inside the\n`if` statement by mistake.\n\n**Example:**\n\n\n void test(Integer i) {\n if (i != null) { // here 'i' is not used inside 'if' statement\n System.out.println();\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SynchronizationOnGetClass", + "suppressToolId": "VariableNotUsedInsideIf", + "cweIds": [ + 563 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26454,8 +26375,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -26467,28 +26388,28 @@ ] }, { - "id": "StringTemplateReverseMigration", + "id": "CollectionAddAllCanBeReplacedWithConstructor", "shortDescription": { - "text": "String template can be concatenated string" + "text": "Redundant 'Collection.addAll()' call" }, "fullDescription": { - "text": "Reports string template expressions using the 'STR' processor and offers a quick-fix to migrate back to a plain string concatenation. Example: 'String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";' After the quick-fix is applied: 'String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are 29 years old.\";' New in 2024.2", - "markdown": "Reports string template expressions using the `STR` processor and offers a quick-fix to migrate back to a plain string concatenation.\n\n**Example:**\n\n\n String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";\n\nAfter the quick-fix is applied:\n\n\n String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are 29 years old.\";\n\nNew in 2024.2" + "text": "Reports 'Collection.addAll()' and 'Map.putAll()' calls immediately after an instantiation of a collection using a no-arg constructor. Such constructs can be replaced with a single call to a parametrized constructor, which simplifies the code. Also, for some collections the replacement might be more performant. Example: 'Set set = new HashSet<>();\n set.addAll(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));' After the quick-fix is applied: 'Set set = new HashSet<>(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));' The JDK collection classes are supported by default. Additionally, you can specify other classes using the Classes to check panel.", + "markdown": "Reports `Collection.addAll()` and `Map.putAll()` calls immediately after an instantiation of a collection using a no-arg constructor.\n\nSuch constructs can be replaced with a single call to a parametrized constructor, which simplifies the code. Also, for some collections the replacement\nmight be more performant.\n\n**Example:**\n\n\n Set set = new HashSet<>();\n set.addAll(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));\n\nAfter the quick-fix is applied:\n\n\n Set set = new HashSet<>(Arrays.asList(\"alpha\", \"beta\", \"gamma\"));\n\n\nThe JDK collection classes are supported by default.\nAdditionally, you can specify other classes using the **Classes to check** panel." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "StringTemplateReverseMigration", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CollectionAddAllCanBeReplacedWithConstructor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 21", - "index": 195, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -26500,19 +26421,19 @@ ] }, { - "id": "ThrownExceptionsPerMethod", + "id": "MultipleReturnPointsPerMethod", "shortDescription": { - "text": "Method with too many exceptions declared" + "text": "Method with multiple return points" }, "fullDescription": { - "text": "Reports methods that have too many types of exceptions in its 'throws' list. Methods with too many exceptions declared are a good sign that your error handling code is getting overly complex. Use the Exceptions thrown limit field to specify the maximum number of exception types a method is allowed to have in its 'throws' list.", - "markdown": "Reports methods that have too many types of exceptions in its `throws` list.\n\nMethods with too many exceptions declared are a good sign that your error handling code is getting overly complex.\n\nUse the **Exceptions thrown limit** field to specify the maximum number of exception types a method is allowed to have in its `throws` list." + "text": "Reports methods whose number of 'return' points exceeds the specified maximum. Methods with too many 'return' points may be confusing and hard to refactor. A 'return' point is either a 'return' statement or a falling through the bottom of a 'void' method or constructor. Example: The method below is reported if only two 'return' statements are allowed: 'void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user)) {\n user.setId(getId());\n return;\n } else if (cond2(user)) {\n if (cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }\n }' Consider rewriting the method so it becomes easier to understand: 'void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user) || cond2(user) && cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }' Configure the inspection: Use the Return point limit field to specify the maximum allowed number of 'return' points for a method. Use the Ignore guard clauses option to ignore guard clauses. A guard clause is an 'if' statement that contains only a 'return' statement Use the Ignore for 'equals()' methods option to ignore 'return' points inside 'equals()' methods.", + "markdown": "Reports methods whose number of `return` points exceeds the specified maximum. Methods with too many `return` points may be confusing and hard to refactor.\n\nA `return` point is either a `return` statement or a falling through the bottom of a\n`void` method or constructor.\n\n**Example:**\n\nThe method below is reported if only two `return` statements are allowed:\n\n\n void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user)) {\n user.setId(getId());\n return;\n } else if (cond2(user)) {\n if (cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }\n }\n\nConsider rewriting the method so it becomes easier to understand:\n\n\n void doSmth(User[] users) {\n for (User user : users) {\n if (cond1(user) || cond2(user) && cond3(user)) {\n user.setId(getId());\n return;\n }\n }\n }\n\nConfigure the inspection:\n\n* Use the **Return point limit** field to specify the maximum allowed number of `return` points for a method.\n* Use the **Ignore guard clauses** option to ignore guard clauses. A guard clause is an `if` statement that contains only a `return` statement\n* Use the **Ignore for 'equals()' methods** option to ignore `return` points inside `equals()` methods." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MethodWithTooExceptionsDeclared", + "suppressToolId": "MethodWithMultipleReturnPoints", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26533,19 +26454,22 @@ ] }, { - "id": "RedundantThrows", + "id": "SuspiciousMethodCalls", "shortDescription": { - "text": "Redundant 'throws' clause" + "text": "Suspicious collection method call" }, "fullDescription": { - "text": "Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods. The inspection ignores methods related to serialization, for example the methods 'readObject()' and 'writeObject()'. Example: 'void method() throws InterruptedException {\n System.out.println();\n }' The quick-fix removes unnecessary exceptions from the declaration and normalizes redundant 'try'-'catch' statements: 'void method() {\n System.out.println();\n }' Note: Some exceptions may not be reported during in-editor highlighting for performance reasons. To see all results, run the inspection by selecting Code | Inspect Code or Code | Analyze Code | Run Inspection by Name from the main menu. Use the Ignore exceptions thrown by entry point methods option to not report exceptions thrown by for example 'main()' methods. Entry point methods can be configured in the settings of the Java | Declaration redundancy | Unused declaration inspection.", - "markdown": "Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods.\n\nThe inspection ignores methods related to serialization, for example the methods `readObject()` and `writeObject()`.\n\n**Example:**\n\n\n void method() throws InterruptedException {\n System.out.println();\n }\n\nThe quick-fix removes unnecessary exceptions from the declaration and normalizes redundant `try`-`catch` statements:\n\n\n void method() {\n System.out.println();\n }\n\n\n**Note:** Some exceptions may not be reported during in-editor highlighting for performance reasons.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the **Ignore exceptions thrown by entry point methods** option to not report exceptions thrown by\nfor example `main()` methods.\nEntry point methods can be configured in the settings of the\n[Java \\| Declaration redundancy \\| Unused declaration](settings://Errors?Unused%20Declaration%20entry%20point) inspection." + "text": "Reports method calls on parameterized collections, where the actual argument type does not correspond to the collection's elements type. Example: 'List list = getListOfElements();\n list.remove(\"\"); // remove is highlighted' In the inspection settings, you can disable warnings for potentially correct code like the following: 'public boolean accept(Map map, Object key) {\n return map.containsKey(key);\n }'", + "markdown": "Reports method calls on parameterized collections, where the actual argument type does not correspond to the collection's elements type.\n\n**Example:**\n\n\n List list = getListOfElements();\n list.remove(\"\"); // remove is highlighted\n\n\nIn the inspection settings, you can disable warnings for potentially correct code like the following:\n\n\n public boolean accept(Map map, Object key) {\n return map.containsKey(key);\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantThrows", + "suppressToolId": "SuspiciousMethodCalls", + "cweIds": [ + 628 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26553,8 +26477,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -26566,19 +26490,19 @@ ] }, { - "id": "UseOfAnotherObjectsPrivateField", + "id": "ForwardCompatibility", "shortDescription": { - "text": "Accessing a non-public field of another object" + "text": "Forward compatibility" }, "fullDescription": { - "text": "Reports accesses to 'private' or 'protected' fields of another object. Java allows access to such fields for objects of the same class as the current object but some coding styles discourage this use. Additionally, such direct access to 'private' fields may fail in component-oriented architectures, such as Spring or Hibernate, that expect all access to other objects to be through method calls so the framework can mediate access using proxies. Example: 'public class Base {\n protected int bar;\n\n void increment(Base base) {\n bar++;\n base.bar++; // warning: direct access to another object's non-public field\n }\n }' A quick-fix to encapsulate the field is available. Configure the inspection: Use the Ignore accesses from the same class option to ignore access from the same class and only report access from inner or outer classes. To ignore access from inner classes as well, use the nested Ignore accesses from inner classes. Use the Ignore accesses from 'equals()' method to ignore access from an 'equals()' method.", - "markdown": "Reports accesses to `private` or `protected` fields of another object. Java allows access to such fields for objects of the same class as the current object but some coding styles discourage this use. Additionally, such direct access to `private` fields may fail in component-oriented architectures, such as Spring or Hibernate, that expect all access to other objects to be through method calls so the framework can mediate access using proxies.\n\n**Example:**\n\n\n public class Base {\n protected int bar;\n\n void increment(Base base) {\n bar++;\n base.bar++; // warning: direct access to another object's non-public field\n }\n }\n\nA quick-fix to encapsulate the field is available.\n\nConfigure the inspection:\n\n* Use the **Ignore accesses from the same class** option to ignore access from the same class and only report access from inner or outer classes.\n\n To ignore access from inner classes as well, use the nested **Ignore accesses from inner classes**.\n* Use the **Ignore accesses from 'equals()' method** to ignore access from an `equals()` method." + "text": "Reports Java code constructs that may fail to compile in future Java versions. The following problems are reported: Uses of 'assert', 'enum' or '_' as an identifier Uses of the 'var', 'yield', or 'record' restricted identifier as a type name Unqualified calls to methods named 'yield' Modifiers on the 'requires java.base' statement inside of 'module-info.java' Redundant semicolons between import statements Example: '// This previously legal class does not compile with Java 14,\n // as 'yield' became a restricted identifier.\n public class yield {}' Fixing these issues timely may simplify migration to future Java versions.", + "markdown": "Reports Java code constructs that may fail to compile in future Java versions.\n\nThe following problems are reported:\n\n* Uses of `assert`, `enum` or `_` as an identifier\n* Uses of the `var`, `yield`, or `record` restricted identifier as a type name\n* Unqualified calls to methods named `yield`\n* Modifiers on the `requires java.base` statement inside of `module-info.java`\n* Redundant semicolons between import statements\n\n**Example:**\n\n\n // This previously legal class does not compile with Java 14,\n // as 'yield' became a restricted identifier.\n public class yield {} \n\nFixing these issues timely may simplify migration to future Java versions." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AccessingNonPublicFieldOfAnotherObject", + "suppressToolId": "ForwardCompatibility", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26586,8 +26510,8 @@ "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Java/Java language level issues", + "index": 147, "toolComponent": { "name": "QDJVM" } @@ -26599,28 +26523,28 @@ ] }, { - "id": "PointlessBitwiseExpression", + "id": "DiamondCanBeReplacedWithExplicitTypeArguments", "shortDescription": { - "text": "Pointless bitwise expression" + "text": "Diamond can be replaced with explicit type arguments" }, "fullDescription": { - "text": "Reports pointless bitwise expressions. Such expressions include applying the '&' operator to the maximum value for the given type, applying the 'or' operator to zero, and shifting by zero. Such expressions may be the result of automated refactorings not followed through to completion and are unlikely to be originally intended. Examples: '// Warning: operation is pointless and can be replaced with just `flags`\n // 0xFFFF_FFFF is the maximum value for an integer, and both literals are treated\n // as 32 bit integer literals.\n int bits = flags & 0xFFFF_FFFF;\n\n // Warning: operation is pointless and can be replaced with just `bits`\n // OR-ing with 0 always outputs the other operand.\n int or = bits | 0x0;\n\n // Warning: operation is pointless, as always results in 0\n int xor = or ^ or;'", - "markdown": "Reports pointless bitwise expressions.\n\n\nSuch expressions include applying the `&` operator to the maximum value for the given type, applying the\n`or` operator to zero, and shifting by zero. Such expressions may be the result of automated\nrefactorings not followed through to completion and are unlikely to be originally intended.\n\n**Examples:**\n\n\n // Warning: operation is pointless and can be replaced with just `flags`\n // 0xFFFF_FFFF is the maximum value for an integer, and both literals are treated\n // as 32 bit integer literals.\n int bits = flags & 0xFFFF_FFFF;\n\n // Warning: operation is pointless and can be replaced with just `bits`\n // OR-ing with 0 always outputs the other operand.\n int or = bits | 0x0;\n\n // Warning: operation is pointless, as always results in 0\n int xor = or ^ or;\n" + "text": "Reports instantiation of generic classes in which the <> symbol (diamond) is used instead of type parameters. The quick-fix replaces <> (diamond) with explicit type parameters. Example: 'List list = new ArrayList<>()' After the quick-fix is applied: 'List list = new ArrayList()' Diamond operation appeared in Java 7. This inspection can help to downgrade for backward compatibility with earlier Java versions.", + "markdown": "Reports instantiation of generic classes in which the **\\<\\>** symbol (diamond) is used instead of type parameters.\n\nThe quick-fix replaces **\\<\\>** (diamond) with explicit type parameters.\n\nExample:\n\n List list = new ArrayList<>()\n\nAfter the quick-fix is applied:\n\n List list = new ArrayList()\n\n\n*Diamond operation* appeared in Java 7.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions." }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "PointlessBitwiseExpression", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "DiamondCanBeReplacedWithExplicitTypeArguments", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Bitwise operation issues", - "index": 199, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -26632,19 +26556,19 @@ ] }, { - "id": "DuplicateThrows", + "id": "UseOfProcessBuilder", "shortDescription": { - "text": "Duplicate throws" + "text": "Use of 'java.lang.ProcessBuilder' class" }, "fullDescription": { - "text": "Reports duplicate exceptions in a method 'throws' list. Example: 'void f() throws Exception, Exception {}' After the quick-fix is applied: 'void f() throws Exception {}' Use the Ignore exceptions subclassing others option to ignore exceptions subclassing other exceptions.", - "markdown": "Reports duplicate exceptions in a method `throws` list.\n\nExample:\n\n\n void f() throws Exception, Exception {}\n\nAfter the quick-fix is applied:\n\n\n void f() throws Exception {}\n\n\nUse the **Ignore exceptions subclassing others** option to ignore exceptions subclassing other exceptions." + "text": "Reports uses of 'java.lang.ProcessBuilder', which might be unportable between operating systems because paths to executables, environment variables, command-line arguments and their escaping might vary depending on the OS.", + "markdown": "Reports uses of `java.lang.ProcessBuilder`, which might be unportable between operating systems because paths to executables, environment variables, command-line arguments and their escaping might vary depending on the OS." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DuplicateThrows", + "suppressToolId": "UseOfProcessBuilder", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26652,8 +26576,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -26665,19 +26589,19 @@ ] }, { - "id": "UnstableTypeUsedInSignature", + "id": "JavaRequiresAutoModule", "shortDescription": { - "text": "Unstable type is used in signature" + "text": "Dependencies on automatic modules" }, "fullDescription": { - "text": "Reports declarations of classes, methods, and fields that reference an unstable API type in the signature, but are not marked with the same unstable annotation. This inspection ensures that the signatures of a public API do not expose any unstable (internal, experimental) types. For example, if a method returns an experimental class, the method itself is considered experimental because incompatible changes of the type (deletion or move to another package) lead to incompatible method signature changes. Use the list below to specify which annotations mark an unstable API.", - "markdown": "Reports declarations of classes, methods, and fields that reference an unstable API type in the signature, but are not marked with the same unstable annotation.\n\n\nThis inspection ensures that the signatures of a public API do not expose any *unstable* (internal, experimental) types.\nFor example, if a method returns an *experimental* class, the method itself is considered *experimental*\nbecause incompatible changes of the type (deletion or move to another package) lead to incompatible method signature changes.\n\nUse the list below to specify which annotations mark an unstable API." + "text": "Reports usages of automatic modules in a 'requires' directive. An automatic module is unreliable since it can depend on the types on the class path, and its name and exported packages can change if it's converted into an explicit module. Corresponds to '-Xlint:requires-automatic' and '-Xlint:requires-transitive-automatic' Javac options. The first option increases awareness of when automatic modules are used. The second warns the authors of a module that they're putting the users of that module at risk by establishing implied readability to an automatic module. Example: '//module-info.java\n module org.printer {\n requires transitive drivers.corp.org; // reported in case 'drivers.corp.org' is an automatic module\n }' Use the Highlight only transitive dependencies option to warn only about transitive dependencies. This inspection depends on the Java feature 'Modules', which is available since Java 9.", + "markdown": "Reports usages of automatic modules in a `requires` directive.\n\nAn automatic\nmodule is unreliable since it can depend on the types on the class path,\nand its name and exported packages can change if it's\nconverted into an explicit module.\n\nCorresponds to `-Xlint:requires-automatic` and `-Xlint:requires-transitive-automatic` Javac options.\nThe first option increases awareness of when automatic modules are used.\nThe second warns the authors of a module that they're putting the users of that module at risk by establishing implied readability to an automatic module.\n\n**Example:**\n\n\n //module-info.java\n module org.printer {\n requires transitive drivers.corp.org; // reported in case 'drivers.corp.org' is an automatic module\n }\n\n\nUse the **Highlight only transitive dependencies** option to warn only about transitive dependencies.\n\nThis inspection depends on the Java feature 'Modules', which is available since Java 9." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnstableTypeUsedInSignature", + "suppressToolId": "requires-transitive-automatic", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26685,8 +26609,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Java language level migration aids/Java 9", + "index": 87, "toolComponent": { "name": "QDJVM" } @@ -26698,19 +26622,19 @@ ] }, { - "id": "PrivateMemberAccessBetweenOuterAndInnerClass", + "id": "ExcessiveRangeCheck", "shortDescription": { - "text": "Synthetic accessor call" + "text": "Excessive range check" }, "fullDescription": { - "text": "Reports references from a nested class to non-constant 'private' members of an outer class. For such references, javac will generate package-private synthetic accessor methods, which may compromise the security because members appearing to be private will in fact be accessible from the entire package. A nested class and its outer class are compiled to separate class files. The Java virtual machine normally prohibits access from a class to private fields and methods of another class. To enable access from a nested class to private members of an outer class, javac creates a package-private synthetic accessor method. By making the 'private' member package-private instead, the actual accessibility is made explicit. This also saves a little bit of memory, which may improve performance in resource constrained environments. This inspection only reports if the language level of the project or module is 10 or lower. Under Java 11 and higher accessor methods are not generated anymore, because of nest-based access control (JEP 181). Example: 'class Outer {\n private void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }' After the quick fix is applied: 'class Outer {\n void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }'", - "markdown": "Reports references from a nested class to non-constant `private` members of an outer class. For such references, javac will generate package-private synthetic accessor methods, which may compromise the security because members appearing to be private will in fact be accessible from the entire package.\n\n\nA nested class and its outer class are compiled to separate\nclass files. The Java virtual machine normally prohibits access from a class to private fields and methods of\nanother class. To enable access from a nested class to private members of an outer class, javac creates a package-private\nsynthetic accessor method.\n\n\nBy making the `private` member package-private instead, the actual accessibility is made explicit.\nThis also saves a little bit of memory, which may improve performance in resource constrained environments.\n\n\nThis inspection only reports if the language level of the project or module is 10 or lower.\nUnder Java 11 and higher accessor methods are not generated anymore,\nbecause of nest-based access control ([JEP 181](https://openjdk.org/jeps/181)).\n\n**Example:**\n\n\n class Outer {\n private void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }\n\nAfter the quick fix is applied:\n\n\n class Outer {\n void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }\n" + "text": "Reports condition chains in which a value range is checked and these condition chains can be simplified to a single check. The quick-fix replaces a condition chain with a simplified expression: Example: 'x > 2 && x < 4' After the quick-fix is applied: 'x == 3' Example: 'arr.length == 0 || arr.length > 1' After the quick-fix is applied: 'arr.length != 1' New in 2019.1", + "markdown": "Reports condition chains in which a value range is checked and these condition chains can be simplified to a single check.\n\nThe quick-fix replaces a condition chain with a simplified expression:\n\nExample:\n\n\n x > 2 && x < 4\n\nAfter the quick-fix is applied:\n\n\n x == 3\n\nExample:\n\n\n arr.length == 0 || arr.length > 1\n\nAfter the quick-fix is applied:\n\n\n arr.length != 1\n\nNew in 2019.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SyntheticAccessorCall", + "suppressToolId": "ExcessiveRangeCheck", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26718,8 +26642,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -26731,19 +26655,19 @@ ] }, { - "id": "ClassIndependentOfModule", + "id": "StringConcatenation", "shortDescription": { - "text": "Class independent of its module" + "text": "String concatenation" }, "fullDescription": { - "text": "Reports classes that: do not depend on any other class in their module are not a dependency for any other class in their module Such classes are an indication of ad-hoc or incoherent modularisation strategies, and may often profitably be moved. 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* are not a dependency for any other class in their module\n\nSuch classes are an indication of ad-hoc or incoherent modularisation strategies,\nand may often profitably be moved.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor." + "text": "Reports 'String' concatenations. Concatenation might be incorrect in an internationalized environment and could be replaced by usages of 'java.text.MessageFormat' or similar classes. Example: 'String getMessage(String string, int number) {\n return string + number;\n }'", + "markdown": "Reports `String` concatenations. Concatenation might be incorrect in an internationalized environment and could be replaced by usages of `java.text.MessageFormat` or similar classes.\n\n**Example:**\n\n\n String getMessage(String string, int number) {\n return string + number;\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassIndependentOfModule", + "suppressToolId": "StringConcatenation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26751,8 +26675,8 @@ "relationships": [ { "target": { - "id": "Java/Modularization issues", - "index": 76, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -26764,28 +26688,28 @@ ] }, { - "id": "SystemRunFinalizersOnExit", + "id": "ClassCanBeRecord", "shortDescription": { - "text": "Call to 'System.runFinalizersOnExit()'" + "text": "Class can be record class" }, "fullDescription": { - "text": "Reports calls to 'System.runFinalizersOnExit()'. This call is one of the most dangerous in the Java language. It is inherently non-thread-safe, may result in data corruption, a deadlock, and may affect parts of the program far removed from its call point. It is deprecated and was removed in JDK 11, and its use is strongly discouraged. This inspection only reports if the language level of the project or module is 10 or lower.", - "markdown": "Reports calls to `System.runFinalizersOnExit()`.\n\n\nThis call is one of the most dangerous in the Java language. It is inherently non-thread-safe,\nmay result in data corruption, a deadlock, and may affect parts of the program far removed from its call point.\nIt is deprecated and was removed in JDK 11, and its use is strongly discouraged.\n\nThis inspection only reports if the language level of the project or module is 10 or lower." + "text": "Reports classes that can be converted record classes. Record classes focus on modeling immutable data rather than extensible behavior. Automatic implicit implementation of data-driven methods, such as 'equals()' and accessors, helps to reduce boilerplate code. Note that not every class can be a record class. Here are some of the restrictions: The class must have no subclasses. All non-static fields in the class must be final. Initializers, generic constructors, and native methods must not be present. For a full description of record classes, refer to the Java Language Specification. Example: 'class Point {\n private final double x;\n private final double y;\n\n Point(double x, double y) {\n this.x = x;\n this.y = y;\n }\n\n double getX() {\n return x;\n }\n\n double getY() {\n return y;\n }\n }' After the quick-fix is applied: 'record Point(int x, int y) {\n }' Enable the Suggest renaming accessor methods option to rename 'getX()'/'isX()' accessors to 'x()' automatically. Use the If members become more accessible option to specify what to do when conversion will make members more accessible: Choose Do not suggest conversion option to not convert when members would become more accessible. Choose Show conflicts view option to show the affected members and ask to continue. In batch mode conversion will not be suggested. Choose Convert silently option to increase accessibility silently when needed. Use the Suppress conversion if class is annotated by list to exclude classes from conversion when annotated by annotations matching the specified patterns. This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.3", + "markdown": "Reports classes that can be converted record classes.\n\nRecord classes focus on modeling immutable data rather than extensible behavior.\nAutomatic implicit implementation of data-driven methods, such as `equals()` and accessors, helps to reduce boilerplate code.\n\n\nNote that not every class can be a record class. Here are some of the restrictions:\n\n* The class must have no subclasses.\n* All non-static fields in the class must be final.\n* Initializers, generic constructors, and native methods must not be present.\n\nFor a full description of record classes, refer to the\n[Java Language Specification](https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-8.10).\n\nExample:\n\n\n class Point {\n private final double x;\n private final double y;\n\n Point(double x, double y) {\n this.x = x;\n this.y = y;\n }\n\n double getX() {\n return x;\n }\n\n double getY() {\n return y;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n record Point(int x, int y) {\n }\n\nEnable the **Suggest renaming accessor methods** option to rename `getX()`/`isX()` accessors to `x()` automatically.\n\n\nUse the **If members become more accessible** option to specify what to do when conversion will make members more accessible:\n\n* Choose **Do not suggest conversion** option to not convert when members would become more accessible.\n* Choose **Show conflicts view** option to show the affected members and ask to continue. In batch mode conversion will not be suggested.\n* Choose **Convert silently** option to increase accessibility silently when needed.\n\nUse the **Suppress conversion if class is annotated by** list to exclude classes from conversion when annotated by annotations matching the specified patterns.\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.3" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "CallToSystemRunFinalizersOnExit", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ClassCanBeRecord", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Java language level migration aids/Java 16", + "index": 188, "toolComponent": { "name": "QDJVM" } @@ -26797,19 +26721,19 @@ ] }, { - "id": "ParameterTypePreventsOverriding", + "id": "ConstantAssertArgument", "shortDescription": { - "text": "Parameter type prevents overriding" + "text": "Constant assert argument" }, "fullDescription": { - "text": "Reports parameter types of a subclass method that have the same name as the parameter type of the corresponding super method but belong to a different package. In these cases, the subclass method cannot override the super method. Example: 'public class A {\n public void method(Object o) {}\n}\n\npublic class B extends A {\n public void method(Object o) {} // warning on parameter type\n class Object {}\n}' After the quick-fix is applied: 'public class A {\n public void method(Object o) {}\n}\n\npublic class B extends A {\n public void method(java.lang.Object o) {} // new parameter type\n class Object {}\n}'", - "markdown": "Reports parameter types of a subclass method that have the same name as the parameter type of the corresponding super method but belong to a different package. In these cases, the subclass method cannot override the super method.\n\n**Example:**\n\n\n public class A {\n public void method(Object o) {}\n }\n\n public class B extends A {\n public void method(Object o) {} // warning on parameter type\n class Object {}\n }\n\nAfter the quick-fix is applied:\n\n\n public class A {\n public void method(Object o) {}\n }\n\n public class B extends A {\n public void method(java.lang.Object o) {} // new parameter type\n class Object {}\n }\n" + "text": "Reports constant arguments in 'assertTrue()', 'assertFalse()', 'assertNull()', and 'assertNotNull()' calls. Calls to these methods with constant arguments will either always succeed or always fail. Such statements can easily be left over after refactoring and are probably not intended. Example: 'assertNotNull(\"foo\");'", + "markdown": "Reports constant arguments in `assertTrue()`, `assertFalse()`, `assertNull()`, and `assertNotNull()` calls.\n\n\nCalls to these methods with\nconstant arguments will either always succeed or always fail.\nSuch statements can easily be left over after refactoring and are probably not intended.\n\n**Example:**\n\n\n assertNotNull(\"foo\");\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ParameterTypePreventsOverriding", + "suppressToolId": "ConstantAssertArgument", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26817,8 +26741,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Test frameworks", + "index": 130, "toolComponent": { "name": "QDJVM" } @@ -26830,19 +26754,19 @@ ] }, { - "id": "ReplaceInefficientStreamCount", + "id": "RuntimeExec", "shortDescription": { - "text": "Inefficient Stream API call chains ending with count()" + "text": "Call to 'Runtime.exec()'" }, "fullDescription": { - "text": "Reports Stream API call chains ending with a 'count()' operation, that are optimizable. The following call chains can be replaced by this inspection: 'Collection.stream().count()' → 'Collection.size()'. In Java 8 'Collection.stream().count()' actually iterates over the collection elements to count them, while 'Collection.size()' is much faster for most of the collections. 'Stream.flatMap(Collection::stream).count()' → 'Stream.mapToLong(Collection::size).sum()'. Similarly, there's no need to iterate over all the nested collections. Instead, their sizes could be summed up. 'Stream.filter(o -> ...).count() > 0' → 'Stream.anyMatch(o -> ...)'. Unlike the original call, 'anyMatch()' may stop the computation as soon as a matching element is found. 'Stream.filter(o -> ...).count() == 0' → 'Stream.noneMatch(o -> ...)'. Similar to the above. Note that if the replacement involves a short-circuiting operation like 'anyMatch()', there could be a visible behavior change, if the intermediate stream operations produce side effects. In general, side effects should be avoided in Stream API calls. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports Stream API call chains ending with a `count()` operation, that are optimizable.\n\n\nThe following call chains can be replaced by this inspection:\n\n* `Collection.stream().count()` → `Collection.size()`. In Java 8 `Collection.stream().count()` actually iterates over the collection elements to count them, while `Collection.size()` is much faster for most of the collections.\n* `Stream.flatMap(Collection::stream).count()` → `Stream.mapToLong(Collection::size).sum()`. Similarly, there's no need to iterate over all the nested collections. Instead, their sizes could be summed up.\n* `Stream.filter(o -> ...).count() > 0` → `Stream.anyMatch(o -> ...)`. Unlike the original call, `anyMatch()` may stop the computation as soon as a matching element is found.\n* `Stream.filter(o -> ...).count() == 0` → `Stream.noneMatch(o -> ...)`. Similar to the above.\n\n\nNote that if the replacement involves a short-circuiting operation like `anyMatch()`, there could be a visible behavior change,\nif the intermediate stream operations produce side effects. In general, side effects should be avoided in Stream API calls.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "text": "Reports calls to 'Runtime.exec()' or any of its variants. Calls to 'Runtime.exec()' are inherently unportable.", + "markdown": "Reports calls to `Runtime.exec()` or any of its variants. Calls to `Runtime.exec()` are inherently unportable." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ReplaceInefficientStreamCount", + "suppressToolId": "CallToRuntimeExec", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26850,8 +26774,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -26863,19 +26787,19 @@ ] }, { - "id": "ExtractMethodRecommender", + "id": "StaticInitializerReferencesSubClass", "shortDescription": { - "text": "Method can be extracted" + "text": "Static initializer references subclass" }, "fullDescription": { - "text": "Suggests extracting fragments of code to a separate method to make code more clear. This inspection has a number of heuristics to select good candidates for extraction, including the following ones. The extracted fragment has no non-local control flow The extracted fragment has exactly one output variable There are no similar uses of output variable inside the extracted fragment and outside it The extracted fragment has only few input parameters (no more than three by default; configured with the inspection option) The extracted fragment is not smaller than the configured length (500 characters by default) but no bigger than 60% of the containing method body", - "markdown": "Suggests extracting fragments of code to a separate method to make code more clear. This inspection has a number of heuristics to select good candidates for extraction, including the following ones.\n\n* The extracted fragment has no non-local control flow\n* The extracted fragment has exactly one output variable\n* There are no similar uses of output variable inside the extracted fragment and outside it\n* The extracted fragment has only few input parameters (no more than three by default; configured with the inspection option)\n* The extracted fragment is not smaller than the configured length (500 characters by default) but no bigger than 60% of the containing method body" + "text": "Reports classes that refer to their subclasses in static initializers or static fields. Such references can cause JVM-level deadlocks in multithreaded environment, when one thread tries to load the superclass and another thread tries to load the subclass at the same time. Example: 'class Parent {\n static final Child field = new Child();\n }\n class Child extends Parent { }'", + "markdown": "Reports classes that refer to their subclasses in static initializers or static fields.\n\nSuch references can cause JVM-level deadlocks in multithreaded environment, when one thread tries to load the superclass\nand another thread tries to load the subclass at the same time.\n\n**Example:**\n\n\n class Parent {\n static final Child field = new Child();\n }\n class Child extends Parent { }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ExtractMethodRecommender", + "suppressToolId": "StaticInitializerReferencesSubClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26883,8 +26807,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -26896,28 +26820,28 @@ ] }, { - "id": "StringOperationCanBeSimplified", + "id": "MissingDeprecatedAnnotationOnScheduledForRemovalApi", "shortDescription": { - "text": "Redundant 'String' operation" + "text": "Missing '@Deprecated' annotation on scheduled for removal API" }, "fullDescription": { - "text": "Reports redundant calls to 'String' constructors and methods like 'toString()' or 'substring()' that can be replaced with a simpler expression. For example, calls to these methods can be safely removed in code like '\"string\".substring(0)', '\"string\".toString()', or 'new StringBuilder().toString().substring(1,3)'. Example: 'System.out.println(new String(\"message\"));' After the quick-fix is applied: 'System.out.println(\"message\");' Note that the quick-fix removes the redundant constructor call, and this may affect 'String' referential equality. If you need to preserve it, even though it is considered bad practice, suppress the warning or use the inspection setting to ignore redundant 'String' constructor calls. Use the Do not report String constructor calls option below to not report code like the example above. This will avoid changing the outcome of String comparisons with '==' or '!=' after applying the quick-fix in code that uses 'new String()' calls to guarantee a different object identity. Use the Do not report single argument substring() calls option below to not report code like the following. 'stringBuilder.append(string.substring(5));' which can be replaced with the following. 'stringBuilder.append(string, 5, string.length());' New in 2018.1", - "markdown": "Reports redundant calls to `String` constructors and methods like `toString()` or `substring()` that can be replaced with a simpler expression.\n\nFor example, calls to these methods can be safely removed in code\nlike `\"string\".substring(0)`, `\"string\".toString()`, or\n`new StringBuilder().toString().substring(1,3)`.\n\nExample:\n\n\n System.out.println(new String(\"message\"));\n\nAfter the quick-fix is applied:\n\n\n System.out.println(\"message\");\n\n\nNote that the quick-fix removes the redundant constructor call, and this may affect `String` referential equality.\nIf you need to preserve it, even though it is considered bad practice, suppress the warning or use the inspection setting to ignore\nredundant `String` constructor calls.\n\n\nUse the **Do not report String constructor calls** option below to not report code like the example above.\nThis will avoid changing the outcome of String comparisons with `==` or `!=` after applying\nthe quick-fix in code that uses `new String()` calls to guarantee a different object identity.\n\n\nUse the **Do not report single argument substring() calls** option below to not report code like the following.\n\n\n stringBuilder.append(string.substring(5));\n\nwhich can be replaced with the following.\n\n\n stringBuilder.append(string, 5, string.length());\n\nNew in 2018.1" + "text": "Reports declarations marked with '@ApiStatus.ScheduledForRemoval' without '@Deprecated'. Example: '@ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }' After the quick-fix is applied the result looks like: '@Deprecated\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }'", + "markdown": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` without `@Deprecated`.\n\nExample:\n\n\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n\nAfter the quick-fix is applied the result looks like:\n\n\n @Deprecated\n @ApiStatus.ScheduledForRemoval(inVersion = \"2017.3\")\n public void myLegacyMethod() { }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "error", "parameters": { - "suppressToolId": "StringOperationCanBeSimplified", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MissingDeprecatedAnnotationOnScheduledForRemovalApi", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -26929,19 +26853,19 @@ ] }, { - "id": "ClassReferencesSubclass", + "id": "ConstantDeclaredInAbstractClass", "shortDescription": { - "text": "Class references one of its subclasses" + "text": "Constant declared in 'abstract' class" }, "fullDescription": { - "text": "Reports classes which contain references to one of their subclasses. Such references may be confusing and violate several rules of object-oriented design. Example: 'class Entity {\n // Warning: the class references its subclass\n void compare(SimpleEntity entity) {\n ...\n }\n }\n class SimpleEntity extends Entity {\n ...\n }'", - "markdown": "Reports classes which contain references to one of their subclasses. Such references may be confusing and violate several rules of object-oriented design.\n\nExample:\n\n\n class Entity {\n // Warning: the class references its subclass\n void compare(SimpleEntity entity) {\n ...\n }\n }\n class SimpleEntity extends Entity {\n ...\n }\n" + "text": "Reports constants ('public static final' fields) declared in abstract classes. Some coding standards require declaring constants in interfaces instead.", + "markdown": "Reports constants (`public static final` fields) declared in abstract classes.\n\nSome coding standards require declaring constants in interfaces instead." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassReferencesSubclass", + "suppressToolId": "ConstantDeclaredInAbstractClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26949,8 +26873,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -26962,19 +26886,22 @@ ] }, { - "id": "DateToString", + "id": "SubtractionInCompareTo", "shortDescription": { - "text": "Call to 'Date.toString()'" + "text": "Subtraction in 'compareTo()'" }, "fullDescription": { - "text": "Reports 'toString()' calls on 'java.util.Date' objects. Such calls are usually incorrect in an internationalized environment.", - "markdown": "Reports `toString()` calls on `java.util.Date` objects. Such calls are usually incorrect in an internationalized environment." + "text": "Reports subtraction in 'compareTo()' methods and methods implementing 'java.util.Comparator.compare()'. While it is a common idiom to use the results of integer subtraction as the result of a 'compareTo()' method, this construct may cause subtle and difficult bugs in cases of integer overflow. Comparing the integer values directly and returning '-1', '0', or '1' is a better practice in most cases. Subtraction on floating point values that is immediately cast to integral type is also reported because precision loss is possible due to rounding. The inspection doesn't report when it's statically determined that value ranges are limited, and overflow never occurs. Additionally, subtraction on 'int' numbers greater than or equal to '0' will never overflow. Therefore, this inspection tries not to warn in those cases. Methods that always return zero or greater can be marked with the 'javax.annotation.Nonnegative' annotation or specified in this inspection's options. Example: 'class DoubleHolder implements Comparable {\n double d;\n public int compareTo(DoubleHolder that) {\n return (int)(this.d - that.d);\n }\n }' A no-warning example because 'String.length()' is known to be non-negative: 'class A implements Comparable {\n final String s = \"\";\n public int compareTo(A a) {\n return s.length() - a.s.length();\n }\n }' Use the options to list methods that are safe to use inside a subtraction. Methods are safe when they return an 'int' value that is always greater than or equal to '0'.", + "markdown": "Reports subtraction in `compareTo()` methods and methods implementing `java.util.Comparator.compare()`.\n\n\nWhile it is a common idiom to\nuse the results of integer subtraction as the result of a `compareTo()`\nmethod, this construct may cause subtle and difficult bugs in cases of integer overflow.\nComparing the integer values directly and returning `-1`, `0`, or `1` is a better practice in most cases.\n\n\nSubtraction on floating point values that is immediately cast to integral type is also reported because precision loss is possible due to\nrounding.\n\n\nThe inspection doesn't report when it's statically determined that value ranges are limited, and overflow never occurs.\nAdditionally, subtraction on `int` numbers greater than or equal to `0` will never overflow.\nTherefore, this inspection tries not to warn in those cases.\n\n\nMethods that always return zero or greater can be marked with the\n`javax.annotation.Nonnegative` annotation or specified in this inspection's options.\n\n**Example:**\n\n\n class DoubleHolder implements Comparable {\n double d;\n public int compareTo(DoubleHolder that) {\n return (int)(this.d - that.d);\n }\n }\n\nA no-warning example because `String.length()` is known to be non-negative:\n\n\n class A implements Comparable {\n final String s = \"\";\n public int compareTo(A a) {\n return s.length() - a.s.length();\n }\n }\n\n\nUse the options to list methods that are safe to use inside a subtraction.\nMethods are safe when they return an `int` value that is always greater than or equal to `0`." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToDateToString", + "suppressToolId": "SubtractionInCompareTo", + "cweIds": [ + 682 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -26982,8 +26909,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -26995,22 +26922,19 @@ ] }, { - "id": "IterableUsedAsVararg", + "id": "ConnectionResource", "shortDescription": { - "text": "Iterable is used as vararg" + "text": "Connection opened but not safely closed" }, "fullDescription": { - "text": "Reports suspicious usages of 'Collection' or 'Iterable' in vararg method calls. For example, in the following method: ' boolean contains(T needle, T... haystack) {...}' a call like 'if(contains(\"item\", listOfStrings)) {...}' looks suspicious as the list will be wrapped into a single element array. Such code can be successfully compiled and will likely run without exceptions, but it's probably used by mistake. This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5. New in 2019.2", - "markdown": "Reports suspicious usages of `Collection` or `Iterable` in vararg method calls.\n\nFor example, in the following method:\n\n\n boolean contains(T needle, T... haystack) {...}\n\na call like\n\n\n if(contains(\"item\", listOfStrings)) {...}\n\nlooks suspicious as the list will be wrapped into a single element array.\nSuch code can be successfully compiled and will likely run without\nexceptions, but it's probably used by mistake.\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.\n\nNew in 2019.2" + "text": "Reports Java ME 'javax.microedition.io.Connection' 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. Example: 'void example() throws IOException {\n Connection c = Connector.open(\"foo\");\n }'", + "markdown": "Reports Java ME `javax.microedition.io.Connection` 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.\n\n**Example:**\n\n\n void example() throws IOException {\n Connection c = Connector.open(\"foo\");\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IterableUsedAsVararg", - "cweIds": [ - 628 - ], + "suppressToolId": "ConnectionOpenedButNotSafelyClosed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27018,8 +26942,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -27031,19 +26955,19 @@ ] }, { - "id": "MethodNameSameAsParentName", + "id": "BooleanVariableAlwaysNegated", "shortDescription": { - "text": "Method name same as parent class name" + "text": "Boolean variable is always inverted" }, "fullDescription": { - "text": "Reports methods that have the same name as the superclass of the method's class, as such a method name may be confusing. This inspection doesn't check interfaces or superclasses deep in the hierarchy. Example: 'class Parent {}\n class Child extends Parent {\n public Parent Parent() {\n return null;\n }\n }' A quick-fix that renames such methods is available only in the editor.", - "markdown": "Reports methods that have the same name as the superclass of the method's class, as such a method name may be confusing.\n\nThis inspection doesn't check interfaces or superclasses deep in the hierarchy.\n\n**Example:**\n\n\n class Parent {}\n class Child extends Parent {\n public Parent Parent() {\n return null;\n }\n }\n\nA quick-fix that renames such methods is available only in the editor." + "text": "Reports boolean variables or fields which are always negated when their value is used. Example: 'void m() {\n boolean b = true; //boolean variable 'b' is always inverted\n System.out.println(!b);\n }'", + "markdown": "Reports boolean variables or fields which are always negated when their value is used.\n\nExample:\n\n\n void m() {\n boolean b = true; //boolean variable 'b' is always inverted\n System.out.println(!b);\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MethodNameSameAsParentName", + "suppressToolId": "BooleanVariableAlwaysNegated", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27051,8 +26975,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Java/Data flow", + "index": 65, "toolComponent": { "name": "QDJVM" } @@ -27064,19 +26988,19 @@ ] }, { - "id": "LambdaParameterNamingConvention", + "id": "ExtendsAnnotation", "shortDescription": { - "text": "Lambda parameter naming convention" + "text": "Class extends annotation interface" }, "fullDescription": { - "text": "Reports lambda parameters whose names are too short, too long, or do not follow the specified regular expression pattern. Example: 'Function id = X -> X;' should be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter. Configure the inspection: Use the fields in the Options section to specify the minimum length, maximum length, and a regular expression expected for lambda parameter names. Specify 0 in order not to check the length of names. Regular expressions should be specified in the standard 'java.util.regex' format.", - "markdown": "Reports lambda parameters whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:** `Function id = X -> X;`\nshould be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter.\n\nConfigure the inspection:\n\n\nUse the fields in the **Options** section to specify the minimum length, maximum length, and a regular expression expected for lambda parameter names.\nSpecify **0** in order not to check the length of names.\n\nRegular expressions should be specified in the standard `java.util.regex` format." + "text": "Reports classes declared as an implementation or extension of an annotation interface. While it is legal to extend an annotation interface, it is often done by accident, and the result can't be used as an annotation. This inspection depends on the Java feature 'Annotations', which is available since Java 5.", + "markdown": "Reports classes declared as an implementation or extension of an annotation interface.\n\nWhile it is legal to extend an annotation interface, it is often done by accident,\nand the result can't be used as an annotation.\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "LambdaParameterNamingConvention", + "suppressToolId": "ClassExplicitlyAnnotation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27084,8 +27008,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -27097,19 +27021,19 @@ ] }, { - "id": "LawOfDemeter", + "id": "unused", "shortDescription": { - "text": "Law of Demeter" + "text": "Unused declaration" }, "fullDescription": { - "text": "Reports Law of Demeter violations. The Law of Demeter is not really a law, but specifies a style guideline: never call a method on an object received from another call. The code that follows this guideline is easier to maintain, adapt, and refactor, has less coupling between methods, less duplication, and better information hiding. On the other hand, you may need to write many wrapper methods to meet this guideline. Example: 'boolean pay(Customer c, Invoice invoice) {\n int dollars = c.getWallet().contents; // violation\n if (dollars >= invoice.getAmount()) {\n Wallet w = c.getWallet();\n w.subtract(invoice.getAmount()); // violation\n return true;\n }\n return false;\n }' The above example might be better implemented as a method 'payInvoice(Invoice invoice)' in 'Customer'. Use the Ignore calls to library methods and access to library fields option to ignore Law of Demeter violations that can't be fixed without changing a library.", - "markdown": "Reports [Law of Demeter](https://en.wikipedia.org/wiki/Law_of_Demeter) violations.\n\n\nThe Law of Demeter is not really a law, but specifies a style guideline: never call a method on an object received from another call.\nThe code that follows this guideline is easier to maintain, adapt, and refactor, has less coupling between methods, less duplication,\nand better information hiding. On the other hand, you may need to write many wrapper methods to meet this guideline.\n\n**Example:**\n\n\n boolean pay(Customer c, Invoice invoice) {\n int dollars = c.getWallet().contents; // violation\n if (dollars >= invoice.getAmount()) {\n Wallet w = c.getWallet();\n w.subtract(invoice.getAmount()); // violation\n return true;\n }\n return false;\n }\n\nThe above example might be better implemented as a method `payInvoice(Invoice invoice)` in `Customer`.\n\n\nUse the **Ignore calls to library methods and access to library fields** option to ignore Law of Demeter violations\nthat can't be fixed without changing a library." + "text": "Reports classes, methods, or fields that are not used or unreachable from the entry points. An entry point can be a main method, tests, classes from outside the specified scope, classes accessible from 'module-info.java', and so on. It is possible to configure custom entry points by using name patterns or annotations. Example: 'public class Department {\n private Organization myOrganization;\n }' In this example, 'Department' explicitly references 'Organization' but if 'Department' class itself is unused, then inspection will report both classes. The inspection also reports parameters that are not used by their methods and all method implementations and overriders, as well as local variables that are declared but not used. Note: Some unused members may not be reported during in-editor code highlighting. For performance reasons, a non-private member is checked only when its name rarely occurs in the project. To see all results, run the inspection by selecting Code | Inspect Code or Code | Analyze Code | Run Inspection by Name from the main menu. Use the visibility settings below to configure members to be reported. For example, configuring report 'private' methods only means that 'public' methods of 'private' inner class will be reported but 'protected' methods of top level class will be ignored. Use the entry points tab to configure entry points to be considered during the inspection run. You can add entry points manually when inspection results are ready. If your code uses unsupported frameworks, there are several options: If the framework relies on annotations, use the Annotations... button to configure the framework's annotations. If the framework doesn't rely on annotations, try to configure class name patterns that are expected by the framework. This way the annotated code accessible by the framework internals will be treated as used.", + "markdown": "Reports classes, methods, or fields that are not used or unreachable from the entry points.\n\nAn entry point can be a main method, tests, classes from outside the specified scope, classes accessible from\n`module-info.java`, and so on. It is possible to configure custom entry points by using name patterns or annotations.\n\n**Example:**\n\n\n public class Department {\n private Organization myOrganization;\n }\n\nIn this example, `Department` explicitly references `Organization` but if `Department` class itself is unused, then inspection will report both classes.\n\n\nThe inspection also reports parameters that are not used by their methods and all method implementations and overriders, as well as local\nvariables that are declared but not used.\n\n\n**Note:** Some unused members may not be reported during in-editor code highlighting. For performance reasons, a non-private member is\nchecked only when its name rarely occurs in the project.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the visibility settings below to configure members to be reported. For example, configuring report `private` methods only means\nthat `public` methods of `private` inner class will be reported but `protected` methods of top level class\nwill be ignored.\n\n\nUse the **entry points** tab to configure entry points to be considered during the inspection run.\n\nYou can add entry points manually when inspection results are ready.\n\nIf your code uses unsupported frameworks, there are several options:\n\n* If the framework relies on annotations, use the **Annotations...** button to configure the framework's annotations.\n* If the framework doesn't rely on annotations, try to configure class name patterns that are expected by the framework.\n\nThis way the annotated code accessible by the framework internals will be treated as used." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LawOfDemeter", + "suppressToolId": "unused", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27117,8 +27041,8 @@ "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -27130,19 +27054,22 @@ ] }, { - "id": "AmbiguousFieldAccess", + "id": "MismatchedStringCase", "shortDescription": { - "text": "Access to inherited field looks like access to element from surrounding code" + "text": "Mismatched case in 'String' operation" }, "fullDescription": { - "text": "Reports access to a superclass field from an anonymous, inner or local class, if a local variable, parameter, or field with the same name is available in the code surrounding the class. In this case it may seem that an element from the surrounding code is accessed, when in fact it is an access to a field from the superclass. To clarify the intent of the code, it is recommended to add an explicit 'super' qualifier to the field access. Example: 'class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(ambiguous); // the field is accessed, not the parameter\n }\n };\n }\n }' After the quick-fix is applied: 'class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(super.ambiguous);\n }\n };\n }\n }'", - "markdown": "Reports access to a superclass field from an anonymous, inner or local class, if a local variable, parameter, or field with the same name is available in the code surrounding the class. In this case it may seem that an element from the surrounding code is accessed, when in fact it is an access to a field from the superclass.\n\n\nTo clarify the intent of the code, it is recommended to add an explicit\n`super` qualifier to the field access.\n\n**Example:**\n\n\n class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(ambiguous); // the field is accessed, not the parameter\n }\n };\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(super.ambiguous);\n }\n };\n }\n }\n" + "text": "Reports 'String' method calls that always return the same value ('-1' or 'false') because a lowercase character is searched in an uppercase-only string or vice versa. Reported methods include 'equals', 'startsWith', 'endsWith', 'contains', 'indexOf', and 'lastIndexOf'. Example: if (columnName.toLowerCase().equals(\"ID\")) {...}\n New in 2019.3", + "markdown": "Reports `String` method calls that always return the same value (`-1` or `false`) because a lowercase character is searched in an uppercase-only string or vice versa.\n\nReported methods include `equals`, `startsWith`, `endsWith`, `contains`,\n`indexOf`, and `lastIndexOf`.\n\n**Example:**\n\n```\n if (columnName.toLowerCase().equals(\"ID\")) {...}\n```\n\nNew in 2019.3" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AmbiguousFieldAccess", + "suppressToolId": "MismatchedStringCase", + "cweIds": [ + 597 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27150,8 +27077,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -27163,19 +27090,19 @@ ] }, { - "id": "NonProtectedConstructorInAbstractClass", + "id": "SuspiciousGetterSetter", "shortDescription": { - "text": "Public constructor in abstract class" + "text": "Suspicious getter/setter" }, "fullDescription": { - "text": "Reports 'public' constructors of 'abstract' classes. Constructors of 'abstract' classes can only be called from the constructors of their subclasses, declaring them 'public' may be confusing. The quick-fix makes such constructors protected. Example: 'public abstract class Foo {\n public Foo () { // warning: has 'public' modifier\n /* ... */\n }\n }' After the quick-fix is applied: 'public abstract class Foo {\n protected Foo () {\n /* ... */\n }\n }' Configure the inspection: Use the Ignore for non-public classes option below to ignore 'public' constructors in non-public classes.", - "markdown": "Reports `public` constructors of `abstract` classes.\n\n\nConstructors of `abstract` classes can only be called from the constructors of\ntheir subclasses, declaring them `public` may be confusing.\n\nThe quick-fix makes such constructors protected.\n\n**Example:**\n\n\n public abstract class Foo {\n public Foo () { // warning: has 'public' modifier\n /* ... */\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public abstract class Foo {\n protected Foo () {\n /* ... */\n }\n }\n\nConfigure the inspection:\n\nUse the **Ignore for non-public classes** option below to ignore `public` constructors in non-public classes." + "text": "Reports getter or setter methods that access a field that is not expected by its name. For example, when 'getY()' returns the 'x' field. Usually, it might be a copy-paste error. Example: 'class Point {\n private int x;\n private int y;\n\n public void setX(int x) { // Warning: setter 'setX()' assigns field 'y'\n this.y = x;\n }\n\n public int getY() { // Warning: getter 'getY()' returns field 'x'\n return x;\n }\n }' Use the checkbox below to report situations when a field in the class has a name that matches a name of a getter or a setter.", + "markdown": "Reports getter or setter methods that access a field that is not expected by its name. For example, when `getY()` returns the `x` field. Usually, it might be a copy-paste error.\n\n**Example:**\n\n class Point {\n private int x;\n private int y;\n\n public void setX(int x) { // Warning: setter 'setX()' assigns field 'y'\n this.y = x;\n }\n\n public int getY() { // Warning: getter 'getY()' returns field 'x'\n return x;\n }\n }\n\n\nUse the checkbox below to report situations when a field in the class has a name that matches a name of a getter or a setter." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConstructorNotProtectedInAbstractClass", + "suppressToolId": "SuspiciousGetterSetter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27183,8 +27110,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/JavaBeans issues", + "index": 141, "toolComponent": { "name": "QDJVM" } @@ -27196,22 +27123,19 @@ ] }, { - "id": "ComparableImplementedButEqualsNotOverridden", + "id": "AssignmentToNull", "shortDescription": { - "text": "'Comparable' implemented but 'equals()' not overridden" + "text": "'null' assignment" }, "fullDescription": { - "text": "Reports classes that implement 'java.lang.Comparable' but do not override 'equals()'. If 'equals()' is not overridden, the 'equals()' implementation is not consistent with the 'compareTo()' implementation. If an object of such a class is added to a collection such as 'java.util.SortedSet', this collection will violate the contract of 'java.util.Set', which is defined in terms of 'equals()'. Example: 'class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n }' After the quick fix is applied: 'class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n\n @Override\n public boolean equals(Object o) {\n return o instanceof Length && compareTo((Length) o) == 0;\n }\n }'", - "markdown": "Reports classes that implement `java.lang.Comparable` but do not override `equals()`.\n\n\nIf `equals()`\nis not overridden, the `equals()` implementation is not consistent with\nthe `compareTo()` implementation. If an object of such a class is added\nto a collection such as `java.util.SortedSet`, this collection will violate\nthe contract of `java.util.Set`, which is defined in terms of\n`equals()`.\n\n**Example:**\n\n\n class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n }\n\nAfter the quick fix is applied:\n\n\n class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n\n @Override\n public boolean equals(Object o) {\n return o instanceof Length && compareTo((Length) o) == 0;\n }\n }\n" + "text": "Reports variables that are assigned to 'null' outside a declaration. The main purpose of 'null' in Java is to denote uninitialized reference variables. In rare cases, assigning a variable explicitly to 'null' is useful to aid garbage collection. However, using 'null' to denote a missing, not specified, or invalid value or a not found element is considered bad practice and may make your code more prone to 'NullPointerExceptions'. Instead, consider defining a sentinel object with the intended semantics or use library types like 'Optional' to denote the absence of a value. Example: 'Integer convert(String s) {\n Integer value;\n try {\n value = Integer.parseInt(s);\n } catch (NumberFormatException e) {\n // Warning: null is used to denote an 'invalid value'\n value = null;\n }\n return value;\n }' Use the Ignore assignments to fields option to ignore assignments to fields.", + "markdown": "Reports variables that are assigned to `null` outside a declaration.\n\nThe main purpose of `null` in Java is to denote uninitialized\nreference variables. In rare cases, assigning a variable explicitly to `null`\nis useful to aid garbage collection. However, using `null` to denote a missing, not specified, or invalid value or a not\nfound element is considered bad practice and may make your code more prone to `NullPointerExceptions`.\nInstead, consider defining a sentinel object with the intended semantics\nor use library types like `Optional` to denote the absence of a value.\n\n**Example:**\n\n\n Integer convert(String s) {\n Integer value;\n try {\n value = Integer.parseInt(s);\n } catch (NumberFormatException e) {\n // Warning: null is used to denote an 'invalid value'\n value = null;\n }\n return value;\n }\n\n\nUse the **Ignore assignments to fields** option to ignore assignments to fields." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ComparableImplementedButEqualsNotOverridden", - "cweIds": [ - 697 - ], + "suppressToolId": "AssignmentToNull", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27219,8 +27143,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -27232,19 +27156,19 @@ ] }, { - "id": "MapReplaceableByEnumMap", + "id": "WaitCalledOnCondition", "shortDescription": { - "text": "'Map' can be replaced with 'EnumMap'" + "text": "'wait()' called on 'java.util.concurrent.locks.Condition' object" }, "fullDescription": { - "text": "Reports instantiations of 'java.util.Map' objects whose key types are enumerated classes. Such 'java.util.Map' objects can be replaced with 'java.util.EnumMap' objects. 'java.util.EnumMap' implementations can be much more efficient because the underlying data structure is a simple array. Example: 'Map myEnums = new HashMap<>();' After the quick-fix is applied: 'Map myEnums = new EnumMap<>(MyEnum.class);'", - "markdown": "Reports instantiations of `java.util.Map` objects whose key types are enumerated classes. Such `java.util.Map` objects can be replaced with `java.util.EnumMap` objects.\n\n\n`java.util.EnumMap` implementations can be much more efficient\nbecause the underlying data structure is a simple array.\n\n**Example:**\n\n\n Map myEnums = new HashMap<>();\n\nAfter the quick-fix is applied:\n\n\n Map myEnums = new EnumMap<>(MyEnum.class);\n" + "text": "Reports calls to 'wait()' made on a 'java.util.concurrent.locks.Condition' object. This is probably a programming error, and some variant of the 'await()' method was intended instead. Example: 'void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.wait();\n }\n }' Good code would look like this: 'void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.await();\n }\n }'", + "markdown": "Reports calls to `wait()` made on a `java.util.concurrent.locks.Condition` object. This is probably a programming error, and some variant of the `await()` method was intended instead.\n\n**Example:**\n\n\n void acquire(Condition released) throws InterruptedException {\n while (acquired) {\n released.wait();\n }\n }\n\nGood code would 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": "MapReplaceableByEnumMap", + "suppressToolId": "WaitCalledOnCondition", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27252,8 +27176,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -27265,23 +27189,19 @@ ] }, { - "id": "ReturnNull", + "id": "NonSynchronizedMethodOverridesSynchronizedMethod", "shortDescription": { - "text": "Return of 'null'" + "text": "Unsynchronized method overrides 'synchronized' method" }, "fullDescription": { - "text": "Reports 'return' statements with 'null' return values. While occasionally useful, this construct may make the code more prone to failing with a 'NullPointerException'. If a method is designed to return 'null', it is suggested to mark it with the '@Nullable' annotation - such methods will be ignored by this inspection. Example: 'class Person {\n public String getName () {\n return null;\n }\n }' After the quick-fix is applied: 'class Person {\n public @Nullable String getName () {\n return null;\n }\n }' If the return type is 'java.util.Optional', an additional quick-fix to convert 'null' to 'Optional.empty()' is suggested. Use the following options to configure the inspection: Whether to ignore 'private' methods. This will also ignore return of 'null' from anonymous classes and lambdas. Whether 'null' values on array returns, collection object returns, plain object returns, or a combination of the three should be reported. Return of 'null' in methods with return type 'java.util.Optional' are always reported. Click Configure annotations to specify which annotations should be considered 'nullable'.", - "markdown": "Reports `return` statements with `null` return values. While occasionally useful, this construct may make the code more prone to failing with a `NullPointerException`.\n\n\nIf a method is designed to return `null`, it is suggested to mark it with the\n`@Nullable` annotation - such methods will be ignored by this inspection.\n\n**Example:**\n\n\n class Person {\n public String getName () {\n return null;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Person {\n public @Nullable String getName () {\n return null;\n }\n }\n\n\nIf the return type is `java.util.Optional`, an additional quick-fix to convert\n`null` to `Optional.empty()` is suggested.\n\n\nUse the following options to configure the inspection:\n\n* Whether to ignore `private` methods. This will also ignore return of `null` from anonymous classes and lambdas.\n* Whether `null` values on array returns, collection object returns, plain object returns, or a combination of the three should be reported. Return of `null` in methods with return type `java.util.Optional` are always reported.\n* Click **Configure annotations** to specify which annotations should be considered 'nullable'." + "text": "Reports non-'synchronized' methods overriding 'synchronized' methods. The overridden method will not be automatically synchronized if the superclass method is declared as 'synchronized'. This may result in unexpected race conditions when using the subclass. Example: 'class Super {\n synchronized void process() {}\n }\n class Sub extends Super {\n // Unsynchronized method 'process()' overrides synchronized method\n void process() {}\n }'", + "markdown": "Reports non-`synchronized` methods overriding `synchronized` methods.\n\n\nThe overridden method will not be automatically synchronized if the superclass method\nis declared as `synchronized`. This may result in unexpected race conditions when using the subclass.\n\n**Example:**\n\n\n class Super {\n synchronized void process() {}\n }\n class Sub extends Super {\n // Unsynchronized method 'process()' overrides synchronized method\n void process() {}\n } \n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ReturnOfNull", - "cweIds": [ - 252, - 476 - ], + "suppressToolId": "NonSynchronizedMethodOverridesSynchronizedMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27289,8 +27209,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs/Nullability problems", - "index": 174, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -27302,19 +27222,19 @@ ] }, { - "id": "LoggingStringTemplateAsArgument", + "id": "TooBroadCatch", "shortDescription": { - "text": "String template as argument to logging call" + "text": "Overly broad 'catch' block" }, "fullDescription": { - "text": "Reports string templates that are used as arguments to SLF4J and Log4j 2 logging methods. The method 'org.apache.logging.log4j.Logger.log()' and its overloads are supported only for all log levels option. String templates 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 (for Kotlin): 'val variable1 = getVariable()\n logger.info(\"variable1: $variable1\")' After the quick-fix is applied (for Kotlin): 'val variable1 = getVariable()\n logger.info(\"variable1: {}\", variable1)' Note that the suggested replacement might not be equivalent to the original code, for example, when string templates contain method calls or assignment expressions. Use the Warn on list to ignore certain higher logging levels. Higher logging levels may be always enabled, and the arguments will always be evaluated. Use the Do not warn when only expressions with primitive types, their wrappers or String are included option to ignore string templates, which contain only expressions with primitive types, their wrappers or String. For example, it could be useful to prevent loading lazy collections. Note that, creating string even only with expressions with primitive types, their wrappers or String at runtime can negatively impact performance. Use the Do not warn when call only with an exception as argument after message argument option to ignore calls, which only contain an exception as an argument after the message argument. For example, it could be useful to adjust the inspection's behavior with a custom code style. New in 2023.1", - "markdown": "Reports string templates that are used as arguments to **SLF4J** and **Log4j 2** logging methods. The method `org.apache.logging.log4j.Logger.log()` and its overloads are supported only for **all log levels** option. String templates 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 (for Kotlin):**\n\n\n val variable1 = getVariable()\n logger.info(\"variable1: $variable1\")\n\n**After the quick-fix is applied (for Kotlin):**\n\n\n val variable1 = getVariable()\n logger.info(\"variable1: {}\", variable1)\n\n\nNote that the suggested replacement might not be equivalent to the original code, for example,\nwhen string templates contain method calls or assignment expressions.\n\n* Use the **Warn on** list to ignore certain higher logging levels. Higher logging levels may be always enabled, and the arguments will always be evaluated.\n* Use the **Do not warn when only expressions with primitive types, their wrappers or String are included** option to ignore string templates, which contain only expressions with primitive types, their wrappers or String. For example, it could be useful to prevent loading lazy collections. Note that, creating string even only with expressions with primitive types, their wrappers or String at runtime can negatively impact performance.\n* Use the **Do not warn when call only with an exception as argument after message argument** option to ignore calls, which only contain an exception as an argument after the message argument. For example, it could be useful to adjust the inspection's behavior with a custom code style.\n\nNew in 2023.1" + "text": "Reports 'catch' blocks with parameters that are more generic than the exception thrown by the corresponding 'try' block. Example: 'try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (Exception ex) { // warning: 'catch' of 'Exception' is too broad, masking exceptions 'RuntimeException'\n return defaultFilePath;\n }' After the quick-fix is applied: 'try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (RuntimeException ex) {\n return defaultFilePath;\n }' Configure the inspection: 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 which hide others but are themselves thrown option to ignore any exceptions that hide other exceptions but still may be thrown and thus are technically not overly broad.", + "markdown": "Reports `catch` blocks with parameters that are more generic than the exception thrown by the corresponding `try` block.\n\n**Example:**\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (Exception ex) { // warning: 'catch' of 'Exception' is too broad, masking exceptions 'RuntimeException'\n return defaultFilePath;\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n File file = new File(pathToFile);\n return file.getAbsolutePath();\n } catch (RuntimeException ex) {\n return defaultFilePath;\n }\n\nConfigure the inspection:\n\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 which hide others but are themselves thrown** option to ignore any exceptions that hide other exceptions but still may be thrown and thus are technically not overly broad." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LoggingStringTemplateAsArgument", + "suppressToolId": "OverlyBroadCatchBlock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27322,8 +27242,8 @@ "relationships": [ { "target": { - "id": "JVM languages/Logging", - "index": 52, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -27335,19 +27255,19 @@ ] }, { - "id": "UnpredictableBigDecimalConstructorCall", + "id": "ProtectedMemberInFinalClass", "shortDescription": { - "text": "Unpredictable 'BigDecimal' constructor call" + "text": "'protected' member in 'final' class" }, "fullDescription": { - "text": "Reports calls to 'BigDecimal' constructors that accept a 'double' value. These constructors produce 'BigDecimal' that is exactly equal to the supplied 'double' value. However, because doubles are encoded in the IEEE 754 64-bit double-precision binary floating-point format, the exact value can be unexpected. For example, 'new BigDecimal(0.1)' yields a 'BigDecimal' object. Its value is '0.1000000000000000055511151231257827021181583404541015625' which is the nearest number to 0.1 representable as a double. To get 'BigDecimal' that stores the same value as written in the source code, use either 'new BigDecimal(\"0.1\")' or 'BigDecimal.valueOf(0.1)'. Example: 'class Constructor {\n void foo() {\n new BigDecimal(0.1);\n }\n }' After the quick-fix is applied: 'class Constructor {\n void foo() {\n new BigDecimal(\"0.1\");\n }\n }'", - "markdown": "Reports calls to `BigDecimal` constructors that accept a `double` value. These constructors produce `BigDecimal` that is exactly equal to the supplied `double` value. However, because doubles are encoded in the IEEE 754 64-bit double-precision binary floating-point format, the exact value can be unexpected.\n\nFor example, `new BigDecimal(0.1)` yields a `BigDecimal` object. Its value is\n`0.1000000000000000055511151231257827021181583404541015625`\nwhich is the nearest number to 0.1 representable as a double.\nTo get `BigDecimal` that stores the same value as written in the source code,\nuse either `new BigDecimal(\"0.1\")` or `BigDecimal.valueOf(0.1)`.\n\n**Example:**\n\n\n class Constructor {\n void foo() {\n new BigDecimal(0.1);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Constructor {\n void foo() {\n new BigDecimal(\"0.1\");\n }\n }\n" + "text": "Reports 'protected' members in 'final'classes. Since 'final' classes cannot be inherited, marking the method as 'protected' may be confusing. It is better to declare such members as 'private' or package-visible instead. Example: 'record Bar(int a, int b) {\n protected int sum() { \n return a + b;\n }\n}'\n After the quick-fix is applied: 'record Bar(int a, int b) {\n int sum() { \n return a + b;\n }\n}' As shown in the example, a class can be marked as 'final' explicitly or implicitly.", + "markdown": "Reports `protected` members in `final`classes.\n\nSince `final` classes cannot be inherited, marking the method as `protected`\nmay be confusing. It is better to declare such members as `private` or package-visible instead.\n\n**Example:**\n\n record Bar(int a, int b) {\n protected int sum() { \n return a + b;\n }\n }\n\nAfter the quick-fix is applied:\n\n record Bar(int a, int b) {\n int sum() { \n return a + b;\n }\n }\n\nAs shown in the example, a class can be marked as `final` explicitly or implicitly." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnpredictableBigDecimalConstructorCall", + "suppressToolId": "ProtectedMemberInFinalClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27355,8 +27275,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -27368,19 +27288,19 @@ ] }, { - "id": "IntegerDivisionInFloatingPointContext", + "id": "DanglingJavadoc", "shortDescription": { - "text": "Integer division in floating-point context" + "text": "Dangling Javadoc comment" }, "fullDescription": { - "text": "Reports integer divisions where the result is used as a floating-point number. Such division is often an error and may have unexpected results due to the truncation that happens in integer division. Example: 'float x = 3.0F + 3 * 2 / 5;' After the quick-fix is applied: 'float x = 3.0F + ((float) (3 * 2)) /5;'", - "markdown": "Reports integer divisions where the result is used as a floating-point number. Such division is often an error and may have unexpected results due to the truncation that happens in integer division.\n\n**Example:**\n\n\n float x = 3.0F + 3 * 2 / 5;\n\nAfter the quick-fix is applied:\n\n\n float x = 3.0F + ((float) (3 * 2)) /5;\n" + "text": "Reports Javadoc comments that don't belong to any class, method or field. The Javadoc tool ignores dangling Javadoc comments and doesn't include them in the HTML documentation it generates. Example: 'class A {\n /**\n * Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }' A quick-fix is available to delete such comments completely or convert them into a block comment. After the quick-fix is applied: 'class A {\n /*\n Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }' Use the Ignore file header comment in JavaDoc format option to ignore comments at the beginning of Java files. These are usually copyright messages.", + "markdown": "Reports Javadoc comments that don't belong to any class, method or field. The Javadoc tool ignores dangling Javadoc comments and doesn't include them in the HTML documentation it generates.\n\n**Example:**\n\n\n class A {\n /**\n * Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }\n\nA quick-fix is available to delete such comments completely or convert them into a block comment. After the quick-fix is applied:\n\n\n class A {\n /*\n Dangling comment\n */\n /**\n * Method javadoc\n */\n public void m(){}\n }\n\nUse the **Ignore file header comment in JavaDoc format** option to ignore comments at the beginning of Java files.\nThese are usually copyright messages." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IntegerDivisionInFloatingPointContext", + "suppressToolId": "DanglingJavadoc", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27388,8 +27308,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -27401,19 +27321,19 @@ ] }, { - "id": "AssertWithoutMessage", + "id": "HibernateResource", "shortDescription": { - "text": "Message missing on assertion" + "text": "Hibernate resource opened but not safely closed" }, "fullDescription": { - "text": "Reports calls to 'assertXXX()' or 'fail()' without an error message string argument. An error message on assertion failure may help clarify the test case's intent. Example: 'assertTrue(checkValid());' After the quick-fix is applied: 'assertTrue(checkValid(), \"|\");' The message argument is added before or after the existing arguments according to the assertions framework that you use.", - "markdown": "Reports calls to `assertXXX()` or `fail()` without an error message string argument. An error message on assertion failure may help clarify the test case's intent.\n\n**Example:**\n\n\n assertTrue(checkValid());\n\nAfter the quick-fix is applied:\n\n assertTrue(checkValid(), \"|\");\n\n\nThe message argument is added before or after the existing arguments according to the assertions framework that you use." + "text": "Reports calls to the 'openSession()' method if the returned 'org.hibernate.Session' resource is not safely closed. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'void doHibernateQuery(SessionFactory factory) {\n Session session = factory.openSession(); //warning\n session.createQuery(\"...\");\n }' Use the following options to configure the inspection: Whether a 'org.hibernate.Session' 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 calls to the `openSession()` method if the returned `org.hibernate.Session` resource is not safely closed.\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 doHibernateQuery(SessionFactory factory) {\n Session session = factory.openSession(); //warning\n session.createQuery(\"...\");\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a `org.hibernate.Session` 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": "AssertWithoutMessage", + "suppressToolId": "HibernateResourceOpenedButNotSafelyClosed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27421,8 +27341,8 @@ "relationships": [ { "target": { - "id": "Java/Test frameworks", - "index": 130, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -27434,19 +27354,19 @@ ] }, { - "id": "ConditionalBreakInInfiniteLoop", + "id": "UnnecessaryInitCause", "shortDescription": { - "text": "Conditional break inside loop" + "text": "Unnecessary call to 'Throwable.initCause()'" }, "fullDescription": { - "text": "Reports conditional breaks at the beginning or at the end of a loop and suggests adding a loop condition instead to shorten the code. Example: 'while (true) {\n if (i == 23) break;\n i++;\n }' After the quick fix is applied: 'while (i != 23) {\n i++;\n }'", - "markdown": "Reports conditional breaks at the beginning or at the end of a loop and suggests adding a loop condition instead to shorten the code.\n\nExample:\n\n\n while (true) {\n if (i == 23) break;\n i++;\n }\n\nAfter the quick fix is applied:\n\n\n while (i != 23) {\n i++;\n }\n" + "text": "Reports calls to 'Throwable.initCause()' where an exception constructor also takes a 'Throwable cause' argument. In this case, the 'initCause()' call can be removed and its argument can be added to the call to the exception's constructor. Example: 'try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\");\n wrapper.initCause(ex); // Unnecessary call to 'Throwable.initCause()'\n throw wrapper;\n }' A quick-fix is available to pass the cause argument to the constructor. After the quick-fix is applied: 'try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\", ex);\n throw wrapper;\n }'", + "markdown": "Reports calls to `Throwable.initCause()` where an exception constructor also takes a `Throwable cause` argument.\n\nIn this case, the `initCause()` call can be removed and its argument can be added to the call to the exception's constructor.\n\n**Example:**\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\");\n wrapper.initCause(ex); // Unnecessary call to 'Throwable.initCause()'\n throw wrapper;\n }\n\nA quick-fix is available to pass the cause argument to the constructor. After the quick-fix is applied:\n\n\n try {\n process();\n }\n catch (RuntimeException ex) {\n RuntimeException wrapper = new RuntimeException(\"Error while processing\", ex);\n throw wrapper;\n }\n \n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ConditionalBreakInInfiniteLoop", + "suppressToolId": "UnnecessaryInitCause", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27454,8 +27374,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -27467,19 +27387,19 @@ ] }, { - "id": "UnqualifiedInnerClassAccess", + "id": "ComparisonOfShortAndChar", "shortDescription": { - "text": "Unqualified inner class access" + "text": "Comparison of 'short' and 'char' values" }, "fullDescription": { - "text": "Reports references to inner classes that are not qualified with the name of the enclosing class. Example: 'import foo.Foo.Bar;\n\n class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Bar bar) {}\n }' After the quick-fix is applied: 'class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Foo.Bar bar) {}\n }' Use the inspection settings to ignore references to inner classes within the same class, which therefore do not require an import.", - "markdown": "Reports references to inner classes that are not qualified with the name of the enclosing class.\n\n**Example:**\n\n\n import foo.Foo.Bar;\n\n class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Bar bar) {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Foo.Bar bar) {}\n }\n\n\nUse the inspection settings to ignore references to inner classes within the same class,\nwhich therefore do not require an import." + "text": "Reports equality comparisons between 'short' and 'char' values. Such comparisons may cause subtle bugs because while both values are 2-byte long, 'short' values are signed, and 'char' values are unsigned. Example: 'if (Character.MAX_VALUE == shortValue()) {} //never can be true'", + "markdown": "Reports equality comparisons between `short` and `char` values.\n\nSuch comparisons may cause subtle bugs because while both values are 2-byte long, `short` values are\nsigned, and `char` values are unsigned.\n\n**Example:**\n\n\n if (Character.MAX_VALUE == shortValue()) {} //never can be true\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnqualifiedInnerClassAccess", + "suppressToolId": "ComparisonOfShortAndChar", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27487,8 +27407,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -27500,28 +27420,28 @@ ] }, { - "id": "RedundantClassCall", + "id": "ArrayCanBeReplacedWithEnumValues", "shortDescription": { - "text": "Redundant 'isInstance()' or 'cast()' call" + "text": "Array can be replaced with enum values" }, "fullDescription": { - "text": "Reports redundant calls of 'java.lang.Class' methods. For example, 'Xyz.class.isInstance(object)' can be replaced with 'object instanceof Xyz'. The instanceof check is preferred: even though the performance will probably be the same as these methods are intrinsics, they better indicate a static check. New in 2018.2", - "markdown": "Reports redundant calls of `java.lang.Class` methods.\n\nFor example, `Xyz.class.isInstance(object)` can be replaced with `object instanceof Xyz`.\nThe instanceof check is preferred: even though the performance will probably be the same as these methods are intrinsics,\nthey better indicate a static check.\n\nNew in 2018.2" + "text": "Reports arrays of enum constants that can be replaced with a call to 'EnumType.values()'. Usually, when updating such an enum, you have to update the array as well. However, if you use 'EnumType.values()' instead, no modifications are required. Example: 'enum States {\n NOT_RUN, IN_PROGRESS, FINISHED;\n }\n \n handleStates(new States[] {NOT_RUN, IN_PROGRESS, FINISHED});' After the quick-fix is applied: 'handleStates(States.values());' New in 2019.1", + "markdown": "Reports arrays of enum constants that can be replaced with a call to `EnumType.values()`.\n\nUsually, when updating such an enum, you have to update the array as well. However, if you use `EnumType.values()`\ninstead, no modifications are required.\n\nExample:\n\n\n enum States {\n NOT_RUN, IN_PROGRESS, FINISHED;\n }\n \n handleStates(new States[] {NOT_RUN, IN_PROGRESS, FINISHED});\n\nAfter the quick-fix is applied:\n\n\n handleStates(States.values());\n\nNew in 2019.1" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "RedundantClassCall", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ArrayCanBeReplacedWithEnumValues", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -27533,19 +27453,19 @@ ] }, { - "id": "UnnecessaryStringEscape", + "id": "WaitNotifyNotInSynchronizedContext", "shortDescription": { - "text": "Unnecessarily escaped character" + "text": "'wait()' or 'notify()' is not in synchronized context" }, "fullDescription": { - "text": "Reports unnecessarily escaped characters in 'String' and optionally 'char' literals. Escaped tab characters '\\t' are not reported, because tab characters are invisible. Examples: 'String s = \"\\'Scare\\' quotes\";\n String t = \"\"\"\n All you need is\\n\\tLove\\n\"\"\";' After the quick-fix is applied: 'String s = \"'Scare' quotes\";\n String t = \"\"\"\n All you need is\n \\tLove\n \"\"\";' New in 2019.3", - "markdown": "Reports unnecessarily escaped characters in `String` and optionally `char` literals.\n\nEscaped tab characters `\\t` are not reported, because tab characters are invisible.\n\nExamples:\n\n\n String s = \"\\'Scare\\' quotes\";\n String t = \"\"\"\n All you need is\\n\\tLove\\n\"\"\";\n\nAfter the quick-fix is applied:\n\n\n String s = \"'Scare' quotes\";\n String t = \"\"\"\n All you need is\n \\tLove\n \"\"\";\n\nNew in 2019.3" + "text": "Reports calls to 'wait()', 'notify()', and 'notifyAll()' that are not made inside a corresponding synchronized statement or synchronized method. Calling these methods on an object without holding a lock on that object causes 'IllegalMonitorStateException'. Such a construct is not necessarily an error, as the necessary lock may be acquired before the containing method is called, but it's worth looking at. Example: 'class Sync {\n private final Object lock = new Object();\n\n void test() throws InterruptedException {\n synchronized (this) {\n lock.wait(); // 'lock.wait()' is not synchronized on 'lock'\n }\n }\n }'", + "markdown": "Reports calls to `wait()`, `notify()`, and `notifyAll()` that are not made inside a corresponding synchronized statement or synchronized method.\n\n\nCalling these methods on an object\nwithout holding a lock on that object causes `IllegalMonitorStateException`.\nSuch a construct is not necessarily an error, as the necessary lock may be acquired before\nthe containing method is called, but it's worth looking at.\n\n**Example:**\n\n\n class Sync {\n private final Object lock = new Object();\n\n void test() throws InterruptedException {\n synchronized (this) {\n lock.wait(); // 'lock.wait()' is not synchronized on 'lock'\n }\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryStringEscape", + "suppressToolId": "WaitNotifyWhileNotSynced", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27553,8 +27473,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -27566,19 +27486,19 @@ ] }, { - "id": "FieldCanBeLocal", + "id": "DollarSignInName", "shortDescription": { - "text": "Field can be local" + "text": "Use of '$' in identifier" }, "fullDescription": { - "text": "Reports redundant class fields that can be replaced with local variables. If all local usages of a field are preceded by assignments to that field, the field can be removed, and its usages can be replaced with local variables.", - "markdown": "Reports redundant class fields that can be replaced with local variables.\n\nIf all local usages of a field are preceded by assignments to that field, the\nfield can be removed, and its usages can be replaced with local variables." + "text": "Reports variables, methods, and classes with dollar signs ('$') in their names. While such names are legal Java, their use outside of generated java code is strongly discouraged. Example: 'class SalaryIn${}' Rename quick-fix is suggested only in the editor.", + "markdown": "Reports variables, methods, and classes with dollar signs (`$`) in their names. While such names are legal Java, their use outside of generated java code is strongly discouraged.\n\n**Example:**\n\n\n class SalaryIn${}\n\nRename quick-fix is suggested only in the editor." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FieldCanBeLocal", + "suppressToolId": "DollarSignInName", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27586,8 +27506,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -27599,19 +27519,19 @@ ] }, { - "id": "UrlHashCode", + "id": "DynamicRegexReplaceableByCompiledPattern", "shortDescription": { - "text": "Call to 'equals()' or 'hashCode()' on 'URL' object" + "text": "Dynamic regular expression can be replaced by compiled 'Pattern'" }, "fullDescription": { - "text": "Reports 'hashCode()' and 'equals()' calls on 'java.net.URL' objects and calls that add 'URL' objects to maps and sets. 'URL''s 'equals()' and 'hashCode()' methods can perform a DNS lookup to resolve the host name. This may cause significant delays, depending on the availability and speed of the network and the DNS server. Using 'java.net.URI' instead of 'java.net.URL' will avoid the DNS lookup. Example: 'boolean urlEquals(URL url1, URL url2) {\n return url1.equals(url2);\n }'", - "markdown": "Reports `hashCode()` and `equals()` calls on `java.net.URL` objects and calls that add `URL` objects to maps and sets.\n\n\n`URL`'s `equals()` and `hashCode()` methods can perform a DNS lookup to resolve the host name.\nThis may cause significant delays, depending on the availability and speed of the network and the DNS server.\nUsing `java.net.URI` instead of `java.net.URL` will avoid the DNS lookup.\n\n**Example:**\n\n\n boolean urlEquals(URL url1, URL url2) {\n return url1.equals(url2);\n }\n" + "text": "Reports calls to the regular expression methods (such as 'matches()' or 'split()') of 'java.lang.String' using constant arguments. Such calls may be profitably replaced with a 'private static final Pattern' field so that the regular expression does not have to be compiled each time it is used. Example: 'text.replaceAll(\"abc\", replacement);' After the quick-fix is applied: 'private static final Pattern ABC = Pattern.compile(\"abc\", Pattern.LITERAL);\n ABC.matcher(text).replaceAll(Matcher.quoteReplacement(replacement));'", + "markdown": "Reports calls to the regular expression methods (such as `matches()` or `split()`) of `java.lang.String` using constant arguments.\n\n\nSuch calls may be profitably replaced with a `private static final Pattern` field\nso that the regular expression does not have to be compiled each time it is used.\n\n**Example:**\n\n\n text.replaceAll(\"abc\", replacement);\n\nAfter the quick-fix is applied:\n\n\n private static final Pattern ABC = Pattern.compile(\"abc\", Pattern.LITERAL);\n ABC.matcher(text).replaceAll(Matcher.quoteReplacement(replacement));\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UrlHashCode", + "suppressToolId": "DynamicRegexReplaceableByCompiledPattern", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27619,8 +27539,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -27632,28 +27552,28 @@ ] }, { - "id": "IfStatementWithIdenticalBranches", + "id": "EmptyInitializer", "shortDescription": { - "text": "'if' statement with identical branches or common parts" + "text": "Empty class initializer" }, "fullDescription": { - "text": "Reports 'if' statements in which common parts can be extracted from the branches. These common parts are independent from the condition and make 'if' statements harder to understand. Example: 'if (x > 12) {\n doSomethingBefore();\n doSomethingDifferent1();\n doSomethingAfter();\n } else {\n doSomethingBefore();\n doSomethingDifferent2();\n doSomethingAfter();\n }' After the quick-fix is applied: 'doSomethingBefore();\n if (x > 12) {\n doSomethingDifferent1();\n } else {\n doSomethingDifferent2();\n }\n doSomethingAfter();' Updated in 2018.1", - "markdown": "Reports `if` statements in which common parts can be extracted from the branches.\n\nThese common parts are independent from the condition and make `if` statements harder to understand.\n\nExample:\n\n\n if (x > 12) {\n doSomethingBefore();\n doSomethingDifferent1();\n doSomethingAfter();\n } else {\n doSomethingBefore();\n doSomethingDifferent2();\n doSomethingAfter();\n }\n\nAfter the quick-fix is applied:\n\n\n doSomethingBefore();\n if (x > 12) {\n doSomethingDifferent1();\n } else {\n doSomethingDifferent2();\n }\n doSomethingAfter();\n\nUpdated in 2018.1" + "text": "Reports empty class initializer blocks.", + "markdown": "Reports empty class initializer blocks." }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "IfStatementWithIdenticalBranches", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "EmptyClassInitializer", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -27665,19 +27585,19 @@ ] }, { - "id": "InterfaceWithOnlyOneDirectInheritor", + "id": "UnnecessaryBreak", "shortDescription": { - "text": "Interface with a single direct inheritor" + "text": "Unnecessary 'break' statement" }, "fullDescription": { - "text": "Reports interfaces that have precisely one direct inheritor. While such interfaces may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the interface with its inheritor. 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.", - "markdown": "Reports interfaces that have precisely one direct inheritor. While such interfaces may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the interface with its inheritor.\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." + "text": "Reports any unnecessary 'break' statements. An 'break' statement is unnecessary if no other statements are executed after it has been removed. Example: 'switch (e) {\n case A -> {\n System.out.println(\"A\");\n break; // reports 'break' statement is unnecessary\n }\n default -> {\n System.out.println(\"Default\");\n break; // reports 'break' statement is unnecessary\n }\n }'", + "markdown": "Reports any unnecessary `break` statements.\n\nAn `break` statement is unnecessary if no other statements are executed after it has been removed.\n\n**Example:**\n\n\n switch (e) {\n case A -> {\n System.out.println(\"A\");\n break; // reports 'break' statement is unnecessary\n }\n default -> {\n System.out.println(\"Default\");\n break; // reports 'break' statement is unnecessary\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InterfaceWithOnlyOneDirectInheritor", + "suppressToolId": "UnnecessaryBreak", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27685,8 +27605,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -27698,19 +27618,19 @@ ] }, { - "id": "InstanceofChain", + "id": "RawUseOfParameterizedType", "shortDescription": { - "text": "Chain of 'instanceof' checks" + "text": "Raw use of parameterized class" }, "fullDescription": { - "text": "Reports any chains of 'if'-'else' statements all of whose conditions are 'instanceof' expressions or class equality expressions (e.g. comparison with 'String.class'). Such constructions usually indicate a failure in object-oriented design which dictates that such type-based dispatch should be done via polymorphic method calls rather than explicit chains of type tests. Example: 'double getArea(Shape shape) {\n // Warning: abstraction failure.\n // It would be better to declare a getArea()\n // abstract method in the shape interface\n // and implement it in every inheritor.\n if (shape instanceof Point) {\n return 0;\n }\n if (shape instanceof Circle) {\n return Math.PI *\n Math.pow(((Circle) shape).radius(), 2);\n }\n if (shape instanceof Rectangle) {\n return ((Rectangle) shape).width() *\n ((Rectangle) shape).height();\n }\n throw new IllegalArgumentException();\n }' Use the checkbox below to ignore 'instanceof' expressions on library classes.", - "markdown": "Reports any chains of `if`-`else` statements all of whose conditions are `instanceof` expressions or class equality expressions (e.g. comparison with `String.class`). Such constructions usually indicate a failure in object-oriented design which dictates that such type-based dispatch should be done via polymorphic method calls rather than explicit chains of type tests.\n\nExample:\n\n\n double getArea(Shape shape) {\n // Warning: abstraction failure.\n // It would be better to declare a getArea()\n // abstract method in the shape interface\n // and implement it in every inheritor.\n if (shape instanceof Point) {\n return 0;\n }\n if (shape instanceof Circle) {\n return Math.PI *\n Math.pow(((Circle) shape).radius(), 2);\n }\n if (shape instanceof Rectangle) {\n return ((Rectangle) shape).width() *\n ((Rectangle) shape).height();\n }\n throw new IllegalArgumentException();\n }\n\n\nUse the checkbox below to ignore `instanceof` expressions on library classes." + "text": "Reports generic classes with omitted type parameters. Such raw use of generic types is valid in Java, but it defeats the purpose of type parameters and may mask bugs. This inspection mirrors the 'rawtypes' warning of 'javac'. Examples: '//warning: Raw use of parameterized class 'List'\nList list = new ArrayList();\n//list of strings was created but integer is accepted as well\nlist.add(1);' '//no warning as it's impossible to provide type arguments during array creation\nIntFunction[]> fun = List[]::new;' Configure the inspection: Use the Ignore construction of new objects option to ignore raw types used in object construction. Use the Ignore type casts option to ignore raw types used in type casts. Use the Ignore where a type parameter would not compile option to ignore the cases when a type parameter fails to compile (for example, when creating an array or overriding a library method). Use the Ignore parameter types of overriding methods option to ignore type parameters used in parameters of overridden methods. Use the Ignore when automatic quick-fix is not available option to ignore the cases when a quick-fix is not available. This inspection depends on the Java feature 'Generics', which is available since Java 5.", + "markdown": "Reports generic classes with omitted type parameters. Such *raw* use of generic types is valid in Java, but it defeats the purpose of type parameters and may mask bugs. This inspection mirrors the `rawtypes` warning of `javac`.\n\n**Examples:**\n\n\n //warning: Raw use of parameterized class 'List'\n List list = new ArrayList();\n //list of strings was created but integer is accepted as well\n list.add(1);\n\n\n //no warning as it's impossible to provide type arguments during array creation\n IntFunction[]> fun = List[]::new;\n\nConfigure the inspection:\n\n* Use the **Ignore construction of new objects** option to ignore raw types used in object construction.\n* Use the **Ignore type casts** option to ignore raw types used in type casts.\n* Use the **Ignore where a type parameter would not compile** option to ignore the cases when a type parameter fails to compile (for example, when creating an array or overriding a library method).\n* Use the **Ignore parameter types of overriding methods** option to ignore type parameters used in parameters of overridden methods.\n* Use the **Ignore when automatic quick-fix is not available** option to ignore the cases when a quick-fix is not available.\n\nThis inspection depends on the Java feature 'Generics', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ChainOfInstanceofChecks", + "suppressToolId": "rawtypes", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27718,8 +27638,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -27731,19 +27651,19 @@ ] }, { - "id": "BlockMarkerComments", + "id": "PublicConstructorInNonPublicClass", "shortDescription": { - "text": "Block marker comment" + "text": "'public' constructor in non-public class" }, "fullDescription": { - "text": "Reports comments which are used as code block markers. The quick-fix removes such comments. Example: 'while (i < 10) {\n i++;\n } // end while' After the quick-fix is applied: 'while (i < 10) {\n i++;\n }'", - "markdown": "Reports comments which are used as code block markers. The quick-fix removes such comments.\n\nExample:\n\n\n while (i < 10) {\n i++;\n } // end while\n\nAfter the quick-fix is applied:\n\n\n while (i < 10) {\n i++;\n }\n" + "text": "Reports 'public' constructors in non-'public' classes. Usually, there is no reason for creating a 'public' constructor in a class with a lower access level. Please note, however, that this inspection changes the behavior of some reflection calls. In particular, 'Class.getConstructor()' won't be able to find the updated constructor ('Class.getDeclaredConstructor()' should be used instead). Do not use the inspection if your code or code of some used frameworks relies on constructor accessibility via 'getConstructor()'. Example: 'class House {\n public House() {}\n }' After the quick-fix is applied: 'class House {\n House() {}\n }'", + "markdown": "Reports `public` constructors in non-`public` classes.\n\nUsually, there is no reason for creating a `public` constructor in a class with a lower access level.\nPlease note, however, that this inspection changes the behavior of some reflection calls. In particular,\n`Class.getConstructor()` won't be able to find the updated constructor\n(`Class.getDeclaredConstructor()` should be used instead). Do not use the inspection if your code\nor code of some used frameworks relies on constructor accessibility via `getConstructor()`.\n\n**Example:**\n\n\n class House {\n public House() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class House {\n House() {}\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BlockMarkerComments", + "suppressToolId": "PublicConstructorInNonPublicClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27751,8 +27671,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -27764,19 +27684,19 @@ ] }, { - "id": "SerializableHasSerializationMethods", + "id": "ProtectedInnerClass", "shortDescription": { - "text": "Serializable class without 'readObject()' and 'writeObject()'" + "text": "Protected nested class" }, "fullDescription": { - "text": "Reports 'Serializable' classes that do not implement 'readObject()' and 'writeObject()' methods. If 'readObject()' and 'writeObject()' methods are not implemented, the default serialization algorithms are used, which may be sub-optimal for performance and compatibility in many environments. 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' classes without non-static fields. Whether to ignore 'Serializable' anonymous classes.", - "markdown": "Reports `Serializable` classes that do not implement `readObject()` and `writeObject()` methods.\n\n\nIf `readObject()` and `writeObject()` methods are not implemented,\nthe default serialization algorithms are used,\nwhich may be sub-optimal for performance and compatibility in many environments.\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` classes without non-static fields.\n* Whether to ignore `Serializable` anonymous classes." + "text": "Reports 'protected' nested classes. Example: 'public class Outer {\n protected static class Nested {} // warning\n protected class Inner {} // warning\n protected enum Mode {} // warning depends on the setting\n protected interface I {} // warning depends on the setting\n }' Configure the inspection: Use the Ignore 'protected' inner enums option to ignore 'protected' inner enums. Use the Ignore 'protected' inner interfaces option to ignore 'protected' inner interfaces.", + "markdown": "Reports `protected` nested classes.\n\n**Example:**\n\n\n public class Outer {\n protected static class Nested {} // warning\n protected class Inner {} // warning\n protected enum Mode {} // warning depends on the setting\n protected interface I {} // warning depends on the setting\n }\n\nConfigure the inspection:\n\n* Use the **Ignore 'protected' inner enums** option to ignore `protected` inner enums.\n* Use the **Ignore 'protected' inner interfaces** option to ignore `protected` inner interfaces." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SerializableHasSerializationMethods", + "suppressToolId": "ProtectedInnerClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27784,8 +27704,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -27797,19 +27717,19 @@ ] }, { - "id": "IdempotentLoopBody", + "id": "UnqualifiedStaticUsage", "shortDescription": { - "text": "Idempotent loop body" + "text": "Unqualified static access" }, "fullDescription": { - "text": "Reports loops whose second and all subsequent iterations do not produce any additional side effects other than the one produced by the first iteration, which can indicate a programming error. Such loops may iterate only zero, one, or infinite number of times. If the infinite number of times case is unreachable, such a loop can be replaced with an 'if' statement. Otherwise, there's a possibility that the program can get stuck. Example: 'public void foo(String baseName, String names) {\n int suffix = 1;\n String name = baseName;\n while (names.contains(name)) {\n // error: suffix is not updated making loop body idempotent\n name = baseName + suffix;\n }\n }' New in 2018.1", - "markdown": "Reports loops whose second and all subsequent iterations do not produce any additional side effects other than the one produced by the first iteration, which can indicate a programming error.\n\nSuch loops may iterate only zero, one, or infinite number of times.\nIf the infinite number of times case is unreachable, such a loop can be replaced with an `if` statement.\nOtherwise, there's a possibility that the program can get stuck.\n\nExample:\n\n\n public void foo(String baseName, String names) {\n int suffix = 1;\n String name = baseName;\n while (names.contains(name)) {\n // error: suffix is not updated making loop body idempotent\n name = baseName + suffix;\n }\n }\n\nNew in 2018.1" + "text": "Reports usage of static members that is not qualified with the class name. This is legal if the static member is in the same class, but may be confusing. Example: '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 }' After the quick-fix is applied: '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 }' Use the inspection settings to toggle the reporting for the following items: static fields access 'void bar() { System.out.println(x); }' calls to static methods 'void bar() { foo(); }' 'static void baz() { foo(); }' You can also configure the inspection to only report static member usage from a non-static context. In the above example, 'static void baz() { foo(); }' will not be reported.", + "markdown": "Reports usage of static members that is not qualified with the class name.\n\n\nThis is legal if the static member is in\nthe same class, but may be confusing.\n\n**Example:**\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\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.foo();\n System.out.println(Foo.x);\n }\n\n static void baz() { Foo.foo(); }\n }\n\nUse the inspection settings to toggle the reporting for the following items:\n\n*\n static fields access \n\n `void bar() { System.out.println(x); }`\n\n*\n calls to static methods \n\n `void bar() { foo(); }` \n\n `static void baz() { foo(); }`\n\n\nYou can also configure the inspection to only report static member usage from a non-static context.\nIn the above example, `static void baz() { foo(); }` will not be reported." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IdempotentLoopBody", + "suppressToolId": "UnqualifiedStaticUsage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27817,8 +27737,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -27830,19 +27750,19 @@ ] }, { - "id": "RedundantImplements", + "id": "StaticGuardedByInstance", "shortDescription": { - "text": "Redundant interface declaration" + "text": "Static member guarded by instance field or this" }, "fullDescription": { - "text": "Reports interfaces in a class' 'implements' list or an interface's 'extends' list that are already implemented by a superclass or extended by a superinterface. Such declarations are unnecessary and may be safely removed. Example: 'class X implements One, Two {\n }\n interface One {}\n interface Two extends One {}' After the quick-fix is applied: 'class X implements Two {\n }\n interface One {}\n interface Two extends One {}' Use the options to not report on 'Serializable' or 'Externalizable' in an 'extends' or 'implements' list.", - "markdown": "Reports interfaces in a class' `implements` list or an interface's `extends` list that are already implemented by a superclass or extended by a superinterface. Such declarations are unnecessary and may be safely removed.\n\n**Example:**\n\n\n class X implements One, Two {\n }\n interface One {}\n interface Two extends One {}\n\nAfter the quick-fix is applied:\n\n\n class X implements Two {\n }\n interface One {}\n interface Two extends One {}\n\n\nUse the options to not report on `Serializable` or `Externalizable`\nin an `extends` or `implements` list." + "text": "Reports '@GuardedBy' annotations on 'static' fields or methods in which the guard is either a non-static field or 'this'. Guarding a static element with a non-static element may result in excessive concurrency, multiple threads may be able to access the guarded field simultaneously by locking in different object contexts. Example: 'private ReadWriteLock lock = new ReentrantReadWriteLock();\n\n @GuardedBy(\"lock\")\n public static void bar() {\n // ...\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 `static` fields or methods in which the guard is either a non-static field or `this`.\n\nGuarding a static element with a non-static element may result in\nexcessive concurrency, multiple threads may be able to access the guarded field simultaneously by locking in different object contexts.\n\nExample:\n\n\n private ReadWriteLock lock = new ReentrantReadWriteLock();\n\n @GuardedBy(\"lock\")\n public static void bar() {\n // ...\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": "RedundantInterfaceDeclaration", + "suppressToolId": "StaticGuardedByInstance", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27850,8 +27770,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Concurrency annotation issues", + "index": 100, "toolComponent": { "name": "QDJVM" } @@ -27863,28 +27783,28 @@ ] }, { - "id": "FrequentlyUsedInheritorInspection", + "id": "ExternalizableWithoutPublicNoArgConstructor", "shortDescription": { - "text": "Class may extend a commonly used base class" + "text": "'Externalizable' class without 'public' no-arg constructor" }, "fullDescription": { - "text": "Reports classes or interfaces that can be replaced with an implementation or extension of a more specific commonly used class or interface. For this inspection to work, a superclass needs to be in project source files and the project needs to use the IntelliJ IDEA build system. Example: 'class MyInheritor implements A {} // B suggested on the A reference\n\n interface A {}\n\n abstract class B implements A {}\n\n abstract class C1 extends B {}\n abstract class C2 extends B {}\n abstract class C3 extends B {}\n abstract class C4 extends B {}\n abstract class C5 extends B {}' By default, this inspection doesn't highlight issues in the editor but only provides a quick-fix. New in 2017.2", - "markdown": "Reports classes or interfaces that can be replaced with an implementation or extension of a more specific commonly used class or interface.\n\nFor this inspection to work, a superclass needs to be in project source files and the project needs to use the IntelliJ IDEA build system.\n\n**Example:**\n\n\n class MyInheritor implements A {} // B suggested on the A reference\n\n interface A {}\n\n abstract class B implements A {}\n\n abstract class C1 extends B {}\n abstract class C2 extends B {}\n abstract class C3 extends B {}\n abstract class C4 extends B {}\n abstract class C5 extends B {}\n\nBy default, this inspection doesn't highlight issues in the editor but only provides a quick-fix.\n\nNew in 2017.2" + "text": "Reports 'Externalizable' classes without a public no-argument constructor. When an 'Externalizable' object is reconstructed, an instance is created using the public no-arg constructor before the 'readExternal' method called. If a public no-arg constructor is not available, a 'java.io.InvalidClassException' will be thrown at runtime.", + "markdown": "Reports `Externalizable` classes without a public no-argument constructor.\n\nWhen an `Externalizable` object is reconstructed, an instance is created using the public\nno-arg constructor before the `readExternal` method called. If a public\nno-arg constructor is not available, a `java.io.InvalidClassException` will be\nthrown at runtime." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "FrequentlyUsedInheritorInspection", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ExternalizableWithoutPublicNoArgConstructor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -27896,19 +27816,19 @@ ] }, { - "id": "FieldNamingConvention", + "id": "ManualArrayCopy", "shortDescription": { - "text": "Field naming convention" + "text": "Manual array copy" }, "fullDescription": { - "text": "Reports fields whose names are too short, too long, or do not follow the specified regular expression pattern. Example: if the inspection is enabled for constants, and the minimum specified length for a field name is 5 (the default), the following constant produces a warning because the length of its name is 3, which is less than 5: 'public static final int MAX = 42;'. A quick-fix that renames such fields is available only in the editor. Configure the inspection: Use the list in the Options section to specify which fields should be checked. Deselect the checkboxes for the fields for which you want to skip the check. For each field type, specify the minimum length, maximum length, and the regular expression expected for field names using the provided input fields. 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 fields 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 constants, and the minimum specified length for a field name is 5 (the default), the following constant\nproduces a warning because the length of its name is 3, which is less than 5: `public static final int MAX = 42;`.\n\nA quick-fix that renames such fields is available only in the editor.\n\nConfigure the inspection:\n\nUse the list in the **Options** section to specify which fields should be checked. Deselect the checkboxes for the fields for which\nyou want to skip the check.\n\nFor each field type, specify the minimum length, maximum length, and the regular expression expected for field names using the\nprovided input fields.\nSpecify **0** in the length fields to skip the corresponding checks.\n\nRegular expressions should be specified in the standard\n`java.util.regex` format." + "text": "Reports manual copying of array contents that can be replaced with a call to 'System.arraycopy()'. Example: 'for (int i = 0; i < array.length; i++) {\n newArray[i] = array[i];\n }' After the quick-fix is applied: 'System.arraycopy(array, 0, newArray, 0, array.length);'", + "markdown": "Reports manual copying of array contents that can be replaced with a call to `System.arraycopy()`.\n\n**Example:**\n\n\n for (int i = 0; i < array.length; i++) {\n newArray[i] = array[i];\n }\n\nAfter the quick-fix is applied:\n\n\n System.arraycopy(array, 0, newArray, 0, array.length);\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "FieldNamingConvention", + "suppressToolId": "ManualArrayCopy", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27916,8 +27836,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions", - "index": 79, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -27929,19 +27849,19 @@ ] }, { - "id": "ClassNamePrefixedWithPackageName", + "id": "StaticPseudoFunctionalStyleMethod", "shortDescription": { - "text": "Class name prefixed with package name" + "text": "Guava pseudo-functional call can be converted to Stream API call" }, "fullDescription": { - "text": "Reports classes whose names are prefixed with their package names, ignoring differences in capitalization. While occasionally having such names is reasonable, they are often used due to a poor naming scheme, may be redundant and annoying. Example: 'package byteCode;\n class ByteCodeAnalyzer {}' A quick-fix that renames such classes is available only in the editor.", - "markdown": "Reports classes whose names are prefixed with their package names, ignoring differences in capitalization.\n\nWhile occasionally having such names is reasonable, they are often used due to a poor naming scheme, may be redundant and\nannoying.\n\n**Example:**\n\n\n package byteCode;\n class ByteCodeAnalyzer {}\n\nA quick-fix that renames such classes is available only in the editor." + "text": "Reports usages of Guava pseudo-functional code when 'Java Stream API' is available. Though 'Guava Iterable API' provides functionality similar to 'Java Streams API', it's slightly different and may miss some features. Especially, primitive-specialized stream variants like 'IntStream' are more performant than generic variants. Example: 'List transformedIterable = Iterables.transform(someList, someTransformFunction);//warning: Pseudo functional style code' After the quick-fix is applied: 'List transformedIterable = someList.stream().map(someTransformFunction).collect(Collectors.toList());' Note: Code semantics can be changed; for example, Guava's 'Iterable.transform' produces a lazy-evaluated iterable, but the replacement is eager-evaluated. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports usages of Guava pseudo-functional code when `Java Stream API` is available.\n\nThough `Guava Iterable API` provides functionality similar to `Java Streams API`, it's slightly different and\nmay miss some features.\nEspecially, primitive-specialized stream variants like `IntStream` are more performant than generic variants.\n\n**Example:**\n\n\n List transformedIterable = Iterables.transform(someList, someTransformFunction);//warning: Pseudo functional style code\n\nAfter the quick-fix is applied:\n\n List transformedIterable = someList.stream().map(someTransformFunction).collect(Collectors.toList());\n\n\n**Note:** Code semantics can be changed; for example, Guava's `Iterable.transform` produces a lazy-evaluated iterable,\nbut the replacement is eager-evaluated.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassNamePrefixedWithPackageName", + "suppressToolId": "StaticPseudoFunctionalStyleMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -27949,8 +27869,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Class", - "index": 80, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -27962,28 +27882,28 @@ ] }, { - "id": "ConstantConditionalExpression", + "id": "ControlFlowStatementWithoutBraces", "shortDescription": { - "text": "Constant conditional expression" + "text": "Control flow statement without braces" }, "fullDescription": { - "text": "Reports conditional expressions in which the condition is either a 'true' or 'false' constant. These expressions sometimes occur as a result of automatic refactorings and may be simplified. Example: 'return true ? \"Yes\" : \"No\";' After quick-fix is applied: 'return \"Yes\";'", - "markdown": "Reports conditional expressions in which the condition is either a `true` or `false` constant. These expressions sometimes occur as a result of automatic refactorings and may be simplified.\n\nExample:\n\n\n return true ? \"Yes\" : \"No\";\n\nAfter quick-fix is applied:\n\n\n return \"Yes\";\n" + "text": "Reports any 'if', 'while', 'do', or 'for' statements without braces. Some code styles, e.g. the Google Java Style guide, require braces for all control statements. When adding further statements to control statements without braces, it is important not to forget adding braces. When commenting out a line of code, it is also necessary to be more careful when not using braces, to not inadvertently make the next statement part of the control flow statement. Always using braces makes inserting or commenting out a line of code safer. It's likely the goto fail vulnerability would not have happened, if an always use braces code style was used. Control statements with braces make the control flow easier to see, without relying on, possibly incorrect, indentation. Example: 'class Strange {\n void x(boolean one, boolean two) {\n if(one)\n if(two)\n foo();\n else\n bar();\n }\n\n void foo() {}\n void bar() {}\n }' The quick-fix wraps the statement body with braces: 'class Strange {\n void x(boolean one, boolean two) {\n if(one) {\n if(two) {\n foo();\n } else {\n bar();\n }\n }\n }\n\n void foo() {}\n void bar() {}\n }'", + "markdown": "Reports any `if`, `while`, `do`, or `for` statements without braces. Some code styles, e.g. the [Google Java Style guide](https://google.github.io/styleguide/javaguide.html), require braces for all control statements.\n\n\nWhen adding further statements to control statements without braces, it is important not to forget adding braces.\nWhen commenting out a line of code, it is also necessary to be more careful when not using braces,\nto not inadvertently make the next statement part of the control flow statement.\nAlways using braces makes inserting or commenting out a line of code safer.\n\n\nIt's likely the [goto fail vulnerability](https://www.imperialviolet.org/2014/02/22/applebug.html) would not have happened,\nif an always use braces code style was used.\nControl statements with braces make the control flow easier to see, without relying on, possibly incorrect, indentation.\n\nExample:\n\n\n class Strange {\n void x(boolean one, boolean two) {\n if(one)\n if(two)\n foo();\n else\n bar();\n }\n\n void foo() {}\n void bar() {}\n }\n\nThe quick-fix wraps the statement body with braces:\n\n\n class Strange {\n void x(boolean one, boolean two) {\n if(one) {\n if(two) {\n foo();\n } else {\n bar();\n }\n }\n }\n\n void foo() {}\n void bar() {}\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "ConstantConditionalExpression", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ControlFlowStatementWithoutBraces", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -27995,19 +27915,19 @@ ] }, { - "id": "SameParameterValue", + "id": "LengthOneStringInIndexOf", "shortDescription": { - "text": "Method parameter always has the same value" + "text": "Single character string argument in 'String.indexOf()' call" }, "fullDescription": { - "text": "Reports method parameters that always have the same constant value. Example: 'static void printPoint(int x, int y) { // x is always 0\n System.out.println(x + \", \" + y);\n }\n\n public static void main(String[] args) {\n printPoint(0, 1);\n printPoint(0, 2);\n }' The quick-fix inlines the constant value. This may simplify the method implementation. Use the Ignore when a quick-fix can not be provided option to suppress the inspections when: the parameter is modified inside the method the parameter value that is being passed is a reference to an inaccessible field (Java ony) the parameter is a vararg (Java only) Use the Maximal method visibility option to control the maximum visibility of methods to be reported. Use the Minimal method usage count to report parameter field to specify the minimal number of method usages with the same parameter value.", - "markdown": "Reports method parameters that always have the same constant value.\n\nExample:\n\n\n static void printPoint(int x, int y) { // x is always 0\n System.out.println(x + \", \" + y);\n }\n\n public static void main(String[] args) {\n printPoint(0, 1);\n printPoint(0, 2);\n }\n\nThe quick-fix inlines the constant value. This may simplify the method implementation.\n\n\nUse the **Ignore when a quick-fix can not be provided** option to suppress the inspections when:\n\n* the parameter is modified inside the method\n* the parameter value that is being passed is a reference to an inaccessible field (Java ony)\n* the parameter is a vararg (Java only)\n\n\nUse the **Maximal method visibility** option to control the maximum visibility of methods to be reported.\n\n\nUse the **Minimal method usage count to report parameter** field to specify the minimal number of method usages with the same parameter value." + "text": "Reports single character strings being used as an argument in 'String.indexOf()' and 'String.lastIndexOf()' calls. A quick-fix is suggested to replace such string literals with equivalent character literals, gaining some performance enhancement. Example: 'return s.indexOf(\"x\");' After the quick-fix is applied: 'return s.indexOf('x');'", + "markdown": "Reports single character strings being used as an argument in `String.indexOf()` and `String.lastIndexOf()` calls.\n\nA quick-fix is suggested to replace such string literals with equivalent character literals, gaining some performance enhancement.\n\n**Example:**\n\n\n return s.indexOf(\"x\");\n\nAfter the quick-fix is applied:\n\n\n return s.indexOf('x');\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SameParameterValue", + "suppressToolId": "SingleCharacterStringConcatenation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28015,8 +27935,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -28028,19 +27948,22 @@ ] }, { - "id": "CatchMayIgnoreException", + "id": "MisspelledEquals", "shortDescription": { - "text": "Catch block may ignore exception" + "text": "'equal()' instead of 'equals()'" }, "fullDescription": { - "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. Finally, the static code analyzer reports if it detects that a 'catch' block may silently ignore important VM exceptions like 'NullPointerException'. Ignoring such an exception (without logging or rethrowing it) may hide a bug. The inspection won't report any 'catch' parameters named 'ignore' or 'ignored'. Conversely, the inspection will warn you about any 'catch' parameters named 'ignore' or 'ignored' that are actually in use. Additionally, the inspection won't report 'catch' parameters inside test sources named 'expected' or 'ok'. You can use a quick-fix to change the exception name to 'ignored'. For empty catch blocks, an additional quick-fix to generate the catch body is suggested. You can modify the \"Catch Statement Body\" template on the Code tab in Settings | Editor | File and Code Templates. Example: 'try {\n throwingMethod();\n } catch (IOException ex) {\n\n }' After the quick-fix is applied: 'try {\n System.out.println(System.in.read());\n } catch (IOException ignored) {\n\n }' Configure the inspection: Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments. Use the Do not warn when 'catch' block is not empty option to ignore 'catch' blocks that contain statements or comments inside, while the variable itself is not used. Use the Do not warn when exception named 'ignore(d)' is not actually ignored option to ignore variables named 'ignored' if they are in use. New in 2018.1", - "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\nFinally, the static code analyzer reports if it detects that a `catch` block may silently ignore important VM\nexceptions like `NullPointerException`. Ignoring such an exception\n(without logging or rethrowing it) may hide a bug.\n\n\nThe inspection won't report any `catch` parameters named `ignore` or `ignored`.\nConversely, the inspection will warn you about any `catch` parameters named `ignore` or `ignored` that are actually in use.\nAdditionally, the inspection won't report `catch` parameters inside test sources named `expected` or `ok`.\n\n\nYou can use a quick-fix to change the exception name to `ignored`.\nFor empty **catch** blocks, an additional quick-fix to generate the **catch** body is suggested.\nYou can modify the \"Catch Statement Body\" template on the Code tab in\n[Settings \\| Editor \\| File and Code Templates](settings://fileTemplates).\n\n**Example:**\n\n\n try {\n throwingMethod();\n } catch (IOException ex) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n System.out.println(System.in.read());\n } catch (IOException ignored) {\n\n }\n\nConfigure the inspection:\n\n* Use the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments.\n* Use the **Do not warn when 'catch' block is not empty** option to ignore `catch` blocks that contain statements or comments inside, while the variable itself is not used.\n* Use the **Do not warn when exception named 'ignore(d)' is not actually ignored** option to ignore variables named `ignored` if they are in use.\n\nNew in 2018.1" + "text": "Reports declarations of 'equal()' with a single parameter. Normally, this is a typo and 'equals()' is actually intended. A quick-fix is suggested to rename the method to 'equals'. Example: 'class Main {\n public boolean equal(Object obj) {\n return true;\n }\n }' After the quick-fix is applied: 'class Main {\n public boolean equals(Object obj) {\n return true;\n }\n }'", + "markdown": "Reports declarations of `equal()` with a single parameter. Normally, this is a typo and `equals()` is actually intended.\n\nA quick-fix is suggested to rename the method to `equals`.\n\n**Example:**\n\n\n class Main {\n public boolean equal(Object obj) {\n return true;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n public boolean equals(Object obj) {\n return true;\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CatchMayIgnoreException", + "suppressToolId": "MisspelledEquals", + "cweIds": [ + 697 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28048,8 +27971,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -28061,19 +27984,19 @@ ] }, { - "id": "ClassWithTooManyDependents", + "id": "NonFinalFieldInEnum", "shortDescription": { - "text": "Class with too many dependents" + "text": "Non-final field in 'enum'" }, "fullDescription": { - "text": "Reports a class on which too many other classes are directly dependent. Any modification to such a class may require changing many other classes, which may be expensive. Only top-level classes are reported. Use the field below to specify the maximum allowed number of dependents 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 a class on which too many other classes are directly dependent.\n\nAny modification to such a class may require changing many other classes, which may be expensive.\n\nOnly top-level classes are reported.\n\nUse the field below to specify the maximum allowed number of dependents for 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." + "text": "Reports non-final fields in enumeration types. Non-final fields introduce global mutable state, which is generally considered undesirable. Example: 'enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public String str;\n\n Enum(String str) {\n this.str = str;\n }\n }' After the quick-fix is applied: 'enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public final String str;\n\n Enum(String str) {\n this.str = str;\n }\n }' Use the `Ignore fields that cannot be made 'final'` option to only warn on fields that can be made final using the quick-fix.", + "markdown": "Reports non-final fields in enumeration types. Non-final fields introduce global mutable state, which is generally considered undesirable.\n\n**Example:**\n\n\n enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public String str;\n\n Enum(String str) {\n this.str = str;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n enum Enum {\n FIRST(\"first\"),\n SECOND(\"second\");\n\n public final String str;\n\n Enum(String str) {\n this.str = str;\n }\n }\n\nUse the \\`Ignore fields that cannot be made 'final'\\` option to only warn on fields that can be made final using the quick-fix." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassWithTooManyDependents", + "suppressToolId": "NonFinalFieldInEnum", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28081,8 +28004,8 @@ "relationships": [ { "target": { - "id": "Java/Dependency issues", - "index": 146, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -28094,28 +28017,28 @@ ] }, { - "id": "WrongPackageStatement", + "id": "EnumClass", "shortDescription": { - "text": "Wrong package statement" + "text": "Enumerated class" }, "fullDescription": { - "text": "Detects 'package' statements that do not correspond to the project directory structure. Also, reports classes without 'package' statements if the class is not located directly in source root directory. While it's not strictly mandated by Java language, it's good practise to keep classes from package 'com.example.myapp' inside a 'com/example/myapp' directory directly under a source root. Failure to do this may confuse code readers and make some tools work incorrectly.", - "markdown": "Detects `package` statements that do not correspond to the project directory structure. Also, reports classes without `package` statements if the class is not located directly in source root directory.\n\nWhile it's not strictly mandated by Java language, it's good practise to keep classes\nfrom package `com.example.myapp` inside a `com/example/myapp` directory directly under\na source root. Failure to do this may confuse code readers and make some tools work incorrectly." + "text": "Reports enum classes. Such statements are not supported in Java 1.4 and earlier JVM.", + "markdown": "Reports **enum** classes. Such statements are not supported in Java 1.4 and earlier JVM." }, "defaultConfiguration": { - "enabled": true, - "level": "error", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "WrongPackageStatement", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "EnumClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Java language level issues", + "index": 147, "toolComponent": { "name": "QDJVM" } @@ -28127,19 +28050,19 @@ ] }, { - "id": "FieldNotUsedInToString", + "id": "TrivialFunctionalExpressionUsage", "shortDescription": { - "text": "Field not used in 'toString()' method" + "text": "Trivial usage of functional expression" }, "fullDescription": { - "text": "Reports fields that are not used in the 'toString()' method of a class. Helps discover fields added after the 'toString()' method was last updated. The quick-fix regenerates the 'toString()' method. In the Generate | toString() dialog, it is possible to exclude fields from this check. This inspection will also check for problems with getter methods if the Enable getters in code generation option is enabled there. Example: 'public class Relevant {\n private String name; // not used in toString()\n private int index;\n private int length;\n\n @Override\n public String toString() {\n return \"Relevant{\" + \"index=\" + index +\n \", length=\" + length + '}';\n }\n }' After the quick-fix is applied: 'public class Relevant {\n private String name;\n private int index;\n private int length;\n\n @Override\n public String toString() {\n return \"Relevant{\" + \"name='\" + name + '\\'' +\n \", index=\" + index + \", length=\" + length + '}';\n }\n }'", - "markdown": "Reports fields that are not used in the `toString()` method of a class.\n\nHelps discover fields added after the `toString()` method was last updated.\nThe quick-fix regenerates the `toString()` method.\n\n\nIn the **Generate \\| toString()** dialog, it is possible to exclude fields from this check.\nThis inspection will also check for problems with getter methods if the *Enable getters in code generation* option is enabled there.\n\nExample:\n\n\n public class Relevant {\n private String name; // not used in toString()\n private int index;\n private int length;\n\n @Override\n public String toString() {\n return \"Relevant{\" + \"index=\" + index +\n \", length=\" + length + '}';\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Relevant {\n private String name;\n private int index;\n private int length;\n\n @Override\n public String toString() {\n return \"Relevant{\" + \"name='\" + name + '\\'' +\n \", index=\" + index + \", length=\" + length + '}';\n }\n }\n" + "text": "Reports functional interface methods calls that are directly invoked on the definition of the lambda, method reference, or anonymous class. Such method calls can be replaced with the body of the functional interface implementation. Example: 'boolean contains(List names, String name) {\n return ((Predicate)x -> {\n return names.contains(x);\n }).test(name);\n }' When the quick-fix is applied, the method call changes to: 'boolean contains(List names, String name) {\n return names.contains(name);\n }'", + "markdown": "Reports functional interface methods calls that are directly invoked on the definition of the lambda, method reference, or anonymous class. Such method calls can be replaced with the body of the functional interface implementation.\n\n**Example:**\n\n\n boolean contains(List names, String name) {\n return ((Predicate)x -> {\n return names.contains(x);\n }).test(name);\n }\n\nWhen the quick-fix is applied, the method call changes to:\n\n\n boolean contains(List names, String name) {\n return names.contains(name);\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FieldNotUsedInToString", + "suppressToolId": "TrivialFunctionalExpressionUsage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28147,8 +28070,8 @@ "relationships": [ { "target": { - "id": "Java/toString() issues", - "index": 205, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -28160,19 +28083,19 @@ ] }, { - "id": "CovariantEquals", + "id": "AnonymousHasLambdaAlternative", "shortDescription": { - "text": "Covariant 'equals()'" + "text": "Anonymous type has shorter lambda alternative" }, "fullDescription": { - "text": "Reports 'equals()' methods taking an argument type other than 'java.lang.Object' if the containing class does not have other overloads of 'equals()' that take 'java.lang.Object' as its argument type. A covariant version of 'equals()' does not override the 'Object.equals(Object)' method. It may cause unexpected behavior at runtime. For example, if the class is used to construct one of the standard collection classes, which expect that the 'Object.equals(Object)' method is overridden. Example: 'class Foo {\n public boolean equals(Foo foo) { // warning\n return false;\n }\n }\n class Bar {\n public boolean equals(Bar bar) { // no warning here\n return false;\n }\n @Override\n public boolean equals(Object obj) {\n return false;\n }\n }'", - "markdown": "Reports `equals()` methods taking an argument type other than `java.lang.Object` if the containing class does not have other overloads of `equals()` that take `java.lang.Object` as its argument type.\n\n\nA covariant version of `equals()` does not override the\n`Object.equals(Object)` method. It may cause unexpected\nbehavior at runtime. For example, if the class is used to construct\none of the standard collection classes, which expect that the\n`Object.equals(Object)` method is overridden.\n\n**Example:**\n\n\n class Foo {\n public boolean equals(Foo foo) { // warning\n return false;\n }\n }\n class Bar {\n public boolean equals(Bar bar) { // no warning here\n return false;\n }\n @Override\n public boolean equals(Object obj) {\n return false;\n }\n }\n" + "text": "Reports anonymous classes which could be transformed to a constructor or a factory method call with a lambda expression argument. The following classes are reported by this inspection: Anonymous classes extending 'ThreadLocal' which have an 'initialValue()' method (can be replaced with 'ThreadLocal.withInitial') Anonymous classes extending 'Thread' which have a 'run()' method (can be replaced with 'new Thread(Runnable)' Example: 'new Thread() {\n @Override\n public void run() {\n System.out.println(\"Hello from thread!\");\n }\n }.start();' After the quick-fix is applied: 'new Thread(() -> {\n System.out.println(\"Hello from thread!\");\n }).start();' This inspection depends on the Java feature 'ThreadLocal.withInitial()', which is available since Java 8.", + "markdown": "Reports anonymous classes which could be transformed to a constructor or a factory method call with a lambda expression argument.\n\nThe following classes are reported by this inspection:\n\n* Anonymous classes extending `ThreadLocal` which have an `initialValue()` method (can be replaced with `ThreadLocal.withInitial`)\n* Anonymous classes extending `Thread` which have a `run()` method (can be replaced with `new Thread(Runnable)`\n\nExample:\n\n\n new Thread() {\n @Override\n public void run() {\n System.out.println(\"Hello from thread!\");\n }\n }.start();\n\nAfter the quick-fix is applied:\n\n\n new Thread(() -> {\n System.out.println(\"Hello from thread!\");\n }).start();\n\nThis inspection depends on the Java feature 'ThreadLocal.withInitial()', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CovariantEquals", + "suppressToolId": "AnonymousHasLambdaAlternative", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28180,8 +28103,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -28193,19 +28116,19 @@ ] }, { - "id": "Convert2Lambda", + "id": "ExtendsThread", "shortDescription": { - "text": "Anonymous type can be replaced with lambda" + "text": "Class directly extends 'Thread'" }, "fullDescription": { - "text": "Reports anonymous classes which can be replaced with lambda expressions. Example: 'new Thread(new Runnable() {\n @Override\n public void run() {\n // run thread\n }\n });' After the quick-fix is applied: 'new Thread(() -> {\n // run thread\n });' Note that if an anonymous class is converted into a stateless lambda, the same lambda object can be reused by 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. Use the Report when interface is not annotated with @FunctionalInterface option to ignore the cases in which an anonymous class implements an interface without '@FunctionalInterface' annotation. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "markdown": "Reports anonymous classes which can be replaced with lambda expressions.\n\nExample:\n\n\n new Thread(new Runnable() {\n @Override\n public void run() {\n // run thread\n }\n });\n\nAfter the quick-fix is applied:\n\n\n new Thread(() -> {\n // run thread\n });\n\n\nNote that if an anonymous class is converted into a stateless lambda, the same lambda object\ncan be reused by 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\nUse the **Report when interface is not annotated with @FunctionalInterface** option to ignore the cases in which an anonymous\nclass implements an interface without `@FunctionalInterface` annotation.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "text": "Reports classes that directly extend 'java.lang.Thread'. It is usually recommended to prefer composition over inheritance to create more reusable code that is easier to modify later. Example: 'class MainThread extends Thread {\n }'", + "markdown": "Reports classes that directly extend `java.lang.Thread`. It is usually recommended to prefer composition over inheritance to create more reusable code that is easier to modify later.\n\n**Example:**\n\n\n class MainThread extends Thread {\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "Convert2Lambda", + "suppressToolId": "ClassExplicitlyExtendsThread", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28213,8 +28136,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -28226,28 +28149,28 @@ ] }, { - "id": "SimplifiableIfStatement", + "id": "SimplifyOptionalCallChains", "shortDescription": { - "text": "'if' statement can be replaced with conditional or boolean expression" + "text": "Optional call chain can be simplified" }, "fullDescription": { - "text": "Reports 'if' statements that can be replaced with conditions using the '&&', '||', '==', '!=', or '?:' operator. The result is usually shorter, but not always clearer, so it's not advised to apply the fix in every case. Example: 'if (condition) return true; else return foo;' After the quick-fix is applied: 'return condition || foo;' Configure the inspection: Use the Don't suggest '?:' operator option to disable the warning when the '?:' operator is suggested. In this case, only '&&', '||', '==', and '!=' suggestions will be highlighted. The quick-fix will still be available in the editor. Use the Ignore chained 'if' statements option to disable the warning for 'if-else' chains. The quick-fix will still be available in the editor. New in 2018.2", - "markdown": "Reports `if` statements that can be replaced with conditions using the `&&`, `||`, `==`, `!=`, or `?:` operator.\n\nThe result is usually shorter, but not always clearer, so it's not advised to apply the fix in every case.\n\nExample:\n\n\n if (condition) return true; else return foo;\n\nAfter the quick-fix is applied:\n\n\n return condition || foo;\n\nConfigure the inspection:\n\n* Use the **Don't suggest '?:' operator** option to disable the warning when the `?:` operator is suggested. In this case, only `&&`, `||`, `==`, and `!=` suggestions will be highlighted. The quick-fix will still be available in the editor.\n* Use the **Ignore chained 'if' statements** option to disable the warning for `if-else` chains. The quick-fix will still be available in the editor.\n\nNew in 2018.2" + "text": "Reports Optional call chains that can be simplified. Here are several examples of possible simplifications: 'optional.map(x -> true).orElse(false)' → 'optional.isPresent()' 'optional.map(x -> Optional.of(x.trim())).orElseGet(Optional::empty)' → 'optional.map(String::trim)' 'optional.map(x -> (String)x).orElse(null)' → '(String) optional.orElse(null)' 'Optional.ofNullable(optional.orElse(null))' → 'optional' 'val = optional.orElse(null); val != null ? val : defaultExpr' → 'optional.orElse(defaultExpr)' 'val = optional.orElse(null); if(val != null) expr(val)' → 'optional.ifPresent(val -> expr(val))' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2017.2", + "markdown": "Reports **Optional** call chains that can be simplified. Here are several examples of possible simplifications:\n\n* `optional.map(x -> true).orElse(false)` → `optional.isPresent()`\n* `optional.map(x -> Optional.of(x.trim())).orElseGet(Optional::empty)` → `optional.map(String::trim)`\n* `optional.map(x -> (String)x).orElse(null)` → `(String) optional.orElse(null)`\n* `Optional.ofNullable(optional.orElse(null))` → `optional`\n* `val = optional.orElse(null); val != null ? val : defaultExpr ` → `optional.orElse(defaultExpr)`\n* `val = optional.orElse(null); if(val != null) expr(val) ` → `optional.ifPresent(val -> expr(val))`\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2017.2" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SimplifiableIfStatement", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "SimplifyOptionalCallChains", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -28259,19 +28182,19 @@ ] }, { - "id": "ThrowCaughtLocally", + "id": "RandomDoubleForRandomInteger", "shortDescription": { - "text": "'throw' caught by containing 'try' statement" + "text": "Using 'Random.nextDouble()' to get random integer" }, "fullDescription": { - "text": "Reports 'throw' statements whose exceptions are always caught by containing 'try' statements. Using 'throw' statements as a \"goto\" to change the local flow of control is confusing and results in poor performance. Example: 'try {\n if (!Files.isDirectory(PROJECTS)) {\n throw new IllegalStateException(\"Directory not found.\"); // warning: 'throw' caught by containing 'try' statement\n }\n ...\n } catch (Exception e) {\n LOG.error(\"run failed\");\n }' Use the Ignore rethrown exceptions option to ignore exceptions that are rethrown.", - "markdown": "Reports `throw` statements whose exceptions are always caught by containing `try` statements.\n\nUsing `throw`\nstatements as a \"goto\" to change the local flow of control is confusing and results in poor performance.\n\n**Example:**\n\n\n try {\n if (!Files.isDirectory(PROJECTS)) {\n throw new IllegalStateException(\"Directory not found.\"); // warning: 'throw' caught by containing 'try' statement\n }\n ...\n } catch (Exception e) {\n LOG.error(\"run failed\");\n }\n\nUse the **Ignore rethrown exceptions** option to ignore exceptions that are rethrown." + "text": "Reports calls to 'java.util.Random.nextDouble()' that are used to create a positive integer number by multiplying the call by a factor and casting to an integer. For generating a random positive integer in a range, 'java.util.Random.nextInt(int)' is simpler and more efficient. Example: 'int getRandomInt() {\n return (int) ((new Random()).nextDouble() * SIZE);\n }'\n After the quick-fix is applied: 'int getRandomInt() {\n return (new Random()).nextInt(SIZE);\n }'", + "markdown": "Reports calls to `java.util.Random.nextDouble()` that are used to create a positive integer number by multiplying the call by a factor and casting to an integer.\n\n\nFor generating a random positive integer in a range,\n`java.util.Random.nextInt(int)` is simpler and more efficient.\n\n**Example:**\n\n\n int getRandomInt() {\n return (int) ((new Random()).nextDouble() * SIZE);\n }\n \nAfter the quick-fix is applied:\n\n\n int getRandomInt() {\n return (new Random()).nextInt(SIZE);\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ThrowCaughtLocally", + "suppressToolId": "UsingRandomNextDoubleForRandomInteger", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28279,8 +28202,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -28292,19 +28215,22 @@ ] }, { - "id": "NonSerializableWithSerialVersionUIDField", + "id": "SuspiciousArrayCast", "shortDescription": { - "text": "Non-serializable class with 'serialVersionUID'" + "text": "Suspicious array cast" }, "fullDescription": { - "text": "Reports non-'Serializable' classes that define a 'serialVersionUID' field. A 'serialVersionUID' field in that context normally indicates an error because the field will be ignored and the class will not be serialized. Example: 'public class IWantToSerializeThis {\n private static final long serialVersionUID = 2669293150219020249L;\n }'", - "markdown": "Reports non-`Serializable` classes that define a `serialVersionUID` field. A `serialVersionUID` field in that context normally indicates an error because the field will be ignored and the class will not be serialized.\n\n**Example:**\n\n\n public class IWantToSerializeThis {\n private static final long serialVersionUID = 2669293150219020249L;\n }\n" + "text": "Reports suspicious array casts. An array cast is considered suspicious when it casts to a more specific array type. Such a cast is legal at compile time but may fail with a 'ClassCastException' at runtime. Example: 'Number[] numbers = new Number[]{1L, 2L, 4L};\n Long[] longs = (Long[])numbers;'", + "markdown": "Reports suspicious array casts. An array cast is considered suspicious when it casts to a more specific array type. Such a cast is legal at compile time but may fail with a `ClassCastException` at runtime.\n\n**Example:**\n\n\n Number[] numbers = new Number[]{1L, 2L, 4L};\n Long[] longs = (Long[])numbers;\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonSerializableClassWithSerialVersionUID", + "suppressToolId": "SuspiciousArrayCast", + "cweIds": [ + 704 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28312,8 +28238,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -28325,19 +28251,19 @@ ] }, { - "id": "SynchronizeOnValueBasedClass", + "id": "ZeroLengthArrayInitialization", "shortDescription": { - "text": "Value-based warnings" + "text": "Zero-length array allocation" }, "fullDescription": { - "text": "Reports attempts to synchronize on an instance of a value-based class that produce compile-time warnings and raise run-time exceptions starting from Java 16. For example, 'java.lang.Double' is annotated with 'jdk.internal.ValueBased', so the following code will produce a compile-time warning: 'Double d = 20.0;\nsynchronized (d) { ... } // javac warning' New in 2021.1", - "markdown": "Reports attempts to synchronize on an instance of a value-based class that produce compile-time warnings and raise run-time exceptions starting from Java 16.\n\n\nFor example, `java.lang.Double` is annotated with `jdk.internal.ValueBased`, so the following code will\nproduce a compile-time warning:\n\n\n Double d = 20.0;\n synchronized (d) { ... } // javac warning\n\nNew in 2021.1" + "text": "Reports allocations of arrays with known lengths of zero. Since array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly allocate new ones. Such sharing may provide useful optimizations in the program runtime or footprint. Note that the inspection does not report zero-length arrays allocated as static final fields, since those arrays are assumed to be used for implementing array sharing.", + "markdown": "Reports allocations of arrays with known lengths of zero.\n\n\nSince array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly\nallocate new ones. Such sharing may provide useful optimizations in the program runtime or footprint.\n\n\nNote that the inspection does not report zero-length arrays allocated as static final fields,\nsince those arrays are assumed to be used for implementing array sharing." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "synchronization", + "suppressToolId": "ZeroLengthArrayAllocation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28345,8 +28271,8 @@ "relationships": [ { "target": { - "id": "Java/Compiler issues", - "index": 162, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -28358,27 +28284,27 @@ ] }, { - "id": "SwitchStatementsWithoutDefault", + "id": "DivideByZero", "shortDescription": { - "text": "'switch' statement without 'default' branch" + "text": "Division by zero" }, "fullDescription": { - "text": "Reports 'switch' statements that do not contain 'default' labels. Adding the 'default' label guarantees that all possible scenarios are covered, and it becomes easier to make assumptions about the current state of the program. Note that by default, the inspection does not report 'switch' statements if all cases for enums or 'sealed' classes are covered. Use the Ignore exhaustive switch statements option if you want to change this behavior.", - "markdown": "Reports `switch` statements that do not contain `default` labels.\n\nAdding the `default` label guarantees that all possible scenarios are covered, and it becomes\neasier to make assumptions about the current state of the program.\n\n\nNote that by default, the inspection does not report `switch` statements if all cases for enums or `sealed` classes are covered.\nUse the **Ignore exhaustive switch statements** option if you want to change this behavior." + "text": "Reports division by zero or remainder by zero. Such expressions will produce an 'Infinity', '-Infinity' or 'NaN' result for doubles or floats, and will throw an 'ArithmeticException' for integers. When the expression has a 'NaN' result, the fix suggests replacing the division expression with the 'NaN' constant.", + "markdown": "Reports division by zero or remainder by zero. Such expressions will produce an `Infinity`, `-Infinity` or `NaN` result for doubles or floats, and will throw an `ArithmeticException` for integers.\n\nWhen the expression has a `NaN` result, the fix suggests replacing the division expression with the `NaN` constant." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "SwitchStatementWithoutDefaultBranch", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "divzero", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", + "id": "Java/Numeric issues", "index": 30, "toolComponent": { "name": "QDJVM" @@ -28391,19 +28317,19 @@ ] }, { - "id": "IncompatibleMask", + "id": "MissingSerialAnnotation", "shortDescription": { - "text": "Incompatible bitwise mask operation" + "text": "'@Serial' annotation can be used" }, "fullDescription": { - "text": "Reports bitwise mask expressions which are guaranteed to evaluate to 'true' or 'false'. The inspection checks the expressions of the form '(var & constant1) == constant2' or '(var | constant1) == constant2', where 'constant1' and 'constant2' are incompatible bitmask constants. Example: '// Incompatible mask: as the mask ends in 00,\n // the result could be 0x1200 but not 0x1234\n if ((mask & 0xFF00) == 0x1234) {...}'", - "markdown": "Reports bitwise mask expressions which are guaranteed to evaluate to `true` or `false`.\n\n\nThe inspection checks the expressions of the form `(var & constant1) == constant2` or\n`(var | constant1) == constant2`, where `constant1`\nand `constant2` are incompatible bitmask constants.\n\n**Example:**\n\n // Incompatible mask: as the mask ends in 00,\n // the result could be 0x1200 but not 0x1234\n if ((mask & 0xFF00) == 0x1234) {...}\n" + "text": "Reports methods and fields in the 'Serializable' and 'Externalizable' classes that are suitable to be annotated with the 'java.io.Serial' annotation. The quick-fix adds the annotation. Example: 'class Main implements Serializable {\n private static final long serialVersionUID = 7874493593505141603L;\n\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' After the quick-fix is applied: 'class Main implements Serializable {\n @Serial\n private static final long serialVersionUID = 7874493593505141603L;\n\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' Example: 'class Main implements Externalizable {\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }' After the quick-fix is applied: 'class Main implements Externalizable {\n @Serial\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }' For more information about all possible cases, refer to the Javadoc of the 'java.io.Serial' class. This inspection depends on the Java feature '@Serial annotation', which is available since Java 14. New in 2020.3", + "markdown": "Reports methods and fields in the `Serializable` and `Externalizable` classes that are suitable to be annotated with the `java.io.Serial` annotation. The quick-fix adds the annotation.\n\n**Example:**\n\n\n class Main implements Serializable {\n private static final long serialVersionUID = 7874493593505141603L;\n\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Main implements Serializable {\n @Serial\n private static final long serialVersionUID = 7874493593505141603L;\n\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\n**Example:**\n\n\n class Main implements Externalizable {\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Main implements Externalizable {\n @Serial\n protected Object readResolve() throws ObjectStreamException {\n return \"SomeObject\";\n }\n }\n\nFor more information about all possible cases, refer to the Javadoc of the `java.io.Serial` class.\n\nThis inspection depends on the Java feature '@Serial annotation', which is available since Java 14.\n\nNew in 2020.3" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "IncompatibleBitwiseMaskOperation", + "suppressToolId": "MissingSerialAnnotation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28411,8 +28337,8 @@ "relationships": [ { "target": { - "id": "Java/Bitwise operation issues", - "index": 199, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -28424,28 +28350,28 @@ ] }, { - "id": "ExplicitArgumentCanBeLambda", + "id": "StringConcatenationMissingWhitespace", "shortDescription": { - "text": "Explicit argument can be lambda" + "text": "Whitespace may be missing in string concatenation" }, "fullDescription": { - "text": "Reports method calls that accept a non-trivial expression and can be replaced with an equivalent method call which accepts a lambda instead. Converting an expression to a lambda ensures that the expression won't be evaluated if it's not used inside the method. For example, 'optional.orElse(createDefaultValue())' can be converted to 'optional.orElseGet(this::createDefaultValue)'. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8. New in 2018.1", - "markdown": "Reports method calls that accept a non-trivial expression and can be replaced with an equivalent method call which accepts a lambda instead.\n\n\nConverting an expression to a lambda ensures that the expression won't be evaluated\nif it's not used inside the method. For example, `optional.orElse(createDefaultValue())` can be converted\nto `optional.orElseGet(this::createDefaultValue)`.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.\n\nNew in 2018.1" + "text": "Reports string concatenations with missing whitespaces, that is where the left-hand side ends with a Unicode letter or digit and the right-hand side starts with a Unicode letter or digit. Example: 'String sql = \"SELECT column\" +\n \"FROM table\";' Use the Ignore concatenations with variable strings option to only report when both the left and right side of the concatenation are literals.", + "markdown": "Reports string concatenations with missing whitespaces, that is where the left-hand side ends with a Unicode letter or digit and the right-hand side starts with a Unicode letter or digit.\n\n**Example:**\n\n\n String sql = \"SELECT column\" +\n \"FROM table\";\n\n\nUse the **Ignore concatenations with variable strings** option to only report\nwhen both the left and right side of the concatenation are literals." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ExplicitArgumentCanBeLambda", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "StringConcatenationMissingWhitespace", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -28457,19 +28383,19 @@ ] }, { - "id": "EqualsCalledOnEnumConstant", + "id": "StandardVariableNames", "shortDescription": { - "text": "'equals()' called on enum value" + "text": "Standard variable names" }, "fullDescription": { - "text": "Reports 'equals()' calls on enum constants. Such calls can be replaced by an identity comparison ('==') because two enum constants are equal only when they have the same identity. A quick-fix is available to change the call to a comparison. Example: 'boolean foo(MyEnum value) {\n return value.equals(MyEnum.FOO);\n }' After the quick-fix is applied: 'boolean foo(MyEnum value) {\n return value == MyEnum.FOO;\n }'", - "markdown": "Reports `equals()` calls on enum constants.\n\nSuch calls can be replaced by an identity comparison (`==`) because two\nenum constants are equal only when they have the same identity.\n\nA quick-fix is available to change the call to a comparison.\n\n**Example:**\n\n\n boolean foo(MyEnum value) {\n return value.equals(MyEnum.FOO);\n }\n\nAfter the quick-fix is applied:\n\n\n boolean foo(MyEnum value) {\n return value == MyEnum.FOO;\n }\n" + "text": "Reports variables with 'standard' names that do not correspond to their types. Such names may be confusing. There are the following standard names for specific types: i, j, k, m, n - 'int' f - 'float' d - 'double' b - 'byte' c, ch - 'char' l - 'long' s, str - 'String' Rename quick-fix is suggested only in the editor. Use the option to ignore parameter names which are identical to the parameter name from a direct super method.", + "markdown": "Reports variables with 'standard' names that do not correspond to their types. Such names may be confusing. There are the following standard names for specific types:\n\n* i, j, k, m, n - `int`\n* f - `float`\n* d - `double`\n* b - `byte`\n* c, ch - `char`\n* l - `long`\n* s, str - `String`\n\nRename quick-fix is suggested only in the editor.\n\n\nUse the option to ignore parameter names which are identical to the parameter name from a direct super method." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EqualsCalledOnEnumConstant", + "suppressToolId": "StandardVariableNames", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28477,8 +28403,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -28490,28 +28416,28 @@ ] }, { - "id": "HardcodedLineSeparators", + "id": "DeconstructionCanBeUsed", "shortDescription": { - "text": "Hardcoded line separator" + "text": "Record pattern can be used" }, "fullDescription": { - "text": "Reports linefeed ('\\n') and carriage return ('\\r') character escape sequences used in string literals, character literals or text blocks. These characters are commonly used as line separators, and portability may suffer if they are hardcoded. Example: 'String count = \"first\\nsecond\\rthird\";'", - "markdown": "Reports linefeed (`\\n`) and carriage return (`\\r`) character escape sequences used in string literals, character literals or text blocks. These characters are commonly used as line separators, and portability may suffer if they are hardcoded.\n\n**Example:**\n\n\n String count = \"first\\nsecond\\rthird\";\n" + "text": "Reports patterns that can be replaced with record patterns. Example: 'record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point p) {\n int x = p.x();\n int y = p.y();\n System.out.println(x + y);\n }\n }' After the quick-fix is applied: 'record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point(int x, int y)) {\n System.out.println(x + y);\n }\n }' This inspection depends on the Java feature 'Pattern guards and record patterns', which is available since Java 21. New in 2023.1", + "markdown": "Reports patterns that can be replaced with record patterns.\n\nExample:\n\n\n record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point p) {\n int x = p.x();\n int y = p.y();\n System.out.println(x + y);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n record Point(int x, int y) {}\n\n static void printSum(Object obj) {\n if (obj instanceof Point(int x, int y)) {\n System.out.println(x + y);\n }\n }\n\nThis inspection depends on the Java feature 'Pattern guards and record patterns', which is available since Java 21.\n\nNew in 2023.1" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "HardcodedLineSeparator", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "DeconstructionCanBeUsed", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Java/Java language level migration aids/Java 21", + "index": 195, "toolComponent": { "name": "QDJVM" } @@ -28523,19 +28449,19 @@ ] }, { - "id": "UnnecessaryConstantArrayCreationExpression", + "id": "ExceptionFromCatchWhichDoesntWrap", "shortDescription": { - "text": "Redundant 'new' expression in constant array creation" + "text": "'throw' inside 'catch' block which ignores the caught exception" }, "fullDescription": { - "text": "Reports constant new array expressions that can be replaced with an array initializer. Array initializers can omit the type because it is already specified in the left side of the assignment. Example: 'int[] foo = new int[] {42};' After the quick-fix is applied: 'int[] foo = {42};'", - "markdown": "Reports constant new array expressions that can be replaced with an array initializer. Array initializers can omit the type because it is already specified in the left side of the assignment.\n\n**Example:**\n\n\n int[] foo = new int[] {42};\n\nAfter the quick-fix is applied:\n\n\n int[] foo = {42};\n" + "text": "Reports exceptions that are thrown from inside 'catch' blocks but do not \"wrap\" the caught exception. When an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information, such as stack frames and line numbers. Example: '...\n catch (IOException e) {\n closeAllConnections();\n throw new ConnectException(\"Connection problem.\"); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'\n }' Configure the inspection: Use the Ignore if result of exception method call is used option to indicate whether the inspection should ignore exceptions whose argument is the result of a method call on the original exception, such as 'getMessage()'. Use the Ignore if thrown exception cannot wrap an exception option to ignore 'throw' statements that throw exceptions without a constructor that accepts a 'Throwable' cause.", + "markdown": "Reports exceptions that are thrown from inside `catch` blocks but do not \"wrap\" the caught exception.\n\nWhen an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information,\nsuch as stack frames and line numbers.\n\n**Example:**\n\n\n ...\n catch (IOException e) {\n closeAllConnections();\n throw new ConnectException(\"Connection problem.\"); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'\n }\n\nConfigure the inspection:\n\n* Use the **Ignore if result of exception method call is used** option to indicate whether the inspection should ignore exceptions whose argument is the result of a method call on the original exception, such as `getMessage()`.\n* Use the **Ignore if thrown exception cannot wrap an exception** option to ignore `throw` statements that throw exceptions without a constructor that accepts a `Throwable` cause." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryConstantArrayCreationExpression", + "suppressToolId": "ThrowInsideCatchBlockWhichIgnoresCaughtException", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28543,8 +28469,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -28556,19 +28482,19 @@ ] }, { - "id": "LabeledStatement", + "id": "MethodOnlyUsedFromInnerClass", "shortDescription": { - "text": "Labeled statement" + "text": "Private method only used from inner class" }, "fullDescription": { - "text": "Reports labeled statements that can complicate refactorings and control flow of the method. Example: 'label:\n while (true) {\n // code\n }'", - "markdown": "Reports labeled statements that can complicate refactorings and control flow of the method.\n\nExample:\n\n\n label:\n while (true) {\n // code\n }\n" + "text": "Reports 'private' methods which are only called from an inner class of the class containing the method. Such methods can be safely moved into that inner class. Example: 'public class Outer {\n public static void main(String[] args) {\n new Inner().run(args[0]);\n }\n\n static class Inner {\n void run(String arg) {\n // Method isEmpty() is used from Inner class only\n // consider moving it to the Inner class\n if (!isEmpty(arg)) {\n System.out.println(\"Argument is supplied\");\n }\n }\n }\n\n private static boolean isEmpty(String s) {\n return s != null && s.trim().isEmpty();\n }\n}' Use the first checkbox below to ignore 'private' methods which are called from an anonymous or local class. Use the third checkbox to only report 'static' methods.", + "markdown": "Reports `private` methods which are only called from an inner class of the class containing the method. Such methods can be safely moved into that inner class.\n\nExample:\n\n\n public class Outer {\n public static void main(String[] args) {\n new Inner().run(args[0]);\n }\n\n static class Inner {\n void run(String arg) {\n // Method isEmpty() is used from Inner class only\n // consider moving it to the Inner class\n if (!isEmpty(arg)) {\n System.out.println(\"Argument is supplied\");\n }\n }\n }\n\n private static boolean isEmpty(String s) {\n return s != null && s.trim().isEmpty();\n }\n }\n\n\nUse the first checkbox below to ignore `private`\nmethods which are called from an anonymous or local class.\n\n\nUse the third checkbox to only report `static` methods." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LabeledStatement", + "suppressToolId": "MethodOnlyUsedFromInnerClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28576,8 +28502,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -28589,22 +28515,19 @@ ] }, { - "id": "SuspiciousNameCombination", + "id": "ComparisonToNaN", "shortDescription": { - "text": "Suspicious variable/parameter name combination" + "text": "Comparison to 'Double.NaN' or 'Float.NaN'" }, "fullDescription": { - "text": "Reports assignments and function calls in which the name of the target variable or the function parameter does not match the name of the value assigned to it. Example 1: 'int x = 0;\n int y = x; // x is used as a y-coordinate' Example 2: 'int x = 0, y = 0;\n // x is used as a y-coordinate and y as an x-coordinate\n Rectangle rc = new Rectangle(y, x, 20, 20);' Configure the inspection: Use the Group of names area to specify the names which should not be used together: an error is reported if the parameter name or assignment target name contains words from one group and the name of the assigned or passed variable contains words from a different group. Use the Ignore methods area to specify the methods that should not be checked but have a potentially suspicious name. For example, the 'Integer.compare()' parameters are named 'x' and 'y' but are unrelated to coordinates.", - "markdown": "Reports assignments and function calls in which the name of the target variable or the function parameter does not match the name of the value assigned to it.\n\nExample 1:\n\n\n int x = 0;\n int y = x; // x is used as a y-coordinate\n \nExample 2:\n\n\n int x = 0, y = 0;\n // x is used as a y-coordinate and y as an x-coordinate\n Rectangle rc = new Rectangle(y, x, 20, 20);\n\nConfigure the inspection:\n\nUse the **Group of names** area to specify the names which should not be used together: an error is reported\nif the parameter name or assignment target name contains words from one group and the name of the assigned or passed\nvariable contains words from a different group.\n\nUse the **Ignore methods** area to specify the methods that should not be checked but have a potentially suspicious name.\nFor example, the `Integer.compare()` parameters are named `x` and `y` but are unrelated to coordinates." + "text": "Reports any comparisons to 'Double.NaN' or 'Float.NaN'. Such comparisons are never meaningful, as NaN is not equal to anything, including itself. Use the 'Double.isNaN()' or 'Float.isNaN()' methods instead. Example: 'if (x == Double.NaN) {...}' After the quick-fix is applied: 'if (Double.isNaN(x)) {...}'", + "markdown": "Reports any comparisons to `Double.NaN` or `Float.NaN`. Such comparisons are never meaningful, as NaN is not equal to anything, including itself. Use the `Double.isNaN()` or `Float.isNaN()` methods instead.\n\n**Example:**\n\n\n if (x == Double.NaN) {...}\n\nAfter the quick-fix is applied:\n\n\n if (Double.isNaN(x)) {...}\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousNameCombination", - "cweIds": [ - 628 - ], + "suppressToolId": "ComparisonToNaN", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28612,8 +28535,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -28625,28 +28548,28 @@ ] }, { - "id": "ImplicitDefaultCharsetUsage", + "id": "MultiCatchCanBeSplit", "shortDescription": { - "text": "Implicit platform default charset" + "text": "Multi-catch can be split into separate catch blocks" }, "fullDescription": { - "text": "Reports method and constructor calls that implicitly use the platform default charset. Such calls can produce different results on systems that use a different default charset and may result in unexpected behaviour. Example: 'void foo(byte[] bytes) {\n String s = new String(bytes);\n}'\n You can use a quick-fix that specifies the explicit UTF-8 charset if the corresponding overloaded method is available. After the quick-fix is applied: 'void foo(byte[] bytes) {\n String s = new String(bytes, StandardCharsets.UTF_8);\n}'", - "markdown": "Reports method and constructor calls that implicitly use the platform default charset. Such calls can produce different results on systems that use a different default charset and may result in unexpected behaviour.\n\n**Example:**\n\n void foo(byte[] bytes) {\n String s = new String(bytes);\n }\n\nYou can use a quick-fix that specifies the explicit UTF-8 charset if the corresponding overloaded method is available.\nAfter the quick-fix is applied:\n\n void foo(byte[] bytes) {\n String s = new String(bytes, StandardCharsets.UTF_8);\n }\n" + "text": "Reports multi-'catch' sections and suggests splitting them into separate 'catch' blocks. Example: 'try {\n int i = getIndex();\n } catch (NullPointerException|IndexOutOfBoundsException e) {\n e.printStackTrace();\n }' After the quick-fix is applied: 'try {\n int i = getIndex();\n } catch (NullPointerException e) {\n e.printStackTrace();\n } catch (IndexOutOfBoundsException e) {\n e.printStackTrace();\n }' This inspection depends on the Java feature 'Multi-catches', which is available since Java 7.", + "markdown": "Reports multi-`catch` sections and suggests splitting them into separate `catch` blocks.\n\nExample:\n\n\n try {\n int i = getIndex();\n } catch (NullPointerException|IndexOutOfBoundsException e) {\n e.printStackTrace();\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n int i = getIndex();\n } catch (NullPointerException e) {\n e.printStackTrace();\n } catch (IndexOutOfBoundsException e) {\n e.printStackTrace();\n }\n\nThis inspection depends on the Java feature 'Multi-catches', which is available since Java 7." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ImplicitDefaultCharsetUsage", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MultiCatchCanBeSplit", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -28658,22 +28581,19 @@ ] }, { - "id": "DesignForExtension", + "id": "ResultSetIndexZero", "shortDescription": { - "text": "Design for extension" + "text": "Use of index 0 in JDBC ResultSet" }, "fullDescription": { - "text": "Reports methods which are not 'static', 'private', 'final' or 'abstract', and whose bodies are not empty. Coding in a style that avoids such methods protects the contracts of classes from being broken by their subclasses. The benefit of this style is that subclasses cannot corrupt the state of the superclass by forgetting to call the super method. The cost is that subclasses are limited in their flexibility, in particular they cannot prevent execution of code in the superclass. Use the quick-fix to add the missing modifiers. Example: 'class Foo {\n public boolean equals(Object o) { return true; }\n }' After the quick-fix is applied: 'class Foo {\n public final boolean equals(Object o) { return true; }\n }' This inspection is intended for code that is going to be used in secure environments, and is probably not appropriate for less restrictive environments.", - "markdown": "Reports methods which are not `static`, `private`, `final` or `abstract`, and whose bodies are not empty.\n\n\nCoding in a style that avoids such methods protects the contracts of classes from being broken by their subclasses. The\nbenefit of this style is that subclasses cannot corrupt the state of the superclass by forgetting to call the super method. The cost is\nthat\nsubclasses are limited in their flexibility, in particular they cannot prevent execution of code in the superclass. Use the quick-fix to\nadd\nthe missing modifiers.\n\n**Example:**\n\n\n class Foo {\n public boolean equals(Object o) { return true; }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n public final boolean equals(Object o) { return true; }\n }\n\nThis inspection is intended for code that is going to be used in secure environments, and is probably not appropriate for less restrictive environments." + "text": "Reports attempts to access column 0 of 'java.sql.ResultSet' or 'java.sql.PreparedStatement'. For historical reasons, columns of 'java.sql.ResultSet' and 'java.sql.PreparedStatement' are numbered starting with 1, rather than with 0, and accessing column 0 is a common error in JDBC programming. Example: 'String getName(ResultSet rs) {\n return rs.getString(0);\n }'", + "markdown": "Reports attempts to access column 0 of `java.sql.ResultSet` or `java.sql.PreparedStatement`. For historical reasons, columns of `java.sql.ResultSet` and `java.sql.PreparedStatement` are numbered starting with **1** , rather than with **0** , and accessing column 0 is a common error in JDBC programming.\n\n**Example:**\n\n\n String getName(ResultSet rs) {\n return rs.getString(0);\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DesignForExtension", - "cweIds": [ - 668 - ], + "suppressToolId": "UseOfIndexZeroInJDBCResultSet", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28681,8 +28601,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -28694,19 +28614,19 @@ ] }, { - "id": "SimplifyStreamApiCallChains", + "id": "ConditionCoveredByFurtherCondition", "shortDescription": { - "text": "Stream API call chain can be simplified" + "text": "Condition is covered by further condition" }, "fullDescription": { - "text": "Reports stream API call chains that can be simplified. Simplification will often avoid some temporary object creation during collection traversal. The inspection replaces the following call chains: 'collection.stream().forEach()' → 'collection.forEach()' 'collection.stream().collect(toList/toSet/toCollection())' → 'new CollectionType<>(collection)' 'collection.stream().toArray()' → 'collection.toArray()' 'Arrays.asList().stream()' → 'Arrays.stream()' or 'Stream.of()' 'IntStream.range(0, array.length).mapToObj(idx -> array[idx])' → 'Arrays.stream(array)' 'IntStream.range(0, list.size()).mapToObj(idx -> list.get(idx))' → 'list.stream()' 'Collections.singleton().stream()' → 'Stream.of()' 'Collections.emptyList().stream()' → 'Stream.empty()' 'stream.filter().findFirst().isPresent()' → 'stream.anyMatch()' 'stream.collect(counting())' → 'stream.count()' 'stream.collect(maxBy())' → 'stream.max()' 'stream.collect(mapping())' → 'stream.map().collect()' 'stream.collect(reducing())' → 'stream.reduce()' 'stream.collect(summingInt())' → 'stream.mapToInt().sum()' 'stream.mapToObj(x -> x)' → 'stream.boxed()' 'stream.map(x -> {...; return x;})' → 'stream.peek(x -> ...)' '!stream.anyMatch()' → 'stream.noneMatch()' '!stream.anyMatch(x -> !(...))' → 'stream.allMatch()' 'stream.map().anyMatch(Boolean::booleanValue)' → 'stream.anyMatch()' 'IntStream.range(expr1, expr2).mapToObj(x -> array[x])' → 'Arrays.stream(array, expr1, expr2)' 'Collection.nCopies(count, ...)' → 'Stream.generate().limit(count)' 'stream.sorted(comparator).findFirst()' → 'Stream.min(comparator)' 'optional.orElseGet(() -> { throw new ...; })' → 'optional.orElseThrow()' Note that the replacement semantics may have minor differences in some cases. For example, 'Collections.synchronizedList(...).stream().forEach()' is not synchronized while 'Collections.synchronizedList(...).forEach()' is synchronized. Also, 'collect(Collectors.maxBy())' returns an empty 'Optional' if the resulting element is 'null' while 'Stream.max()' throws 'NullPointerException' in this case. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports stream API call chains that can be simplified. Simplification will often avoid some temporary object creation during collection traversal.\n\n\nThe inspection replaces the following call chains:\n\n* `collection.stream().forEach()` → `collection.forEach()`\n* `collection.stream().collect(toList/toSet/toCollection())` → `new CollectionType<>(collection)`\n* `collection.stream().toArray()` → `collection.toArray()`\n* `Arrays.asList().stream()` → `Arrays.stream()` or `Stream.of()`\n* `IntStream.range(0, array.length).mapToObj(idx -> array[idx])` → `Arrays.stream(array)`\n* `IntStream.range(0, list.size()).mapToObj(idx -> list.get(idx))` → `list.stream()`\n* `Collections.singleton().stream()` → `Stream.of()`\n* `Collections.emptyList().stream()` → `Stream.empty()`\n* `stream.filter().findFirst().isPresent()` → `stream.anyMatch()`\n* `stream.collect(counting())` → `stream.count()`\n* `stream.collect(maxBy())` → `stream.max()`\n* `stream.collect(mapping())` → `stream.map().collect()`\n* `stream.collect(reducing())` → `stream.reduce()`\n* `stream.collect(summingInt())` → `stream.mapToInt().sum()`\n* `stream.mapToObj(x -> x)` → `stream.boxed()`\n* `stream.map(x -> {...; return x;})` → `stream.peek(x -> ...)`\n* `!stream.anyMatch()` → `stream.noneMatch()`\n* `!stream.anyMatch(x -> !(...))` → `stream.allMatch()`\n* `stream.map().anyMatch(Boolean::booleanValue)` → `stream.anyMatch()`\n* `IntStream.range(expr1, expr2).mapToObj(x -> array[x])` → `Arrays.stream(array, expr1, expr2)`\n* `Collection.nCopies(count, ...)` → `Stream.generate().limit(count)`\n* `stream.sorted(comparator).findFirst()` → `Stream.min(comparator)`\n* `optional.orElseGet(() -> { throw new ...; })` → `optional.orElseThrow()`\n\n\nNote that the replacement semantics may have minor differences in some cases. For example,\n`Collections.synchronizedList(...).stream().forEach()` is not synchronized while\n`Collections.synchronizedList(...).forEach()` is synchronized.\nAlso, `collect(Collectors.maxBy())` returns an empty `Optional` if the resulting element is\n`null` while `Stream.max()` throws `NullPointerException` in this case.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "text": "Reports conditions that become redundant as they are completely covered by a subsequent condition. For example, in the 'value != -1 && value > 0' condition, the first part is redundant: if it's false, then the second part is also false. Or in a condition like 'obj != null && obj instanceof String', the null-check is redundant as 'instanceof' operator implies non-nullity. New in 2018.3", + "markdown": "Reports conditions that become redundant as they are completely covered by a subsequent condition.\n\nFor example, in the `value != -1 && value > 0` condition, the first part is redundant:\nif it's false, then the second part is also false.\nOr in a condition like `obj != null && obj instanceof String`,\nthe null-check is redundant as `instanceof` operator implies non-nullity.\n\nNew in 2018.3" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SimplifyStreamApiCallChains", + "suppressToolId": "ConditionCoveredByFurtherCondition", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28727,19 +28647,19 @@ ] }, { - "id": "UnknownGuard", + "id": "PatternVariableHidesField", "shortDescription": { - "text": "Unknown '@GuardedBy' field" + "text": "Pattern variable hides field" }, "fullDescription": { - "text": "Reports '@GuardedBy' annotations in which the specified guarding field is unknown. Example: 'private Object state;\n\n @GuardedBy(\"lock\") //unknown guard reference\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 specified guarding field is unknown.\n\nExample:\n\n\n private Object state;\n\n @GuardedBy(\"lock\") //unknown guard reference\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`" + "text": "Reports pattern variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the pattern variable when using the identically named field is intended. A quick-fix is suggested to rename the variable. Example: 'class Pointless {\n Point p = new Point();\n\n public void test(Object a) {\n if (a instanceof Point p) {\n System.out.print(\"a is a point (\" + p.x + \", \" + p.y + ')');\n } else {\n System.out.print(\"p is a point (\" + p.x + \", \" + p.y + ')');\n }\n }\n }' New in 2022.2", + "markdown": "Reports pattern variables named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the pattern variable when using the identically named field is intended.\n\n\nA quick-fix is suggested to rename the variable.\n\n**Example:**\n\n\n class Pointless {\n Point p = new Point();\n\n public void test(Object a) {\n if (a instanceof Point p) {\n System.out.print(\"a is a point (\" + p.x + \", \" + p.y + ')');\n } else {\n System.out.print(\"p is a point (\" + p.x + \", \" + p.y + ')');\n }\n }\n }\n\nNew in 2022.2" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnknownGuard", + "suppressToolId": "PatternVariableHidesField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28747,8 +28667,8 @@ "relationships": [ { "target": { - "id": "Java/Concurrency annotation issues", - "index": 100, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -28760,28 +28680,28 @@ ] }, { - "id": "AbstractClassExtendsConcreteClass", + "id": "JoinDeclarationAndAssignmentJava", "shortDescription": { - "text": "Abstract class extends concrete class" + "text": "Assignment can be joined with declaration" }, "fullDescription": { - "text": "Reports 'abstract' classes that extend concrete classes.", - "markdown": "Reports `abstract` classes that extend concrete classes." + "text": "Reports variable assignments that can be joined with a variable declaration. Example: 'int x;\n x = 1;' The quick-fix converts the assignment into an initializer: 'int x = 1;' New in 2018.3", + "markdown": "Reports variable assignments that can be joined with a variable declaration.\n\nExample:\n\n\n int x;\n x = 1;\n\nThe quick-fix converts the assignment into an initializer:\n\n\n int x = 1;\n\nNew in 2018.3" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "AbstractClassExtendsConcreteClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "JoinDeclarationAndAssignmentJava", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -28793,19 +28713,19 @@ ] }, { - "id": "Java8CollectionRemoveIf", + "id": "InnerClassVariableHidesOuterClassVariable", "shortDescription": { - "text": "Loop can be replaced with 'Collection.removeIf()'" + "text": "Inner class field hides outer class field" }, "fullDescription": { - "text": "Reports loops which can be collapsed into a single 'Collection.removeIf()' call. Example: 'for (Iterator it = collection.iterator(); it.hasNext(); ) {\n String aValue = it.next();\n if(shouldBeRemoved(aValue)) {\n it.remove();\n }\n }' After the quick-fix is applied: 'collection.removeIf(aValue -> shouldBeRemoved(aValue));' This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.", - "markdown": "Reports loops which can be collapsed into a single `Collection.removeIf()` call.\n\nExample:\n\n\n for (Iterator it = collection.iterator(); it.hasNext(); ) {\n String aValue = it.next();\n if(shouldBeRemoved(aValue)) {\n it.remove();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n collection.removeIf(aValue -> shouldBeRemoved(aValue));\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8." + "text": "Reports inner class fields named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the field from the inner class when using the identically named field of a surrounding class is intended. A quick-fix is suggested to rename the inner class field. Example: 'class Outer {\n private String name;\n\n class Inner {\n private String name;\n }\n }' Use the option to choose whether this inspection should report all name clashes, or only clashes with fields that are visible from the inner class.", + "markdown": "Reports inner class fields named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the field from the inner class when using the identically named field of a surrounding class is intended.\n\nA quick-fix is suggested to rename the inner class field.\n\n**Example:**\n\n\n class Outer {\n private String name;\n\n class Inner {\n private String name;\n }\n }\n\n\nUse the option to choose whether this inspection should report all name clashes,\nor only clashes with fields that are visible from the inner class." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "Java8CollectionRemoveIf", + "suppressToolId": "InnerClassFieldHidesOuterClassField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28813,8 +28733,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -28826,19 +28746,19 @@ ] }, { - "id": "LogStatementNotGuardedByLogCondition", + "id": "MISSORTED_IMPORTS", "shortDescription": { - "text": "Logging call not guarded by log condition" + "text": "Missorted imports" }, "fullDescription": { - "text": "Reports logging calls that are not surrounded by a guard condition. The evaluation of a call's arguments 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 TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }' After a quick-fix is applied: 'public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }' This inspection supports Log4j2 and the SLF4J logging frameworks (except builders). New in 2024.2", - "markdown": "Reports logging calls that are not surrounded by a guard condition. The evaluation of a call's arguments 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 TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n\nAfter a quick-fix is applied:\n\n\n public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }\n\nThis inspection supports *Log4j2* and the *SLF4J* logging frameworks (except builders).\n\nNew in 2024.2" + "text": "Reports 'import' statements which are not arranged according to the current code style (see Settings|Editor|Code Style). Example: 'import java.util.List;\n import java.util.ArrayList;\n\n public class Example {\n List list = new ArrayList();\n }' After the \"Optimize Imports\" quick fix is applied: 'import java.util.ArrayList;\n import java.util.List;\n\n public class Example {\n List list = new ArrayList();\n }'", + "markdown": "Reports `import` statements which are not arranged according to the current code style (see Settings\\|Editor\\|Code Style).\n\n**Example:**\n\n\n import java.util.List;\n import java.util.ArrayList;\n\n public class Example {\n List list = new ArrayList();\n }\n\nAfter the \"Optimize Imports\" quick fix is applied:\n\n\n import java.util.ArrayList;\n import java.util.List;\n\n public class Example {\n List list = new ArrayList();\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "LogStatementNotGuardedByLogCondition", + "suppressToolId": "MISSORTED_IMPORTS", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -28846,8 +28766,8 @@ "relationships": [ { "target": { - "id": "JVM languages/Logging", - "index": 52, + "id": "Java/Imports", + "index": 24, "toolComponent": { "name": "QDJVM" } @@ -28859,19 +28779,19 @@ ] }, { - "id": "SafeVarargsDetector", + "id": "NonThreadSafeLazyInitialization", "shortDescription": { - "text": "Possible heap pollution from parameterized vararg type" + "text": "Unsafe lazy initialization of 'static' field" }, "fullDescription": { - "text": "Reports methods with variable arity, which can be annotated as '@SafeVarargs'. The '@SafeVarargs' annotation suppresses unchecked warnings about parameterized array creation at call sites. Example: 'public class Foo {\n private List list = new ArrayList<>();\n\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }' After the quick-fix is applied: 'public class Foo {\n private List list = new ArrayList<>();\n\n @SafeVarargs\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }' This annotation is not supported under Java 1.6 or earlier JVMs.", - "markdown": "Reports methods with variable arity, which can be annotated as `@SafeVarargs`. The `@SafeVarargs` annotation suppresses unchecked warnings about parameterized array creation at call sites.\n\n**Example:**\n\n\n public class Foo {\n private List list = new ArrayList<>();\n\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Foo {\n private List list = new ArrayList<>();\n\n @SafeVarargs\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }\n\n\nThis annotation is not supported under Java 1.6 or earlier JVMs." + "text": "Reports 'static' variables that are lazily initialized in a non-thread-safe manner. Lazy initialization of 'static' variables should be done with an appropriate synchronization construct to prevent different threads from performing conflicting initialization. When applicable, a quick-fix, which introduces the lazy initialization holder class idiom, is suggested. This idiom makes use of the fact that the JVM guarantees that a class will not be initialized until it is used. Example: 'class X {\n private static List list;\n\n public List getList() {\n if (list == null) {\n list = List.of(\"one\", \"two\", \"tree\");\n }\n return list;\n }\n }' After the quick-fix is applied: 'class X {\n private static final class ListHolder {\n static final List list = List.of(\"one\", \"two\", \"tree\");\n }\n\n public List getList() {\n return ListHolder.list;\n }\n }'", + "markdown": "Reports `static` variables that are lazily initialized in a non-thread-safe manner.\n\nLazy initialization of `static` variables should be done with an appropriate synchronization construct\nto prevent different threads from performing conflicting initialization.\n\nWhen applicable, a quick-fix, which introduces the\n[lazy initialization holder class idiom](https://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom), is suggested.\nThis idiom makes use of the fact that the JVM guarantees that a class will not be initialized until it is used.\n\n**Example:**\n\n\n class X {\n private static List list;\n\n public List getList() {\n if (list == null) {\n list = List.of(\"one\", \"two\", \"tree\");\n }\n return list;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n private static final class ListHolder {\n static final List list = List.of(\"one\", \"two\", \"tree\");\n }\n\n public List getList() {\n return ListHolder.list;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "unchecked", + "suppressToolId": "NonThreadSafeLazyInitialization", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28879,8 +28799,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 7", - "index": 161, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -28892,22 +28812,19 @@ ] }, { - "id": "ComparatorMethodParameterNotUsed", + "id": "UnnecessaryModifier", "shortDescription": { - "text": "Suspicious 'Comparator.compare()' implementation" + "text": "Unnecessary modifier" }, "fullDescription": { - "text": "Reports problems in 'Comparator.compare()' and 'Comparable.compareTo()' implementations. The following cases are reported: A parameter is not used. Most likely this is a typo and the other parameter is compared with itself, or the method is not implemented correctly. It's evident that the method does not return '0' for the same elements. Such a comparison method violates the contract and can produce unpredictable results when equal elements are encountered. In particular, sorting may fail with an exception on some data. The comparison method never returns positive or negative value. To fulfill the contract, if the comparison method returns positive values, it should also return negative ones if arguments are supplied in reversed order. The comparison method returns 'Integer.MIN_VALUE'. While allowed by the contract, it may be error-prone, as some call sites may incorrectly try to invert the return value of the comparison method using the unary minus operator. The negated value of 'Integer.MIN_VALUE' is 'Integer.MIN_VALUE'. Example: 'Comparator lambda =\n (a, b) -> a.length() > b.length()\n ? 0\n : Math.random() > 0.5 ? -1 : 1;'", - "markdown": "Reports problems in `Comparator.compare()` and `Comparable.compareTo()` implementations.\n\nThe following cases are reported:\n\n* A parameter is not used. Most likely this is a typo and the other parameter is compared with itself, or the method is not implemented correctly.\n* It's evident that the method does not return `0` for the same elements. Such a comparison method violates the contract and can produce unpredictable results when equal elements are encountered. In particular, sorting may fail with an exception on some data.\n* The comparison method never returns positive or negative value. To fulfill the contract, if the comparison method returns positive values, it should also return negative ones if arguments are supplied in reversed order.\n* The comparison method returns `Integer.MIN_VALUE`. While allowed by the contract, it may be error-prone, as some call sites may incorrectly try to invert the return value of the comparison method using the unary minus operator. The negated value of `Integer.MIN_VALUE` is `Integer.MIN_VALUE`.\n\n**Example:**\n\n\n Comparator lambda =\n (a, b) -> a.length() > b.length()\n ? 0\n : Math.random() > 0.5 ? -1 : 1;\n" + "text": "Reports redundant modifiers and suggests to remove them. The resulting code will be shorter, but the behaviour and meaning will remain the same. Example 1: '// all code is implicitly strictfp under Java 17 and higher\n strictfp class X {\n\n // inner enums are implicitly static\n static enum Inner {\n A, B, C\n }\n\n // inner records are implicitly static\n static record R() {\n }\n }' Example 2: 'final record R() {\n // all records are implicitly final\n }' Example 3: '// all interfaces are implicitly abstract\n abstract interface Printer {\n\n // all interface members are implicitly public\n public int size();\n\n // all inner classes of interfaces are implicitly static\n static class Inner {}\n }'", + "markdown": "Reports redundant modifiers and suggests to remove them. The resulting code will be shorter, but the behaviour and meaning will remain the same.\n\n**Example 1:**\n\n\n // all code is implicitly strictfp under Java 17 and higher\n strictfp class X {\n\n // inner enums are implicitly static\n static enum Inner {\n A, B, C\n }\n\n // inner records are implicitly static\n static record R() {\n }\n }\n\n**Example 2:**\n\n\n final record R() {\n // all records are implicitly final\n }\n\n**Example 3:**\n\n\n // all interfaces are implicitly abstract\n abstract interface Printer {\n\n // all interface members are implicitly public\n public int size();\n\n // all inner classes of interfaces are implicitly static\n static class Inner {}\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ComparatorMethodParameterNotUsed", - "cweIds": [ - 628 - ], + "suppressToolId": "UnnecessaryModifier", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28915,8 +28832,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -28928,28 +28845,28 @@ ] }, { - "id": "Annotation", + "id": "ConditionalCanBePushedInsideExpression", "shortDescription": { - "text": "Annotation" + "text": "Conditional can be pushed inside branch expression" }, "fullDescription": { - "text": "Reports annotations. Annotations are not supported in Java 1.4 and earlier JVM.", - "markdown": "Reports annotations. Annotations are not supported in Java 1.4 and earlier JVM." + "text": "Reports conditional expressions with 'then' and else branches that are similar enough so that the expression can be moved inside. This action shortens the code. Example: 'double g(int a, int b) {\n return a == b ? Math.cos(0) : Math.cos(1);\n }' After the quick-fix is applied: 'double g(int a, int b) {\n return Math.cos(a == b ? 0 : 1);\n }' New in 2017.2", + "markdown": "Reports conditional expressions with `then` and else branches that are similar enough so that the expression can be moved inside. This action shortens the code.\n\nExample:\n\n\n double g(int a, int b) {\n return a == b ? Math.cos(0) : Math.cos(1);\n }\n\nAfter the quick-fix is applied:\n\n\n double g(int a, int b) {\n return Math.cos(a == b ? 0 : 1);\n }\n\nNew in 2017.2" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "Annotation", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ConditionalCanBePushedInsideExpression", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Java language level issues", - "index": 147, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -28961,19 +28878,19 @@ ] }, { - "id": "StringTokenizer", + "id": "CloneInNonCloneableClass", "shortDescription": { - "text": "Use of 'StringTokenizer'" + "text": "'clone()' method in non-Cloneable class" }, "fullDescription": { - "text": "Reports usages of the 'StringTokenizer' class. Excessive use of 'StringTokenizer' is incorrect in an internationalized environment.", - "markdown": "Reports usages of the `StringTokenizer` class. Excessive use of `StringTokenizer` is incorrect in an internationalized environment." + "text": "Reports classes that override the 'clone()' method but don't implement the 'Cloneable' interface. This usually represents a programming error. Use the Only warn on 'public' clone methods option to ignore methods that aren't 'public'. For classes designed to be inherited, you may choose to override 'clone()' and declare it as 'protected' without implementing the 'Cloneable' interface and decide whether to implement the 'Cloneable' interface in subclasses.", + "markdown": "Reports classes that override the `clone()` method but don't implement the `Cloneable` interface. This usually represents a programming error.\n\n\nUse the **Only warn on 'public' clone methods** option to ignore methods that aren't `public`.\n\nFor classes designed to be inherited, you may choose to override `clone()` and declare it as `protected`\nwithout implementing the `Cloneable` interface and decide whether to implement the `Cloneable` interface in subclasses." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UseOfStringTokenizer", + "suppressToolId": "CloneInNonCloneableClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -28981,8 +28898,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Cloning issues", + "index": 116, "toolComponent": { "name": "QDJVM" } @@ -28994,19 +28911,19 @@ ] }, { - "id": "PrimitiveArrayArgumentToVariableArgMethod", + "id": "Java8ListReplaceAll", "shortDescription": { - "text": "Confusing primitive array argument to varargs method" + "text": "Loop can be replaced with 'List.replaceAll()'" }, "fullDescription": { - "text": "Reports any calls to a variable arity method where the call has a primitive array in the variable arity parameter position (for example, 'System.out.printf(\"%s\", new int[]{1, 2, 3})'). Such a primitive-array argument may be confusing, as it will be wrapped as a single-element array, rather than each individual element being boxed, as might be expected. Example: 'String.format(\"%s\", new int[]{1, 2, 3});' After the quick-fix is applied: 'String.format(\"%s\", (Object) new int[]{1, 2, 3});' This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.", - "markdown": "Reports any calls to a variable arity method where the call has a primitive array in the variable arity parameter position (for example, `System.out.printf(\"%s\", new int[]{1, 2, 3})`). Such a primitive-array argument may be confusing, as it will be wrapped as a single-element array, rather than each individual element being boxed, as might be expected.\n\n**Example:**\n\n\n String.format(\"%s\", new int[]{1, 2, 3});\n\nAfter the quick-fix is applied:\n\n\n String.format(\"%s\", (Object) new int[]{1, 2, 3});\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5." + "text": "Reports loops which can be collapsed into a single 'List.replaceAll()' call. Example: 'for (int i = 0; i < strings.size(); i++) {\n String str = strings.get(i).toLowerCase();\n strings.set(i, str);\n }' After the quick-fix is applied: 'strings.replaceAll(String::toLowerCase);' This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8. New in 2022.1", + "markdown": "Reports loops which can be collapsed into a single `List.replaceAll()` call.\n\n**Example:**\n\n\n for (int i = 0; i < strings.size(); i++) {\n String str = strings.get(i).toLowerCase();\n strings.set(i, str);\n }\n\nAfter the quick-fix is applied:\n\n\n strings.replaceAll(String::toLowerCase);\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.\n\nNew in 2022.1" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PrimitiveArrayArgumentToVarargsMethod", + "suppressToolId": "Java8ListReplaceAll", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29014,8 +28931,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -29027,19 +28944,19 @@ ] }, { - "id": "UnnecessaryUnicodeEscape", + "id": "BigDecimalLegacyMethod", "shortDescription": { - "text": "Unnecessary unicode escape sequence" + "text": "'BigDecimal' legacy method called" }, "fullDescription": { - "text": "Reports unnecessary unicode escape sequences. For example, when the file encoding can handle the character without escaping it. Unicode control characters are not reported by this inspection (except for a line feed and a tab). Example: 'String s = \"\\u0062\";'", - "markdown": "Reports unnecessary unicode escape sequences. For example, when the file encoding can handle the character without escaping it. Unicode control characters are not reported by this inspection (except for a line feed and a tab).\n\n**Example:**\n\n String s = \"\\u0062\";\n" + "text": "Reports calls to 'BigDecimal.divide()' or 'BigDecimal.setScale()' that use integer constants to specify the rounding mode. Since JDK 1.5, consider using methods that take the 'RoundingMode' 'enum' parameter instead. Example: 'new BigDecimal(\"42\").setScale(2, BigDecimal.ROUND_FLOOR);' After the quick-fix is applied: 'new BigDecimal(\"42\").setScale(2, RoundingMode.FLOOR);'", + "markdown": "Reports calls to `BigDecimal.divide()` or `BigDecimal.setScale()` that use integer constants to specify the rounding mode. Since JDK 1.5, consider using methods that take the `RoundingMode` `enum` parameter instead.\n\n**Example:**\n\n new BigDecimal(\"42\").setScale(2, BigDecimal.ROUND_FLOOR);\n\nAfter the quick-fix is applied:\n\n new BigDecimal(\"42\").setScale(2, RoundingMode.FLOOR);\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryUnicodeEscape", + "suppressToolId": "BigDecimalLegacyMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29047,8 +28964,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -29060,19 +28977,19 @@ ] }, { - "id": "UseBulkOperation", + "id": "MissingPackageInfo", "shortDescription": { - "text": "Bulk operation can be used instead of iteration" + "text": "Missing 'package-info.java'" }, "fullDescription": { - "text": "Reports single operations inside loops that could be replaced with a bulk method. Not only are bulk methods shorter, but in some cases they may be more performant as well. Example: 'void test(Collection numbers) {\n List result = new ArrayList<>();\n for (Integer i : numbers) {\n result.add(i);\n }\n }' After the fix is applied: 'void test(Collection numbers) {\n List result = new ArrayList<>();\n result.addAll(numbers);\n }' The Use Arrays.asList() to wrap arrays option allows to report arrays, even if the bulk method requires a collection. In this case the quick-fix will automatically wrap the array in 'Arrays.asList()' call. New in 2017.1", - "markdown": "Reports single operations inside loops that could be replaced with a bulk method.\n\n\nNot only are bulk methods shorter, but in some cases they may be more performant as well.\n\n**Example:**\n\n void test(Collection numbers) {\n List result = new ArrayList<>();\n for (Integer i : numbers) {\n result.add(i);\n }\n }\n\nAfter the fix is applied:\n\n\n void test(Collection numbers) {\n List result = new ArrayList<>();\n result.addAll(numbers);\n }\n\n\nThe **Use Arrays.asList() to wrap arrays** option allows to report arrays, even if the bulk method requires a collection.\nIn this case the quick-fix will automatically wrap the array in `Arrays.asList()` call.\n\nNew in 2017.1" + "text": "Reports packages that contain classes but do not contain the 'package-info.java' or 'package.html' files and are, thus, missing the package documentation. The quick-fix creates an initial 'package-info.java' file.", + "markdown": "Reports packages that contain classes but do not contain the `package-info.java` or `package.html` files and are, thus, missing the package documentation.\n\nThe quick-fix creates an initial `package-info.java` file." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UseBulkOperation", + "suppressToolId": "MissingPackageInfo", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29080,8 +28997,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -29093,19 +29010,19 @@ ] }, { - "id": "BigDecimalEquals", + "id": "UnnecessaryConstructor", "shortDescription": { - "text": "'equals()' called on 'BigDecimal'" + "text": "Redundant no-arg constructor" }, "fullDescription": { - "text": "Reports 'equals()' calls that compare two 'java.math.BigDecimal' numbers. This is normally a mistake, as two 'java.math.BigDecimal' numbers are only equal if they are equal in both value and scale. Example: 'if (new BigDecimal(\"2.0\").equals(\n new BigDecimal(\"2.00\"))) {} // false' After the quick-fix is applied: 'if (new BigDecimal(\"2.0\").compareTo(\n new BigDecimal(\"2.00\")) == 0) {} // true'", - "markdown": "Reports `equals()` calls that compare two `java.math.BigDecimal` numbers. This is normally a mistake, as two `java.math.BigDecimal` numbers are only equal if they are equal in both value and scale.\n\n**Example:**\n\n\n if (new BigDecimal(\"2.0\").equals(\n new BigDecimal(\"2.00\"))) {} // false\n\nAfter the quick-fix is applied:\n\n\n if (new BigDecimal(\"2.0\").compareTo(\n new BigDecimal(\"2.00\")) == 0) {} // true\n" + "text": "Reports unnecessary constructors. A constructor is unnecessary if it is the only constructor of a class, has no parameters, has the same access modifier as its containing class, and does not perform any initialization except explicitly or implicitly calling the superclass constructor without arguments. Such a constructor can be safely removed as it will be generated by the compiler even if not specified. Example: 'public class Foo {\n public Foo() {}\n }' After the quick-fix is applied: 'public class Foo {}' Use the inspection settings to ignore unnecessary constructors that have an annotation.", + "markdown": "Reports unnecessary constructors.\n\n\nA constructor is unnecessary if it is the only constructor of a class, has no parameters,\nhas the same access modifier as its containing class,\nand does not perform any initialization except explicitly or implicitly calling the superclass constructor without arguments.\nSuch a constructor can be safely removed as it will be generated by the compiler even if not specified.\n\n**Example:**\n\n\n public class Foo {\n public Foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n public class Foo {}\n\n\nUse the inspection settings to ignore unnecessary constructors that have an annotation." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BigDecimalEquals", + "suppressToolId": "RedundantNoArgConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29113,8 +29030,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -29126,19 +29043,19 @@ ] }, { - "id": "AccessToNonThreadSafeStaticFieldFromInstance", + "id": "StringBufferField", "shortDescription": { - "text": "Non-thread-safe 'static' field access" + "text": "'StringBuilder' field" }, "fullDescription": { - "text": "Reports access to 'static' fields that are of a non-thread-safe type. When a 'static' field is accessed from an instance method or a non-synchronized block, multiple threads can access that field. This can lead to unspecified side effects, like exceptions and incorrect results. Example: 'class Sample {\n private static final SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");\n String method() {\n return df.format(\"\");\n }\n }' You can specify which types should be considered not thread-safe. Only fields with these exact types or initialized with these exact types are reported, because there may exist thread-safe subclasses of these types.", - "markdown": "Reports access to `static` fields that are of a non-thread-safe type.\n\n\nWhen a `static` field is accessed from an instance method or a non-synchronized block,\nmultiple threads can access that field.\nThis can lead to unspecified side effects, like exceptions and incorrect results.\n\n**Example:**\n\n\n class Sample {\n private static final SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");\n String method() {\n return df.format(\"\");\n }\n }\n\n\nYou can specify which types should be considered not thread-safe.\nOnly fields with these exact types or initialized with these exact types are reported,\nbecause there may exist thread-safe subclasses of these types." + "text": "Reports fields of type 'java.lang.StringBuffer' or 'java.lang.StringBuilder'. Such fields can grow without limit and are often the cause of memory leaks. Example: 'public class Example {\n private StringBuilder builder = new StringBuilder();\n\n }'", + "markdown": "Reports fields of type `java.lang.StringBuffer` or `java.lang.StringBuilder`. Such fields can grow without limit and are often the cause of memory leaks.\n\n**Example:**\n\n\n public class Example {\n private StringBuilder builder = new StringBuilder();\n\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AccessToNonThreadSafeStaticField", + "suppressToolId": "StringBufferField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29146,8 +29063,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -29159,19 +29076,19 @@ ] }, { - "id": "AssignmentToCatchBlockParameter", + "id": "ClassNameSameAsAncestorName", "shortDescription": { - "text": "Assignment to 'catch' block parameter" + "text": "Class name same as ancestor name" }, "fullDescription": { - "text": "Reports assignments to, 'catch' block parameters. Changing a 'catch' block parameter is very confusing and should be discouraged. The quick-fix adds a declaration of a new variable. Example: 'void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n if (ex instanceof UncheckedIOException) {\n // Warning: catch block parameter reassigned\n ex = ((UncheckedIOException) ex).getCause();\n }\n throw ex;\n }\n }' After the quick-fix is applied: 'void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n Exception unwrapped = ex;\n if (unwrapped instanceof UncheckedIOException) {\n unwrapped = ((UncheckedIOException)\n unwrapped).getCause();\n }\n throw unwrapped;\n }\n }'", - "markdown": "Reports assignments to, `catch` block parameters.\n\nChanging a `catch` block parameter is very confusing and should be discouraged.\n\nThe quick-fix adds a declaration of a new variable.\n\n**Example:**\n\n\n void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n if (ex instanceof UncheckedIOException) {\n // Warning: catch block parameter reassigned\n ex = ((UncheckedIOException) ex).getCause();\n }\n throw ex;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n Exception unwrapped = ex;\n if (unwrapped instanceof UncheckedIOException) {\n unwrapped = ((UncheckedIOException)\n unwrapped).getCause();\n }\n throw unwrapped;\n }\n }\n" + "text": "Reports classes that have the same name as one of their superclasses, while their fully qualified names remain different. Such class names may be very confusing. Example: 'package util;\n abstract class Iterable implements java.lang.Iterable {}' A quick-fix that renames such classes is available only in the editor.", + "markdown": "Reports classes that have the same name as one of their superclasses, while their fully qualified names remain different. Such class names may be very confusing.\n\n**Example:**\n\n\n package util;\n abstract class Iterable implements java.lang.Iterable {}\n\nA quick-fix that renames such classes is available only in the editor." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AssignmentToCatchBlockParameter", + "suppressToolId": "ClassNameSameAsAncestorName", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29179,8 +29096,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Naming conventions/Class", + "index": 80, "toolComponent": { "name": "QDJVM" } @@ -29192,19 +29109,19 @@ ] }, { - "id": "AbstractMethodOverridesAbstractMethod", + "id": "RedundantMethodOverride", "shortDescription": { - "text": "Abstract method overrides abstract method" + "text": "Method is identical to its super method" }, "fullDescription": { - "text": "Reports 'abstract' methods that override 'abstract' methods. Such methods don't make sense because any concrete child class will have to implement the abstract method anyway. Methods whose return types, exception declarations, annotations, or modifiers differ from the overridden method are not reported by this inspection. Configure the inspection: Use the Ignore methods with different Javadoc than their super methods option to ignore any abstract methods whose JavaDoc comment differs from their super method.", - "markdown": "Reports `abstract` methods that override `abstract` methods.\n\nSuch methods don't make sense because any concrete child class will have to implement the abstract method anyway.\n\n\nMethods whose return types, exception declarations, annotations, or modifiers differ from the overridden method are not reported by this inspection.\n\n\nConfigure the inspection:\n\n* Use the **Ignore methods with different Javadoc than their super methods** option to ignore any abstract methods whose JavaDoc comment differs from their super method." + "text": "Reports methods that are identical to their super methods. Such methods have the same signature as their super method and either have an identical body or only their body consists only of a call to the super method. These methods are redundant and can be removed. Use the first checkbox below to run the inspection for the methods that override library methods. Checking library methods may slow down the inspection. Use the second checkbox below to ignore methods that only delegate calls to their super methods.", + "markdown": "Reports methods that are identical to their super methods. Such methods have the same signature as their super method and either have an identical body or only their body consists only of a call to the super method. These methods are redundant and can be removed.\n\n\nUse the first checkbox below to run the inspection for the methods that override library methods.\nChecking library methods may slow down the inspection.\n\n\nUse the second checkbox below to ignore methods that only delegate calls to their super methods." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AbstractMethodOverridesAbstractMethod", + "suppressToolId": "RedundantMethodOverride", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29225,19 +29142,19 @@ ] }, { - "id": "LoopStatementsThatDontLoop", + "id": "ContinueStatementWithLabel", "shortDescription": { - "text": "Loop statement that does not loop" + "text": "'continue' statement with label" }, "fullDescription": { - "text": "Reports any instance of 'for', 'while', and 'do' statements whose bodies will be executed once at most. Normally, this is an indication of a bug. Use the Ignore enhanced for loops option to ignore the foreach loops. They are sometimes used to perform an action only on the first item of an iterable in a compact way. Example: 'for (String s : stringIterable) {\n doSomethingOnFirstString(s);\n break;\n }'", - "markdown": "Reports any instance of `for`, `while`, and `do` statements whose bodies will be executed once at most. Normally, this is an indication of a bug.\n\n\nUse the **Ignore enhanced for loops** option to ignore the foreach loops.\nThey are sometimes used to perform an action only on the first item of an iterable in a compact way.\n\nExample:\n\n\n for (String s : stringIterable) {\n doSomethingOnFirstString(s);\n break;\n }\n" + "text": "Reports 'continue' statements with labels. Labeled 'continue' statements complicate refactoring and can be confusing. Example: 'void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) continue outer;\n handleChar(ch);\n }\n }\n }'", + "markdown": "Reports `continue` statements with labels.\n\nLabeled `continue` statements complicate refactoring and can be confusing.\n\nExample:\n\n\n void handle(List strs) {\n outer:\n for (String s: strs) {\n for (char ch : s.toCharArray()) {\n if ('s' == ch) continue outer;\n handleChar(ch);\n }\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LoopStatementThatDoesntLoop", + "suppressToolId": "ContinueStatementWithLabel", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29246,7 +29163,7 @@ { "target": { "id": "Java/Control flow issues", - "index": 30, + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -29258,28 +29175,28 @@ ] }, { - "id": "ArrayCreationWithoutNewKeyword", + "id": "SimplifiableBooleanExpression", "shortDescription": { - "text": "Array creation without 'new' expression" + "text": "Simplifiable boolean expression" }, "fullDescription": { - "text": "Reports array initializers without 'new' array expressions and suggests adding them. Example: 'int[] a = {42}' After the quick-fix is applied: 'int[] a = new int[]{42}'", - "markdown": "Reports array initializers without `new` array expressions and suggests adding them.\n\nExample:\n\n\n int[] a = {42}\n\nAfter the quick-fix is applied:\n\n\n int[] a = new int[]{42}\n" + "text": "Reports boolean expressions that can be simplified. Example: 'void f(boolean foo, boolean bar) {\n boolean b = !(foo ^ bar);\n }' After the quick-fix is applied: 'void f(boolean foo, boolean bar) {\n boolean b = foo == bar;\n }' Example: 'void f(boolean foo, boolean bar) {\n boolean b = (foo && bar) || !foo;\n }' After the quick-fix is applied: 'void f(boolean foo, boolean bar) {\n boolean b = !foo || bar;\n }'", + "markdown": "Reports boolean expressions that can be simplified.\n\nExample:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = !(foo ^ bar);\n }\n\nAfter the quick-fix is applied:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = foo == bar;\n }\n\nExample:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = (foo && bar) || !foo;\n }\n \nAfter the quick-fix is applied:\n\n\n void f(boolean foo, boolean bar) {\n boolean b = !foo || bar;\n }\n \n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ArrayCreationWithoutNewKeyword", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "SimplifiableBooleanExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -29291,28 +29208,28 @@ ] }, { - "id": "ConfusingOctalEscape", + "id": "JavaExistingMethodCanBeUsed", "shortDescription": { - "text": "Confusing octal escape sequence" + "text": "Copy of existing static method body" }, "fullDescription": { - "text": "Reports string literals containing an octal escape sequence immediately followed by a digit. Such strings may be confusing, and are often the result of errors in escape code creation. Example: 'System.out.println(\"\\1234\"); // Octal escape sequence '\\123' immediately followed by a digit'", - "markdown": "Reports string literals containing an octal escape sequence immediately followed by a digit.\n\nSuch strings may be confusing, and are often the result of errors in escape code creation.\n\n**Example:**\n\n\n System.out.println(\"\\1234\"); // Octal escape sequence '\\123' immediately followed by a digit\n" + "text": "Reports fragments of Java code which are identical to the existing static methods suggesting to reuse these static methods. Reusing existing methods makes code shorter and more readable. Example: 'static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n \n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n List lines = Files.readAllLines(p);\n return lines.stream().map(String::trim).toList();\n }' Here, the second method is quite similar to the first one, and the first one can be reused in its implementation. After the quick-fix is applied, the result will look like this: 'static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n\n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n return readFileAndTrim(p);\n }' New in 2024.1", + "markdown": "Reports fragments of Java code which are identical to the existing static methods suggesting to reuse these static methods. Reusing existing methods makes code shorter and more readable.\n\nExample:\n\n\n static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n \n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n List lines = Files.readAllLines(p);\n return lines.stream().map(String::trim).toList();\n }\n\nHere, the second method is quite similar to the first one, and the first one can be reused in its implementation. After the quick-fix is applied, the result will look like this:\n\n\n static List readFileAndTrim(Path path) throws IOException {\n List lines = Files.readAllLines(path);\n return lines.stream().map(String::trim).toList();\n }\n\n static List readFileAndTrim(String path) throws IOException {\n Path p = Path.of(path);\n return readFileAndTrim(p);\n }\n\nNew in 2024.1" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ConfusingOctalEscapeSequence", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "JavaExistingMethodCanBeUsed", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -29324,19 +29241,19 @@ ] }, { - "id": "LambdaParameterHidingMemberVariable", + "id": "SignalWithoutCorrespondingAwait", "shortDescription": { - "text": "Lambda parameter hides field" + "text": "'signal()' without corresponding 'await()'" }, "fullDescription": { - "text": "Reports lambda parameters named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the lambda parameter when using the identically named field is intended. A quick-fix is suggested to rename the lambda parameter. Example: 'public class MyClass {\n public Object foo;\n\n void sort(List list) {\n list.sort((foo, bar) -> foo - bar);\n }\n }' Use the option to choose whether to ignore fields that are not visible from the lambda expression. For example, private fields of a superclass. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "markdown": "Reports lambda parameters named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the lambda parameter when using the identically named field is intended.\n\nA quick-fix is suggested to rename the lambda parameter.\n\n**Example:**\n\n\n public class MyClass {\n public Object foo;\n\n void sort(List list) {\n list.sort((foo, bar) -> foo - bar);\n }\n }\n\n\nUse the option to choose whether to ignore fields that are not visible from the lambda expression.\nFor example, private fields of a superclass.\n\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "text": "Reports calls to 'Condition.signal()' or 'Condition.signalAll()' for which no call to a corresponding 'Condition.await()' can be found. Only calls that target fields of the current class are reported by this inspection. Example: 'class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n isEmpty.signal(); // warning: Call to 'signal()' without corresponding 'await()'\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n // isEmpty.await();\n // ...\n }\n }'", + "markdown": "Reports calls to `Condition.signal()` or `Condition.signalAll()` for which no call to a corresponding `Condition.await()` can be found.\n\nOnly calls that target fields of the current class are reported by this inspection.\n\n**Example:**\n\n\n class Queue {\n private final Condition isEmpty = ...;\n\n void add(Object elem) {\n // ...\n isEmpty.signal(); // warning: Call to 'signal()' without corresponding 'await()'\n // ...\n }\n\n void remove(Object elem) throws InterruptedException {\n // ...\n // isEmpty.await();\n // ...\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LambdaParameterHidesMemberVariable", + "suppressToolId": "SignalWithoutCorrespondingAwait", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29344,8 +29261,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -29357,28 +29274,28 @@ ] }, { - "id": "ConstantMathCall", + "id": "FoldExpressionIntoStream", "shortDescription": { - "text": "Constant call to 'Math'" + "text": "Expression can be folded into Stream chain" }, "fullDescription": { - "text": "Reports calls to 'java.lang.Math' or 'java.lang.StrictMath' methods that can be replaced with simple compile-time constants. Example: 'double v = Math.sin(0.0);' After the quick-fix is applied: 'double v = 0.0;'", - "markdown": "Reports calls to `java.lang.Math` or `java.lang.StrictMath` methods that can be replaced with simple compile-time constants.\n\n**Example:**\n\n double v = Math.sin(0.0);\n\nAfter the quick-fix is applied:\n\n double v = 0.0;\n" + "text": "Reports expressions with a repeating pattern that could be replaced with Stream API or a 'String.join()' call. Example: 'boolean allStartWith(String a, String b, String c, String d, String prefix) {\n return a.startsWith(prefix) && b.startsWith(prefix) && c.startsWith(prefix) && d.startsWith(prefix);\n }' After the quick-fix is applied: 'boolean foo(String a, String b, String c, String d, String prefix) {\n return Stream.of(a, b, c, d).allMatch(s -> s.startsWith(prefix));\n }' Example: 'String joinAll(String a, String b, String c, String d) {\n return a + \",\" + b + \",\" + c + \",\" + d;\n }' After the quick-fix is applied: 'String joinAll(String a, String b, String c, String d) {\n return String.join(\",\", a, b, c, d);\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2018.2", + "markdown": "Reports expressions with a repeating pattern that could be replaced with *Stream API* or a `String.join()` call.\n\nExample:\n\n\n boolean allStartWith(String a, String b, String c, String d, String prefix) {\n return a.startsWith(prefix) && b.startsWith(prefix) && c.startsWith(prefix) && d.startsWith(prefix);\n }\n\nAfter the quick-fix is applied:\n\n\n boolean foo(String a, String b, String c, String d, String prefix) {\n return Stream.of(a, b, c, d).allMatch(s -> s.startsWith(prefix));\n }\n\nExample:\n\n\n String joinAll(String a, String b, String c, String d) {\n return a + \",\" + b + \",\" + c + \",\" + d;\n }\n\nAfter the quick-fix is applied:\n\n\n String joinAll(String a, String b, String c, String d) {\n return String.join(\",\", a, b, c, d);\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2018.2" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ConstantMathCall", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "FoldExpressionIntoStream", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -29390,28 +29307,28 @@ ] }, { - "id": "MissortedModifiers", + "id": "SerializableDeserializableClassInSecureContext", "shortDescription": { - "text": "Missorted modifiers" + "text": "Serializable class in secure context" }, "fullDescription": { - "text": "Reports declarations whose modifiers are not in the canonical preferred order (as stated in the Java Language Specification). Example: 'class Foo {\n native public final void foo();\n }' After the quick-fix is applied: 'class Foo {\n public final native void foo();\n }'", - "markdown": "Reports declarations whose modifiers are not in the canonical preferred order (as stated in the Java Language Specification).\n\n**Example:**\n\n\n class Foo {\n native public final void foo();\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n public final native void foo();\n }\n" + "text": "Reports classes that may be serialized or deserialized. A class may be serialized if it supports the 'Serializable' interface, and its 'readObject()' and 'writeObject()' methods are not defined to always throw an exception. Serializable classes may be dangerous in code intended for secure use. Example: 'class DeserializableClass implements Serializable { // the class doesn't contain 'writeObject()' method throwing an exception\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n}' After the quick-fix is applied: 'class DeserializableClass implements Serializable {\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n\n private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {\n throw new java.io.NotSerializableException(\"DeserializableClass\");\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. Note that it still may be more secure to add 'readObject()' and 'writeObject()' methods which always throw an exception, instead of ignoring those classes. Whether to ignore serializable anonymous classes.", + "markdown": "Reports classes that may be serialized or deserialized.\n\n\nA class may be serialized if it supports the `Serializable` interface,\nand its `readObject()` and `writeObject()` methods are not defined to always\nthrow an exception. Serializable classes may be dangerous in code intended for secure use.\n\n**Example:**\n\n\n class DeserializableClass implements Serializable { // the class doesn't contain 'writeObject()' method throwing an exception\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class DeserializableClass implements Serializable {\n private int sensitive = 736326;\n\n private void readObject(ObjectInputStream in) {\n throw new Error();\n }\n\n private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {\n throw new java.io.NotSerializableException(\"DeserializableClass\");\n }\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. Note that it still may be more secure to add `readObject()` and `writeObject()` methods which always throw an exception, instead of ignoring those classes.\n* Whether to ignore serializable anonymous classes." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MissortedModifiers", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "SerializableDeserializableClassInSecureContext", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -29423,19 +29340,19 @@ ] }, { - "id": "TransientFieldInNonSerializableClass", + "id": "JavaModuleNaming", "shortDescription": { - "text": "Transient field in non-serializable class" + "text": "Java module name contradicts the convention" }, "fullDescription": { - "text": "Reports 'transient' fields in classes that do not implement 'java.io.Serializable'. Example: 'public class NonSerializableClass {\n private transient String password;\n }' After the quick-fix is applied: 'public class NonSerializableClass {\n private String password;\n }'", - "markdown": "Reports `transient` fields in classes that do not implement `java.io.Serializable`.\n\n**Example:**\n\n\n public class NonSerializableClass {\n private transient String password;\n }\n\nAfter the quick-fix is applied:\n\n\n public class NonSerializableClass {\n private String password;\n }\n" + "text": "Reports cases when a module name contradicts Java Platform Module System recommendations. One of the recommendations is to avoid using digits at the end of module names. Example: 'module foo1.bar2 {}'", + "markdown": "Reports cases when a module name contradicts Java Platform Module System recommendations.\n\nOne of the [recommendations](http://mail.openjdk.org/pipermail/jpms-spec-experts/2017-March/000659.html)\nis to avoid using digits at the end of module names.\n\n**Example:**\n\n\n module foo1.bar2 {}\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "TransientFieldInNonSerializableClass", + "suppressToolId": "JavaModuleNaming", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29443,8 +29360,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -29456,19 +29373,19 @@ ] }, { - "id": "SlowListContainsAll", + "id": "UnaryPlus", "shortDescription": { - "text": "Call to 'list.containsAll(collection)' may have poor performance" + "text": "Unary plus" }, "fullDescription": { - "text": "Reports calls to 'containsAll()' on 'java.util.List'. The time complexity of this method call is O(n·m), where n is the number of elements in the list on which the method is called, and m is the number of elements in the collection passed to the method as a parameter. When the list is large, this can be an expensive operation. The quick-fix wraps the list in 'new java.util.HashSet<>()' since the time required to create 'java.util.HashSet' from 'java.util.List' and execute 'containsAll()' on 'java.util.HashSet' is O(n+m). Example: 'public boolean check(List list, Collection collection) {\n // O(n·m) complexity\n return list.containsAll(collection);\n }' After the quick-fix is applied: 'public boolean check(List list, Collection collection) {\n // O(n+m) complexity\n return new HashSet<>(list).containsAll(collection);\n }' New in 2022.1", - "markdown": "Reports calls to `containsAll()` on `java.util.List`.\n\n\nThe time complexity of this method call is O(n·m), where n is the number of elements in the list on which\nthe method is called, and m is the number of elements in the collection passed to the method as a parameter.\nWhen the list is large, this can be an expensive operation.\n\n\nThe quick-fix wraps the list in `new java.util.HashSet<>()` since the time required to create\n`java.util.HashSet` from `java.util.List` and execute `containsAll()` on\n`java.util.HashSet` is O(n+m).\n\n**Example:**\n\n public boolean check(List list, Collection collection) {\n // O(n·m) complexity\n return list.containsAll(collection);\n }\n\nAfter the quick-fix is applied:\n\n public boolean check(List list, Collection collection) {\n // O(n+m) complexity\n return new HashSet<>(list).containsAll(collection);\n }\n\nNew in 2022.1" + "text": "Reports usages of the '+' unary operator. The unary plus is usually a null operation, and its presence might represent a coding error. For example, in a combination with the increment operator (like in '+++') or with the equal operator (like in '=+'). Example: 'void unaryPlus(int i) {\n int x = + +i;\n }' The following quick fixes are suggested: Remove '+' operators before the 'i' variable: 'void unaryPlus(int i) {\n int x = i;\n }' Replace '+' operators with the prefix increment operator: 'void unaryPlus(int i) {\n int x = ++i;\n }' Use the checkbox below to report unary pluses that are used together with a binary or another unary expression. It means the inspection will not report situations when a unary plus expression is used in array initializer expressions or as a method argument.", + "markdown": "Reports usages of the `+` unary operator. The unary plus is usually a null operation, and its presence might represent a coding error. For example, in a combination with the increment operator (like in `+++`) or with the equal operator (like in `=+`).\n\n**Example:**\n\n\n void unaryPlus(int i) {\n int x = + +i;\n }\n\nThe following quick fixes are suggested:\n\n* Remove `+` operators before the `i` variable:\n\n\n void unaryPlus(int i) {\n int x = i;\n }\n\n* Replace `+` operators with the prefix increment operator:\n\n\n void unaryPlus(int i) {\n int x = ++i;\n }\n\n\nUse the checkbox below to report unary pluses that are used together with a binary or another unary expression.\nIt means the inspection will not report situations when a unary plus expression is used in array\ninitializer expressions or as a method argument." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SlowListContainsAll", + "suppressToolId": "UnaryPlus", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29476,8 +29393,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -29489,19 +29406,19 @@ ] }, { - "id": "ExceptionPackage", + "id": "ConstructorCount", "shortDescription": { - "text": "Exception package" + "text": "Class with too many constructors" }, "fullDescription": { - "text": "Reports packages that only contain classes that extend 'java.lang.Throwable', either directly or indirectly. Although exceptions usually don't depend on other classes for their implementation, they are normally not used separately. It is often a better design to locate exceptions in the same package as the classes that use them. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", - "markdown": "Reports packages that only contain classes that extend `java.lang.Throwable`, either directly or indirectly.\n\nAlthough exceptions usually don't depend on other classes for their implementation, they are normally not used separately.\nIt is often a better design to locate exceptions in the same package as the classes that use them.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor." + "text": "Reports classes whose number of constructors exceeds the specified maximum. Classes with too many constructors are prone to initialization errors, and often modeling such a class as multiple subclasses is preferable. Configure the inspection: Use the Constructor count limit field to specify the maximum allowed number of constructors in a class. Use the Ignore deprecated constructors option to avoid adding deprecated constructors to the total count.", + "markdown": "Reports classes whose number of constructors exceeds the specified maximum.\n\nClasses with too many constructors are prone to initialization errors, and often modeling such a class as multiple subclasses is preferable.\n\nConfigure the inspection:\n\n* Use the **Constructor count limit** field to specify the maximum allowed number of constructors in a class.\n* Use the **Ignore deprecated constructors** option to avoid adding deprecated constructors to the total count." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ExceptionPackage", + "suppressToolId": "ClassWithTooManyConstructors", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29509,8 +29426,8 @@ "relationships": [ { "target": { - "id": "Java/Packaging issues", - "index": 44, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -29522,19 +29439,19 @@ ] }, { - "id": "TypeParameterExtendsObject", + "id": "IncrementDecrementUsedAsExpression", "shortDescription": { - "text": "Type parameter explicitly extends 'Object'" + "text": "Result of '++' or '--' used" }, "fullDescription": { - "text": "Reports type parameters and wildcard type arguments that are explicitly declared to extend 'java.lang.Object'. Such 'extends' clauses are redundant as 'java.lang.Object' is a supertype for all classes. Example: 'class ClassA {}' If you need to preserve the 'extends Object' clause because of annotations, disable the Ignore when java.lang.Object is annotated option. This might be useful, for example, when you use a nullness analyzer, and the 'extends Object' clause holds a '@Nullable'/'@NotNull' annotation. Example: 'class MyClass {}'", - "markdown": "Reports type parameters and wildcard type arguments that are explicitly declared to extend `java.lang.Object`.\n\nSuch 'extends' clauses are redundant as `java.lang.Object` is a supertype for all classes.\n\n**Example:**\n\n class ClassA {}\n\n\nIf you need to preserve the 'extends Object' clause because of annotations, disable the\n**Ignore when java.lang.Object is annotated** option.\nThis might be useful, for example, when you use a nullness analyzer, and the 'extends Object' clause\nholds a `@Nullable`/`@NotNull` annotation.\n\n**Example:**\n\n class MyClass {}\n" + "text": "Reports increment or decrement 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. The quick-fix extracts the increment or decrement operation to a separate expression statement. Example: 'int i = 10;\n while (i-- > 0) {\n System.out.println(i);\n }' After the quick-fix is applied: 'int i = 10;\n while (i > 0) {\n i--;\n System.out.println(i);\n }\n i--;'", + "markdown": "Reports increment or decrement 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.\n\nThe quick-fix extracts the increment or decrement operation to a separate expression statement.\n\n**Example:**\n\n\n int i = 10;\n while (i-- > 0) {\n System.out.println(i);\n }\n\nAfter the quick-fix is applied:\n\n\n int i = 10;\n while (i > 0) {\n i--;\n System.out.println(i);\n }\n i--;\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "TypeParameterExplicitlyExtendsObject", + "suppressToolId": "ValueOfIncrementOrDecrementUsed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29542,8 +29459,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -29555,19 +29472,19 @@ ] }, { - "id": "StringConcatenationInsideStringBufferAppend", + "id": "MethodOverloadsParentMethod", "shortDescription": { - "text": "String concatenation as argument to 'StringBuilder.append()' call" + "text": "Possibly unintended overload of method from superclass" }, "fullDescription": { - "text": "Reports 'String' concatenation used as the argument to 'StringBuffer.append()', 'StringBuilder.append()' or 'Appendable.append()'. Such calls may profitably be turned into chained append calls on the existing 'StringBuffer/Builder/Appendable' saving the cost of an extra 'StringBuffer/Builder' allocation. This inspection ignores compile-time evaluated 'String' concatenations, in which case the conversion would only worsen performance. Example: 'void bar(StringBuilder builder, String name) {\n builder.append(\"Hello,\" + name); //warning\n builder.append(\"Hello,\" + \"world\"); //no warning\n }'", - "markdown": "Reports `String` concatenation used as the argument to `StringBuffer.append()`, `StringBuilder.append()` or `Appendable.append()`.\n\n\nSuch calls may profitably be turned into chained append calls on the existing `StringBuffer/Builder/Appendable`\nsaving the cost of an extra `StringBuffer/Builder` allocation.\nThis inspection ignores compile-time evaluated `String` concatenations, in which case the conversion would only\nworsen performance.\n\n**Example:**\n\n\n void bar(StringBuilder builder, String name) {\n builder.append(\"Hello,\" + name); //warning\n builder.append(\"Hello,\" + \"world\"); //no warning\n }\n" + "text": "Reports instance methods with the same name and the same number of parameters as a method in a superclass, but where at least one of the parameters is of a different incompatible type. In this case, the method in a subclass will be overloading the method from the superclass instead of overriding it. If it is unintended, it may result in latent bugs. Example: 'public class Foo {\n void foo(int x) {}\n }\n\n public class Bar extends Foo {\n void foo(Number x) {} // Method 'foo()' overloads a compatible method of a superclass,\n // when overriding might have been intended\n }' Use the option to choose whether the inspection should also report cases where parameter types are not compatible.", + "markdown": "Reports instance methods with the same name and the same number of parameters as a method in a superclass, but where at least one of the parameters is of a different incompatible type.\n\n\nIn this case, the method in a subclass will be overloading the method from the superclass\ninstead of overriding it. If it is unintended, it may result in latent bugs.\n\n**Example:**\n\n\n public class Foo {\n void foo(int x) {}\n }\n\n public class Bar extends Foo {\n void foo(Number x) {} // Method 'foo()' overloads a compatible method of a superclass,\n // when overriding might have been intended\n }\n\n\nUse the option to choose whether the inspection should also report cases where parameter types are not compatible." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StringConcatenationInsideStringBufferAppend", + "suppressToolId": "MethodOverloadsMethodOfSuperclass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29575,8 +29492,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -29588,19 +29505,19 @@ ] }, { - "id": "FeatureEnvy", + "id": "DisjointPackage", "shortDescription": { - "text": "Feature envy" + "text": "Package with disjoint dependency graph" }, "fullDescription": { - "text": "Reports the Feature Envy code smell. The warning is thrown when a method calls methods on another class three or more times. Calls to library classes, parent classes, contained or containing classes are not counted by this inspection. Feature envy is often an indication of the fact that this functionality is located in a wrong class. Example: 'class JobManager {\n // Warning: this method calls three methods\n // of the Job class\n // It would be better to move this chain of\n // calls to the Job class itself.\n void performJob(Job job) {\n job.beforeStart();\n job.process();\n job.afterProcessing();\n }\n }'", - "markdown": "Reports the *Feature Envy* code smell. The warning is thrown when a method calls methods on another class three or more times. Calls to library classes, parent classes, contained or containing classes are not counted by this inspection. Feature envy is often an indication of the fact that this functionality is located in a wrong class.\n\nExample:\n\n\n class JobManager {\n // Warning: this method calls three methods\n // of the Job class\n // It would be better to move this chain of\n // calls to the Job class itself.\n void performJob(Job job) {\n job.beforeStart();\n job.process();\n job.afterProcessing();\n }\n }\n" + "text": "Reports packages whose classes can be separated into mutually independent subsets. Such disjoint packages indicate ad-hoc packaging or a lack of conceptual cohesion. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", + "markdown": "Reports packages whose classes can be separated into mutually independent subsets.\n\nSuch disjoint packages indicate ad-hoc packaging or a lack of conceptual cohesion.\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": "FeatureEnvy", + "suppressToolId": "DisjointPackage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29608,8 +29525,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Packaging issues", + "index": 46, "toolComponent": { "name": "QDJVM" } @@ -29621,19 +29538,19 @@ ] }, { - "id": "BoxingBoxedValue", + "id": "MethodMayBeSynchronized", "shortDescription": { - "text": "Boxing of already boxed value" + "text": "Method with single 'synchronized' block can be replaced with 'synchronized' method" }, "fullDescription": { - "text": "Reports boxing of already boxed values. This is a redundant operation since any boxed value will first be auto-unboxed before boxing the value again. If done inside an inner loop, such code may cause performance problems. Example: 'Integer value = 1;\n method(Integer.valueOf(value));' After the quick fix is applied: 'Integer value = 1;\n method(value);'", - "markdown": "Reports boxing of already boxed values.\n\n\nThis is a redundant\noperation since any boxed value will first be auto-unboxed before boxing the\nvalue again. If done inside an inner loop, such code may cause performance\nproblems.\n\n**Example:**\n\n\n Integer value = 1;\n method(Integer.valueOf(value));\n\nAfter the quick fix is applied:\n\n\n Integer value = 1;\n method(value);\n" + "text": "Reports methods whose body contains a single 'synchronized' statement. A lock expression for this 'synchronized' statement must be equal to 'this' for instance methods or '[ClassName].class' for static methods. To improve readability of such methods, you can remove the 'synchronized' wrapper and mark the method as 'synchronized'. Example: 'public int generateInt(int x) {\n synchronized (this) {\n return 1;\n }\n }' After the quick-fix is applied: 'public synchronized int generateInt(int x) {\n return 1;\n }'", + "markdown": "Reports methods whose body contains a single `synchronized` statement. A lock expression for this `synchronized` statement must be equal to `this` for instance methods or `[ClassName].class` for static methods.\n\n\nTo improve readability of such methods,\nyou can remove the `synchronized` wrapper and mark the method as `synchronized`.\n\n**Example:**\n\n\n public int generateInt(int x) {\n synchronized (this) {\n return 1;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public synchronized int generateInt(int x) {\n return 1;\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BoxingBoxedValue", + "suppressToolId": "MethodMayBeSynchronized", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29641,8 +29558,8 @@ "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -29654,19 +29571,19 @@ ] }, { - "id": "RedundantCollectionOperation", + "id": "UpperCaseFieldNameNotConstant", "shortDescription": { - "text": "Redundant 'Collection' operation" + "text": "Non-constant field with upper-case name" }, "fullDescription": { - "text": "Reports unnecessarily complex collection operations which have simpler alternatives. Example: 'void f(String[] array, Collection collection) {\n String[] strings = Arrays.asList(array).subList(0, 10).toArray(new String[0]);\n boolean contains = collection.containsAll(Collections.singletonList(\"x\"));\n }' After the quick-fix is applied: 'void f(String[] array, Collection collection) {\n String[] strings = Arrays.copyOf(array, 10);\n boolean contains = collection.contains(\"x\");\n }' New in 2018.1", - "markdown": "Reports unnecessarily complex collection operations which have simpler alternatives.\n\nExample:\n\n\n void f(String[] array, Collection collection) {\n String[] strings = Arrays.asList(array).subList(0, 10).toArray(new String[0]);\n boolean contains = collection.containsAll(Collections.singletonList(\"x\"));\n }\n\nAfter the quick-fix is applied:\n\n\n void f(String[] array, Collection collection) {\n String[] strings = Arrays.copyOf(array, 10);\n boolean contains = collection.contains(\"x\");\n }\n\nNew in 2018.1" + "text": "Reports non-'static' non-'final' fields whose names are all in upper case. Such fields may cause confusion by breaking a common naming convention and are often used by mistake. Example: 'public static int THE_ANSWER = 42; //a warning here: final modifier is missing' A quick-fix that renames such fields is available only in the editor.", + "markdown": "Reports non-`static` non-`final` fields whose names are all in upper case.\n\nSuch fields may cause confusion by breaking a common naming convention and\nare often used by mistake.\n\n**Example:**\n\n\n public static int THE_ANSWER = 42; //a warning here: final modifier is missing\n\nA quick-fix that renames such fields is available only in the editor." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantCollectionOperation", + "suppressToolId": "NonConstantFieldWithUpperCaseName", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29674,8 +29591,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -29687,28 +29604,28 @@ ] }, { - "id": "OverriddenMethodCallDuringObjectConstruction", + "id": "Convert2streamapi", "shortDescription": { - "text": "Overridden method called during object construction" + "text": "Loop can be collapsed with Stream API" }, "fullDescription": { - "text": "Reports any calls to overridden methods of the current class during object construction. This happens if an object construction is inside: A constructor A non-static instance initializer A non-static field initializer 'clone()' 'readObject()' 'readObjectNoData()' Such calls may result in subtle bugs, as the object is not guaranteed to be initialized before the method call occurs. Example: 'abstract class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n\n @Override\n void someMethod() { }\n }' This inspection shares its functionality with: The Abstract method called during object construction inspection The Overridable method called during object construction inspection Only one inspection should be enabled at the same time to prevent duplicate warnings.", - "markdown": "Reports any calls to overridden methods of the current class during object construction. This happens if an object construction is inside:\n\n* A constructor\n* A non-static instance initializer\n* A non-static field initializer\n* `clone()`\n* `readObject()`\n* `readObjectNoData()`\n\nSuch calls may result in subtle bugs, as the object is not guaranteed to be initialized before the method call occurs.\n\nExample:\n\n\n abstract class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n\n @Override\n void someMethod() { }\n }\n\nThis inspection shares its functionality with:\n\n* The **Abstract method called during object construction** inspection\n* The **Overridable method called during object construction** inspection\n\nOnly one inspection should be enabled at the same time to prevent duplicate warnings." + "text": "Reports loops which can be replaced with stream API calls using lambda expressions. Such a replacement changes the style from imperative to more functional and makes the code more compact. Example: 'boolean check(List data) {\n for (String e : data) {\n String trimmed = e.trim();\n if (!trimmed.startsWith(\"xyz\")) {\n return false;\n }\n }\n return true;\n }' After the quick-fix is applied: 'boolean check(List data) {\n return data.stream().map(String::trim).allMatch(trimmed -> trimmed.startsWith(\"xyz\"));\n }' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports loops which can be replaced with stream API calls using lambda expressions.\n\nSuch a replacement changes the style from imperative to more functional and makes the code more compact.\n\nExample:\n\n\n boolean check(List data) {\n for (String e : data) {\n String trimmed = e.trim();\n if (!trimmed.startsWith(\"xyz\")) {\n return false;\n }\n }\n return true;\n }\n\nAfter the quick-fix is applied:\n\n\n boolean check(List data) {\n return data.stream().map(String::trim).allMatch(trimmed -> trimmed.startsWith(\"xyz\"));\n }\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "OverriddenMethodCallDuringObjectConstruction", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "Convert2streamapi", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -29720,19 +29637,19 @@ ] }, { - "id": "AbstractClassWithoutAbstractMethods", + "id": "SerialPersistentFieldsWithWrongSignature", "shortDescription": { - "text": "Abstract class without 'abstract' methods" + "text": "'serialPersistentFields' field not declared 'private static final ObjectStreamField[]'" }, "fullDescription": { - "text": "Reports 'abstract' classes that have no 'abstract' methods. In most cases it does not make sense to have an 'abstract' class without any 'abstract' methods, and the 'abstract' modifier can be removed from the class. If the class was declared 'abstract' to prevent instantiation, it is often a better option to use a 'private' constructor to prevent instantiation instead. Example: 'abstract class Example {\n public String getName() {\n return \"IntelliJ IDEA\";\n }\n }' Use the option to ignore utility classes.", - "markdown": "Reports `abstract` classes that have no `abstract` methods. In most cases it does not make sense to have an `abstract` class without any `abstract` methods, and the `abstract` modifier can be removed from the class. If the class was declared `abstract` to prevent instantiation, it is often a better option to use a `private` constructor to prevent instantiation instead.\n\n**Example:**\n\n\n abstract class Example {\n public String getName() {\n return \"IntelliJ IDEA\";\n }\n }\n\nUse the option to ignore utility classes." + "text": "Reports 'Serializable' classes whose 'serialPersistentFields' field is not declared as 'private static final ObjectStreamField[]'. If a 'serialPersistentFields' field is not declared with those modifiers, the serialization behavior will be as if the field was not declared at all. Example: 'class List implements Serializable {\n private List next;\n\n ObjectStreamField[] serialPersistentFields = {new ObjectStreamField(\"next\", List.class)};\n\n }'", + "markdown": "Reports `Serializable` classes whose `serialPersistentFields` field is not declared as `private static final ObjectStreamField[]`.\n\n\nIf a `serialPersistentFields` field is not declared with those modifiers,\nthe serialization behavior will be as if the field was not declared at all.\n\n**Example:**\n\n\n class List implements Serializable {\n private List next;\n\n ObjectStreamField[] serialPersistentFields = {new ObjectStreamField(\"next\", List.class)};\n\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AbstractClassWithoutAbstractMethods", + "suppressToolId": "SerialPersistentFieldsWithWrongSignature", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29740,8 +29657,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -29753,19 +29670,22 @@ ] }, { - "id": "CastThatLosesPrecision", + "id": "ComparatorResultComparison", "shortDescription": { - "text": "Numeric cast that loses precision" + "text": "Suspicious usage of compare method" }, "fullDescription": { - "text": "Reports cast operations between primitive numeric types that may result in precision loss. Such casts are not necessarily a problem but may result in difficult to trace bugs if the loss of precision is unexpected. Example: 'int a = 420;\n byte b = (byte) a;' Use the Ignore casts from int to char option to ignore casts from 'int' to 'char'. This type of cast is often used when implementing I/O operations because the 'read()' method of the 'java.io.Reader' class returns an 'int'. Use the Ignore casts from int 128-255 to byte option to ignore casts of constant values (128-255) from 'int' to 'byte'. Such values will overflow to negative numbers that still fit inside a byte.", - "markdown": "Reports cast operations between primitive numeric types that may result in precision loss.\n\nSuch casts are not necessarily a problem but may result in difficult to\ntrace bugs if the loss of precision is unexpected.\n\n**Example:**\n\n\n int a = 420;\n byte b = (byte) a;\n\nUse the **Ignore casts from int to char** option to ignore casts from `int` to `char`.\nThis type of cast is often used when implementing I/O operations because the `read()` method of the\n`java.io.Reader` class returns an `int`.\n\nUse the **Ignore casts from int 128-255 to byte** option to ignore casts of constant values (128-255) from `int` to\n`byte`.\nSuch values will overflow to negative numbers that still fit inside a byte." + "text": "Reports comparisons of the result of 'Comparator.compare()' or 'Comparable.compareTo()' calls with non-zero constants. By contract, these methods can return any integer (not just -1, 0 or 1), so comparing against particular numbers is bad practice. Some widely used comparison methods (e.g. 'String.compareTo()') actually return values outside the [-1..1] range, and such a comparison may cause incorrect program behavior. Example: 'void validate(String s1, String s2) {\n // Comparing to 1 is incorrect\n if (s1.compareTo(s2) == 1) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }' After the quick-fix is applied: 'void validate(String s1, String s2) {\n if (s1.compareTo(s2) > 0) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }' New in 2017.2", + "markdown": "Reports comparisons of the result of `Comparator.compare()` or `Comparable.compareTo()` calls with non-zero constants. By contract, these methods can return any integer (not just -1, 0 or 1), so comparing against particular numbers is bad practice. Some widely used comparison methods (e.g. `String.compareTo()`) actually return values outside the \\[-1..1\\] range, and such a comparison may cause incorrect program behavior.\n\nExample:\n\n\n void validate(String s1, String s2) {\n // Comparing to 1 is incorrect\n if (s1.compareTo(s2) == 1) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void validate(String s1, String s2) {\n if (s1.compareTo(s2) > 0) {\n throw new IllegalArgumentException(\"Incorrect order\");\n }\n }\n\nNew in 2017.2" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NumericCastThatLosesPrecision", + "suppressToolId": "ComparatorResultComparison", + "cweIds": [ + 253 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29773,8 +29693,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues/Cast", - "index": 139, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -29786,19 +29706,19 @@ ] }, { - "id": "SameReturnValue", + "id": "ListIndexOfReplaceableByContains", "shortDescription": { - "text": "Method always returns the same value" + "text": "'List.indexOf()' expression can be replaced with 'contains()'" }, "fullDescription": { - "text": "Reports methods and method hierarchies that always return the same constant. The inspection works differently in batch-mode (from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name) and on-the-fly in the editor: In batch-mode, the inspection reports methods and method hierarchies that always return the same constant. In the editor, the inspection only reports methods that have more than one 'return' statement, do not have super methods, and cannot be overridden. If a method overrides or implements a method, a contract may require it to return a specific constant, but at the same time, we may want to have several exit points. If a method can be overridden, it is possible that a different value will be returned in subclasses. Example: 'class X {\n // Warn only in batch-mode:\n int xxx() { // Method 'xxx()' and all its overriding methods always return '0'\n return 0;\n }\n }\n\n class Y extends X {\n @Override\n int xxx() {\n return 0;\n }\n\n // Warn only in batch-mode:\n int yyy() { // Method 'yyy()' always returns '0'\n return 0;\n }\n\n // Warn both in batch-mode and on-the-fly:\n final int zzz(boolean flag) { // Method 'zzz()' always returns '0'\n if (Math.random() > 0.5) {\n return 0;\n }\n return 0;\n }\n }'", - "markdown": "Reports methods and method hierarchies that always return the same constant.\n\n\nThe inspection works differently in batch-mode\n(from **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name**)\nand on-the-fly in the editor:\n\n* In batch-mode, the inspection reports methods and method hierarchies that always return the same constant.\n* In the editor, the inspection only reports methods that have more than one `return` statement, do not have super methods, and cannot be overridden. If a method overrides or implements a method, a contract may require it to return a specific constant, but at the same time, we may want to have several exit points. If a method can be overridden, it is possible that a different value will be returned in subclasses.\n\n**Example:**\n\n\n class X {\n // Warn only in batch-mode:\n int xxx() { // Method 'xxx()' and all its overriding methods always return '0'\n return 0;\n }\n }\n\n class Y extends X {\n @Override\n int xxx() {\n return 0;\n }\n\n // Warn only in batch-mode:\n int yyy() { // Method 'yyy()' always returns '0'\n return 0;\n }\n\n // Warn both in batch-mode and on-the-fly:\n final int zzz(boolean flag) { // Method 'zzz()' always returns '0'\n if (Math.random() > 0.5) {\n return 0;\n }\n return 0;\n }\n }\n" + "text": "Reports any 'List.indexOf()' expressions that can be replaced with the 'List.contains()' method. Example: 'boolean hasEmptyString(List list) {\n // Warning: can be simplified\n return list.indexOf(\"\") >= 0;\n }' The provided quick-fix replaces the 'indexOf' call with the 'contains' call: 'boolean hasEmptyString(List list) {\n // Quick-fix is applied\n return list.contains(\"\");\n }'", + "markdown": "Reports any `List.indexOf()` expressions that can be replaced with the `List.contains()` method.\n\nExample:\n\n\n boolean hasEmptyString(List list) {\n // Warning: can be simplified\n return list.indexOf(\"\") >= 0;\n }\n\nThe provided quick-fix replaces the `indexOf` call with the `contains` call:\n\n\n boolean hasEmptyString(List list) {\n // Quick-fix is applied\n return list.contains(\"\");\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SameReturnValue", + "suppressToolId": "ListIndexOfReplaceableByContains", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29806,8 +29726,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -29819,28 +29739,28 @@ ] }, { - "id": "StringBufferMustHaveInitialCapacity", + "id": "NonStrictComparisonCanBeEquality", "shortDescription": { - "text": "'StringBuilder' without initial capacity" + "text": "Non-strict inequality '>=' or '<=' can be replaced with '=='" }, "fullDescription": { - "text": "Reports attempts to instantiate a new 'StringBuffer' or 'StringBuilder' object without specifying its initial capacity. If no initial capacity is specified, a default capacity is used, which will rarely be optimal. Failing to specify the initial capacity for 'StringBuffer' may result in performance issues if space needs to be reallocated and memory copied when the initial capacity is exceeded. Example: '// Capacity is not specified\n var sb = new StringBuilder();'", - "markdown": "Reports attempts to instantiate a new `StringBuffer` or `StringBuilder` object without specifying its initial capacity.\n\n\nIf no initial capacity is specified, a default capacity is used, which will rarely be optimal.\nFailing to specify the initial capacity for `StringBuffer` may result\nin performance issues if space needs to be reallocated and memory copied\nwhen the initial capacity is exceeded.\n\nExample:\n\n\n // Capacity is not specified\n var sb = new StringBuilder();\n" + "text": "Reports inequality conditions that, according to data flow analysis, can be satisfied only for a single operand value. Such conditions could be replaced with equality conditions to make the code clearer. Example: 'if (x >= 10) {\n ...\n if (x <= 10) { // can be replaced with 'x == 10'\n }\n }' New in 2022.2", + "markdown": "Reports inequality conditions that, according to data flow analysis, can be satisfied only for a single operand value. Such conditions could be replaced with equality conditions to make the code clearer.\n\nExample:\n\n\n if (x >= 10) {\n ...\n if (x <= 10) { // can be replaced with 'x == 10'\n }\n }\n\nNew in 2022.2" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "StringBufferWithoutInitialCapacity", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "NonStrictComparisonCanBeEquality", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Performance", - "index": 10, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -29852,28 +29772,28 @@ ] }, { - "id": "ThrowablePrintStackTrace", + "id": "UnnecessaryParentheses", "shortDescription": { - "text": "Call to 'printStackTrace()'" + "text": "Unnecessary parentheses" }, "fullDescription": { - "text": "Reports calls to 'Throwable.printStackTrace()' without arguments. Such statements are often used for temporary debugging and should be either removed from the production code or replaced with a more robust logging facility.", - "markdown": "Reports calls to `Throwable.printStackTrace()` without arguments.\n\nSuch statements are often used for temporary debugging and should be either removed from the production code\nor replaced with a more robust logging facility." + "text": "Reports any instance of unnecessary parentheses. Parentheses are considered unnecessary if the evaluation order of an expression remains unchanged after you remove the parentheses. Example: 'int n = 3 + (9 * 8);' After quick-fix is applied: 'int n = 3 + 9 * 8;' Configure the inspection: Use the Ignore clarifying parentheses option to ignore parentheses that help clarify a binary expression. Parentheses are clarifying if the parenthesized expression is an 'instanceof' expression that is a part of a larger expression or has a different operator than the parent expression. Use the Ignore parentheses around the condition of conditional expressions option to ignore any parentheses around the condition of conditional expressions. Some coding standards specify that all such conditions must be surrounded by parentheses. Use the Ignore parentheses around single no formal type lambda parameter option to ignore parentheses around a single lambda parameter within a lambda expression.", + "markdown": "Reports any instance of unnecessary parentheses.\n\nParentheses are considered unnecessary if the evaluation order of an expression remains\nunchanged after you remove the parentheses.\n\nExample:\n\n\n int n = 3 + (9 * 8);\n\nAfter quick-fix is applied:\n\n\n int n = 3 + 9 * 8;\n\nConfigure the inspection:\n\n* Use the **Ignore clarifying parentheses** option to ignore parentheses that help clarify a binary expression. Parentheses are clarifying if the parenthesized expression is an `instanceof` expression that is a part of a larger expression or has a different operator than the parent expression.\n* Use the **Ignore parentheses around the condition of conditional expressions** option to ignore any parentheses around the condition of conditional expressions. Some coding standards specify that all such conditions must be surrounded by parentheses.\n* Use the **Ignore parentheses around single no formal type lambda parameter** option to ignore parentheses around a single lambda parameter within a lambda expression." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "CallToPrintStackTrace", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UnnecessaryParentheses", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -29885,19 +29805,22 @@ ] }, { - "id": "ThreeNegationsPerMethod", + "id": "SuspiciousToArrayCall", "shortDescription": { - "text": "Method with more than three negations" + "text": "Suspicious 'Collection.toArray()' call" }, "fullDescription": { - "text": "Reports methods with three or more negations. Such methods may be confusing. Example: 'void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (!flag && !flag2) {\n if (a != b) {\n doOther();\n }\n }\n }' Without negations, the method becomes easier to understand: 'void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (flag1 || flag2 || a == b) return;\n doOther();\n }' Configure the inspection: Use the Ignore negations in 'equals()' methods option to disable the inspection within 'equals()' methods. Use the Ignore negations in 'assert' statements to disable the inspection within 'assert' statements.", - "markdown": "Reports methods with three or more negations. Such methods may be confusing.\n\n**Example:**\n\n\n void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (!flag && !flag2) {\n if (a != b) {\n doOther();\n }\n }\n }\n\nWithout negations, the method becomes easier to understand:\n\n\n void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (flag1 || flag2 || a == b) return;\n doOther();\n }\n\nConfigure the inspection:\n\n* Use the **Ignore negations in 'equals()' methods** option to disable the inspection within `equals()` methods.\n* Use the **Ignore negations in 'assert' statements** to disable the inspection within `assert` statements." + "text": "Reports suspicious calls to 'Collection.toArray()'. The following types of calls are considered suspicious: when the type of the array argument is not the same as the array type to which the result is casted. when the type of the array argument does not match the type parameter in the collection declaration. Example: 'void m1(List list) {\n Number[] ns = (Number[]) list.toArray(new String[0]);\n}\n\nvoid m2(List list) {\n Number[] ns = list.toArray(new String[0]);\n}'", + "markdown": "Reports suspicious calls to `Collection.toArray()`.\n\nThe following types of calls are considered suspicious:\n\n* when the type of the array argument is not the same as the array type to which the result is casted.\n* when the type of the array argument does not match the type parameter in the collection declaration.\n\n**Example:**\n\n\n void m1(List list) {\n Number[] ns = (Number[]) list.toArray(new String[0]);\n }\n\n void m2(List list) {\n Number[] ns = list.toArray(new String[0]);\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MethodWithMoreThanThreeNegations", + "suppressToolId": "SuspiciousToArrayCall", + "cweIds": [ + 704 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29905,8 +29828,8 @@ "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -29918,19 +29841,19 @@ ] }, { - "id": "ThreadWithDefaultRunMethod", + "id": "StringToUpperWithoutLocale", "shortDescription": { - "text": "Instantiating a 'Thread' with default 'run()' method" + "text": "Call to 'String.toUpperCase()' or 'toLowerCase()' without locale" }, "fullDescription": { - "text": "Reports instantiations of 'Thread' or an inheritor without specifying a 'Runnable' parameter or overriding the 'run()' method. Such threads do nothing useful. Example: 'new Thread().start();'", - "markdown": "Reports instantiations of `Thread` or an inheritor without specifying a `Runnable` parameter or overriding the `run()` method. Such threads do nothing useful.\n\n**Example:**\n\n\n new Thread().start();\n" + "text": "Reports 'toUpperCase()' or 'toLowerCase()' calls on 'String' objects that do not specify a 'java.util.Locale'. In these cases the default system locale is used, which can cause problems in an internationalized environment. For example the code '\"i\".toUpperCase().equals(\"I\")' returns 'false' in the Turkish and Azerbaijani locales, where the dotted and dotless 'i' are separate letters. Calling 'toUpperCase()' on an English string containing an 'i', when running in a Turkish locale, will return incorrect results. Alternatively, when dealing with strings that should be treated as locale-independent, like HTML tags, this can lead to errors.", + "markdown": "Reports `toUpperCase()` or `toLowerCase()` calls on `String` objects that do not specify a `java.util.Locale`. In these cases the default system locale is used, which can cause problems in an internationalized environment.\n\n\nFor example the code `\"i\".toUpperCase().equals(\"I\")` returns `false` in the Turkish and Azerbaijani locales, where\nthe dotted and dotless 'i' are separate letters. Calling `toUpperCase()` on an English string containing an 'i', when running\nin a Turkish locale, will return incorrect results. Alternatively, when dealing with strings that should be treated as locale-independent,\nlike HTML tags, this can lead to errors." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InstantiatingAThreadWithDefaultRunMethod", + "suppressToolId": "StringToUpperCaseOrToLowerCaseWithoutLocale", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29938,8 +29861,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -29951,19 +29874,19 @@ ] }, { - "id": "TestOnlyProblems", + "id": "ExplicitToImplicitClassMigration", "shortDescription": { - "text": "Test-only usage in production code" + "text": "Explicit class declaration can be converted into implicitly declared class" }, "fullDescription": { - "text": "Reports '@TestOnly'- and '@VisibleForTesting'-annotated methods and classes that are used in production code. Also reports usage of applying '@TestOnly' '@VisibleForTesting' to the same element. The problems are not reported if such method or class is referenced from: Code under the Test Sources folder A test class (JUnit/TestNG) Another '@TestOnly'-annotated method Example (in production code): '@TestOnly\n fun foo() { ... }\n\n fun main () {\n foo()\n }'", - "markdown": "Reports `@TestOnly`- and `@VisibleForTesting`-annotated methods and classes that are used in production code. Also reports usage of applying `@TestOnly` `@VisibleForTesting` to the same element.\n\nThe problems are not reported if such method or class is referenced from:\n\n* Code under the **Test Sources** folder\n* A test class (JUnit/TestNG)\n* Another `@TestOnly`-annotated method\n\n**Example (in production code):**\n\n\n @TestOnly\n fun foo() { ... }\n\n fun main () {\n foo()\n }\n" + "text": "Reports ordinary classes, which can be converted into implicitly declared classes Example: 'public class Sample {\n public static void main(String[] args) {\n System.out.println(\"Hello, world!\");\n }\n }' After the quick-fix is applied: 'public static void main(String[] args) {\n System.out.println(\"Hello, world!\");\n }' This inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview. New in 2024.1", + "markdown": "Reports ordinary classes, which can be converted into implicitly declared classes\n\n**Example:**\n\n\n public class Sample {\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 static void main(String[] args) {\n System.out.println(\"Hello, world!\");\n }\n\nThis inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview.\n\nNew in 2024.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "TestOnlyProblems", + "suppressToolId": "ExplicitToImplicitClassMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -29971,8 +29894,8 @@ "relationships": [ { "target": { - "id": "JVM languages/Test frameworks", - "index": 123, + "id": "Java/Java language level migration aids/Java 21", + "index": 195, "toolComponent": { "name": "QDJVM" } @@ -29984,19 +29907,19 @@ ] }, { - "id": "Java8MapApi", + "id": "NestedMethodCall", "shortDescription": { - "text": "Simplifiable 'Map' operations" + "text": "Nested method call" }, "fullDescription": { - "text": "Reports common usage patterns of 'java.util.Map' and suggests replacing them with: 'getOrDefault()', 'computeIfAbsent()', 'putIfAbsent()', 'merge()', or 'replaceAll()'. Example: 'map.containsKey(key) ? map.get(key) : \"default\";' After the quick-fix is applied: 'map.getOrDefault(key, \"default\");' Example: 'List list = map.get(key);\n if (list == null) {\n list = new ArrayList<>();\n map.put(key, list);\n }' After the quick-fix is applied: 'map.computeIfAbsent(key, localKey -> new ArrayList<>());' Example: 'Integer val = map.get(key);\n if (val == null) map.put(key, 1);\n else map.put(key, val + 1);' After the quick-fix is applied: 'map.merge(key, 1, (localKey, localValue) -> localValue + 1);' Example: 'for (Map.Entry entry : map.entrySet()) {\n map.put(entry.getKey(), transform(entry.getValue()));\n }' After the quick-fix is applied: 'map.replaceAll((localKey, localValue) -> transform(localValue));' Note that the replacement with 'computeIfAbsent()' or 'merge()' might work incorrectly for some 'Map' implementations if the code extracted to the lambda expression modifies the same 'Map'. By default, the warning doesn't appear if this code might have side effects. If necessary, enable the Suggest replacement even if lambda may have side effects option to always show the warning. Also, due to different handling of the 'null' value in old methods like 'put()' and newer methods like 'computeIfAbsent()' or 'merge()', semantics might change if storing the 'null' value into given 'Map' is important. The inspection won't suggest the replacement when the value is statically known to be nullable, but for values with unknown nullability the replacement is still suggested. In these cases, we recommended suppressing the warning and adding an explanatory comment. This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.", - "markdown": "Reports common usage patterns of `java.util.Map` and suggests replacing them with: `getOrDefault()`, `computeIfAbsent()`, `putIfAbsent()`, `merge()`, or `replaceAll()`.\n\nExample:\n\n\n map.containsKey(key) ? map.get(key) : \"default\";\n\nAfter the quick-fix is applied:\n\n\n map.getOrDefault(key, \"default\");\n\nExample:\n\n\n List list = map.get(key);\n if (list == null) {\n list = new ArrayList<>();\n map.put(key, list);\n }\n\nAfter the quick-fix is applied:\n\n\n map.computeIfAbsent(key, localKey -> new ArrayList<>());\n\nExample:\n\n\n Integer val = map.get(key);\n if (val == null) map.put(key, 1);\n else map.put(key, val + 1);\n\nAfter the quick-fix is applied:\n\n\n map.merge(key, 1, (localKey, localValue) -> localValue + 1);\n\nExample:\n\n\n for (Map.Entry entry : map.entrySet()) {\n map.put(entry.getKey(), transform(entry.getValue()));\n }\n\nAfter the quick-fix is applied:\n\n\n map.replaceAll((localKey, localValue) -> transform(localValue));\n\nNote that the replacement with `computeIfAbsent()` or `merge()` might work incorrectly for some `Map`\nimplementations if the code extracted to the lambda expression modifies the same `Map`. By default,\nthe warning doesn't appear if this code might have side effects. If necessary, enable the\n**Suggest replacement even if lambda may have side effects** option to always show the warning.\n\nAlso, due to different handling of the `null` value in old methods like `put()` and newer methods like\n`computeIfAbsent()` or `merge()`, semantics might change if storing the `null` value into given\n`Map` is important. The inspection won't suggest the replacement when the value is statically known to be nullable,\nbut for values with unknown nullability the replacement is still suggested. In these cases, we recommended suppressing the warning\nand adding an explanatory comment.\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8." + "text": "Reports method calls used as parameters to another method call. The quick-fix introduces a variable to make the code simpler and easier to debug. Example: 'public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int x = f(y());\n }' After the quick-fix is applied: 'public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int y = y();\n int x = f(y);\n }' Use the inspection options to toggle the reporting of: method calls in field initializers calls to static methods calls to simple getters", + "markdown": "Reports method calls used as parameters to another method call.\n\nThe quick-fix introduces a variable to make the code simpler and easier to debug.\n\n**Example:**\n\n\n public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int x = f(y());\n }\n\nAfter the quick-fix is applied:\n\n\n public int y() { return 1; }\n public int f(int x) { return 2 * x; }\n\n public void foo() {\n int y = y();\n int x = f(y);\n }\n\n\nUse the inspection options to toggle the reporting of:\n\n* method calls in field initializers\n* calls to static methods\n* calls to simple getters" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "Java8MapApi", + "suppressToolId": "NestedMethodCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30004,8 +29927,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 8", - "index": 122, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -30017,19 +29940,19 @@ ] }, { - "id": "MeaninglessRecordAnnotationInspection", + "id": "ClassWithTooManyTransitiveDependents", "shortDescription": { - "text": "Meaningless record annotation" + "text": "Class with too many transitive dependents" }, "fullDescription": { - "text": "Reports annotations used on record components that have no effect. This can happen in two cases: The reported annotation has the METHOD target, but the corresponding accessor is explicitly defined. The reported annotation has the PARAMETER target, but the canonical constructor is explicitly defined. Example: '@Target(ElementType.METHOD)\n@interface A { }\n \n// The annotation will not appear in bytecode at all,\n// as it should be propagated to the accessor but accessor is explicitly defined \nrecord R(@A int x) {\n public int x() { return x; }\n}' This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2021.1", - "markdown": "Reports annotations used on record components that have no effect.\n\nThis can happen in two cases:\n\n* The reported annotation has the METHOD target, but the corresponding accessor is explicitly defined.\n* The reported annotation has the PARAMETER target, but the canonical constructor is explicitly defined.\n\nExample:\n\n\n @Target(ElementType.METHOD)\n @interface A { }\n \n // The annotation will not appear in bytecode at all,\n // as it should be propagated to the accessor but accessor is explicitly defined \n record R(@A int x) {\n public int x() { return x; }\n }\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2021.1" + "text": "Reports a class on which too many other classes are directly or indirectly dependent. Any modification to such a class may require changing many other classes, which may be expensive. Only top-level classes are reported. Use the Maximum number of transitive dependents field to specify the maximum allowed number of direct or indirect dependents 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 a class on which too many other classes are directly or indirectly dependent.\n\nAny modification to such a class may require changing many other classes, which may be expensive.\n\nOnly top-level classes are reported.\n\nUse the **Maximum number of transitive dependents** field to specify the maximum allowed number of direct or indirect dependents\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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MeaninglessRecordAnnotationInspection", + "suppressToolId": "ClassWithTooManyTransitiveDependents", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30037,8 +29960,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Dependency issues", + "index": 146, "toolComponent": { "name": "QDJVM" } @@ -30050,28 +29973,28 @@ ] }, { - "id": "FillPermitsList", + "id": "CompareToUsesNonFinalVariable", "shortDescription": { - "text": "Same file subclasses are missing from permits clause of a sealed class" + "text": "Non-final field referenced in 'compareTo()'" }, "fullDescription": { - "text": "Reports 'sealed' classes without an explicit 'permits' list. Sealed classes that only have subclasses in the same file are not required to have an explicit 'permits' list. By default, this inspection does not highlight in the editor, but only provides a fix. Example: 'sealed class A {}\n final class B extends A {}' After the quick-fix is applied: 'sealed class A permits B {}\n final class B extends A {}' This inspection depends on the Java feature 'Sealed classes', which is available since Java 17. New in 2020.3", - "markdown": "Reports `sealed` classes without an explicit `permits` list. Sealed classes that only have subclasses in the same file are not required to have an explicit `permits` list. By default, this inspection does not highlight in the editor, but only provides a fix.\n\nExample:\n\n\n sealed class A {}\n final class B extends A {}\n\nAfter the quick-fix is applied:\n\n\n sealed class A permits B {}\n final class B extends A {}\n\nThis inspection depends on the Java feature 'Sealed classes', which is available since Java 17.\n\nNew in 2020.3" + "text": "Reports access to a non-'final' field inside a 'compareTo()' implementation. Such access may result in 'compareTo()' returning different results at different points in the object's lifecycle, which may in turn cause problems when using the standard collections classes, for example 'java.util.TreeSet'. A quick-fix to make the field 'final' is available only when there is no write access to the field, otherwise no fixes are suggested. Example: 'class Foo implements Comparable{\n private int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }' After the quick-fix is applied: 'class Foo implements Comparable{\n private final int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }'", + "markdown": "Reports access to a non-`final` field inside a `compareTo()` implementation.\n\n\nSuch access may result in `compareTo()`\nreturning different results at different points in the object's lifecycle, which may in turn cause problems when\nusing the standard collections classes, for example `java.util.TreeSet`.\n\n\nA quick-fix to make the field `final` is available\nonly when there is no write access to the field, otherwise no fixes are suggested.\n\n**Example:**\n\n\n class Foo implements Comparable{\n private int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo implements Comparable{\n private final int index;\n Foo(int idx) {\n index = idx;\n }\n @Override\n public int compareTo(Foo foo) {\n return Integer.compare(this.index, foo.index);\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "FillPermitsList", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CompareToUsesNonFinalVariable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -30083,22 +30006,19 @@ ] }, { - "id": "MagicConstant", + "id": "JavacQuirks", "shortDescription": { - "text": "Magic constant" + "text": "Javac quirks" }, "fullDescription": { - "text": "Reports expressions that can be replaced with \"magic\" constants. Example 1: '// Bare literal \"2\" is used, warning:\n Font font = new Font(\"Arial\", 2)' Example 2: '// Predefined constant is used, good:\n Font font = new Font(\"Arial\", Font.ITALIC)' When possible, the quick-fix inserts an appropriate predefined constant. The behavior of this inspection is controlled by 'org.intellij.lang.annotations.MagicConstant' annotation. Some standard Java library methods are pre-annotated, but you can use this annotation in your code as well.", - "markdown": "Reports expressions that can be replaced with \"magic\" constants.\n\nExample 1:\n\n\n // Bare literal \"2\" is used, warning:\n Font font = new Font(\"Arial\", 2)\n\nExample 2:\n\n\n // Predefined constant is used, good:\n Font font = new Font(\"Arial\", Font.ITALIC)\n\n\nWhen possible, the quick-fix inserts an appropriate predefined constant.\n\n\nThe behavior of this inspection is controlled by `org.intellij.lang.annotations.MagicConstant` annotation.\nSome standard Java library methods are pre-annotated, but you can use this annotation in your code as well." + "text": "Reports known Javac issues, performance problems, and incompatibilities. For example, type inference may be slow when it has to process many nested calls. The following code triggers a warning, as the vararg method call has 50+ poly arguments: 'Arrays.asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));' The quick-fix adds explicit type arguments, which makes compilation and IDE processing much faster: '//noinspection RedundantTypeArguments\n Arrays.>asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));'", + "markdown": "Reports known Javac issues, performance problems, and incompatibilities. For example, type inference may be slow when it has to process many nested calls.\n\nThe following code triggers a warning, as the vararg method call has 50+ poly arguments:\n\n\n Arrays.asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));\n\nThe quick-fix adds explicit type arguments, which makes compilation and IDE processing much faster:\n\n\n //noinspection RedundantTypeArguments\n Arrays.>asList(\n Arrays.asList(\"a1\", \"b1\"),\n Arrays.asList(\"a2\", \"b2\"),\n ...\n Arrays.asList(\"a100\", \"b100\"));\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MagicConstant", - "cweIds": [ - 489 - ], + "suppressToolId": "JavacQuirks", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30106,8 +30026,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Compiler issues", + "index": 162, "toolComponent": { "name": "QDJVM" } @@ -30119,19 +30039,19 @@ ] }, { - "id": "SuspiciousDateFormat", + "id": "SwitchStatement", "shortDescription": { - "text": "Suspicious date format pattern" + "text": "'switch' statement" }, "fullDescription": { - "text": "Reports date format patterns that are likely used by mistake. The following patterns are reported: Uppercase \"Y\", unless \"w\" appears nearby. It stands for \"Week year\" that is almost always the same as normal \"Year\" (lowercase \"y\" pattern), but may point to the next year at the end of December. Uppercase \"M\" (month) close to \"H\", \"K\", \"h\", or \"k\" (hour). It's likely that a lowercase \"m\" (minute) was intended. Lowercase \"m\" (minute) close to \"y\" (year) or \"d\" (day in month). It's likely that an uppercase \"M\" (month) was intended. Uppercase \"D\" (day in year) close to \"M\", or \"L\" (month). It's likely that a lowercase \"d\" (day in month) was intended. Uppercase \"S\" (milliseconds) close to \"m\" (minutes). It's likely that a lowercase \"s\" (seconds) was intended. Examples: 'new SimpleDateFormat(\"YYYY-MM-dd\")': likely '\"yyyy-MM-dd\"' was intended. 'new SimpleDateFormat(\"yyyy-MM-DD\")': likely '\"yyyy-MM-dd\"' was intended. 'new SimpleDateFormat(\"HH:MM\")': likely '\"HH:mm\"' was intended. New in 2020.1", - "markdown": "Reports date format patterns that are likely used by mistake.\n\nThe following patterns are reported:\n\n* Uppercase \"Y\", unless \"w\" appears nearby. It stands for \"Week year\" that is almost always the same as normal \"Year\" (lowercase \"y\" pattern), but may point to the next year at the end of December.\n* Uppercase \"M\" (month) close to \"H\", \"K\", \"h\", or \"k\" (hour). It's likely that a lowercase \"m\" (minute) was intended.\n* Lowercase \"m\" (minute) close to \"y\" (year) or \"d\" (day in month). It's likely that an uppercase \"M\" (month) was intended.\n* Uppercase \"D\" (day in year) close to \"M\", or \"L\" (month). It's likely that a lowercase \"d\" (day in month) was intended.\n* Uppercase \"S\" (milliseconds) close to \"m\" (minutes). It's likely that a lowercase \"s\" (seconds) was intended.\n\n\nExamples: \n\n`new SimpleDateFormat(\"YYYY-MM-dd\")`: likely `\"yyyy-MM-dd\"` was intended. \n\n`new SimpleDateFormat(\"yyyy-MM-DD\")`: likely `\"yyyy-MM-dd\"` was intended. \n\n`new SimpleDateFormat(\"HH:MM\")`: likely `\"HH:mm\"` was intended.\n\nNew in 2020.1" + "text": "Reports 'switch' statements. 'switch' statements often (but not always) indicate a poor object-oriented design. Example: 'switch (i) {\n // code\n }'", + "markdown": "Reports `switch` statements.\n\n`switch` statements often (but not always) indicate a poor object-oriented design.\n\nExample:\n\n\n switch (i) {\n // code\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousDateFormat", + "suppressToolId": "SwitchStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30139,8 +30059,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -30152,19 +30072,19 @@ ] }, { - "id": "NumericToString", + "id": "StringBufferReplaceableByString", "shortDescription": { - "text": "Call to 'Number.toString()'" + "text": "'StringBuilder' can be replaced with 'String'" }, "fullDescription": { - "text": "Reports 'toString()' calls on objects of a class extending 'Number'. Such calls are usually incorrect in an internationalized environment and some locale specific formatting should be used instead. Example: 'void print(Double d) {\n System.out.println(d.toString());\n }' A possible way to fix this problem could be: 'void print(Double d) {\n System.out.printf(\"%f%n\", d);\n }' This formats the number using the default locale which is set during the startup of the JVM and is based on the host environment.", - "markdown": "Reports `toString()` calls on objects of a class extending `Number`. Such calls are usually incorrect in an internationalized environment and some locale specific formatting should be used instead.\n\n**Example:**\n\n\n void print(Double d) {\n System.out.println(d.toString());\n }\n\nA possible way to fix this problem could be:\n\n\n void print(Double d) {\n System.out.printf(\"%f%n\", d);\n }\n\nThis formats the number using the default locale which is set during the startup of the JVM and is based on the host environment." + "text": "Reports usages of 'StringBuffer', 'StringBuilder', or 'StringJoiner' which can be replaced with a single 'String' concatenation. Using 'String' concatenation makes the code shorter and simpler. This inspection only reports when the suggested replacement does not result in significant performance drawback on modern JVMs. In many cases, 'String' concatenation may perform better. Example: 'StringBuilder result = new StringBuilder();\n result.append(\"i = \");\n result.append(i);\n result.append(\";\");\n return result.toString();' After the quick-fix is applied: 'String result = \"i = \" + i + \";\";\n return result;'", + "markdown": "Reports usages of `StringBuffer`, `StringBuilder`, or `StringJoiner` which can be replaced with a single `String` concatenation.\n\nUsing `String` concatenation\nmakes the code shorter and simpler.\n\n\nThis inspection only reports when the suggested replacement does not result in significant\nperformance drawback on modern JVMs. In many cases, `String` concatenation may perform better.\n\n**Example:**\n\n\n StringBuilder result = new StringBuilder();\n result.append(\"i = \");\n result.append(i);\n result.append(\";\");\n return result.toString();\n\nAfter the quick-fix is applied:\n\n\n String result = \"i = \" + i + \";\";\n return result;\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToNumericToString", + "suppressToolId": "StringBufferReplaceableByString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30172,8 +30092,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -30185,19 +30105,19 @@ ] }, { - "id": "UnnecessaryDefault", + "id": "SourceToSinkFlow", "shortDescription": { - "text": "Unnecessary 'default' for enum 'switch' statement" + "text": "Non-safe string is passed to safe method" }, "fullDescription": { - "text": "Reports enum 'switch' statements or expression with 'default' branches which can never be taken, because all possible values are covered by a 'case' branch. Such elements are redundant, especially for 'switch' expressions, because they don't compile when all enum constants are not covered by a 'case' branch. The language level needs to be configured to 14 to report 'switch' expressions. The provided quick-fix removes 'default' branches. Example: 'enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n default -> 3;\n };\n }' After the quick-fix is applied: 'enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n };\n }' Use the Only report switch expressions option to report only redundant 'default' branches in switch expressions.", - "markdown": "Reports enum `switch` statements or expression with `default` branches which can never be taken, because all possible values are covered by a `case` branch.\n\nSuch elements are redundant, especially for `switch` expressions, because they don't compile when all\nenum constants are not covered by a `case` branch.\n\n\nThe language level needs to be configured to 14 to report `switch` expressions.\n\nThe provided quick-fix removes `default` branches.\n\nExample:\n\n\n enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n default -> 3;\n };\n }\n\nAfter the quick-fix is applied:\n\n\n enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n };\n }\n\nUse the **Only report switch expressions** option to report only redundant `default` branches in switch expressions." + "text": "Reports cases when a non-safe object is passed to a method with a parameter marked with '@Untainted' annotations, returned from annotated methods or assigned to annotated fields, parameters, or local variables. Kotlin 'set' and 'get' methods for fields are not supported as entry points. A safe object (in the same class) is: a string literal, interface instance, or enum object a result of a call of a method that is marked as '@Untainted' a private field, which is assigned only with a string literal and has a safe initializer a final field, which has a safe initializer local variable or parameter that are marked as '@Untainted' and are not assigned from non-safe objects This field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable. Also static final fields are considered as safe. The analysis is performed only inside one file. To process dependencies from other classes, use options. The analysis extends to private or static methods and has a limit of depth propagation. Example: 'void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n if (b) s1 = s;\n sink(s);\n }\n\n String sink(@Untainted String s) {}'\n Here we do not have non-safe string assignments to 's' so a warning is not produced. On the other hand: 'void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n s1 = foo();\n if (b) s = s1;\n sink(s); // warning here\n }\n\n String foo();\n\n String sink(@Untainted String s) {}'\n Here we have a warning since 's1' has an unknown state after 'foo' call result assignment. New in 2021.2", + "markdown": "Reports cases when a non-safe object is passed to a method with a parameter marked with `@Untainted` annotations, returned from annotated methods or assigned to annotated fields, parameters, or local variables. Kotlin `set` and `get` methods for fields are not supported as entry points.\n\n\nA safe object (in the same class) is:\n\n* a string literal, interface instance, or enum object\n* a result of a call of a method that is marked as `@Untainted`\n* a private field, which is assigned only with a string literal and has a safe initializer\n* a final field, which has a safe initializer\n* local variable or parameter that are marked as `@Untainted` and are not assigned from non-safe objects\nThis field, local variable, or parameter must not be passed as arguments to methods or used as a qualifier or must be a primitive, its wrapper or immutable.\n\nAlso static final fields are considered as safe.\n\n\nThe analysis is performed only inside one file. To process dependencies from other classes, use options.\nThe analysis extends to private or static methods and has a limit of depth propagation.\n\n\nExample:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n if (b) s1 = s;\n sink(s);\n }\n\n String sink(@Untainted String s) {}\n\n\nHere we do not have non-safe string assignments to `s` so a warning is not produced. On the other hand:\n\n\n void doSmth(boolean b) {\n String s = safe();\n String s1 = \"other\";\n s1 = foo();\n if (b) s = s1;\n sink(s); // warning here\n }\n\n String foo();\n\n String sink(@Untainted String s) {}\n\n\nHere we have a warning since `s1` has an unknown state after `foo` call result assignment.\n\nNew in 2021.2" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryDefault", + "suppressToolId": "tainting", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30205,8 +30125,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -30218,28 +30138,28 @@ ] }, { - "id": "VolatileArrayField", + "id": "RecordCanBeClass", "shortDescription": { - "text": "Volatile array field" + "text": "Record can be converted to class" }, "fullDescription": { - "text": "Reports array fields that are declared 'volatile'. Such declarations may be confusing because accessing the array itself follows the rules for 'volatile' fields, but accessing the array's contents does not. Example: 'class Data {\n private volatile int[] idx = new int[0];\n }' If such volatile access is needed for array contents, consider using 'java.util.concurrent.atomic' classes instead: 'class Data {\n private final AtomicIntegerArray idx = new AtomicIntegerArray(new int[0]);\n }'", - "markdown": "Reports array fields that are declared `volatile`. Such declarations may be confusing because accessing the array itself follows the rules for `volatile` fields, but accessing the array's contents does not.\n\n**Example:**\n\n\n class Data {\n private volatile int[] idx = new int[0];\n }\n\n\nIf such volatile access is needed for array contents, consider using\n`java.util.concurrent.atomic` classes instead:\n\n\n class Data {\n private final AtomicIntegerArray idx = new AtomicIntegerArray(new int[0]);\n }\n" + "text": "Reports record classes and suggests converting them to ordinary classes. This inspection makes it possible to move a Java record to a codebase using an earlier Java version by applying the quick-fix to this record. Note that the resulting class is not completely equivalent to the original record: The resulting class no longer extends 'java.lang.Record', so 'instanceof Record' returns 'false'. Reflection methods like 'Class.isRecord()' and 'Class.getRecordComponents()' produce different results. The generated 'hashCode()' implementation may produce a different result because the formula to calculate record 'hashCode' is deliberately not specified. Record serialization mechanism differs from that of an ordinary class. Refer to Java Object Serialization Specification for details. Example: 'record Point(int x, int y) {}' After the quick-fix is applied: 'final class Point {\n private final int x;\n private final int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n public int x() { return x; }\n\n public int y() { return y; }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == this) return true;\n if (obj == null || obj.getClass() != this.getClass()) return false;\n var that = (Point)obj;\n return this.x == that.x &&\n this.y == that.y;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(x, y);\n }\n\n @Override\n public String toString() {\n return \"Point[\" +\n \"x=\" + x + \", \" +\n \"y=\" + y + ']';\n }\n }' This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.3", + "markdown": "Reports record classes and suggests converting them to ordinary classes.\n\nThis inspection makes it possible to move a Java record to a codebase using an earlier Java version\nby applying the quick-fix to this record.\n\n\nNote that the resulting class is not completely equivalent to the original record:\n\n* The resulting class no longer extends `java.lang.Record`, so `instanceof Record` returns `false`.\n* Reflection methods like `Class.isRecord()` and `Class.getRecordComponents()` produce different results.\n* The generated `hashCode()` implementation may produce a different result because the formula to calculate record `hashCode` is deliberately not specified.\n* Record serialization mechanism differs from that of an ordinary class. Refer to *Java Object Serialization Specification* for details.\n\nExample:\n\n\n record Point(int x, int y) {}\n\nAfter the quick-fix is applied:\n\n\n final class Point {\n private final int x;\n private final int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n public int x() { return x; }\n\n public int y() { return y; }\n\n @Override\n public boolean equals(Object obj) {\n if (obj == this) return true;\n if (obj == null || obj.getClass() != this.getClass()) return false;\n var that = (Point)obj;\n return this.x == that.x &&\n this.y == that.y;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(x, y);\n }\n\n @Override\n public String toString() {\n return \"Point[\" +\n \"x=\" + x + \", \" +\n \"y=\" + y + ']';\n }\n }\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.3" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "VolatileArrayField", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "RecordCanBeClass", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -30251,19 +30171,19 @@ ] }, { - "id": "UnnecessaryInheritDoc", + "id": "MalformedFormatString", "shortDescription": { - "text": "Unnecessary '{@inheritDoc}' Javadoc comment" + "text": "Malformed format string" }, "fullDescription": { - "text": "Reports Javadoc comments that contain only an '{@inheritDoc}' tag. Since Javadoc copies the super class' comment if no comment is present, a comment containing only '{@inheritDoc}' adds nothing. Also, it reports the '{@inheritDoc}' usages in invalid locations, for example, in fields. Suggests removing the unnecessary Javadoc comment. Example: 'class Example implements Comparable {\n /**\n * {@inheritDoc}\n */\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }' After the quick-fix is applied: 'class Example implements Comparable {\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }'", - "markdown": "Reports Javadoc comments that contain only an `{@inheritDoc}` tag. Since Javadoc copies the super class' comment if no comment is present, a comment containing only `{@inheritDoc}` adds nothing.\n\nAlso, it reports the `{@inheritDoc}` usages in invalid locations, for example, in fields.\n\nSuggests removing the unnecessary Javadoc comment.\n\n**Example:**\n\n\n class Example implements Comparable {\n /**\n * {@inheritDoc}\n */\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example implements Comparable {\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }\n" + "text": "Reports format strings that don't comply with the standard Java syntax. By default, the inspection considers a compile-time constant a format string if it's used as an argument to the corresponding methods on 'java.util.Formatter', 'java.lang.String', 'java.io.PrintWriter' or 'java.io.PrintStream'. Example: 'String.format(\"x = %d, y = %d\", 42);' Use the inspection settings to mark additional classes and methods as related to string formatting. As an alternative, you can use the 'org.intellij.lang.annotations.PrintFormat' annotation to mark the format string method parameter. In this case, the format arguments parameter must immediately follow the format string and be the last method parameter. Example: 'void myFormatMethod(int mode, @PrintFormat String formatString, Object... args) {...}' Methods annotated in this way will also be recognized by this inspection.", + "markdown": "Reports format strings that don't comply with the standard Java syntax.\n\nBy default, the inspection considers a compile-time constant a format string if it's used as an argument to the corresponding methods on\n`java.util.Formatter`, `java.lang.String`, `java.io.PrintWriter` or `java.io.PrintStream`.\n\n**Example:**\n\n\n String.format(\"x = %d, y = %d\", 42);\n\nUse the inspection settings to mark additional classes and methods as related to string formatting.\n\nAs an alternative, you can use the `org.intellij.lang.annotations.PrintFormat` annotation\nto mark the format string method parameter. In this case,\nthe format arguments parameter must immediately follow the format string and be the last method parameter. Example:\n\n\n void myFormatMethod(int mode, @PrintFormat String formatString, Object... args) {...}\n\n\nMethods annotated in this way will also be recognized by this inspection." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryInheritDoc", + "suppressToolId": "MalformedFormatString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30271,8 +30191,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -30284,19 +30204,19 @@ ] }, { - "id": "NonReproducibleMathCall", + "id": "ThreadYield", "shortDescription": { - "text": "Non-reproducible call to 'Math'" + "text": "Call to 'Thread.yield()'" }, "fullDescription": { - "text": "Reports calls to 'java.lang.Math' methods, which results are not guaranteed to be reproduced precisely. In environments where reproducibility of results is required, 'java.lang.StrictMath' should be used instead.", - "markdown": "Reports calls to `java.lang.Math` methods, which results are not guaranteed to be reproduced precisely.\n\nIn environments where reproducibility of results is required, `java.lang.StrictMath`\nshould be used instead." + "text": "Reports calls to 'Thread.yield()'. The behavior of 'yield()' is non-deterministic and platform-dependent, and it is rarely appropriate to use this method. Its use should be combined with detailed profiling and benchmarking to ensure that it actually has the desired effect. Example: 'public static void main(String[] args) {\n Runnable r = () -> {\n for (int i = 0; i < 10; i++) {\n System.out.println(i);\n Thread.yield();\n }\n };\n new Thread(r).start();\n new Thread(r).start();\n }'", + "markdown": "Reports calls to `Thread.yield()`.\n\n\nThe behavior of `yield()` is non-deterministic and platform-dependent, and it is rarely appropriate to use this method.\nIts use should be combined with detailed profiling and benchmarking to ensure that it actually has the desired effect.\n\n**Example:**\n\n\n public static void main(String[] args) {\n Runnable r = () -> {\n for (int i = 0; i < 10; i++) {\n System.out.println(i);\n Thread.yield();\n }\n };\n new Thread(r).start();\n new Thread(r).start();\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonReproducibleMathCall", + "suppressToolId": "CallToThreadYield", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30304,8 +30224,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -30317,28 +30237,28 @@ ] }, { - "id": "ParametersPerConstructor", + "id": "LambdaCanBeMethodCall", "shortDescription": { - "text": "Constructor with too many parameters" + "text": "Lambda can be replaced with method call" }, "fullDescription": { - "text": "Reports constructors whose number of parameters exceeds the specified maximum. Such objects are hard to instantiate, especially if some parameters are optional. Constructors with too many parameters may indicate that refactoring is necessary. Consider applying the builder pattern, for example. Example: 'public BankAccount(long accountNumber,\n String owner,\n double balance,\n double interestRate) {\n // fields initialization\n }' Configure the inspection: Use the Parameter limit field to specify the maximum allowed number of parameters in a constructor. Use the Ignore constructors with visibility list to specify whether the inspection should ignore constructors with specific visibility.", - "markdown": "Reports constructors whose number of parameters exceeds the specified maximum. Such objects are hard to instantiate, especially if some parameters are optional. Constructors with too many parameters may indicate that refactoring is necessary. Consider applying the builder pattern, for example.\n\n**Example:**\n\n\n public BankAccount(long accountNumber,\n String owner,\n double balance,\n double interestRate) {\n // fields initialization\n }\n\nConfigure the inspection:\n\n* Use the **Parameter limit** field to specify the maximum allowed number of parameters in a constructor.\n* Use the **Ignore constructors with visibility** list to specify whether the inspection should ignore constructors with specific visibility." + "text": "Reports lambda expressions which can be replaced with a call to a JDK method. For example, an expression 'x -> x' of type 'Function' can be replaced with a 'Function.identity()' call. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8. New in 2017.1", + "markdown": "Reports lambda expressions which can be replaced with a call to a JDK method.\n\nFor example, an expression `x -> x` of type `Function`\ncan be replaced with a `Function.identity()` call.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.\n\nNew in 2017.1" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ConstructorWithTooManyParameters", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "LambdaCanBeMethodCall", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -30350,19 +30270,22 @@ ] }, { - "id": "MappingBeforeCount", + "id": "EndlessStream", "shortDescription": { - "text": "Mapping call before count()" + "text": "Non-short-circuit operation consumes infinite stream" }, "fullDescription": { - "text": "Reports redundant 'Stream' API calls like 'map()', or 'boxed()' right before the 'count()' call. Such calls don't change the final count, so could be removed. It's possible that the code relies on a side effect from the lambda inside such a mapping call. However, relying on side effects inside the stream chain is extremely bad practice. There are no guarantees that the call will not be optimized out in future Java versions. Example: '// map() call is redundant\n long count = list.stream().filter(s -> !s.isEmpty()).map(s -> s.trim()).count();' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2024.1", - "markdown": "Reports redundant `Stream` API calls like `map()`, or `boxed()` right before the `count()` call.\n\n\nSuch calls don't change the final count, so could be removed. It's possible that the code relies on\na side effect from the lambda inside such a mapping call. However, relying on side effects inside\nthe stream chain is extremely bad practice. There are no guarantees that the call will not be\noptimized out in future Java versions.\n\n**Example:**\n\n\n // map() call is redundant\n long count = list.stream().filter(s -> !s.isEmpty()).map(s -> s.trim()).count();\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2024.1" + "text": "Reports non-short-circuit operations consuming an infinite stream. Such operations can be completed only by throwing an exception. Example: 'Stream.iterate(0, i -> i + 1).collect(Collectors.toList())' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports non-short-circuit operations consuming an infinite stream. Such operations can be completed only by throwing an exception.\n\nExample:\n\n\n Stream.iterate(0, i -> i + 1).collect(Collectors.toList())\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "MappingBeforeCount", + "suppressToolId": "EndlessStream", + "cweIds": [ + 835 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30370,8 +30293,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -30383,19 +30306,19 @@ ] }, { - "id": "NonExtendableApiUsage", + "id": "Singleton", "shortDescription": { - "text": "Class, interface, or method should not be extended" + "text": "Singleton" }, "fullDescription": { - "text": "Reports classes, interfaces and methods that extend, implement, or override API elements marked with '@ApiStatus.NonExtendable'. The '@ApiStatus.NonExtendable' annotation indicates that the class, interface, or method must not be extended, implemented, or overridden. Since casting such interfaces and classes to the internal library implementation is rather common, if a client provides a different implementation, you will get 'ClassCastException'. Adding new abstract methods to such classes and interfaces will break the compatibility with the client's implementations.", - "markdown": "Reports classes, interfaces and methods that extend, implement, or override API elements marked with `@ApiStatus.NonExtendable`.\n\n\nThe `@ApiStatus.NonExtendable` annotation indicates that the class, interface, or method **must not be extended,\nimplemented, or overridden** .\nSince casting such interfaces and classes to the internal library implementation is rather common,\nif a client provides a different implementation, you will get `ClassCastException`.\nAdding new abstract methods to such classes and interfaces will break the compatibility with the client's implementations." + "text": "Reports singleton classes. Singleton classes are declared in a way that only one instance of the class can ever be instantiated. Singleton classes complicate testing, and their presence may indicate a lack of object-oriented design. Example: 'class Singleton {\n private static final Singleton ourInstance = new Singleton();\n\n private Singleton() {\n }\n\n public Singleton getInstance() {\n return ourInstance;\n }\n }'", + "markdown": "Reports singleton classes.\n\nSingleton classes are declared in a way that only one instance of the class can ever be instantiated. Singleton classes complicate testing,\nand their presence may indicate a lack of object-oriented design.\n\n**Example:**\n\n\n class Singleton {\n private static final Singleton ourInstance = new Singleton();\n\n private Singleton() {\n }\n\n public Singleton getInstance() {\n return ourInstance;\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonExtendableApiUsage", + "suppressToolId": "Singleton", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30403,8 +30326,8 @@ "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -30416,19 +30339,19 @@ ] }, { - "id": "UnqualifiedFieldAccess", + "id": "NonFinalUtilityClass", "shortDescription": { - "text": "Instance field access not qualified with 'this'" + "text": "Utility class is not 'final'" }, "fullDescription": { - "text": "Reports field access operations that are not qualified with 'this' or some other qualifier. Some coding styles mandate that all field access operations are qualified to prevent confusion with local variable or parameter access. Example: 'class Foo {\n int foo;\n\n void bar() {\n foo += 1;\n }\n }' After the quick-fix is applied: 'class Foo {\n int foo;\n\n void bar() {\n this.foo += 1;\n }\n }'", - "markdown": "Reports field access operations that are not qualified with `this` or some other qualifier.\n\n\nSome coding styles mandate that all field access operations are qualified to prevent confusion with local\nvariable or parameter access.\n\n**Example:**\n\n\n class Foo {\n int foo;\n\n void bar() {\n foo += 1;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n int foo;\n\n void bar() {\n this.foo += 1;\n }\n }\n" + "text": "Reports utility classes that aren't 'final' or 'abstract'. Utility classes have all fields and methods declared as 'static'. Making them 'final' prevents them from being accidentally subclassed. Example: 'public class UtilityClass {\n public static void foo() {}\n }' After the quick-fix is applied: 'public final class UtilityClass {\n public static void foo() {}\n }'", + "markdown": "Reports utility classes that aren't `final` or `abstract`.\n\nUtility classes have all fields and methods declared as `static`.\nMaking them `final` prevents them from being accidentally subclassed.\n\n**Example:**\n\n\n public class UtilityClass {\n public static void foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n public final class UtilityClass {\n public static void foo() {}\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnqualifiedFieldAccess", + "suppressToolId": "NonFinalUtilityClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30436,8 +30359,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -30449,23 +30372,19 @@ ] }, { - "id": "MismatchedCollectionQueryUpdate", + "id": "FuseStreamOperations", "shortDescription": { - "text": "Mismatched query and update of collection" + "text": "Subsequent steps can be fused into Stream API chain" }, "fullDescription": { - "text": "Reports collections whose contents are either queried and not updated, or updated and not queried. Such inconsistent queries and updates are pointless and may indicate either dead code or a typo. Use the inspection settings to specify name patterns that correspond to update/query methods. Query methods that return an element are automatically detected, and only those that write data to an output parameter (for example, an 'OutputStream') need to be specified. Example: Suppose you have your custom 'FixedStack' class with method 'store()': 'public class FixedStack extends Collection {\n public T store(T t) {\n // implementation\n }\n }' You can add 'store' to the update methods table in order to report mismatched queries like: 'void test(int i) {\n FixedStack stack = new FixedStack<>();\n stack.store(i);\n }'", - "markdown": "Reports collections whose contents are either queried and not updated, or updated and not queried.\n\n\nSuch inconsistent queries and updates are pointless and may indicate\neither dead code or a typo.\n\n\nUse the inspection settings to specify name patterns that correspond to update/query methods.\nQuery methods that return an element are automatically detected, and only\nthose that write data to an output parameter (for example, an `OutputStream`) need to be specified.\n\n\n**Example:**\n\nSuppose you have your custom `FixedStack` class with method `store()`:\n\n\n public class FixedStack extends Collection {\n public T store(T t) {\n // implementation\n }\n }\n\nYou can add `store` to the update methods table in order to report mismatched queries like:\n\n\n void test(int i) {\n FixedStack stack = new FixedStack<>();\n stack.store(i);\n }\n" + "text": "Detects transformations outside a Stream API chain that could be incorporated into it. Example: 'List list = stream.collect(Collectors.toList());\n list.sort(null);\n return list.toArray(new String[list.size()]);' After the conversion: 'return stream.sorted().toArray(String[]::new);' Note that sometimes the converted stream chain may replace explicit 'ArrayList' with 'Collectors.toList()' or explicit 'HashSet' with 'Collectors.toSet()'. The current library implementation uses these collections internally. However, this approach is not very reliable and might change in the future altering the semantics of your code. If you are concerned about it, use the Do not suggest 'toList()' or 'toSet()' collectors option to suggest 'Collectors.toCollection()' instead of 'toList' and 'toSet' collectors. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Detects transformations outside a Stream API chain that could be incorporated into it.\n\nExample:\n\n\n List list = stream.collect(Collectors.toList());\n list.sort(null);\n return list.toArray(new String[list.size()]);\n\nAfter the conversion:\n\n\n return stream.sorted().toArray(String[]::new);\n\n\nNote that sometimes the converted stream chain may replace explicit `ArrayList` with `Collectors.toList()` or explicit\n`HashSet` with `Collectors.toSet()`. The current library implementation uses these collections internally. However,\nthis approach is not very reliable and might change in the future altering the semantics of your code.\n\nIf you are concerned about it, use the **Do not suggest 'toList()' or 'toSet()' collectors** option to suggest\n`Collectors.toCollection()` instead of `toList` and `toSet` collectors.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MismatchedQueryAndUpdateOfCollection", - "cweIds": [ - 561, - 563 - ], + "suppressToolId": "FuseStreamOperations", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30473,8 +30392,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -30486,19 +30405,19 @@ ] }, { - "id": "CharacterComparison", + "id": "DefaultNotLastCaseInSwitch", "shortDescription": { - "text": "Character comparison" + "text": "'default' not last case in 'switch'" }, "fullDescription": { - "text": "Reports ordinal comparisons of 'char' values. In an internationalized environment, such comparisons are rarely correct.", - "markdown": "Reports ordinal comparisons of `char` values. In an internationalized environment, such comparisons are rarely correct." + "text": "Reports 'switch' statements or expressions in which the 'default' branch is positioned before another case. Such a construct is unnecessarily confusing. A quick-fix is provided to move the 'default' branch to the last position, if possible. Example: 'switch (n) {\n default:\n System.out.println();\n break;\n case 1:\n break;\n }' After the quick-fix is applied: 'switch (n) {\n case 1:\n break;\n default:\n System.out.println();\n break;\n }'", + "markdown": "Reports `switch` statements or expressions in which the `default` branch is positioned before another case. Such a construct is unnecessarily confusing. A quick-fix is provided to move the `default` branch to the last position, if possible.\n\n**Example:**\n\n\n switch (n) {\n default:\n System.out.println();\n break;\n case 1:\n break;\n }\n\nAfter the quick-fix is applied:\n\n\n switch (n) {\n case 1:\n break;\n default:\n System.out.println();\n break;\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CharacterComparison", + "suppressToolId": "DefaultNotLastCaseInSwitch", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30506,8 +30425,8 @@ "relationships": [ { "target": { - "id": "Java/Internationalization", - "index": 6, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -30519,19 +30438,19 @@ ] }, { - "id": "SynchronizeOnThis", + "id": "NullThrown", "shortDescription": { - "text": "Synchronization on 'this'" + "text": "'null' thrown" }, "fullDescription": { - "text": "Reports synchronization on 'this' or 'class' expressions. The reported constructs include 'synchronized' blocks and calls to 'wait()', 'notify()' or 'notifyAll()'. There are several reasons synchronization on 'this' or 'class' expressions may be a bad idea: it makes synchronization a part of the external interface of the class, which makes a future change to a different locking mechanism difficult, it becomes hard to track just who is locking on a given object, it makes a denial-of-service attack possible, either on purpose or it can happen easily by accident when subclassing. As an alternative, consider synchronizing on a 'private final' lock object, access to which can be completely controlled. Example: 'public void print() {\n synchronized(this) { // warning: Lock operations on 'this' may have unforeseen side-effects\n System.out.println(\"synchronized\");\n }\n }'", - "markdown": "Reports synchronization on `this` or `class` expressions. The reported constructs include `synchronized` blocks and calls to `wait()`, `notify()` or `notifyAll()`.\n\nThere are several reasons synchronization on `this` or `class` expressions may be a bad idea:\n\n1. it makes synchronization a part of the external interface of the class, which makes a future change to a different locking mechanism difficult,\n2. it becomes hard to track just who is locking on a given object,\n3. it makes a denial-of-service attack possible, either on purpose or it can happen easily by accident when subclassing.\n\nAs an alternative, consider synchronizing on a `private final` lock object, access to which can be completely controlled.\n\n**Example:**\n\n\n public void print() {\n synchronized(this) { // warning: Lock operations on 'this' may have unforeseen side-effects\n System.out.println(\"synchronized\");\n }\n }\n \n" + "text": "Reports 'null' literals that are used as the argument of a 'throw' statement. Such constructs produce a 'java.lang.NullPointerException' that usually should not be thrown programmatically.", + "markdown": "Reports `null` literals that are used as the argument of a `throw` statement.\n\nSuch constructs produce a `java.lang.NullPointerException` that usually should not be thrown programmatically." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SynchronizeOnThis", + "suppressToolId": "NullThrown", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30539,8 +30458,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -30552,23 +30471,19 @@ ] }, { - "id": "UnusedAssignment", + "id": "LocalCanBeFinal", "shortDescription": { - "text": "Unused assignment" + "text": "Local variable or parameter can be 'final'" }, "fullDescription": { - "text": "Reports assignment values that are not used after assignment. If the assignment value is unused, it's better to remove the assignment to shorten the code and avoid redundant allocations. The following cases are reported: variables that are never read after assignment variables that are always overwritten with a new value before being read variable initializers that are redundant (for one of the two reasons above) Configure the inspection: Use the Report redundant initializers option to report redundant initializers: 'int getI() {\n int i = 0; // redundant initialization\n i = 2;\n return i;\n }' Use the Report prefix expressions that can be replaced with binary expressions option to report cases where an '++i' expression may be replaced with 'i + 1': 'int preInc(int value) {\n int res = value;\n return ++res;\n }' Use the Report postfix expressions where the changed value is not used option to report 'i++' cases where the value of 'i' is not used later: 'int postInc(int value) {\n int res = value;\n return res++;\n }' Use the Report pattern variables whose values are never used option to report cases where the value of a pattern variable is overwritten before it is read: 'if (object instanceof String s) {\n s = \"hello\";\n System.out.println(s);\n }' Use the Report iteration parameters whose values are never used option to report cases where the value of an iteration parameter of an enhanced 'for' statements is overwritten before it is read: 'for (String arg : args) {\n arg = \"test\";\n System.out.println(arg);\n }'", - "markdown": "Reports assignment values that are not used after assignment. If the assignment value is unused, it's better to remove the assignment to shorten the code and avoid redundant allocations.\n\nThe following cases are reported:\n\n* variables that are never read after assignment\n* variables that are always overwritten with a new value before being read\n* variable initializers that are redundant (for one of the two reasons above)\n\nConfigure the inspection:\n\n\nUse the **Report redundant initializers** option to report redundant initializers:\n\n\n int getI() {\n int i = 0; // redundant initialization\n i = 2;\n return i;\n }\n\n\nUse the **Report prefix expressions that can be replaced with binary expressions** option to report cases\nwhere an `++i` expression may be replaced with `i + 1`:\n\n\n int preInc(int value) {\n int res = value;\n return ++res;\n }\n\n\nUse the **Report postfix expressions where the changed value is not used** option to report `i++` cases\nwhere the value of `i` is not used later:\n\n\n int postInc(int value) {\n int res = value;\n return res++;\n }\n\n\nUse the **Report pattern variables whose values are never used** option to report cases where the value of a pattern variable\nis overwritten before it is read:\n\n\n if (object instanceof String s) {\n s = \"hello\";\n System.out.println(s);\n }\n\n\nUse the **Report iteration parameters whose values are never used** option to report cases where the value of an iteration parameter\nof an enhanced `for` statements is overwritten before it is read:\n\n\n for (String arg : args) {\n arg = \"test\";\n System.out.println(arg);\n }\n" + "text": "Reports parameters or local variables that may have the 'final' modifier added to their declaration. Example: 'ArrayList list = new ArrayList();\n fill(list);\n return list;' After the quick-fix is applied: 'final ArrayList list = new ArrayList();\n fill(list);\n return list;' Use the inspection's options to define whether parameters or local variables should be reported.", + "markdown": "Reports parameters or local variables that may have the `final` modifier added to their declaration.\n\nExample:\n\n\n ArrayList list = new ArrayList();\n fill(list);\n return list;\n\nAfter the quick-fix is applied:\n\n\n final ArrayList list = new ArrayList();\n fill(list);\n return list;\n\n\nUse the inspection's options to define whether parameters or local variables should be reported." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnusedAssignment", - "cweIds": [ - 561, - 563 - ], + "suppressToolId": "LocalCanBeFinal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30576,8 +30491,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -30589,19 +30504,19 @@ ] }, { - "id": "HashCodeUsesNonFinalVariable", + "id": "FieldMayBeStatic", "shortDescription": { - "text": "Non-final field referenced in 'hashCode()'" + "text": "Field can be made 'static'" }, "fullDescription": { - "text": "Reports implementations of 'hashCode()' that access non-'final' variables. Such access may result in 'hashCode()' returning different values at different points in the object's lifecycle, which may in turn cause problems when using the standard collections classes. Example: 'class Drink {\n String name;\n Drink(String name) { this.name = name; }\n @Override public int hashCode() {\n return Objects.hash(name); //warning\n }\n }\n ...\n Drink coffee = new Drink(\"Coffee\");\n priceMap.put(coffee, 10.0);\n coffee.name = \"Tea\";\n double coffeePrice = priceMap.get(coffee); //not found' A quick-fix is suggested to make the field final: 'class Drink {\n final String name;\n ...\n }'", - "markdown": "Reports implementations of `hashCode()` that access non-`final` variables.\n\n\nSuch access may result in `hashCode()`\nreturning different values at different points in the object's lifecycle, which may in turn cause problems when\nusing the standard collections classes.\n\n**Example:**\n\n\n class Drink {\n String name;\n Drink(String name) { this.name = name; }\n @Override public int hashCode() {\n return Objects.hash(name); //warning\n }\n }\n ...\n Drink coffee = new Drink(\"Coffee\");\n priceMap.put(coffee, 10.0);\n coffee.name = \"Tea\";\n double coffeePrice = priceMap.get(coffee); //not found\n\nA quick-fix is suggested to make the field final:\n\n\n class Drink {\n final String name;\n ...\n }\n" + "text": "Reports instance variables that can safely be made 'static'. A field can be static if it is declared 'final' and initialized with a constant. Example: 'public final String str = \"sample\";' The inspection does not report final fields that can be implicitly written. Use the \"Annotations\" button to modify the list of annotations that assume implicit field write.", + "markdown": "Reports instance variables that can safely be made `static`. A field can be static if it is declared `final` and initialized with a constant.\n\n**Example:**\n\n\n public final String str = \"sample\";\n\n\nThe inspection does not report final fields that can be implicitly written. Use the \"Annotations\" button to modify\nthe list of annotations that assume implicit field write." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonFinalFieldReferencedInHashCode", + "suppressToolId": "FieldMayBeStatic", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30609,8 +30524,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -30622,19 +30537,19 @@ ] }, { - "id": "ProtectedField", + "id": "ArrayEquals", "shortDescription": { - "text": "Protected field" + "text": "'equals()' called on array" }, "fullDescription": { - "text": "Reports 'protected' fields. Constants (that is, variables marked 'static' or 'final') are not reported. Example: 'public class A {\n protected Object object; // warning\n protected final static int MODE = 0; // constant, no warning\n }'", - "markdown": "Reports `protected` fields.\n\nConstants (that is, variables marked `static` or `final`) are not reported.\n\n**Example:**\n\n\n public class A {\n protected Object object; // warning\n protected final static int MODE = 0; // constant, no warning\n }\n" + "text": "Reports 'equals()' calls that compare two arrays. Calling 'equals()' on an array compares identity and is equivalent to using '=='. Use 'Arrays.equals()' to compare the contents of two arrays, or 'Arrays.deepEquals()' for multi-dimensional arrays. Example: 'void sample(int[] first, int[] second){\n if (first.equals(second)) return;\n }' After the quick-fix is applied: 'void sample(int[] first, int[] second){\n if (Arrays.equals(first, second)) return;\n }'", + "markdown": "Reports `equals()` calls that compare two arrays.\n\nCalling `equals()` on an array compares identity and is equivalent to using `==`.\nUse `Arrays.equals()` to compare the contents of two arrays, or `Arrays.deepEquals()` for\nmulti-dimensional arrays.\n\n**Example:**\n\n\n void sample(int[] first, int[] second){\n if (first.equals(second)) return;\n }\n\nAfter the quick-fix is applied:\n\n\n void sample(int[] first, int[] second){\n if (Arrays.equals(first, second)) return;\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ProtectedField", + "suppressToolId": "ArrayEquals", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30642,8 +30557,8 @@ "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -30655,19 +30570,19 @@ ] }, { - "id": "AssignmentUsedAsCondition", + "id": "ProblematicVarargsMethodOverride", "shortDescription": { - "text": "Assignment used as condition" + "text": "Non-varargs method overrides varargs method" }, "fullDescription": { - "text": "Reports assignments that are used as a condition of an 'if', 'while', 'for', or 'do' statement, or a conditional expression. Although occasionally intended, this usage is confusing and may indicate a typo, for example, '=' instead of '=='. The quick-fix replaces '=' with '=='. Example: 'void update(String str, boolean empty) {\n // Warning: 'empty' is reassigned,\n // not compared to str.isEmpty()\n if (empty = str.isEmpty()) {\n ...\n }\n }' After the quick-fix is applied: 'void update(String str, boolean empty) {\n if (empty == str.isEmpty()) {\n ...\n }\n }'", - "markdown": "Reports assignments that are used as a condition of an `if`, `while`, `for`, or `do` statement, or a conditional expression.\n\nAlthough occasionally intended, this usage is confusing and may indicate a typo, for example, `=` instead of `==`.\n\nThe quick-fix replaces `=` with `==`.\n\n**Example:**\n\n\n void update(String str, boolean empty) {\n // Warning: 'empty' is reassigned,\n // not compared to str.isEmpty()\n if (empty = str.isEmpty()) {\n ...\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void update(String str, boolean empty) {\n if (empty == str.isEmpty()) {\n ...\n }\n }\n" + "text": "Reports methods that override a variable arity (a.k.a. varargs) method but replace the variable arity parameter with an array parameter. Though this code is valid, it may be confusing and should be avoided.", + "markdown": "Reports methods that override a variable arity (a.k.a. varargs) method but replace the variable arity parameter with an array parameter. Though this code is valid, it may be confusing and should be avoided." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AssignmentUsedAsCondition", + "suppressToolId": "ProblematicVarargsMethodOverride", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30675,8 +30590,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -30688,28 +30603,28 @@ ] }, { - "id": "InstanceofThis", + "id": "MisspelledHeader", "shortDescription": { - "text": "'instanceof' check for 'this'" + "text": "Unknown or misspelled header name" }, "fullDescription": { - "text": "Reports usages of 'instanceof' or 'getClass() == SomeClass.class' in which a 'this' expression is checked. Such expressions indicate a failure of the object-oriented design, and should be replaced by polymorphic constructions. Example: 'class Super {\n void process() {\n if (this instanceof Sub) { // warning\n doSomething();\n } else {\n doSomethingElse();\n }\n }\n}\n \nclass Sub extends Super {}' To fix the problem, use an overriding method: 'class Super {\n void process() {\n doSomethingElse();\n }\n}\n \nclass Sub extends Super {\n @Override\n void process() {\n doSomething();\n }\n}'", - "markdown": "Reports usages of `instanceof` or `getClass() == SomeClass.class` in which a `this` expression is checked.\n\nSuch expressions indicate a failure of the object-oriented design, and should be replaced by\npolymorphic constructions.\n\nExample:\n\n\n class Super {\n void process() {\n if (this instanceof Sub) { // warning\n doSomething();\n } else {\n doSomethingElse();\n }\n }\n }\n \n class Sub extends Super {}\n\nTo fix the problem, use an overriding method:\n\n\n class Super {\n void process() {\n doSomethingElse();\n }\n }\n \n class Sub extends Super {\n @Override\n void process() {\n doSomething();\n }\n } \n" + "text": "Reports any unknown and probably misspelled header names and provides possible variants.", + "markdown": "Reports any unknown and probably misspelled header names and provides possible variants." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "InstanceofThis", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MisspelledHeader", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Manifest", + "index": 117, "toolComponent": { "name": "QDJVM" } @@ -30721,19 +30636,19 @@ ] }, { - "id": "PackageInMultipleModules", + "id": "AtomicFieldUpdaterIssues", "shortDescription": { - "text": "Package with classes in multiple modules" + "text": "Inconsistent 'AtomicFieldUpdater' declaration" }, "fullDescription": { - "text": "Reports non-empty packages that are present in several modules. When packages are contained in several modules, it is very easy to create a class with the same name in two modules. A module which depends on these modules will see a conflict if it tries to use such a class. The Java Platform Module System disallows packages contained in more than one module (also called split packages) Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", - "markdown": "Reports non-empty packages that are present in several modules. When packages are contained in several modules, it is very easy to create a class with the same name in two modules. A module which depends on these modules will see a conflict if it tries to use such a class. The Java Platform Module System disallows packages contained in more than one module (also called *split packages* )\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor." + "text": "Reports issues with 'AtomicLongFieldUpdater', 'AtomicIntegerFieldUpdater', or 'AtomicReferenceFieldUpdater' fields (the 'java.util.concurrent.atomic' package). The reported issues are identical to the runtime problems that can happen with atomic field updaters: specified field not found, specified field not accessible, specified field has a wrong type, and so on. Examples: 'class A {\n private static volatile int value = 0;\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater((A.class), \"value\"); // warning: Field 'value' has 'static' modifier\n }' 'class B {\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater(B.class, \"value\"); // warning: No field named 'value' found in class 'B'\n }'", + "markdown": "Reports issues with `AtomicLongFieldUpdater`, `AtomicIntegerFieldUpdater`, or `AtomicReferenceFieldUpdater` fields (the `java.util.concurrent.atomic` package).\n\nThe reported issues are identical to the runtime problems that can happen with atomic field updaters:\nspecified field not found, specified field not accessible, specified field has a wrong type, and so on.\n\n**Examples:**\n\n*\n\n\n class A {\n private static volatile int value = 0;\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater((A.class), \"value\"); // warning: Field 'value' has 'static' modifier\n }\n \n*\n\n\n class B {\n private static final AtomicIntegerFieldUpdater updater =\n AtomicIntegerFieldUpdater.newUpdater(B.class, \"value\"); // warning: No field named 'value' found in class 'B'\n }\n \n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PackageInMultipleModules", + "suppressToolId": "AtomicFieldUpdaterIssues", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30741,8 +30656,8 @@ "relationships": [ { "target": { - "id": "Java/Packaging issues", - "index": 44, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -30754,19 +30669,19 @@ ] }, { - "id": "FloatingPointEquality", + "id": "PackageNamingConvention", "shortDescription": { - "text": "Floating-point equality comparison" + "text": "Package naming convention" }, "fullDescription": { - "text": "Reports floating-point values that are being compared using the '==' or '!=' operator. Floating-point values are inherently inaccurate, and comparing them for exact equality is seldom the desired semantics. This inspection ignores comparisons with zero and infinity literals. Example: 'void m(double d1, double d2) {\n if (d1 == d2) {}\n }'", - "markdown": "Reports floating-point values that are being compared using the `==` or `!=` operator.\n\nFloating-point values are inherently inaccurate, and comparing them for exact equality is seldom the desired semantics.\n\nThis inspection ignores comparisons with zero and infinity literals.\n\n**Example:**\n\n\n void m(double d1, double d2) {\n if (d1 == d2) {}\n }\n" + "text": "Reports packages whose names are either too short, too long, or do not follow the specified regular expression pattern. Example: 'package io;' Use the options to specify the minimum and maximum length of the package name as well as a regular expression that matches valid package names (regular expressions are in standard 'java.util.regex' format).", + "markdown": "Reports packages whose names are either too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:**\n\n\n package io;\n\n\nUse the options to specify the minimum and maximum length of the package name\nas well as a regular expression that matches valid package names\n(regular expressions are in standard `java.util.regex` format)." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FloatingPointEquality", + "suppressToolId": "PackageNamingConvention", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30774,8 +30689,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -30787,19 +30702,23 @@ ] }, { - "id": "SequencedCollectionMethodCanBeUsed", + "id": "ThrowableNotThrown", "shortDescription": { - "text": "SequencedCollection method can be used" + "text": "'Throwable' not thrown" }, "fullDescription": { - "text": "Reports collection API method calls that can be simplified using 'SequencedCollection' methods. The following conversions are supported: 'list.add(0, element)' → 'list.addFirst(element);' 'list.get(0)' → 'list.getFirst();' 'list.get(list.size() - 1)' → 'list.getLast();' 'list.remove(0)' → 'list.removeFirst();' 'list.remove(list.size() - 1)' → 'list.removeLast();' 'collection.iterator().next()' → 'collection.getFirst();' This inspection depends on the Java feature 'Sequenced Collections', which is available since Java 21. New in 2023.3", - "markdown": "Reports collection API method calls that can be simplified using `SequencedCollection` methods.\n\nThe following conversions are supported:\n\n* `list.add(0, element)` → `list.addFirst(element);`\n* `list.get(0)` → `list.getFirst();`\n* `list.get(list.size() - 1)` → `list.getLast();`\n* `list.remove(0)` → `list.removeFirst();`\n* `list.remove(list.size() - 1)` → `list.removeLast();`\n* `collection.iterator().next()` → `collection.getFirst();`\n\nThis inspection depends on the Java feature 'Sequenced Collections', which is available since Java 21.\n\nNew in 2023.3" + "text": "Reports instantiations of 'Throwable' or its subclasses, where the created 'Throwable' is never actually thrown. Additionally, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the result of the method call is not thrown. Calls to methods annotated with the Error Prone's or AssertJ's '@CanIgnoreReturnValue' annotation will not be reported. Example: 'void check(String s) {\n if (s == null) {\n new NullPointerException(\"s\");\n }\n // ...\n }'", + "markdown": "Reports instantiations of `Throwable` or its subclasses, where the created `Throwable` is never actually thrown. Additionally, this inspection reports method calls that return instances of `Throwable` or its subclasses, when the result of the method call is not thrown.\n\nCalls to methods annotated with the Error Prone's or AssertJ's `@CanIgnoreReturnValue` annotation will not be reported.\n\n**Example:**\n\n\n void check(String s) {\n if (s == null) {\n new NullPointerException(\"s\");\n }\n // ...\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SequencedCollectionMethodCanBeUsed", + "suppressToolId": "ThrowableNotThrown", + "cweIds": [ + 390, + 703 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30807,8 +30726,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 21", - "index": 195, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -30820,28 +30739,28 @@ ] }, { - "id": "PublicField", + "id": "CapturingCleaner", "shortDescription": { - "text": "'public' field" + "text": "Cleaner captures object reference" }, "fullDescription": { - "text": "Reports 'public' fields. Constants (fields marked with 'static' and 'final') are not reported. Example: 'class Main {\n public String name;\n }' After the quick-fix is applied: 'class Main {\n private String name;\n\n public String getName() {\n return name;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n }' Configure the inspection: Use the Ignore If Annotated By list to specify annotations to ignore. The inspection will ignore fields with any of these annotations. Use the Ignore 'public final' fields of an enum option to ignore 'public final' fields of the 'enum' type.", - "markdown": "Reports `public` fields. Constants (fields marked with `static` and `final`) are not reported.\n\n**Example:**\n\n\n class Main {\n public String name;\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n private String name;\n\n public String getName() {\n return name;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n }\n\nConfigure the inspection:\n\n* Use the **Ignore If Annotated By** list to specify annotations to ignore. The inspection will ignore fields with any of these annotations.\n* Use the **Ignore 'public final' fields of an enum** option to ignore `public final` fields of the `enum` type." + "text": "Reports 'Runnable' passed to a 'Cleaner.register()' capturing reference being registered. If the reference is captured, it will never be phantom reachable and the cleaning action will never be invoked. Possible sources of this problem: Lambda using non-static methods, fields, or 'this' itself Non-static inner class (anonymous or not) always captures this reference in java up to 18 version Instance method reference Access to outer class non-static members from non-static inner class Sample of code that will be reported: 'int fileDescriptor;\n Cleaner.Cleanable cleanable = Cleaner.create().register(this, () -> {\n System.out.println(\"adsad\");\n //this is captured via fileDescriptor\n fileDescriptor = 0;\n });' This inspection only reports if the language level of the project or module is 9 or higher. New in 2018.1", + "markdown": "Reports `Runnable` passed to a `Cleaner.register()` capturing reference being registered. If the reference is captured, it will never be phantom reachable and the cleaning action will never be invoked.\n\nPossible sources of this problem:\n\n* Lambda using non-static methods, fields, or `this` itself\n* Non-static inner class (anonymous or not) always captures this reference in java up to 18 version\n* Instance method reference\n* Access to outer class non-static members from non-static inner class\n\nSample of code that will be reported:\n\n\n int fileDescriptor;\n Cleaner.Cleanable cleanable = Cleaner.create().register(this, () -> {\n System.out.println(\"adsad\");\n //this is captured via fileDescriptor\n fileDescriptor = 0;\n });\n\nThis inspection only reports if the language level of the project or module is 9 or higher.\n\nNew in 2018.1" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "PublicField", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CapturingCleaner", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -30853,19 +30772,19 @@ ] }, { - "id": "SerialAnnotationUsedOnWrongMember", + "id": "ThreadStartInConstruction", "shortDescription": { - "text": "'@Serial' annotation used on wrong member" + "text": "Call to 'Thread.start()' during object construction" }, "fullDescription": { - "text": "Reports methods and fields in the 'Serializable' and 'Externalizable' classes that are not suitable to be annotated with the 'java.io.Serial' annotation. Examples: 'class Test implements Serializable {\n @Serial // The annotated field is not a part of serialization mechanism because it's not final\n private static long serialVersionUID = 7874493593505141603L;\n\n @Serial // The annotated method is not a part of the serialization mechanism because it's not private\n void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' 'class Test implements Externalizable {\n @Serial // The annotated method is not a part of the serialization mechanism as it's inside Externalizable class\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' For information about all valid cases, refer to the Javadoc of the 'java.io.Serial' class. This inspection depends on the Java feature '@Serial annotation', which is available since Java 14. New in 2020.3", - "markdown": "Reports methods and fields in the `Serializable` and `Externalizable` classes that are not suitable to be annotated with the `java.io.Serial` annotation.\n\n**Examples:**\n\n\n class Test implements Serializable {\n @Serial // The annotated field is not a part of serialization mechanism because it's not final\n private static long serialVersionUID = 7874493593505141603L;\n\n @Serial // The annotated method is not a part of the serialization mechanism because it's not private\n void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\n\n class Test implements Externalizable {\n @Serial // The annotated method is not a part of the serialization mechanism as it's inside Externalizable class\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\nFor information about all valid cases, refer to the Javadoc of the `java.io.Serial` class.\n\nThis inspection depends on the Java feature '@Serial annotation', which is available since Java 14.\n\nNew in 2020.3" + "text": "Reports calls to 'start()' on 'java.lang.Thread' or any of its subclasses during object construction. While occasionally useful, such constructs should be avoided due to inheritance issues. Subclasses of a class that launches a thread during the object construction will not have finished any initialization logic of their own before the thread has launched. This inspection does not report if the class that starts a thread is declared 'final'. Example: 'class MyThread extends Thread {\n MyThread() {\n start();\n }\n }'", + "markdown": "Reports calls to `start()` on `java.lang.Thread` or any of its subclasses during object construction.\n\n\nWhile occasionally useful, such constructs should be avoided due to inheritance issues.\nSubclasses of a class that launches a thread during the object construction will not have finished\nany initialization logic of their own before the thread has launched.\n\nThis inspection does not report if the class that starts a thread is declared `final`.\n\n**Example:**\n\n\n class MyThread extends Thread {\n MyThread() {\n start();\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "serial", + "suppressToolId": "CallToThreadStartDuringObjectConstruction", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30873,8 +30792,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -30886,19 +30805,19 @@ ] }, { - "id": "ThrowsRuntimeException", + "id": "SwitchStatementWithTooManyBranches", "shortDescription": { - "text": "Unchecked exception declared in 'throws' clause" + "text": "Maximum 'switch' branches" }, "fullDescription": { - "text": "Reports declaration of an unchecked exception ('java.lang.RuntimeException' or one of its subclasses) in the 'throws' clause of a method. Declarations of unchecked exceptions are not required and may be deleted or moved to a Javadoc '@throws' tag. Example: 'public class InvalidDataException extends RuntimeException {}\n\n class TextEditor {\n void readSettings() throws InvalidDataException {} // warning: Unchecked exception 'InvalidDataException' declared in 'throws' clause\n }'", - "markdown": "Reports declaration of an unchecked exception (`java.lang.RuntimeException` or one of its subclasses) in the `throws` clause of a method.\n\nDeclarations of unchecked exceptions are not required and may be deleted or moved to a Javadoc `@throws` tag.\n\n**Example:**\n\n\n public class InvalidDataException extends RuntimeException {}\n\n class TextEditor {\n void readSettings() throws InvalidDataException {} // warning: Unchecked exception 'InvalidDataException' declared in 'throws' clause\n }\n" + "text": "Reports 'switch' statements or expressions with too many 'case' labels. Such a long switch statement may be confusing and should probably be refactored. Sometimes, it is not a problem (for example, a domain is very complicated and has enums with a lot of constants). Example: 'switch (x) {\n case 1 -> {}\n case 2 -> {}\n case 3 -> {}\n case 4 -> {}\n case 5 -> {}\n case 6 -> {}\n case 7 -> {}\n case 8 -> {}\n case 9 -> {}\n case 10 -> {}\n case 11,12,13 -> {}\n default -> {}\n }' Use the Maximum number of branches field to specify the maximum number of 'case' labels expected.", + "markdown": "Reports `switch` statements or expressions with too many `case` labels.\n\nSuch a long switch statement may be confusing and should probably be refactored.\nSometimes, it is not a problem (for example, a domain is very complicated and has enums with a lot of constants).\n\nExample:\n\n\n switch (x) {\n case 1 -> {}\n case 2 -> {}\n case 3 -> {}\n case 4 -> {}\n case 5 -> {}\n case 6 -> {}\n case 7 -> {}\n case 8 -> {}\n case 9 -> {}\n case 10 -> {}\n case 11,12,13 -> {}\n default -> {}\n }\n\nUse the **Maximum number of branches** field to specify the maximum number of `case` labels expected." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ThrowsRuntimeException", + "suppressToolId": "SwitchStatementWithTooManyBranches", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30906,8 +30825,8 @@ "relationships": [ { "target": { - "id": "Java/Error handling", - "index": 12, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -30919,19 +30838,19 @@ ] }, { - "id": "JNDIResource", + "id": "LoopConditionNotUpdatedInsideLoop", "shortDescription": { - "text": "JNDI resource opened but not safely closed" + "text": "Loop variable not updated inside loop" }, "fullDescription": { - "text": "Reports JNDI resources that are not safely closed. JNDI resources reported by this inspection include 'javax.naming.InitialContext', and 'javax.naming.NamingEnumeration'. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'Object findObject(Properties properties, String name) throws NamingException {\n Context context = new InitialContext(properties); //context is not closed\n return context.lookup(name);\n }' Use the following options to configure the inspection: Whether a JNDI 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 JNDI resources that are not safely closed. JNDI resources reported by this inspection include `javax.naming.InitialContext`, and `javax.naming.NamingEnumeration`.\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 Object findObject(Properties properties, String name) throws NamingException {\n Context context = new InitialContext(properties); //context is not closed\n return context.lookup(name);\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a JNDI 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." + "text": "Reports any variables and parameters that are used in a loop condition and are not updated inside the loop. Such variables and parameters are usually used by mistake as they may cause an infinite loop if they are executed. Example: 'void loopDoesNotLoop(boolean b) {\n while (b) {\n System.out.println();\n break;\n }\n }' Configure the inspection: Use the Ignore possible non-local changes option to disable this inspection if the condition can be updated indirectly (e.g. via the called method or concurrently from another thread).", + "markdown": "Reports any variables and parameters that are used in a loop condition and are not updated inside the loop.\n\nSuch variables and parameters are usually used by mistake as they\nmay cause an infinite loop if they are executed.\n\nExample:\n\n\n void loopDoesNotLoop(boolean b) {\n while (b) {\n System.out.println();\n break;\n }\n }\n\nConfigure the inspection:\n\n\nUse the **Ignore possible non-local changes** option to disable this inspection\nif the condition can be updated indirectly (e.g. via the called method or concurrently from another thread)." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "JNDIResourceOpenedButNotSafelyClosed", + "suppressToolId": "LoopConditionNotUpdatedInsideLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30939,8 +30858,8 @@ "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -30952,22 +30871,19 @@ ] }, { - "id": "NewObjectEquality", + "id": "DoubleCheckedLocking", "shortDescription": { - "text": "New object is compared using '=='" + "text": "Double-checked locking" }, "fullDescription": { - "text": "Reports code that applies '==' or '!=' to a newly allocated object instead of calling 'equals()'. The references to newly allocated objects cannot point at existing objects, thus the comparison will always evaluate to 'false'. The inspection may also report newly created objects returned from simple methods. Example: 'void test(Object obj) {\n if (new Object() == obj) {...}\n }' After the quick-fix is applied: 'void test(Object obj) {\n if (new Object().equals(obj)) {...}\n }' New in 2018.3", - "markdown": "Reports code that applies `==` or `!=` to a newly allocated object instead of calling `equals()`.\n\n\nThe references to newly allocated objects cannot point at existing objects,\nthus the comparison will always evaluate to `false`. The inspection may also report newly\ncreated objects returned from simple methods.\n\n**Example:**\n\n\n void test(Object obj) {\n if (new Object() == obj) {...}\n }\n\nAfter the quick-fix is applied:\n\n\n void test(Object obj) {\n if (new Object().equals(obj)) {...}\n }\n\n\nNew in 2018.3" + "text": "Reports double-checked locking. Double-checked locking tries to initialize a field on demand and in a thread-safe manner, while avoiding the cost of synchronization. Unfortunately it is not thread-safe when used on a field that is not declared 'volatile'. When using Java 1.4 or earlier, double-checked locking doesn't work even with a 'volatile' field. Read the article linked above for a detailed explanation of the problem. Example of incorrect double-checked locking: 'class Foo {\n private Helper helper = null;\n public Helper getHelper() {\n if (helper == null)\n synchronized(this) {\n if (helper == null) helper = new Helper();\n }\n return helper;\n }\n }\n // other functions and members...\n }'", + "markdown": "Reports [double-checked locking](https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html).\n\n\nDouble-checked locking tries to initialize a field on demand and in a thread-safe manner, while avoiding the cost of synchronization.\nUnfortunately it is not thread-safe when used on a field that is not declared `volatile`.\nWhen using Java 1.4 or earlier, double-checked locking doesn't work even with a `volatile` field.\nRead the article linked above for a detailed explanation of the problem.\n\nExample of incorrect double-checked locking:\n\n\n class Foo {\n private Helper helper = null;\n public Helper getHelper() {\n if (helper == null)\n synchronized(this) {\n if (helper == null) helper = new Helper();\n }\n return helper;\n }\n }\n // other functions and members...\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NewObjectEquality", - "cweIds": [ - 480 - ], + "suppressToolId": "DoubleCheckedLocking", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -30975,8 +30891,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -30988,19 +30904,19 @@ ] }, { - "id": "TryWithIdenticalCatches", + "id": "MisspelledMethodName", "shortDescription": { - "text": "Identical 'catch' branches in 'try' statement" + "text": "Method names differing only by case" }, "fullDescription": { - "text": "Reports identical 'catch' sections in a single 'try' statement. Collapsing such sections into one multi-catch block reduces code duplication and prevents the situations when one 'catch' section is updated, and another one is not. Example: 'try {\n doSmth();\n }\n catch (IOException e) {\n LOG.error(e);\n }\n catch (URISyntaxException e) {\n LOG.error(e);\n }' A quick-fix is available to make the code more compact: 'try {\n doSmth();\n }\n catch (IOException | URISyntaxException e) {\n LOG.error(e);\n }' This inspection depends on the Java feature 'Multi-catches', which is available since Java 7.", - "markdown": "Reports identical `catch` sections in a single `try` statement.\n\nCollapsing such sections into one *multi-catch* block reduces code duplication and prevents\nthe situations when one `catch` section is updated, and another one is not.\n\n**Example:**\n\n\n try {\n doSmth();\n }\n catch (IOException e) {\n LOG.error(e);\n }\n catch (URISyntaxException e) {\n LOG.error(e);\n }\n\nA quick-fix is available to make the code more compact:\n\n\n try {\n doSmth();\n }\n catch (IOException | URISyntaxException e) {\n LOG.error(e);\n }\n\nThis inspection depends on the Java feature 'Multi-catches', which is available since Java 7." + "text": "Reports cases in which multiple methods of a class have the names that differ only by case. Such names may be very confusing. Example: 'public int hashcode() { // reported, should be hashCode probably?\n return 0;\n }' A quick-fix that renames such methods is available only in the editor. Use the Ignore methods overriding/implementing a super method option to ignore methods overriding or implementing a method from the superclass.", + "markdown": "Reports cases in which multiple methods of a class have the names that differ only by case. Such names may be very confusing.\n\n**Example:**\n\n\n public int hashcode() { // reported, should be hashCode probably?\n return 0;\n }\n\nA quick-fix that renames such methods is available only in the editor.\n\nUse the **Ignore methods overriding/implementing a super method** option to ignore methods overriding or implementing a method from\nthe superclass." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "TryWithIdenticalCatches", + "suppressToolId": "MethodNamesDifferingOnlyByCase", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31008,8 +30924,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 7", - "index": 161, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -31021,28 +30937,28 @@ ] }, { - "id": "LambdaCanBeReplacedWithAnonymous", + "id": "NonSerializableObjectBoundToHttpSession", "shortDescription": { - "text": "Lambda can be replaced with anonymous class" + "text": "Non-serializable object bound to 'HttpSession'" }, "fullDescription": { - "text": "Reports lambda expressions that can be replaced with anonymous classes. Expanding lambda expressions to anonymous classes may be useful if you need to implement other methods inside an anonymous class. Example: 's -> System.out.println(s)' After the quick-fix is applied: 'new Consumer() {\n @Override\n public void accept(String s) {\n System.out.println(s);\n }\n}' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "markdown": "Reports lambda expressions that can be replaced with anonymous classes.\n\n\nExpanding lambda expressions to anonymous classes may be useful if you need to implement other\nmethods inside an anonymous class.\n\nExample:\n\n\n s -> System.out.println(s)\n\nAfter the quick-fix is applied:\n\n new Consumer() {\n @Override\n public void accept(String s) {\n System.out.println(s);\n }\n }\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "text": "Reports objects of classes not implementing 'java.io.Serializable' used as arguments to 'javax.servlet.http.HttpSession.setAttribute()' or 'javax.servlet.http.HttpSession.putValue()'. Such objects will not be serialized if the 'HttpSession' is passivated or migrated, and may result in difficult-to-diagnose bugs. This inspection assumes objects of the types 'java.util.Collection' and 'java.util.Map' to be 'Serializable', unless type parameters are non-'Serializable'. Example: 'void foo(HttpSession session) {\n session.setAttribute(\"foo\", new NonSerializable());\n }\n static class NonSerializable {}'", + "markdown": "Reports objects of classes not implementing `java.io.Serializable` used as arguments to `javax.servlet.http.HttpSession.setAttribute()` or `javax.servlet.http.HttpSession.putValue()`.\n\n\nSuch objects will not be serialized if the `HttpSession` is passivated or migrated,\nand may result in difficult-to-diagnose bugs.\n\n\nThis inspection assumes objects of the types `java.util.Collection` and\n`java.util.Map` to be `Serializable`,\nunless type parameters are non-`Serializable`.\n\n**Example:**\n\n\n void foo(HttpSession session) {\n session.setAttribute(\"foo\", new NonSerializable());\n }\n static class NonSerializable {}\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "LambdaCanBeReplacedWithAnonymous", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "NonSerializableObjectBoundToHttpSession", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -31054,19 +30970,19 @@ ] }, { - "id": "RedundantCompareCall", + "id": "ThreadLocalNotStaticFinal", "shortDescription": { - "text": "Redundant 'compare()' method call" + "text": "'ThreadLocal' field not declared 'static final'" }, "fullDescription": { - "text": "Reports comparisons in which the 'compare' method is superfluous. Example: 'boolean result = Integer.compare(a, b) == 0;' After the quick-fix is applied: 'boolean result = a == b;' New in 2018.2", - "markdown": "Reports comparisons in which the `compare` method is superfluous.\n\nExample:\n\n\n boolean result = Integer.compare(a, b) == 0;\n\nAfter the quick-fix is applied:\n\n\n boolean result = a == b;\n\nNew in 2018.2" + "text": "Reports fields of type 'java.lang.ThreadLocal' that are not declared 'static final'. In the most common case, a 'java.lang.ThreadLocal' instance associates state with a thread. A non-static non-final 'java.lang.ThreadLocal' field associates state with an instance-thread combination. This is usually unnecessary and quite often is a bug that can cause memory leaks and incorrect behavior. A quick-fix is suggested to make the field 'static final'. Example: 'private ThreadLocal tl = ThreadLocal.withInitial(() -> Boolean.TRUE);'", + "markdown": "Reports fields of type `java.lang.ThreadLocal` that are not declared `static final`.\n\n\nIn the most common case, a `java.lang.ThreadLocal` instance associates state with a thread.\nA non-static non-final `java.lang.ThreadLocal` field associates state with an instance-thread combination.\nThis is usually unnecessary and quite often is a bug that can cause memory leaks and incorrect behavior.\n\n\nA quick-fix is suggested to make the field `static final`.\n\n\n**Example:**\n\n\n private ThreadLocal tl = ThreadLocal.withInitial(() -> Boolean.TRUE);\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantCompareCall", + "suppressToolId": "ThreadLocalNotStaticFinal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31074,8 +30990,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -31087,28 +31003,28 @@ ] }, { - "id": "TextBlockBackwardMigration", + "id": "AccessStaticViaInstance", "shortDescription": { - "text": "Text block can be replaced with regular string literal" + "text": "Access static member via instance reference" }, "fullDescription": { - "text": "Reports text blocks that can be replaced with regular string literals. This may help to downgrade for backward compatibility with earlier Java versions. Example: 'Object obj = engine.eval(\"\"\"\n function hello() {\n print('\"Hello, world\"');\n }\n\n hello();\n \"\"\");' After the quick fix is applied: 'Object obj = engine.eval(\"function hello() {\\n\" +\n \" print('\\\"Hello, world\\\"');\\n\" +\n \"}\\n\" +\n \"\\n\" +\n \"hello();\\n\");' This inspection depends on the Java feature 'Text block literals', which is available since Java 15. New in 2019.3", - "markdown": "Reports text blocks that can be replaced with regular string literals. This may help to downgrade for backward compatibility with earlier Java versions.\n\n**Example:**\n\n\n Object obj = engine.eval(\"\"\"\n function hello() {\n print('\"Hello, world\"');\n }\n\n hello();\n \"\"\");\n\nAfter the quick fix is applied:\n\n\n Object obj = engine.eval(\"function hello() {\\n\" +\n \" print('\\\"Hello, world\\\"');\\n\" +\n \"}\\n\" +\n \"\\n\" +\n \"hello();\\n\");\n\nThis inspection depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2019.3" + "text": "Reports references to 'static' methods and fields via a class instance rather than the class itself. Even though referring to static members via instance variables is allowed by The Java Language Specification, this makes the code confusing as the reader may think that the result of the method depends on the instance. The quick-fix replaces the instance variable with the class name. Example: 'String s1 = s.valueOf(0);' After the quick-fix is applied: 'String s = String.valueOf(0);'", + "markdown": "Reports references to `static` methods and fields via a class instance rather than the class itself.\n\nEven though referring to static members via instance variables is allowed by The Java Language Specification,\nthis makes the code confusing as the reader may think that the result of the method depends on the instance.\n\nThe quick-fix replaces the instance variable with the class name.\n\nExample:\n\n\n String s1 = s.valueOf(0);\n\nAfter the quick-fix is applied:\n\n\n String s = String.valueOf(0);\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "TextBlockBackwardMigration", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "AccessStaticViaInstance", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 15", - "index": 132, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -31120,19 +31036,19 @@ ] }, { - "id": "EmptyClass", + "id": "CallToNativeMethodWhileLocked", "shortDescription": { - "text": "Empty class" + "text": "Call to a 'native' method while locked" }, "fullDescription": { - "text": "Reports empty classes and empty Java files. A class is empty if it doesn't contain any fields, methods, constructors, or initializers. Empty classes are sometimes left over after significant changes or refactorings. Example: 'class Example {\n List getList() {\n return new ArrayList<>() {\n\n };\n }\n }' After the quick-fix is applied: 'class Example {\n List getList() {\n return new ArrayList<>();\n }\n }' Configure the inspection: Use the Ignore if annotated by option to specify special annotations. The inspection will ignore the classes marked with these annotations. Use the Ignore class if it is a parametrization of a super type option to ignore classes that parameterize a superclass. For example: 'class MyList extends ArrayList {}' Use the Ignore subclasses of java.lang.Throwable to ignore classes that extend 'java.lang.Throwable'. Use the Comments count as content option to ignore classes that contain comments.", - "markdown": "Reports empty classes and empty Java files.\n\nA class is empty if it doesn't contain any fields, methods, constructors, or initializers. Empty classes are sometimes left over\nafter significant changes or refactorings.\n\n**Example:**\n\n\n class Example {\n List getList() {\n return new ArrayList<>() {\n\n };\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n List getList() {\n return new ArrayList<>();\n }\n }\n\nConfigure the inspection:\n\n* Use the **Ignore if annotated by** option to specify special annotations. The inspection will ignore the classes marked with these annotations.\n*\n Use the **Ignore class if it is a parametrization of a super type** option to ignore classes that parameterize a superclass. For example:\n\n class MyList extends ArrayList {}\n\n* Use the **Ignore subclasses of java.lang.Throwable** to ignore classes that extend `java.lang.Throwable`.\n* Use the **Comments count as content** option to ignore classes that contain comments." + "text": "Reports calls 'native' methods within a 'synchronized' block or method. When possible, it's better to keep calls to 'native' methods out of the synchronized context because such calls cause an expensive context switch and may lead to performance issues. Example: 'native void nativeMethod();\n\n void example(){\n synchronized (lock){\n nativeMethod();//warning\n }\n }'", + "markdown": "Reports calls `native` methods within a `synchronized` block or method.\n\n\nWhen possible, it's better to keep calls to `native` methods out of the synchronized context\nbecause such calls cause an expensive context switch and may lead to performance issues.\n\n**Example:**\n\n\n native void nativeMethod();\n\n void example(){\n synchronized (lock){\n nativeMethod();//warning\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EmptyClass", + "suppressToolId": "CallToNativeMethodWhileLocked", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31140,8 +31056,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -31153,28 +31069,28 @@ ] }, { - "id": "ConditionalCanBeOptional", + "id": "Dependency", "shortDescription": { - "text": "Conditional can be replaced with Optional" + "text": "Illegal package dependencies" }, "fullDescription": { - "text": "Reports null-check conditions and suggests replacing them with 'Optional' chains. Example: 'return str == null ? \"\" : str.trim();' After applying the quick-fix: 'return Optional.ofNullable(str).map(String::trim).orElse(\"\");' While the replacement is not always shorter, it could be helpful for further refactoring (for example, for changing the method return value to 'Optional'). Note that when a not-null branch of the condition returns null, the corresponding mapping step will produce an empty 'Optional' possibly changing the semantics. If it cannot be statically proven that semantics will be preserved, the quick-fix action name will contain the \"(may change semantics)\" notice, and the inspection highlighting will be turned off. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2018.1", - "markdown": "Reports null-check conditions and suggests replacing them with `Optional` chains.\n\nExample:\n\n\n return str == null ? \"\" : str.trim();\n\nAfter applying the quick-fix:\n\n\n return Optional.ofNullable(str).map(String::trim).orElse(\"\");\n\nWhile the replacement is not always shorter, it could be helpful for further refactoring\n(for example, for changing the method return value to `Optional`).\n\nNote that when a not-null branch of the condition returns null, the corresponding mapping step will\nproduce an empty `Optional` possibly changing the semantics. If it cannot be statically\nproven that semantics will be preserved, the quick-fix action name will contain the \"(may change semantics)\"\nnotice, and the inspection highlighting will be turned off.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2018.1" + "text": "Reports illegal dependencies between scopes according to the dependency rules given. Dependency rules can be used to prohibit usage from a scope to another scope. Use the Configure dependency rules button below to customize validation rules.", + "markdown": "Reports illegal dependencies between scopes according to the dependency rules given. Dependency rules can be used to prohibit usage from a scope to another scope.\n\nUse the **Configure dependency rules** button below to customize validation rules." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "error", "parameters": { - "suppressToolId": "ConditionalCanBeOptional", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "Dependency", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -31186,19 +31102,19 @@ ] }, { - "id": "AssignmentToLambdaParameter", + "id": "NestingDepth", "shortDescription": { - "text": "Assignment to lambda parameter" + "text": "Overly nested method" }, "fullDescription": { - "text": "Reports assignment to, or modification of lambda parameters. Although occasionally intended, this construct may be confusing and is often caused by a typo or use of a wrong variable. The quick-fix adds a declaration of a new variable. Example: 'list.forEach(s -> {\n s = s.trim();\n System.out.println(\"String: \" + s);\n });' After the quick-fix is applied: 'list.forEach(s -> {\n String trimmed = s.trim();\n System.out.println(\"String: \" + trimmed);\n });' Use the Ignore if assignment is a transformation of the original parameter option to ignore assignments that modify the parameter value based on its previous value. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", - "markdown": "Reports assignment to, or modification of lambda parameters. Although occasionally intended, this construct may be confusing and is often caused by a typo or use of a wrong variable.\n\nThe quick-fix adds a declaration of a new variable.\n\n**Example:**\n\n\n list.forEach(s -> {\n s = s.trim();\n System.out.println(\"String: \" + s);\n });\n\nAfter the quick-fix is applied:\n\n\n list.forEach(s -> {\n String trimmed = s.trim();\n System.out.println(\"String: \" + trimmed);\n });\n\nUse the **Ignore if assignment is a transformation of the original parameter** option to ignore assignments that modify the parameter\nvalue based on its previous value.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." + "text": "Reports methods whose body contain too deeply nested statements. Methods with too deep statement nesting may be confusing and are a good sign that refactoring may be necessary. Use the Nesting depth limit field to specify the maximum allowed nesting depth for a method.", + "markdown": "Reports methods whose body contain too deeply nested statements.\n\nMethods with too deep statement\nnesting may be confusing and are a good sign that refactoring may be necessary.\n\nUse the **Nesting depth limit** field to specify the maximum allowed nesting depth for a method." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AssignmentToLambdaParameter", + "suppressToolId": "OverlyNestedMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31206,8 +31122,8 @@ "relationships": [ { "target": { - "id": "Java/Assignment issues", - "index": 86, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -31219,19 +31135,19 @@ ] }, { - "id": "SystemGetenv", + "id": "RedundantExplicitChronoField", "shortDescription": { - "text": "Call to 'System.getenv()'" + "text": "Calls of 'java.time' methods with explicit 'ChronoField' or 'ChronoUnit' arguments can be simplified" }, "fullDescription": { - "text": "Reports calls to 'System.getenv()'. Calls to 'System.getenv()' are inherently unportable.", - "markdown": "Reports calls to `System.getenv()`. Calls to `System.getenv()` are inherently unportable." + "text": "Reports 'java.time' method calls with 'java.time.temporal.ChronoField' and 'java.time.temporal.ChronoUnit' as arguments when these calls can be replaced with calls of more specific methods. Example: 'LocalTime localTime = LocalTime.now();\nint minute = localTime.get(ChronoField.MINUTE_OF_HOUR);' After the quick-fix is applied: 'LocalTime localTime = LocalTime.now();\nint minute = localTime.getMinute();' New in 2023.2", + "markdown": "Reports `java.time` method calls with `java.time.temporal.ChronoField` and `java.time.temporal.ChronoUnit` as arguments when these calls can be replaced with calls of more specific methods.\n\nExample:\n\n\n LocalTime localTime = LocalTime.now();\n int minute = localTime.get(ChronoField.MINUTE_OF_HOUR);\n\nAfter the quick-fix is applied:\n\n\n LocalTime localTime = LocalTime.now();\n int minute = localTime.getMinute();\n\nNew in 2023.2" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToSystemGetenv", + "suppressToolId": "RedundantExplicitChronoField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31239,8 +31155,8 @@ "relationships": [ { "target": { - "id": "Java/Portability", - "index": 94, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -31252,28 +31168,31 @@ ] }, { - "id": "ConstantExpression", + "id": "WriteOnlyObject", "shortDescription": { - "text": "Constant expression can be evaluated" + "text": "Write-only object" }, "fullDescription": { - "text": "Reports constant expressions, whose value can be evaluated statically, and suggests replacing them with their actual values. For example, you will be prompted to replace '2 + 2' with '4', or 'Math.sqrt(9.0)' with '3.0'. New in 2018.1", - "markdown": "Reports constant expressions, whose value can be evaluated statically, and suggests replacing them with their actual values. For example, you will be prompted to replace `2 + 2` with `4`, or `Math.sqrt(9.0)` with `3.0`.\n\nNew in 2018.1" + "text": "Reports objects that are modified but never queried. The inspection relies on the method mutation contract, which could be inferred or pre-annotated for some library methods. This inspection does not report collections, maps, and string builders, as these types are reported by other more precise inspections. Example: 'AtomicReference ref = new AtomicReference<>();\n ref.set(\"hello\"); // ref is never used again' Use the Ignore impure constructors option to control whether to process objects created by constructor or method whose purity is not known. Unchecking the option may introduce some false-positives if the object reference is intentionally leaked during the construction. New in 2021.2", + "markdown": "Reports objects that are modified but never queried.\n\nThe inspection relies on the method mutation contract, which could be inferred\nor pre-annotated for some library methods. This inspection does not report collections, maps, and string builders, as these types\nare reported by other more precise inspections.\n\nExample:\n\n\n AtomicReference ref = new AtomicReference<>();\n ref.set(\"hello\"); // ref is never used again\n\n\nUse the **Ignore impure constructors** option to control whether to process objects created by constructor or method whose purity is not known.\nUnchecking the option may introduce some false-positives if the object reference is intentionally leaked during the construction.\n**New in 2021.2**" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ConstantExpression", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "WriteOnlyObject", + "cweIds": [ + 563 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -31285,19 +31204,19 @@ ] }, { - "id": "PackageDotHtmlMayBePackageInfo", + "id": "SocketResource", "shortDescription": { - "text": "'package.html' may be converted to 'package-info.java'" + "text": "Socket opened but not safely closed" }, "fullDescription": { - "text": "Reports any 'package.html' files which are used for documenting packages. Since JDK 1.5, it is recommended that you use 'package-info.java' files instead, as such files can also contain package annotations. This way, package-info.java becomes a sole repository for package level annotations and documentation. Example: 'package.html' '\n \n Documentation example.\n \n' After the quick-fix is applied: 'package-info.java' '/**\n * Documentation example.\n */\npackage com.sample;'", - "markdown": "Reports any `package.html` files which are used for documenting packages.\n\nSince JDK 1.5, it is recommended that you use `package-info.java` files instead, as such\nfiles can also contain package annotations. This way, package-info.java becomes a\nsole repository for package level annotations and documentation.\n\nExample: `package.html`\n\n\n \n \n Documentation example.\n \n \n\nAfter the quick-fix is applied: `package-info.java`\n\n\n /**\n * Documentation example.\n */\n package com.sample;\n" + "text": "Reports socket resources that are not safely closed. Socket resources reported by this inspection include 'java.net.Socket', 'java.net.DatagramSocket', and 'java.net.ServerSocket'. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'byte[] getMessage(ServerSocket socket) throws IOException {\n Socket client = socket.accept(); //socket is not closed\n return client.getInputStream().readAllBytes();\n }' Use the following options to configure the inspection: Whether a socket 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 socket resources that are not safely closed. Socket resources reported by this inspection include `java.net.Socket`, `java.net.DatagramSocket`, and `java.net.ServerSocket`.\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 byte[] getMessage(ServerSocket socket) throws IOException {\n Socket client = socket.accept(); //socket is not closed\n return client.getInputStream().readAllBytes();\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a socket 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": "PackageDotHtmlMayBePackageInfo", + "suppressToolId": "SocketOpenedButNotSafelyClosed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31305,8 +31224,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -31318,19 +31237,19 @@ ] }, { - "id": "LongLiteralsEndingWithLowercaseL", + "id": "TypeParameterHidesVisibleType", "shortDescription": { - "text": "'long' literal ending with 'l' instead of 'L'" + "text": "Type parameter hides visible type" }, "fullDescription": { - "text": "Reports 'long' literals ending with lowercase 'l'. These literals may be confusing, as the lowercase 'l' looks very similar to a literal '1' (one). Example: 'long nights = 100l;' After the quick-fix is applied: 'long nights = 100L;'", - "markdown": "Reports `long` literals ending with lowercase 'l'. These literals may be confusing, as the lowercase 'l' looks very similar to a literal '1' (one).\n\n**Example:**\n\n\n long nights = 100l;\n\nAfter the quick-fix is applied:\n\n\n long nights = 100L;\n" + "text": "Reports type parameters that have the same names as the visible types in the current scope. Such parameter names may be confusing. Example: 'abstract class MyList extends AbstractList {\n private List elements;\n // type parameter 'T' hides type parameter 'T'\n public T[] toArray(T[] array) {\n return elements.toArray(array);\n }\n}'", + "markdown": "Reports type parameters that have the same names as the visible types in the current scope. Such parameter names may be confusing.\n\nExample:\n\n\n abstract class MyList extends AbstractList {\n private List elements;\n // type parameter 'T' hides type parameter 'T'\n public T[] toArray(T[] array) {\n return elements.toArray(array);\n }\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "LongLiteralEndingWithLowercaseL", + "suppressToolId": "TypeParameterHidesVisibleType", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31338,8 +31257,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -31351,19 +31270,19 @@ ] }, { - "id": "RedundantArrayCreation", + "id": "MaskedAssertion", "shortDescription": { - "text": "Redundant array creation" + "text": "Assertion is suppressed by 'catch'" }, "fullDescription": { - "text": "Reports arrays that are created specifically to be passed as a varargs parameter. Example: 'Arrays.asList(new String[]{\"Hello\", \"world\"})' The quick-fix replaces the array initializer with individual arguments: 'Arrays.asList(\"Hello\", \"world\")'", - "markdown": "Reports arrays that are created specifically to be passed as a varargs parameter.\n\nExample:\n\n`Arrays.asList(new String[]{\"Hello\", \"world\"})`\n\nThe quick-fix replaces the array initializer with individual arguments:\n\n`Arrays.asList(\"Hello\", \"world\")`" + "text": "Reports 'assert' statements and test framework assertions that are suppressed by a surrounding catch block. Such assertions will never fail, as the thrown 'AssertionError' will be caught and silently ignored. Example 1: 'void javaAssertion() {\n try {\n ...\n assert 1 == 2;\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }' Example 2: '@Test\n void testWithAssertJ() {\n try {\n ...\n assertThat(1).as(\"test\").isEqualTo(2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }' Example 3: '@Test\n void testWithJunit() {\n try {\n ...\n assertEquals(1, 2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }' New in 2020.3", + "markdown": "Reports `assert` statements and test framework assertions that are suppressed by a surrounding catch block. Such assertions will never fail, as the thrown `AssertionError` will be caught and silently ignored.\n\n**Example 1:**\n\n\n void javaAssertion() {\n try {\n ...\n assert 1 == 2;\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }\n\n**Example 2:**\n\n\n @Test\n void testWithAssertJ() {\n try {\n ...\n assertThat(1).as(\"test\").isEqualTo(2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }\n\n**Example 3:**\n\n\n @Test\n void testWithJunit() {\n try {\n ...\n assertEquals(1, 2);\n } catch (AssertionError e) {\n // the assertion is silently ignored\n }\n }\n\nNew in 2020.3" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantArrayCreation", + "suppressToolId": "MaskedAssertion", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31371,8 +31290,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Test frameworks", + "index": 130, "toolComponent": { "name": "QDJVM" } @@ -31384,23 +31303,19 @@ ] }, { - "id": "NonShortCircuitBoolean", + "id": "StringTokenizerDelimiter", "shortDescription": { - "text": "Non-short-circuit boolean expression" + "text": "Duplicated delimiters in 'StringTokenizer'" }, "fullDescription": { - "text": "Reports usages of the non-short-circuit forms of boolean 'and' and 'or' ('&', '|', '&=' and '|='). Although the non-short-circuit versions are occasionally useful, in most cases the short-circuit forms ('&&' and '||') are intended and such unintentional usages may lead to subtle bugs. A quick-fix is suggested to use the short-circuit versions. Example: 'void foo(boolean x, boolean y, boolean z) {\n if (x | y) { x |= z; }\n }' After the quick-fix is applied: 'void foo(boolean x, boolean y) {\n if (x || y) { x = x || z; }\n }'", - "markdown": "Reports usages of the non-short-circuit forms of boolean 'and' and 'or' (`&`, `|`, `&=` and `|=`). Although the non-short-circuit versions are occasionally useful, in most cases the short-circuit forms (`&&` and `||`) are intended and such unintentional usages may lead to subtle bugs.\n\n\nA quick-fix is suggested to use the short-circuit versions.\n\n**Example:**\n\n\n void foo(boolean x, boolean y, boolean z) {\n if (x | y) { x |= z; }\n }\n\nAfter the quick-fix is applied:\n\n\n void foo(boolean x, boolean y) {\n if (x || y) { x = x || z; }\n }\n" + "text": "Reports 'StringTokenizer()' constructor calls or 'nextToken()' method calls that contain duplicate characters in the delimiter argument. Example: 'void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }' After the quick-fix is applied: 'void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }'", + "markdown": "Reports `StringTokenizer()` constructor calls or `nextToken()` method calls that contain duplicate characters in the delimiter argument.\n\n**Example:**\n\n\n void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void printTokens(String text) {\n StringTokenizer tokenizer = new StringTokenizer(text, \"\\n\");\n while (tokenizer.hasMoreTokens()) {\n System.out.println(tokenizer.nextToken());\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NonShortCircuitBooleanExpression", - "cweIds": [ - 480, - 691 - ], + "suppressToolId": "StringTokenizerDelimiter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31421,19 +31336,19 @@ ] }, { - "id": "ThrowablePrintedToSystemOut", + "id": "ReflectionForUnavailableAnnotation", "shortDescription": { - "text": "'Throwable' printed to 'System.out'" + "text": "Reflective access to a source-only annotation" }, "fullDescription": { - "text": "Reports calls to 'System.out.println()' with an exception as an argument. Using print statements for logging exceptions hides the stack trace from you, which can complicate the investigation of the problem. It is recommended that you use logger instead. Calls to 'System.out.print()', 'System.err.println()', and 'System.err.print()' with an exception argument are also reported. It is better to use a logger to log exceptions instead. The provided quick-fix supports SLF4J and Log4j 2. It replaces 'System.out.println()' call with log calls Example: 'try {\n foo();\n } catch (Exception e) {\n System.out.println(e);\n }' After the quick-fix is applied: 'try {\n foo();\n } catch (Exception e) {\n log.error(\"e: \", e);\n }' Use the Log method for fix option to specify a method which it is used to log a message.", - "markdown": "Reports calls to `System.out.println()` with an exception as an argument.\n\nUsing print statements for logging exceptions hides the stack trace from you, which can complicate the investigation of the problem.\nIt is recommended that you use logger instead.\n\nCalls to `System.out.print()`, `System.err.println()`, and `System.err.print()` with an exception argument are also\nreported. It is better to use a logger to log exceptions instead.\n\nThe provided quick-fix supports **SLF4J** and **Log4j 2** .\nIt replaces `System.out.println()` call with log calls\n\n**Example:**\n\n\n try {\n foo();\n } catch (Exception e) {\n System.out.println(e);\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n foo();\n } catch (Exception e) {\n log.error(\"e: \", e);\n }\n\n\nUse the **Log method for fix** option to specify a method which it is used to log a message." + "text": "Reports attempts to reflectively check for the presence of a non-runtime annotation. Using 'Class.isAnnotationPresent()' to test for an annotation whose retention policy is set to 'SOURCE' or 'CLASS' (the default) will always have a negative result. This mistake is easy to overlook. Example: '{\n getClass().isAnnotationPresent(SourceAnnotation.class); //always false\n }\n\n @Retention(RetentionPolicy.SOURCE)\n @interface SourceAnnotation {}' This inspection depends on the Java feature 'Annotations', which is available since Java 5.", + "markdown": "Reports attempts to reflectively check for the presence of a non-runtime annotation.\n\nUsing `Class.isAnnotationPresent()` to test for an annotation\nwhose retention policy is set to `SOURCE` or `CLASS`\n(the default) will always have a negative result. This mistake is easy to overlook.\n\n**Example:**\n\n\n {\n getClass().isAnnotationPresent(SourceAnnotation.class); //always false\n }\n\n @Retention(RetentionPolicy.SOURCE)\n @interface SourceAnnotation {}\n\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ThrowablePrintedToSystemOut", + "suppressToolId": "ReflectionForUnavailableAnnotation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31441,8 +31356,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -31454,19 +31369,19 @@ ] }, { - "id": "RedundantRecordConstructor", + "id": "InstantiatingObjectToGetClassObject", "shortDescription": { - "text": "Redundant record constructor" + "text": "Instantiating object to get 'Class' object" }, "fullDescription": { - "text": "Reports redundant constructors declared inside Java records. Example 1: 'record Point(int x, int y) {\n public Point {} // could be removed\n }\n \n record Point(int x, int y) {\n public Point(int x, int y) { // could be removed\n this.x = x;\n this.y = y;\n }\n }' The quick-fix removes the redundant constructors. Example 2: '// could be converted to compact constructor\n record Range(int from, int to) {\n public Range(int from, int to) {\n if (from > to) throw new IllegalArgumentException();\n this.from = from;\n this.to = to;\n }\n }' The quick-fix converts this code into a compact constructor. This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.1", - "markdown": "Reports redundant constructors declared inside Java records.\n\n**Example 1:**\n\n\n record Point(int x, int y) {\n public Point {} // could be removed\n }\n \n record Point(int x, int y) {\n public Point(int x, int y) { // could be removed\n this.x = x;\n this.y = y;\n }\n }\n\nThe quick-fix removes the redundant constructors.\n\n**Example 2:**\n\n\n // could be converted to compact constructor\n record Range(int from, int to) {\n public Range(int from, int to) {\n if (from > to) throw new IllegalArgumentException();\n this.from = from;\n this.to = to;\n }\n }\n\nThe quick-fix converts this code into a compact constructor.\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.1" + "text": "Reports code that instantiates a class to get its class object. It is more performant to access the class object directly by name. Example: 'Class c = new Sample().getClass();' After the quick-fix is applied: 'Class c = Sample.class;'", + "markdown": "Reports code that instantiates a class to get its class object.\n\nIt is more performant to access the class object\ndirectly by name.\n\n**Example:**\n\n\n Class c = new Sample().getClass();\n\nAfter the quick-fix is applied:\n\n\n Class c = Sample.class;\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantRecordConstructor", + "suppressToolId": "InstantiatingObjectToGetClassObject", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31474,8 +31389,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -31487,19 +31402,19 @@ ] }, { - "id": "AmbiguousMethodCall", + "id": "ShiftOutOfRange", "shortDescription": { - "text": "Call to inherited method looks like call to local method" + "text": "Shift operation by inappropriate constant" }, "fullDescription": { - "text": "Reports calls to a superclass method from an anonymous, inner or local class, if a method with the same signature exists in the code surrounding the class. In this case it may seem that a method from the surrounding code is called, when in fact it is a call to a method from the superclass. To clarify the intent of the code, it is recommended to add an explicit 'super' qualifier to the method call. Example: 'class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n ambiguous(); //warning\n }\n }\n }' After the quick-fix is applied: 'class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n super.ambiguous();\n }\n }\n }'", - "markdown": "Reports calls to a superclass method from an anonymous, inner or local class, if a method with the same signature exists in the code surrounding the class. In this case it may seem that a method from the surrounding code is called, when in fact it is a call to a method from the superclass.\n\n\nTo clarify the intent of the code, it is recommended to add an explicit\n`super` qualifier to the method call.\n\n**Example:**\n\n\n class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n ambiguous(); //warning\n }\n }\n }\n \nAfter the quick-fix is applied:\n\n\n class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n super.ambiguous();\n }\n }\n }\n" + "text": "Reports shift operations where the shift value is a constant outside the reasonable range. Integer shift operations outside the range '0..31' and long shift operations outside the range '0..63' are reported. Shifting by negative or overly large values is almost certainly a coding error. Example: 'int shiftSize = 32;\n // Warning: shift by 32 bits is equivalent to shift by 0 bits, so there's no shift at all.\n int mask = (1 << shiftSize) - 1;'", + "markdown": "Reports shift operations where the shift value is a constant outside the reasonable range.\n\nInteger shift operations outside the range `0..31` and long shift operations outside the\nrange `0..63` are reported. Shifting by negative or overly large values is almost certainly\na coding error.\n\n**Example:**\n\n\n int shiftSize = 32;\n // Warning: shift by 32 bits is equivalent to shift by 0 bits, so there's no shift at all.\n int mask = (1 << shiftSize) - 1;\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AmbiguousMethodCall", + "suppressToolId": "ShiftOutOfRange", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31507,8 +31422,8 @@ "relationships": [ { "target": { - "id": "Java/Visibility", - "index": 98, + "id": "Java/Bitwise operation issues", + "index": 199, "toolComponent": { "name": "QDJVM" } @@ -31520,19 +31435,19 @@ ] }, { - "id": "StaticInheritance", + "id": "ClassWithMultipleLoggers", "shortDescription": { - "text": "Static inheritance" + "text": "Class with multiple loggers" }, "fullDescription": { - "text": "Reports interfaces that are implemented only to provide access to constants. This kind of inheritance is often confusing and may hide important dependency information.", - "markdown": "Reports interfaces that are implemented only to provide access to constants. This kind of inheritance is often confusing and may hide important dependency information." + "text": "Reports classes that have multiple loggers declared. Ensuring that every class has a single dedicated logger is an important step in providing a unified logging implementation for an application. For example: 'public class Critical {\n protected static final Logger LOG = Logger.getLogger(Critical.class);\n\n protected static final Logger myLogger = Logger.getLogger(getClass());\n }' Use the table below to specify Logger class names. Classes which declare multiple fields that have the type of one of the specified classes will be reported by this inspection.", + "markdown": "Reports classes that have multiple loggers declared. Ensuring that every class has a single dedicated logger is an important step in providing a unified logging implementation for an application.\n\nFor example:\n\n\n public class Critical {\n protected static final Logger LOG = Logger.getLogger(Critical.class);\n\n protected static final Logger myLogger = Logger.getLogger(getClass());\n }\n\n\nUse the table below to specify Logger class names.\nClasses which declare multiple fields that have the type of one of the specified classes will be reported by this inspection." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StaticInheritance", + "suppressToolId": "ClassWithMultipleLoggers", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31540,8 +31455,8 @@ "relationships": [ { "target": { - "id": "Java/Inheritance issues", - "index": 151, + "id": "Java/Logging", + "index": 119, "toolComponent": { "name": "QDJVM" } @@ -31553,19 +31468,19 @@ ] }, { - "id": "RedundantUnmodifiable", + "id": "ThreadRun", "shortDescription": { - "text": "Redundant usage of unmodifiable collection wrappers" + "text": "Call to 'Thread.run()'" }, "fullDescription": { - "text": "Reports redundant calls to unmodifiable collection wrappers from the 'Collections' class. If the argument that is passed to an unmodifiable collection wrapper is already immutable, such a wrapping becomes redundant. Example: 'List x = Collections.unmodifiableList(Collections.singletonList(\"abc\"));' After the quick-fix is applied: 'List x = Collections.singletonList(\"abc\");' In order to detect the methods that return unmodifiable collections, the inspection uses the 'org.jetbrains.annotations.Unmodifiable' and 'org.jetbrains.annotations.UnmodifiableView' annotations. Use them to extend the inspection to your own unmodifiable collection wrappers. New in 2020.3", - "markdown": "Reports redundant calls to unmodifiable collection wrappers from the `Collections` class.\n\nIf the argument that is passed to an unmodifiable\ncollection wrapper is already immutable, such a wrapping becomes redundant.\n\nExample:\n\n\n List x = Collections.unmodifiableList(Collections.singletonList(\"abc\"));\n\nAfter the quick-fix is applied:\n\n\n List x = Collections.singletonList(\"abc\");\n\nIn order to detect the methods that return unmodifiable collections, the\ninspection uses the `org.jetbrains.annotations.Unmodifiable`\nand `org.jetbrains.annotations.UnmodifiableView` annotations.\nUse them to extend the inspection to your own unmodifiable collection\nwrappers.\n\nNew in 2020.3" + "text": "Reports calls to 'run()' on 'java.lang.Thread' or any of its subclasses. While occasionally intended, this is usually a mistake, because 'run()' doesn't start a new thread. To execute the code in a separate thread, 'start()' should be used.", + "markdown": "Reports calls to `run()` on `java.lang.Thread` or any of its subclasses.\n\n\nWhile occasionally intended, this is usually a mistake, because `run()` doesn't start a new thread.\nTo execute the code in a separate thread, `start()` should be used." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantUnmodifiable", + "suppressToolId": "CallToThreadRun", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31573,8 +31488,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -31586,23 +31501,19 @@ ] }, { - "id": "ConstantValue", + "id": "ExtendsThrowable", "shortDescription": { - "text": "Constant values" + "text": "Class directly extends 'Throwable'" }, "fullDescription": { - "text": "Reports expressions and conditions that always produce the same result, like true, false, null, or zero. Such expressions could be replaced with the corresponding constant value. Very often though they signal about a bug in the code. Examples: '// always true\n // root cause: || is used instead of &&\n if (x > 0 || x < 10) {}\n\n System.out.println(str.trim());\n // always false\n // root cause: variable was dereferenced before null-check\n if (str == null) {}' The inspection behavior may be controlled by a number of annotations, such as nullability annotations, '@Contract' annotation, '@Range' annotation and so on. Configure the inspection: Use the Don't report assertions with condition statically proven to be always true option to avoid reporting assertions that were statically proven to be always true. This also includes conditions like 'if (alwaysFalseCondition) throw new IllegalArgumentException();'. Use the Ignore assert statements option to control how the inspection treats 'assert' statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode). Use the Warn when constant is stored in variable option to display warnings when variable is used, whose value is known to be a constant. Before IntelliJ IDEA 2022.3, this inspection was part of \"Constant Conditions & Exceptions\" inspection. Now, it split into two inspections: \"Constant Values\" and \"Nullability and data flow problems\".", - "markdown": "Reports expressions and conditions that always produce the same result, like true, false, null, or zero. Such expressions could be replaced with the corresponding constant value. Very often though they signal about a bug in the code.\n\nExamples:\n\n // always true\n // root cause: || is used instead of &&\n if (x > 0 || x < 10) {}\n\n System.out.println(str.trim());\n // always false\n // root cause: variable was dereferenced before null-check\n if (str == null) {}\n\n\nThe inspection behavior may be controlled by a number of annotations, such as\n[nullability](https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html) annotations,\n[@Contract](https://www.jetbrains.com/help/idea/contract-annotations.html) annotation,\n`@Range` annotation and so on.\n\nConfigure the inspection:\n\n* Use the **Don't report assertions with condition statically proven to be always true** option to avoid reporting assertions that were statically proven to be always true. This also includes conditions like `if (alwaysFalseCondition) throw new IllegalArgumentException();`.\n* Use the **Ignore assert statements** option to control how the inspection treats `assert` statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode).\n* Use the **Warn when constant is stored in variable** option to display warnings when variable is used, whose value is known to be a constant.\n\n\nBefore IntelliJ IDEA 2022.3, this inspection was part of \"Constant Conditions \\& Exceptions\" inspection. Now, it split into two inspections:\n\"Constant Values\" and \"Nullability and data flow problems\"." + "text": "Reports classes that directly extend 'java.lang.Throwable'. Extending 'java.lang.Throwable' directly is generally considered bad practice. It is usually enough to extend 'java.lang.RuntimeException', 'java.lang.Exception', or - in special cases - 'java.lang.Error'. Example: 'class EnigmaThrowable extends Throwable {} // warning: Class 'EnigmaThrowable' directly extends 'java.lang.Throwable''", + "markdown": "Reports classes that directly extend `java.lang.Throwable`.\n\nExtending `java.lang.Throwable` directly is generally considered bad practice.\nIt is usually enough to extend `java.lang.RuntimeException`, `java.lang.Exception`, or - in special\ncases - `java.lang.Error`.\n\n**Example:**\n\n\n class EnigmaThrowable extends Throwable {} // warning: Class 'EnigmaThrowable' directly extends 'java.lang.Throwable'\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConstantValue", - "cweIds": [ - 570, - 571 - ], + "suppressToolId": "ExtendsThrowable", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31610,8 +31521,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -31623,28 +31534,28 @@ ] }, { - "id": "CastCanBeReplacedWithVariable", + "id": "AutoBoxing", "shortDescription": { - "text": "Cast can be replaced with variable" + "text": "Auto-boxing" }, "fullDescription": { - "text": "Reports type cast operations that can be replaced with existing local or pattern variables with the same value. Example: 'void foo(Object obj) {\n String s = (String) obj;\n System.out.println(((String) obj).trim());\n }' After the quick-fix is applied: 'void foo(Object obj) {\n String s = (String) obj;\n System.out.println(s.trim());\n }' New in 2022.3", - "markdown": "Reports type cast operations that can be replaced with existing local or pattern variables with the same value.\n\nExample:\n\n\n void foo(Object obj) {\n String s = (String) obj;\n System.out.println(((String) obj).trim());\n }\n\nAfter the quick-fix is applied:\n\n\n void foo(Object obj) {\n String s = (String) obj;\n System.out.println(s.trim());\n }\n\nNew in 2022.3" + "text": "Reports expressions that are affected by autoboxing conversion (automatic wrapping of primitive values as objects). Try not to use objects instead of primitives. It might significantly affect performance. Example: 'Integer x = 42;' The quick-fix makes the conversion explicit: 'Integer x = Integer.valueOf(42);' AutoBoxing appeared in Java 5. This inspection can help to downgrade for backward compatibility with earlier Java versions.", + "markdown": "Reports expressions that are affected by autoboxing conversion (automatic wrapping of primitive values as objects). Try not to use objects instead of primitives. It might significantly affect performance.\n\n**Example:**\n\n Integer x = 42;\n\nThe quick-fix makes the conversion explicit:\n\n Integer x = Integer.valueOf(42);\n\n\n*AutoBoxing* appeared in Java 5.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "CastCanBeReplacedWithVariable", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "AutoBoxing", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -31656,19 +31567,19 @@ ] }, { - "id": "Convert2Diamond", + "id": "InterfaceNeverImplemented", "shortDescription": { - "text": "Explicit type can be replaced with '<>'" + "text": "Interface which has no concrete subclass" }, "fullDescription": { - "text": "Reports 'new' expressions with type arguments that can be replaced a with diamond type '<>'. Example: 'List list = new ArrayList(); // reports array list type argument' After the quick-fix is applied: 'List list = new ArrayList<>();' This inspection depends on the Java feature 'Diamond types', which is available since Java 7.", - "markdown": "Reports `new` expressions with type arguments that can be replaced a with diamond type `<>`.\n\nExample:\n\n\n List list = new ArrayList(); // reports array list type argument\n\nAfter the quick-fix is applied:\n\n\n List list = new ArrayList<>();\n\nThis inspection depends on the Java feature 'Diamond types', which is available since Java 7." + "text": "Reports interfaces that have no concrete subclasses. Configure the inspection: Use the list below to add annotations. Interfaces declared with one of these annotations will be ignored by the inspection. Use the checkbox below to ignore interfaces that only declare constant fields. Such interfaces may still be usable even without implementations.", + "markdown": "Reports interfaces that have no concrete subclasses.\n\nConfigure the inspection:\n\n* Use the list below to add annotations. Interfaces declared with one of these annotations will be ignored by the inspection.\n* Use the checkbox below to ignore interfaces that only declare constant fields. Such interfaces may still be usable even without implementations." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "Convert2Diamond", + "suppressToolId": "InterfaceNeverImplemented", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31676,8 +31587,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 7", - "index": 161, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -31689,28 +31600,28 @@ ] }, { - "id": "VarargParameter", + "id": "ThreadDeathRethrown", "shortDescription": { - "text": "Varargs method" + "text": "'ThreadDeath' not rethrown" }, "fullDescription": { - "text": "Reports methods that accept an arbitrary number of parameters (also known as varargs methods). Example: 'enum EnumConstants {\n A(null), B, C;\n\n EnumConstants(String... ss) {}\n}' A quick-fix is available to replace a variable argument parameter with an equivalent array parameter. Relevant arguments in method calls are wrapped in an array initializer expression. After the quick-fix is applied: 'enum EnumConstants {\n A(null), B(new String[]{}), C(new String[]{});\n\n EnumConstants(String[] ss) {}\n}' Varargs method appeared in Java 5. This inspection can help to downgrade for backward compatibility with earlier Java versions.", - "markdown": "Reports methods that accept an arbitrary number of parameters (also known as varargs methods).\n\n**Example:**\n\n\n enum EnumConstants {\n A(null), B, C;\n\n EnumConstants(String... ss) {}\n }\n\nA quick-fix is available to replace a variable argument\nparameter with an equivalent array parameter. Relevant arguments in method calls are wrapped in an array initializer expression.\nAfter the quick-fix is applied:\n\n\n enum EnumConstants {\n A(null), B(new String[]{}), C(new String[]{});\n\n EnumConstants(String[] ss) {}\n }\n\n\n*Varargs method* appeared in Java 5.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions." + "text": "Reports 'try' statements that catch 'java.lang.ThreadDeath' and do not rethrow the exception. Example: 'try {\n executeInParallel(request);\n } catch (ThreadDeath ex) { // warning: ThreadDeath 'ex' not rethrown\n return false;\n }'", + "markdown": "Reports `try` statements that catch `java.lang.ThreadDeath` and do not rethrow the exception.\n\n**Example:**\n\n\n try {\n executeInParallel(request);\n } catch (ThreadDeath ex) { // warning: ThreadDeath 'ex' not rethrown\n return false;\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "VariableArgumentMethod", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ThreadDeathNotRethrown", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Java language level issues", - "index": 147, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -31722,19 +31633,19 @@ ] }, { - "id": "ArrayLengthInLoopCondition", + "id": "CloneCallsConstructors", "shortDescription": { - "text": "Array.length in loop condition" + "text": "'clone()' instantiates objects with constructor" }, "fullDescription": { - "text": "Reports accesses to the '.length' property of an array in the condition part of a loop statement. In highly resource constrained environments, such calls may have adverse performance implications. 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 foo(Object[] x) {\n for (int i = 0; i < x.length; i++) { /**/ }\n }'", - "markdown": "Reports accesses to the `.length` property of an array in the condition part of a loop statement. In highly resource constrained environments, such calls may have adverse performance implications.\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 foo(Object[] x) {\n for (int i = 0; i < x.length; i++) { /**/ }\n }\n" + "text": "Reports calls to object constructors inside 'clone()' methods. It is considered good practice to call 'clone()' to instantiate objects inside of a 'clone()' method instead of creating them directly to support later subclassing. This inspection will not report 'clone()' methods declared as 'final' or 'clone()' methods on 'final' classes.", + "markdown": "Reports calls to object constructors inside `clone()` methods.\n\nIt is considered good practice to call `clone()` to instantiate objects inside of a `clone()` method\ninstead of creating them directly to support later subclassing.\nThis inspection will not report\n`clone()` methods declared as `final`\nor `clone()` methods on `final` classes." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ArrayLengthInLoopCondition", + "suppressToolId": "CloneCallsConstructors", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31742,8 +31653,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Cloning issues", + "index": 116, "toolComponent": { "name": "QDJVM" } @@ -31755,19 +31666,19 @@ ] }, { - "id": "CheckForOutOfMemoryOnLargeArrayAllocation", + "id": "UnnecessaryModuleDependencyInspection", "shortDescription": { - "text": "Large array allocation with no OutOfMemoryError check" + "text": "Unnecessary module dependency" }, "fullDescription": { - "text": "Reports large array allocations which do not check for 'java.lang.OutOfMemoryError'. In memory constrained environments, allocations of large data objects should probably be checked for memory depletion. 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. Use the option to specify the maximum number of elements to allow in unchecked array allocations.", - "markdown": "Reports large array allocations which do not check for `java.lang.OutOfMemoryError`. In memory constrained environments, allocations of large data objects should probably be checked for memory depletion.\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\nUse the option to specify the maximum number of elements to allow in unchecked array allocations." + "text": "Reports dependencies on modules that are not used. The quick-fix safely removes such unused dependencies.", + "markdown": "Reports dependencies on modules that are not used. The quick-fix safely removes such unused dependencies." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CheckForOutOfMemoryOnLargeArrayAllocation", + "suppressToolId": "UnnecessaryModuleDependencyInspection", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31775,8 +31686,8 @@ "relationships": [ { "target": { - "id": "Java/Performance/Embedded", - "index": 171, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -31788,19 +31699,19 @@ ] }, { - "id": "ClassWithoutConstructor", + "id": "ArraysAsListWithZeroOrOneArgument", "shortDescription": { - "text": "Class without constructor" + "text": "Call to 'Arrays.asList()' with too few arguments" }, "fullDescription": { - "text": "Reports classes without constructors. Some coding standards prohibit such classes.", - "markdown": "Reports classes without constructors.\n\nSome coding standards prohibit such classes." + "text": "Reports calls to 'Arrays.asList()' with at most one argument. Such calls could be replaced with 'Collections.singletonList()', 'Collections.emptyList()', or 'List.of()' on JDK 9 and later, which will save some memory. In particular, 'Collections.emptyList()' and 'List.of()' with no arguments always return a shared instance, while 'Arrays.asList()' with no arguments creates a new object every time it's called. Note: the lists returned by 'Collections.singletonList()' and 'List.of()' are immutable, while the list returned 'Arrays.asList()' allows calling the 'set()' method. This may break the code in rare cases. Example: 'List empty = Arrays.asList();\n List one = Arrays.asList(\"one\");' After the quick-fix is applied: 'List empty = Collections.emptyList();\n List one = Collections.singletonList(\"one\");'", + "markdown": "Reports calls to `Arrays.asList()` with at most one argument.\n\n\nSuch calls could be replaced\nwith `Collections.singletonList()`, `Collections.emptyList()`,\nor `List.of()` on JDK 9 and later, which will save some memory.\n\nIn particular, `Collections.emptyList()` and `List.of()` with no arguments\nalways return a shared instance,\nwhile `Arrays.asList()` with no arguments creates a new object every time it's called.\n\nNote: the lists returned by `Collections.singletonList()` and `List.of()` are immutable,\nwhile the list returned `Arrays.asList()` allows calling the `set()` method.\nThis may break the code in rare cases.\n\n**Example:**\n\n\n List empty = Arrays.asList();\n List one = Arrays.asList(\"one\");\n\nAfter the quick-fix is applied:\n\n\n List empty = Collections.emptyList();\n List one = Collections.singletonList(\"one\");\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassWithoutConstructor", + "suppressToolId": "ArraysAsListWithZeroOrOneArgument", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31808,8 +31719,8 @@ "relationships": [ { "target": { - "id": "Java/JavaBeans issues", - "index": 141, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -31821,19 +31732,19 @@ ] }, { - "id": "PackageInfoWithoutPackage", + "id": "UnstableApiUsage", "shortDescription": { - "text": "'package-info.java' without 'package' statement" + "text": "Unstable API Usage" }, "fullDescription": { - "text": "Reports 'package-info.java' files without a 'package' statement. The Javadoc tool considers such files documentation for the default package even when the file is located somewhere else.", - "markdown": "Reports `package-info.java` files without a `package` statement.\n\n\nThe Javadoc tool considers such files documentation for the default package even when the file is located somewhere else." + "text": "Reports usages of an API marked with one of the annotations as unstable. Such an API may be changed or removed in future versions, breaking the code that uses it. The annotations which are used to mark unstable APIs are shown in the list below. By default, the inspection ignores usages of unstable APIs if their declarations are located in sources of the same project. In such cases it'll be possible to update the usages when you change APIs. However, it may be inconvenient if the project is big, so one can switch off the Ignore API declared in this project option to report the usages of unstable APIs declared in both the project sources and libraries.", + "markdown": "Reports usages of an API marked with one of the annotations as unstable. Such an API may be changed or removed in future versions, breaking the code that uses it.\n\nThe annotations which are used to mark unstable APIs are shown in the list below.\n\nBy default, the inspection ignores usages of unstable APIs\nif their declarations are located in sources of the same project. In such cases it'll be possible to update the usages when you change APIs.\nHowever, it may be inconvenient if the project is big, so one can switch off the **Ignore API declared in this project** option to report\nthe usages of unstable APIs declared in both the project sources and libraries." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PackageInfoWithoutPackage", + "suppressToolId": "UnstableApiUsage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31841,8 +31752,8 @@ "relationships": [ { "target": { - "id": "Java/Javadoc", - "index": 77, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -31854,19 +31765,19 @@ ] }, { - "id": "NonSerializableWithSerializationMethods", + "id": "LambdaUnfriendlyMethodOverload", "shortDescription": { - "text": "Non-serializable class with 'readObject()' or 'writeObject()'" + "text": "Lambda-unfriendly method overload" }, "fullDescription": { - "text": "Reports non-'Serializable' classes that define 'readObject()' or 'writeObject()' methods. Such methods in that context normally indicate an error. Example: 'public class SampleClass {\n private void readObject(ObjectInputStream str) {}\n private void writeObject(ObjectOutputStream str) {}\n }'", - "markdown": "Reports non-`Serializable` classes that define `readObject()` or `writeObject()` methods. Such methods in that context normally indicate an error.\n\n**Example:**\n\n\n public class SampleClass {\n private void readObject(ObjectInputStream str) {}\n private void writeObject(ObjectOutputStream str) {}\n }\n" + "text": "Reports overloaded methods that take functional interfaces with conflicting abstract method signatures. Such overloads introduce ambiguity and require callers to cast lambdas to a specific type or specify lambda parameter types explicitly. It is preferable to give the overloaded methods different names to eliminate ambiguity. Example: 'interface MyExecutor {\n void execute(Supplier supplier);\n void execute(Callable callable);\n }' Here, 'Supplier' and 'Callable' are functional interfaces whose single abstract methods do not take any parameters and return a non-void value. As a result, the type of the lambda cannot be inferred at the call site unless an explicit cast is used.", + "markdown": "Reports overloaded methods that take functional interfaces with conflicting abstract method signatures.\n\nSuch overloads introduce ambiguity and require callers to cast lambdas to a specific type or specify lambda parameter types explicitly.\nIt is preferable to give the overloaded methods different names to eliminate ambiguity.\n\nExample:\n\n\n interface MyExecutor {\n void execute(Supplier supplier);\n void execute(Callable callable);\n }\n\n\nHere, `Supplier` and `Callable` are functional interfaces\nwhose single abstract methods do not take any parameters and return a non-void value.\nAs a result, the type of the lambda cannot be inferred at the call site unless an explicit cast is used." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonSerializableClassWithSerializationMethods", + "suppressToolId": "LambdaUnfriendlyMethodOverload", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31874,8 +31785,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -31887,19 +31798,19 @@ ] }, { - "id": "CloneReturnsClassType", + "id": "SerializableRecordContainsIgnoredMembers", "shortDescription": { - "text": "'clone()' should have return type equal to the class it contains" + "text": "'record' contains ignored members" }, "fullDescription": { - "text": "Reports 'clone()' methods with return types different from the class they're located in. Often a 'clone()' method will have a return type of 'java.lang.Object', which makes it harder to use by its clients. Effective Java (the second and third editions) recommends making the return type of the 'clone()' method the same as the class type of the object it returns. Example: 'class Foo implements Cloneable {\n public Object clone() {\n try {\n return super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }' After the quick-fix is applied: 'class Foo implements Cloneable {\n public Foo clone() {\n try {\n return (Foo)super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }'", - "markdown": "Reports `clone()` methods with return types different from the class they're located in.\n\nOften a `clone()` method will have a return type of `java.lang.Object`, which makes it harder to use by its clients.\n*Effective Java* (the second and third editions) recommends making the return type of the `clone()` method the same as the\nclass type of the object it returns.\n\n**Example:**\n\n\n class Foo implements Cloneable {\n public Object clone() {\n try {\n return super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo implements Cloneable {\n public Foo clone() {\n try {\n return (Foo)super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }\n" + "text": "Reports serialization methods or fields defined in a 'record' class. Serialization methods include 'writeObject()', 'readObject()', 'readObjectNoData()', 'writeExternal()', and 'readExternal()' and the field 'serialPersistentFields'. These members are not used for the serialization or deserialization of records and therefore unnecessary. Examples: 'record R1() implements Serializable {\n // The field is ignored during record serialization\n @Serial\n private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];\n\n // The method is ignored during record serialization\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }' 'record R2() implements Externalizable {\n // The method is ignored during record serialization\n @Override\n public void writeExternal(ObjectOutput out) throws IOException {\n }\n\n // The method is ignored during record serialization\n @Override\n public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {\n }\n }' This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.3", + "markdown": "Reports serialization methods or fields defined in a `record` class. Serialization methods include `writeObject()`, `readObject()`, `readObjectNoData()`, `writeExternal()`, and `readExternal()` and the field `serialPersistentFields`. These members are not used for the serialization or deserialization of records and therefore unnecessary.\n\n**Examples:**\n\n\n record R1() implements Serializable {\n // The field is ignored during record serialization\n @Serial\n private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];\n\n // The method is ignored during record serialization\n @Serial\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\n\n record R2() implements Externalizable {\n // The method is ignored during record serialization\n @Override\n public void writeExternal(ObjectOutput out) throws IOException {\n }\n\n // The method is ignored during record serialization\n @Override\n public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {\n }\n }\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.3" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CloneReturnsClassType", + "suppressToolId": "SerializableRecordContainsIgnoredMembers", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -31907,8 +31818,8 @@ "relationships": [ { "target": { - "id": "Java/Cloning issues", - "index": 116, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -31920,19 +31831,19 @@ ] }, { - "id": "OptionalToIf", + "id": "UnnecessarilyQualifiedInnerClassAccess", "shortDescription": { - "text": "'Optional' can be replaced with sequence of 'if' statements" + "text": "Unnecessarily qualified inner class access" }, "fullDescription": { - "text": "Reports 'Optional' call chains that can be replaced with a sequence of 'if' statements. Example: 'return Optional.ofNullable(name)\n .map(this::extractInitials)\n .map(initials -> initials.toUpperCase(Locale.ENGLISH))\n .orElseGet(this::getDefault);' After the quick-fix is applied: 'if (name != null) {\n String initials = extractInitials(name);\n if (initials != null) return initials.toUpperCase(Locale.ENGLISH);\n }\n return getDefault();' This inspection can help to downgrade for backward compatibility with earlier Java versions. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2020.2", - "markdown": "Reports `Optional` call chains that can be replaced with a sequence of `if` statements.\n\nExample:\n\n\n return Optional.ofNullable(name)\n .map(this::extractInitials)\n .map(initials -> initials.toUpperCase(Locale.ENGLISH))\n .orElseGet(this::getDefault);\n\nAfter the quick-fix is applied:\n\n\n if (name != null) {\n String initials = extractInitials(name);\n if (initials != null) return initials.toUpperCase(Locale.ENGLISH);\n }\n return getDefault();\n\n\nThis inspection can help to downgrade for backward compatibility with earlier Java versions.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2020.2" + "text": "Reports any references to inner classes that are unnecessarily qualified with the name of the enclosing class. Such a qualification can be safely removed, which sometimes adds an import for the inner class. Example: 'class X {\n X.Y foo;\n class Y{}\n }' After the quick-fix is applied: 'class X {\n Y foo;\n class Y{}\n }' Use the Ignore references for which an import is needed option to ignore references to inner classes, where removing the qualification adds an import.", + "markdown": "Reports any references to inner classes that are unnecessarily qualified with the name of the enclosing class.\n\nSuch a qualification can be safely removed, which sometimes adds an import for the inner class.\n\nExample:\n\n\n class X {\n X.Y foo;\n class Y{}\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n Y foo;\n class Y{}\n }\n\nUse the **Ignore references for which an import is needed** option to ignore references to inner classes, where\nremoving the qualification adds an import." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "OptionalToIf", + "suppressToolId": "UnnecessarilyQualifiedInnerClassAccess", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -31953,28 +31864,28 @@ ] }, { - "id": "IllegalDependencyOnInternalPackage", + "id": "JavadocLinkAsPlainText", "shortDescription": { - "text": "Illegal dependency on internal package" + "text": "Link specified as plain text" }, "fullDescription": { - "text": "Reports references in modules without 'module-info.java' on packages which are not exported from named modules. Such configuration may occur when some modules in the project are already migrated to Java modules but others are still non-modular. By analogy to the JDK, such non-modular code should not get access to the code in named modules which is not explicitly exported.", - "markdown": "Reports references in modules without `module-info.java` on packages which are not exported from named modules.\n\nSuch configuration may occur when some modules in the project are already migrated to Java modules but others are still non-modular.\nBy analogy to the JDK, such non-modular code should not get access to the code in named modules which is not explicitly exported." + "text": "Reports plain text links in Javadoc comments. The quick-fix suggests to wrap the link in an '' tag. Example: 'class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }' After the quick-fix is applied: 'class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }' New in 2022.1", + "markdown": "Reports plain text links in Javadoc comments.\n\n\nThe quick-fix suggests to wrap the link in an `` tag.\n\n**Example:**\n\n\n class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n /**\n * https://en.wikipedia.org/\n */\n void foo() {}\n }\n\nNew in 2022.1" }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "IllegalDependencyOnInternalPackage", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "JavadocLinkAsPlainText", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -31986,19 +31897,19 @@ ] }, { - "id": "BigDecimalMethodWithoutRoundingCalled", + "id": "SharedThreadLocalRandom", "shortDescription": { - "text": "Call to 'BigDecimal' method without a rounding mode argument" + "text": "'ThreadLocalRandom' instance might be shared" }, "fullDescription": { - "text": "Reports calls to 'divide()' or 'setScale()' without a rounding mode argument. Such calls can lead to an 'ArithmeticException' when the exact value cannot be represented in the result (for example, because it has a non-terminating decimal expansion). Specifying a rounding mode prevents the 'ArithmeticException'. Example: 'BigDecimal.valueOf(1).divide(BigDecimal.valueOf(3));'", - "markdown": "Reports calls to `divide()` or `setScale()` without a rounding mode argument.\n\nSuch calls can lead to an `ArithmeticException` when the exact value cannot be represented in the result\n(for example, because it has a non-terminating decimal expansion).\n\nSpecifying a rounding mode prevents the `ArithmeticException`.\n\n**Example:**\n\n\n BigDecimal.valueOf(1).divide(BigDecimal.valueOf(3));\n" + "text": "Reports 'java.util.concurrent.ThreadLocalRandom' instances which might be shared between threads. A 'ThreadLocalRandom' should not be shared between threads because that is not thread-safe. The inspection reports instances that are assigned to a field used as a method argument, or assigned to a local variable and used in anonymous or nested classes as they might get shared between threads. Usages of 'ThreadLocalRandom' should typically look like 'ThreadLocalRandom.current().nextInt(...)' (or 'nextDouble(...)' etc.). When all usages are in this form, 'ThreadLocalRandom' instances cannot be used accidentally by multiple threads. Example: 'class Main {\n void printRandomNumbersAsync() {\n ThreadLocalRandom random = ThreadLocalRandom.current();\n CompletableFuture.supplyAsync(() -> generateNumbers(random))\n .thenAccept(numbers -> System.out.println(Arrays.toString(numbers)));\n }\n\n private int[] generateNumbers(Random random) {\n return random.ints(1000, 0, 100).toArray();\n }\n }' Use the options to list methods that are safe to be passed to 'ThreadLocalRandom' instances as an argument. It's possible to use regular expressions for method names.", + "markdown": "Reports `java.util.concurrent.ThreadLocalRandom` instances which might be shared between threads.\n\n\nA `ThreadLocalRandom` should not be shared between threads because that is not thread-safe.\nThe inspection reports instances that are assigned to a field used as a method argument,\nor assigned to a local variable and used in anonymous or nested classes as they might get shared between threads.\n\n\nUsages of `ThreadLocalRandom` should typically look like `ThreadLocalRandom.current().nextInt(...)`\n(or `nextDouble(...)` etc.).\nWhen all usages are in this form, `ThreadLocalRandom` instances cannot be used accidentally by multiple threads.\n\n**Example:**\n\n\n class Main {\n void printRandomNumbersAsync() {\n ThreadLocalRandom random = ThreadLocalRandom.current();\n CompletableFuture.supplyAsync(() -> generateNumbers(random))\n .thenAccept(numbers -> System.out.println(Arrays.toString(numbers)));\n }\n\n private int[] generateNumbers(Random random) {\n return random.ints(1000, 0, 100).toArray();\n }\n }\n \n\nUse the options to list methods that are safe to be passed to `ThreadLocalRandom` instances as an argument.\nIt's possible to use regular expressions for method names." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "BigDecimalMethodWithoutRoundingCalled", + "suppressToolId": "SharedThreadLocalRandom", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32006,8 +31917,8 @@ "relationships": [ { "target": { - "id": "Java/Numeric issues", - "index": 31, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -32019,27 +31930,27 @@ ] }, { - "id": "OverlyComplexArithmeticExpression", + "id": "WhileCanBeDoWhile", "shortDescription": { - "text": "Overly complex arithmetic expression" + "text": "'while' can be replaced with 'do while'" }, "fullDescription": { - "text": "Reports arithmetic expressions with the excessive number of terms. Such expressions might be hard to understand and might contain errors. Parameters, field references, and other primary expressions are counted as a term. Example: 'int calc(int a, int b) {\n return a + a + a + b + b + b + b; // The line contains 7 terms and will be reported.\n }' Use the field below to specify a number of terms allowed in arithmetic expressions.", - "markdown": "Reports arithmetic expressions with the excessive number of terms. Such expressions might be hard to understand and might contain errors.\n\nParameters, field references, and other primary expressions are counted as a term.\n\n**Example:**\n\n int calc(int a, int b) {\n return a + a + a + b + b + b + b; // The line contains 7 terms and will be reported.\n }\n\nUse the field below to specify a number of terms allowed in arithmetic expressions." + "text": "Reports 'while' loops that could be more effectively written as 'do-while' loops. There are 'while' loops where the code just before the loop is identical to the code in the body of the loop. Replacing with a 'do-while' loop removes the duplicated code. For 'while' loops without such duplicated code, the quick fix is offered in the editor as well, but without highlighting. Example: 'foo();\n while (x) {\n foo();\n }' Can be replaced with: 'do {\n foo();\n } while (x);' New in 2024.1", + "markdown": "Reports `while` loops that could be more effectively written as `do-while` loops.\nThere are `while` loops where the code just before the loop is identical to the code in the body of the loop.\nReplacing with a `do-while` loop removes the duplicated code.\nFor `while` loops without such duplicated code, the quick fix is offered in the editor as well, but without highlighting.\n\n**Example:**\n\n\n foo();\n while (x) {\n foo();\n }\n\nCan be replaced with:\n\n\n do {\n foo();\n } while (x);\n\n\nNew in 2024.1" }, "defaultConfiguration": { - "enabled": false, - "level": "warning", + "enabled": true, + "level": "note", "parameters": { - "suppressToolId": "OverlyComplexArithmeticExpression", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "WhileCanBeDoWhile", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Java/Numeric issues", + "id": "Java/Control flow issues", "index": 31, "toolComponent": { "name": "QDJVM" @@ -32052,19 +31963,19 @@ ] }, { - "id": "DriverManagerGetConnection", + "id": "AbstractMethodOverridesConcreteMethod", "shortDescription": { - "text": "Use of 'DriverManager' to get JDBC connection" + "text": "Abstract method overrides concrete method" }, "fullDescription": { - "text": "Reports any uses of 'java.sql.DriverManager' to acquire a JDBC connection. 'java.sql.DriverManager' has been superseded by 'javax.sql.Datasource', which allows for connection pooling and other optimizations. Example: 'Connection conn = DriverManager.getConnection(url, username, password);'", - "markdown": "Reports any uses of `java.sql.DriverManager` to acquire a JDBC connection.\n\n\n`java.sql.DriverManager`\nhas been superseded by `javax.sql.Datasource`, which\nallows for connection pooling and other optimizations.\n\n**Example:**\n\n Connection conn = DriverManager.getConnection(url, username, password);\n" + "text": "Reports 'abstract' methods that override concrete super methods. Methods overridden from 'java.lang.Object' are not reported by this inspection.", + "markdown": "Reports `abstract` methods that override concrete super methods.\n\nMethods overridden from `java.lang.Object` are not reported by this inspection." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToDriverManagerGetConnection", + "suppressToolId": "AbstractMethodOverridesConcreteMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32072,8 +31983,8 @@ "relationships": [ { "target": { - "id": "Java/Resource management", - "index": 136, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -32085,19 +31996,19 @@ ] }, { - "id": "ThreadDumpStack", + "id": "CodeBlock2Expr", "shortDescription": { - "text": "Call to 'Thread.dumpStack()'" + "text": "Statement lambda can be replaced with expression lambda" }, "fullDescription": { - "text": "Reports usages of 'Thread.dumpStack()'. Such statements are often used for temporary debugging and should be either removed from the production code or replaced with a more robust logging facility.", - "markdown": "Reports usages of `Thread.dumpStack()`.\n\nSuch statements are often used for temporary debugging and should be either removed from the production code\nor replaced with a more robust logging facility." + "text": "Reports lambda expressions with code block bodies when expression-style bodies can be used instead. The result of the conversion is shorter and more clear. Example: 'Comparable c = o -> {return 0;};' After the quick-fix is applied: 'Comparable c = o -> 0;' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "markdown": "Reports lambda expressions with code block bodies when expression-style bodies can be used instead. The result of the conversion is shorter and more clear.\n\nExample:\n\n\n Comparable c = o -> {return 0;};\n\nAfter the quick-fix is applied:\n\n\n Comparable c = o -> 0;\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CallToThreadDumpStack", + "suppressToolId": "CodeBlock2Expr", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32105,8 +32016,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -32118,19 +32029,19 @@ ] }, { - "id": "UnnecessaryBlockStatement", + "id": "SimplifyForEach", "shortDescription": { - "text": "Unnecessary code block" + "text": "Simplifiable forEach() call" }, "fullDescription": { - "text": "Reports code blocks that are redundant to the semantics of the program and can be replaced with their contents. The code blocks that are the bodies of 'if', 'do', 'while', or 'for' statements will not be reported by this inspection. Example: 'void foo() {\n { // unnecessary\n int result = call();\n analyze(result);\n } // unnecessary\n }' Configure the inspection: Use the Ignore branches of 'switch' statements option to ignore the code blocks that are used as branches of switch statements.", - "markdown": "Reports code blocks that are redundant to the semantics of the program and can be replaced with their contents.\n\nThe code blocks that are the bodies of `if`, `do`,\n`while`, or `for` statements will not be reported by this\ninspection.\n\nExample:\n\n\n void foo() {\n { // unnecessary\n int result = call();\n analyze(result);\n } // unnecessary\n }\n\nConfigure the inspection:\n\n\nUse the **Ignore branches of 'switch' statements** option to ignore the code blocks that are used as branches of switch statements." + "text": "Reports 'forEach()' calls that can be replaced with a more concise method or from which intermediate steps can be extracted. Example: 'List findNStrings(List list, int n) {\n List other = new ArrayList<>();\n list.forEach(s -> {\n if(s.length() > n) other.add(s);\n });\n return other;\n }' After the quick-fix is applied: 'List findNStrings(List list, int n) {\n List other = list.stream()\n .filter(s -> s.length() > n)\n .collect(Collectors.toList());\n return other;\n }' This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8. New in 2017.3", + "markdown": "Reports `forEach()` calls that can be replaced with a more concise method or from which intermediate steps can be extracted.\n\n**Example:**\n\n\n List findNStrings(List list, int n) {\n List other = new ArrayList<>();\n list.forEach(s -> {\n if(s.length() > n) other.add(s);\n });\n return other;\n }\n\nAfter the quick-fix is applied:\n\n\n List findNStrings(List list, int n) {\n List other = list.stream()\n .filter(s -> s.length() > n)\n .collect(Collectors.toList());\n return other;\n }\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.\n\nNew in 2017.3" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "UnnecessaryCodeBlock", + "suppressToolId": "SimplifyForEach", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -32138,8 +32049,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -32151,28 +32062,28 @@ ] }, { - "id": "FinalMethodInFinalClass", + "id": "Since15", "shortDescription": { - "text": "'final' method in 'final' class" + "text": "Usages of API which isn't available at the configured language level" }, "fullDescription": { - "text": "Reports 'final' methods in 'final' classes. Since 'final' classes cannot be inherited, marking a method as 'final' may be unnecessary and confusing. Example: 'record Bar(int a, int b) {\n public final int sum() { \n return a + b;\n }\n}'\n After the quick-fix is applied: 'record Bar(int a, int b) {\n public int sum() { \n return a + b;\n }\n}' As shown in the example, a class can be marked as 'final' explicitly or implicitly.", - "markdown": "Reports `final` methods in `final` classes.\n\nSince `final` classes cannot be inherited, marking a method as `final`\nmay be unnecessary and confusing.\n\n**Example:**\n\n record Bar(int a, int b) {\n public final int sum() { \n return a + b;\n }\n }\n\nAfter the quick-fix is applied:\n\n record Bar(int a, int b) {\n public int sum() { \n return a + b;\n }\n }\n\nAs shown in the example, a class can be marked as `final` explicitly or implicitly." + "text": "Reports usages of the API that is unavailable at the configured language level. This inspection does 3 things: Highlight usage of generified classes when the language level is below Java 7. Highlight when default methods are not overridden and the language level is below Java 8. Highlight usage of API when the language level is lower than marked using the '@since' tag in the documentation. Use the Forbid API usages option to forbid usages of the API in respect to the project or custom language level.", + "markdown": "Reports usages of the API that is unavailable at the configured language level. This inspection does 3 things:\n\n* Highlight usage of generified classes when the language level is below Java 7.\n* Highlight when default methods are not overridden and the language level is below Java 8.\n* Highlight usage of API when the language level is lower than marked using the `@since` tag in the documentation.\n\n\nUse the **Forbid API usages** option to forbid usages of the API in respect to the project or custom language level." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "FinalMethodInFinalClass", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "Since15", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -32184,19 +32095,19 @@ ] }, { - "id": "FinalPrivateMethod", + "id": "RedundantFieldInitialization", "shortDescription": { - "text": "'private' method declared 'final'" + "text": "Redundant field initialization" }, "fullDescription": { - "text": "Reports methods that are marked with both 'final' and 'private' keywords. Since 'private' methods cannot be meaningfully overridden because of their visibility, declaring them 'final' is redundant.", - "markdown": "Reports methods that are marked with both `final` and `private` keywords.\n\nSince `private` methods cannot be meaningfully overridden because of their visibility, declaring them\n`final` is redundant." + "text": "Reports fields explicitly initialized to their default values. Example: 'class Foo {\n int foo = 0;\n List bar = null;\n }' After the quick-fix is applied: 'class Foo {\n int foo;\n List bar;\n }' Use the inspection settings to only report explicit 'null' initialization, for example: 'class Foo {\n int foo = 0; // no warning\n List bar = null; // redundant field initialization warning\n }'", + "markdown": "Reports fields explicitly initialized to their default values.\n\n**Example:**\n\n\n class Foo {\n int foo = 0;\n List bar = null;\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n int foo;\n List bar;\n }\n\n\nUse the inspection settings to only report explicit `null` initialization, for example:\n\n\n class Foo {\n int foo = 0; // no warning\n List bar = null; // redundant field initialization warning\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FinalPrivateMethod", + "suppressToolId": "RedundantFieldInitialization", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32204,8 +32115,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -32217,19 +32128,19 @@ ] }, { - "id": "UnnecessaryUnboxing", + "id": "ReadObjectInitialization", "shortDescription": { - "text": "Unnecessary unboxing" + "text": "Instance field may not be initialized by 'readObject()'" }, "fullDescription": { - "text": "Reports unboxing, that is explicit unwrapping of wrapped primitive values. Unboxing is unnecessary as of Java 5 and later, and can safely be removed. Examples: 'Integer i = Integer.valueOf(42).intValue();' → 'Integer i = Integer.valueOf(42);' 'int k = Integer.valueOf(42).intValue();' → 'int k = Integer.valueOf(42);' (reports only when the Only report truly superfluously unboxed expressions option is not checked) Use the Only report truly superfluously unboxed expressions option to only report truly superfluous unboxing, where an unboxed value is immediately boxed either implicitly or explicitly. In this case, the entire unboxing-boxing step can be removed. The inspection doesn't report simple explicit unboxing. This inspection only reports if the language level of the project or module is 5 or higher.", - "markdown": "Reports unboxing, that is explicit unwrapping of wrapped primitive values.\n\nUnboxing is unnecessary as of Java 5 and later, and can safely be removed.\n\n**Examples:**\n\n* `Integer i = Integer.valueOf(42).intValue();` → `Integer i = Integer.valueOf(42);`\n* `int k = Integer.valueOf(42).intValue();` → `int k = Integer.valueOf(42);`\n\n (reports only when the **Only report truly superfluously unboxed expressions** option is not checked)\n\n\nUse the **Only report truly superfluously unboxed expressions** option to only report truly superfluous unboxing,\nwhere an unboxed value is immediately boxed either implicitly or explicitly.\nIn this case, the entire unboxing-boxing step can be removed. The inspection doesn't report simple explicit unboxing.\n\nThis inspection only reports if the language level of the project or module is 5 or higher." + "text": "Reports fields that are not guaranteed to be initialized after the object is deserialized by the 'readObject()' method. The inspection doesn't report transient fields. Note: This inspection uses a very conservative control flow algorithm, and may incorrectly report fields as uninitialized. Example: 'class DataObject implements Serializable {\n String s; // s is not initialized in readObject\n int i;\n\n private void readObject(ObjectInputStream stream) throws IOException {\n i = stream.readInt();\n }\n}'", + "markdown": "Reports fields that are not guaranteed to be initialized after the object is deserialized by the `readObject()` method.\n\nThe inspection doesn't report transient fields.\n\n\nNote: This inspection uses a very conservative control flow algorithm, and may incorrectly report fields\nas uninitialized.\n\n**Example:**\n\n\n class DataObject implements Serializable {\n String s; // s is not initialized in readObject\n int i;\n\n private void readObject(ObjectInputStream stream) throws IOException {\n i = stream.readInt();\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryUnboxing", + "suppressToolId": "InstanceVariableMayNotBeInitializedByReadObject", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32237,8 +32148,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 5", - "index": 121, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -32250,19 +32161,19 @@ ] }, { - "id": "AssignmentOrReturnOfFieldWithMutableType", + "id": "NonAtomicOperationOnVolatileField", "shortDescription": { - "text": "Assignment or return of field with mutable type" + "text": "Non-atomic operation on 'volatile' field" }, "fullDescription": { - "text": "Reports return of, or assignment from a method parameter to an array or a mutable type like 'Collection', 'Date', 'Map', 'Calendar', etc. Because such types are mutable, this construct may result in unexpected modifications of an object's state from outside the owning class. Although this construct may be useful for performance reasons, it is inherently prone to bugs. The following mutable types are reported: 'java.util.Date' 'java.util.Calendar' 'java.util.Collection' 'java.util.Map' 'com.google.common.collect.Multimap' 'com.google.common.collect.Table' The quick-fix adds a call to the field's '.clone()' method. Example: 'class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages; // warning: Return of String[] field 'messages'\n }\n }' After the quick-fix is applied: 'class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages.clone();\n }\n }' Use the Ignore assignments in and returns from private methods option to ignore assignments and returns in 'private' methods.", - "markdown": "Reports return of, or assignment from a method parameter to an array or a mutable type like `Collection`, `Date`, `Map`, `Calendar`, etc.\n\nBecause such types are mutable, this construct may\nresult in unexpected modifications of an object's state from outside the owning class. Although this construct may be useful for\nperformance reasons, it is inherently prone to bugs.\n\nThe following mutable types are reported:\n\n* `java.util.Date`\n* `java.util.Calendar`\n* `java.util.Collection`\n* `java.util.Map`\n* `com.google.common.collect.Multimap`\n* `com.google.common.collect.Table`\n\nThe quick-fix adds a call to the field's `.clone()` method.\n\n**Example:**\n\n\n class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages; // warning: Return of String[] field 'messages'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages.clone();\n }\n }\n\nUse the **Ignore assignments in and returns from private methods** option to ignore assignments and returns in `private` methods." + "text": "Reports non-atomic operations on volatile fields. An example of a non-atomic operation is updating the field using the increment operator. As the operation involves read and write, and other modifications may happen in between, data may become corrupted. The operation can be made atomic by surrounding it with a 'synchronized' block or using one of the classes from the 'java.util.concurrent.atomic' package. Example: 'private volatile int v = 1;\n\n void foo() {\n v = 2 * v;\n }'", + "markdown": "Reports non-atomic operations on volatile fields.\n\n\nAn example of a non-atomic operation is updating the field using the increment operator.\nAs the operation involves read and write, and other modifications may happen in between, data may become corrupted.\nThe operation can be made atomic by surrounding it with a `synchronized` block or\nusing one of the classes from the `java.util.concurrent.atomic` package.\n\n**Example:**\n\n\n private volatile int v = 1;\n\n void foo() {\n v = 2 * v;\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AssignmentOrReturnOfFieldWithMutableType", + "suppressToolId": "NonAtomicOperationOnVolatileField", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32270,8 +32181,8 @@ "relationships": [ { "target": { - "id": "Java/Encapsulation", - "index": 128, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -32283,19 +32194,19 @@ ] }, { - "id": "OptionalAssignedToNull", + "id": "QuestionableName", "shortDescription": { - "text": "Null value for Optional type" + "text": "Questionable name" }, "fullDescription": { - "text": "Reports 'null' assigned to an 'Optional' variable or returned from a method returning 'Optional'. It's recommended that you use 'Optional.empty()' (or 'Optional.absent()' for Guava) to denote an empty value. Example: 'Optional foo(boolean flag) {\n return flag ? Optional.of(42) : null;\n }' After the quick-fix is applied: 'Optional foo(boolean flag) {\n return flag ? Optional.of(42) : Optional.empty();\n }' Configure the inspection: Use the Report comparison of Optional with null option to also report comparisons like 'optional == null'. While in rare cases (e.g. lazily initialized optional field) this might be correct, optional variable is usually never null, and probably 'optional.isPresent()' was intended. New in 2017.2 This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", - "markdown": "Reports `null` assigned to an `Optional` variable or returned from a method returning `Optional`.\n\nIt's recommended that you use `Optional.empty()` (or `Optional.absent()` for Guava) to denote an empty value.\n\nExample:\n\n\n Optional foo(boolean flag) {\n return flag ? Optional.of(42) : null;\n }\n\nAfter the quick-fix is applied:\n\n\n Optional foo(boolean flag) {\n return flag ? Optional.of(42) : Optional.empty();\n }\n\nConfigure the inspection:\n\n\nUse the **Report comparison of Optional with null** option to also report comparisons like `optional == null`. While in rare cases (e.g. lazily initialized\noptional field) this might be correct, optional variable is usually never null, and probably `optional.isPresent()` was\nintended.\n\nNew in 2017.2\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." + "text": "Reports variables, methods, or classes with questionable, not really descriptive names. Such names do not help to understand the code, and most probably were created as a temporary thing but were forgotten afterwards. Example: 'int aa = 42;' Rename quick-fix is suggested only in the editor. Use the option to list names that should be reported.", + "markdown": "Reports variables, methods, or classes with questionable, not really descriptive names. Such names do not help to understand the code, and most probably were created as a temporary thing but were forgotten afterwards.\n\n**Example:**\n\n\n int aa = 42;\n\nRename quick-fix is suggested only in the editor.\n\n\nUse the option to list names that should be reported." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OptionalAssignedToNull", + "suppressToolId": "QuestionableName", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32303,8 +32214,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -32316,19 +32227,19 @@ ] }, { - "id": "PointlessIndexOfComparison", + "id": "UNCHECKED_WARNING", "shortDescription": { - "text": "Pointless 'indexOf()' comparison" + "text": "Unchecked warning" }, "fullDescription": { - "text": "Reports unnecessary comparisons with '.indexOf()' expressions. An example of such an expression is comparing the result of '.indexOf()' with numbers smaller than -1.", - "markdown": "Reports unnecessary comparisons with `.indexOf()` expressions. An example of such an expression is comparing the result of `.indexOf()` with numbers smaller than -1." + "text": "Reports code on which an unchecked warning will be issued by the javac compiler. Every unchecked warning may potentially trigger 'ClassCastException' at runtime. Example: 'List items = Arrays.asList(\"string\", \"string\");\n List numbers = Collections.unmodifiableList(items); // unchecked assignment'", + "markdown": "Reports code on which an unchecked warning will be issued by the javac compiler. Every unchecked warning may potentially trigger `ClassCastException` at runtime.\n\nExample:\n\n\n List items = Arrays.asList(\"string\", \"string\");\n List numbers = Collections.unmodifiableList(items); // unchecked assignment\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PointlessIndexOfComparison", + "suppressToolId": "unchecked", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32336,8 +32247,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Compiler issues", + "index": 162, "toolComponent": { "name": "QDJVM" } @@ -32349,19 +32260,19 @@ ] }, { - "id": "IteratorHasNextCallsIteratorNext", + "id": "RedundantLengthCheck", "shortDescription": { - "text": "'Iterator.hasNext()' which calls 'next()'" + "text": "Redundant array length check" }, "fullDescription": { - "text": "Reports implementations of 'Iterator.hasNext()' or 'ListIterator.hasPrevious()' that call 'Iterator.next()' or 'ListIterator.previous()' on the iterator instance. Such calls are almost certainly an error, as methods like 'hasNext()' should not modify the iterators state, while 'next()' should. Example: 'class MyIterator implements Iterator {\n public boolean hasNext() {\n return next() != null;\n }\n }'", - "markdown": "Reports implementations of `Iterator.hasNext()` or `ListIterator.hasPrevious()` that call `Iterator.next()` or `ListIterator.previous()` on the iterator instance. Such calls are almost certainly an error, as methods like `hasNext()` should not modify the iterators state, while `next()` should.\n\n**Example:**\n\n\n class MyIterator implements Iterator {\n public boolean hasNext() {\n return next() != null;\n }\n }\n" + "text": "Reports unnecessary array length checks followed by array iteration. When array length is zero, the iteration will be skipped anyway, so there's no need to check length explicitly. Example: 'void f(String[] array) {\n if (array.length != 0) { // unnecessary check\n for (String str : array) {\n System.out.println(str);\n }\n }\n }' A quick-fix is suggested to unwrap or remove the length check: 'void f(String[] array) {\n for (String str : array) {\n System.out.println(str);\n }\n }' New in 2022.3", + "markdown": "Reports unnecessary array length checks followed by array iteration. When array length is zero, the iteration will be skipped anyway, so there's no need to check length explicitly.\n\nExample:\n\n\n void f(String[] array) {\n if (array.length != 0) { // unnecessary check\n for (String str : array) {\n System.out.println(str);\n }\n }\n }\n\nA quick-fix is suggested to unwrap or remove the length check:\n\n\n void f(String[] array) {\n for (String str : array) {\n System.out.println(str);\n }\n }\n\nNew in 2022.3" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IteratorHasNextCallsIteratorNext", + "suppressToolId": "RedundantLengthCheck", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32369,8 +32280,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -32382,19 +32293,30 @@ ] }, { - "id": "EqualsAndHashcode", + "id": "DataFlowIssue", "shortDescription": { - "text": "'equals()' and 'hashCode()' not paired" + "text": "Nullability and data flow problems" }, "fullDescription": { - "text": "Reports classes that override the 'equals()' method but do not override the 'hashCode()' method or vice versa, which can potentially lead to problems when the class is added to a 'Collection' or a 'HashMap'. The quick-fix generates the default implementation for an absent method. Example: 'class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n}' After the quick-fix is applied: 'class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (!(o instanceof StringHolder)) return false;\n\n StringHolder holder = (StringHolder)o;\n\n if (s != null ? !s.equals(holder.s) : holder.s != null) return false;\n\n return true;\n }\n}'", - "markdown": "Reports classes that override the `equals()` method but do not override the `hashCode()` method or vice versa, which can potentially lead to problems when the class is added to a `Collection` or a `HashMap`.\n\nThe quick-fix generates the default implementation for an absent method.\n\nExample:\n\n\n class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (!(o instanceof StringHolder)) return false;\n\n StringHolder holder = (StringHolder)o;\n\n if (s != null ? !s.equals(holder.s) : holder.s != null) return false;\n\n return true;\n }\n }\n" + "text": "Reports code constructs that always violate nullability contracts, may throw exceptions, or are just redundant, based on data flow analysis. Examples: 'if (array.length < index) {\n System.out.println(array[index]);\n} // Array index is always out of bounds\n\nif (str == null) System.out.println(\"str is null\");\nSystem.out.println(str.trim());\n// the last statement may throw an NPE\n\n@NotNull\nInteger square(@Nullable Integer input) {\n // the method contract is violated\n return input == null ? null : input * input;\n}' The inspection behavior may be controlled by a number of annotations, such as nullability annotations, '@Contract' annotation, '@Range' annotation and so on. Configure the inspection: Use the Suggest @Nullable annotation for methods/fields/parameters where nullable values are used option to warn when a nullable value is passed as an argument to a method with a non-annotated parameter, stored into non-annotated field, or returned from a non-annotated method. In this case, the inspection will suggest propagating the '@Nullable' annotation. You can also configure nullability annotations using the Configure Annotations button. Use the Treat non-annotated members and parameters as @Nullable option to assume that non-annotated members can be null, so they must not be used in non-null context. Use the Report not-null required parameter with null-literal argument usages option to report method parameters that cannot be null (e.g. immediately dereferenced in the method body), but there are call sites where a 'null' literal is passed. Use the Report nullable methods that always return a non-null value option to report methods that are annotated as '@Nullable', but always return non-null value. In this case, it's suggested that you change the annotation to '@NotNull'. Use the Ignore assert statements option to control how the inspection treats 'assert' statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode). Use the Report problems that happen only on some code paths option to control whether to report problems that may happen only on some code path. If this option is disabled, warnings like exception is possible will not be reported. The inspection will report only warnings like exception will definitely occur. This mode may greatly reduce the number of false-positives, especially if the code is not consistently annotated with nullability and contract annotations. That is why it can be useful for finding the most important problems in legacy code bases. Before IntelliJ IDEA 2022.3, this inspection was part of the \"Constant Conditions & Exceptions\" inspection. Now, it is split into two inspections: \"Constant Values\" and \"Nullability and data flow problems\".", + "markdown": "Reports code constructs that always violate nullability contracts, may throw exceptions, or are just redundant, based on data flow analysis.\n\nExamples:\n\n if (array.length < index) {\n System.out.println(array[index]);\n } // Array index is always out of bounds\n\n if (str == null) System.out.println(\"str is null\");\n System.out.println(str.trim());\n // the last statement may throw an NPE\n\n @NotNull\n Integer square(@Nullable Integer input) {\n // the method contract is violated\n return input == null ? null : input * input;\n }\n\n\nThe inspection behavior may be controlled by a number of annotations, such as\n[nullability](https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html) annotations,\n[@Contract](https://www.jetbrains.com/help/idea/contract-annotations.html) annotation,\n`@Range` annotation and so on.\n\nConfigure the inspection:\n\n* Use the **Suggest @Nullable annotation for methods/fields/parameters where nullable values are used** option to warn when a nullable value is passed as an argument to a method with a non-annotated parameter, stored into non-annotated field, or returned from a non-annotated method. In this case, the inspection will suggest propagating the `@Nullable` annotation. You can also configure nullability annotations using the **Configure Annotations** button.\n* Use the **Treat non-annotated members and parameters as @Nullable** option to assume that non-annotated members can be null, so they must not be used in non-null context.\n* Use the **Report not-null required parameter with null-literal argument usages** option to report method parameters that cannot be null (e.g. immediately dereferenced in the method body), but there are call sites where a `null` literal is passed.\n* Use the **Report nullable methods that always return a non-null value** option to report methods that are annotated as `@Nullable`, but always return non-null value. In this case, it's suggested that you change the annotation to `@NotNull`.\n* Use the **Ignore assert statements** option to control how the inspection treats `assert` statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode).\n* Use the **Report problems that happen only on some code paths** option to control whether to report problems that may happen only on some code path. If this option is disabled, warnings like *exception is possible* will not be reported. The inspection will report only warnings like *exception will definitely occur*. This mode may greatly reduce the number of false-positives, especially if the code is not consistently annotated with nullability and contract annotations. That is why it can be useful for finding the most important problems in legacy code bases.\n\n\nBefore IntelliJ IDEA 2022.3, this inspection was part of the \"Constant Conditions \\& Exceptions\" inspection.\nNow, it is split into two inspections:\n\"Constant Values\" and \"Nullability and data flow problems\"." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "EqualsAndHashcode", + "suppressToolId": "DataFlowIssue", + "cweIds": [ + 129, + 252, + 253, + 394, + 395, + 476, + 570, + 571, + 690 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32415,19 +32337,19 @@ ] }, { - "id": "StringRepeatCanBeUsed", + "id": "ParameterCanBeLocal", "shortDescription": { - "text": "String.repeat() can be used" + "text": "Value passed as parameter never read" }, "fullDescription": { - "text": "Reports loops that can be replaced with a single 'String.repeat()' method (available since Java 11). Example: 'void append(StringBuilder sb, int count, Object obj) {\n for (int i = 0; i < count; i++) {\n sb.append(obj);\n }\n }' After the quick-fix is applied: 'void append(StringBuilder sb, int count, Object obj) {\n sb.append(String.valueOf(obj).repeat(Math.max(0, count)));\n }' By default, the inspection may wrap 'count' with 'Math.max(0, count)' if it cannot prove statically that 'count' is not negative. This is done to prevent possible semantics change, as 'String.repeat()' rejects negative numbers. Use the Add Math.max(0,count) to avoid possible semantics change option to disable this behavior if required. Similarly, a string you want to repeat can be wrapped in 'String.valueOf' to prevent possible 'NullPointerException' if it's unknown whether it can be 'null'. This inspection only reports if the language level of the project or module is 11 or higher. New in 2019.1", - "markdown": "Reports loops that can be replaced with a single `String.repeat()` method (available since Java 11).\n\n**Example:**\n\n\n void append(StringBuilder sb, int count, Object obj) {\n for (int i = 0; i < count; i++) {\n sb.append(obj);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void append(StringBuilder sb, int count, Object obj) {\n sb.append(String.valueOf(obj).repeat(Math.max(0, count)));\n }\n\n\nBy default, the inspection may wrap `count` with `Math.max(0, count)` if it cannot prove statically that `count` is\nnot negative. This is done to prevent possible semantics change, as `String.repeat()` rejects negative numbers.\nUse the **Add Math.max(0,count) to avoid possible semantics change** option to disable this behavior if required.\n\nSimilarly, a string you want to repeat can be wrapped in\n`String.valueOf` to prevent possible `NullPointerException` if it's unknown whether it can be `null`.\n\nThis inspection only reports if the language level of the project or module is 11 or higher.\n\nNew in 2019.1" + "text": "Reports redundant method parameters that can be replaced with local variables. If all local usages of a parameter are preceded by assignments to that parameter, the parameter can be removed and its usages replaced with local variables. It makes no sense to have such a parameter, as values that are passed to it are overwritten. Usually, the problem appears as a result of refactoring. Example: 'void test(int p) {\n p = 1;\n System.out.print(p);\n }' After the quick-fix is applied: 'void test() {\n int p = 1;\n System.out.print(p);\n }'", + "markdown": "Reports redundant method parameters that can be replaced with local variables.\n\nIf all local usages of a parameter are preceded by assignments to that parameter, the\nparameter can be removed and its usages replaced with local variables.\nIt makes no sense to have such a parameter, as values that are passed to it are overwritten.\nUsually, the problem appears as a result of refactoring.\n\nExample:\n\n\n void test(int p) {\n p = 1;\n System.out.print(p);\n }\n\nAfter the quick-fix is applied:\n\n\n void test() {\n int p = 1;\n System.out.print(p);\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StringRepeatCanBeUsed", + "suppressToolId": "ParameterCanBeLocal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32435,8 +32357,8 @@ "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 11", - "index": 178, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -32448,22 +32370,19 @@ ] }, { - "id": "MathRoundingWithIntArgument", + "id": "SwitchStatementDensity", "shortDescription": { - "text": "Call math rounding with 'int' argument" + "text": "'switch' statement with too low of a branch density" }, "fullDescription": { - "text": "Reports calls to 'round()', 'ceil()', 'floor()', 'rint()' methods for 'Math' and 'StrictMath' with 'int' as the argument. These methods could be called in case the argument is expected to be 'long' or 'double', and it may have unexpected results. The inspection provides a fix that simplify such expressions (except 'round') to cast to 'double'. Example: 'int i = 2;\n double d1 = Math.floor(i);' After the quick-fix is applied: 'int i = 2;\n double d1 = i;' New in 2023.1", - "markdown": "Reports calls to `round()`, `ceil()`, `floor()`, `rint()` methods for `Math` and `StrictMath` with `int` as the argument.\n\nThese methods could be called in case the argument is expected to be `long` or `double`, and it may have unexpected results.\n\nThe inspection provides a fix that simplify such expressions (except `round`) to cast to `double`.\n\n**Example:**\n\n\n int i = 2;\n double d1 = Math.floor(i);\n\nAfter the quick-fix is applied:\n\n\n int i = 2;\n double d1 = i;\n\nNew in 2023.1" + "text": "Reports 'switch' statements or expressions with a too low ratio of switch labels to executable statements. Such 'switch' statements may be confusing and should probably be refactored. Example: 'switch (i) { // one case and 5 executable statements -> 20% density\n case 1:\n System.out.println(\"1\");\n System.out.println(\"2\");\n System.out.println(\"3\");\n System.out.println(\"4\");\n System.out.println(\"5\");\n break;\n }' Use the Minimum density of branches field to specify the allowed ratio of the switch labels to executable statements.", + "markdown": "Reports `switch` statements or expressions with a too low ratio of switch labels to executable statements.\n\nSuch `switch` statements\nmay be confusing and should probably be refactored.\n\nExample:\n\n\n switch (i) { // one case and 5 executable statements -> 20% density\n case 1:\n System.out.println(\"1\");\n System.out.println(\"2\");\n System.out.println(\"3\");\n System.out.println(\"4\");\n System.out.println(\"5\");\n break;\n }\n\n\nUse the **Minimum density of branches** field to specify the allowed ratio of the switch labels to executable statements." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MathRoundingWithIntArgument", - "cweIds": [ - 681 - ], + "suppressToolId": "SwitchStatementDensity", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32471,8 +32390,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -32484,19 +32403,19 @@ ] }, { - "id": "SynchronizationOnStaticField", + "id": "MismatchedJavadocCode", "shortDescription": { - "text": "Synchronization on 'static' field" + "text": "Mismatch between Javadoc and code" }, "fullDescription": { - "text": "Reports synchronization on 'static' fields. While not strictly incorrect, synchronization on 'static' fields can lead to bad performance because of contention.", - "markdown": "Reports synchronization on `static` fields. While not strictly incorrect, synchronization on `static` fields can lead to bad performance because of contention." + "text": "Reports parts of method specification written in English that contradict with the method declaration. This includes: Method specified to return 'true' or 'false' but its return type is not boolean. Method specified to return 'null' but it's annotated as '@NotNull' or its return type is primitive. Method specified to return list but its return type is set or array. And so on. Example: '/**\n * @return true if user is found, false otherwise\n */\n User findUser(String name);' Note that false-positives are possible, as this inspection tries to interpret a human language. However, if the inspection reports incorrectly, it's still possible that the description is confusing and should be rewritten. New in 2022.3", + "markdown": "Reports parts of method specification written in English that contradict with the method declaration. This includes:\n\n* Method specified to return `true` or `false` but its return type is not boolean.\n* Method specified to return `null` but it's annotated as `@NotNull` or its return type is primitive.\n* Method specified to return list but its return type is set or array.\n* And so on.\n\n**Example:**\n\n\n /**\n * @return true if user is found, false otherwise\n */\n User findUser(String name);\n\n\nNote that false-positives are possible, as this inspection tries to interpret a human language. However, if the inspection reports\nincorrectly, it's still possible that the description is confusing and should be rewritten.\n\n\nNew in 2022.3" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SynchronizationOnStaticField", + "suppressToolId": "MismatchedJavadocCode", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32504,8 +32423,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -32517,19 +32436,19 @@ ] }, { - "id": "SwitchStatementWithConfusingDeclaration", + "id": "SimplifiableAnnotation", "shortDescription": { - "text": "Local variable used and declared in different 'switch' branches" + "text": "Simplifiable annotation" }, "fullDescription": { - "text": "Reports local variables declared in one branch of a 'switch' statement and used in another branch. Such declarations can be extremely confusing. Example: 'switch(i) {\n case 2:\n int x = 0;\n break;\n case 3:\n x = 3;\n System.out.println(x);\n break;\n }'", - "markdown": "Reports local variables declared in one branch of a `switch` statement and used in another branch. Such declarations can be extremely confusing.\n\nExample:\n\n\n switch(i) {\n case 2:\n int x = 0;\n break;\n case 3:\n x = 3;\n System.out.println(x);\n break;\n }\n" + "text": "Reports annotations that can be simplified to their single-element or marker shorthand form. Problems reported: Redundant 'value=' in annotation name-value pairs Redundant braces around array values that contain only a single value Redundant whitespace between the @-sign and the name of annotations Redundant whitespace between annotation names and parameter lists Redundant parentheses in annotations without any parameters Example: '@interface Foo { String[] value(); }\n\n @ Foo({\"foo\"})\n public String name;' After the quick-fix is applied: '@interface Foo { String[] value(); }\n\n @Foo(\"foo\")\n public String name;'", + "markdown": "Reports annotations that can be simplified to their single-element or marker shorthand form.\n\n\nProblems reported:\n\n* Redundant `value=` in annotation name-value pairs\n* Redundant braces around array values that contain only a single value\n* Redundant whitespace between the @-sign and the name of annotations\n* Redundant whitespace between annotation names and parameter lists\n* Redundant parentheses in annotations without any parameters\n\n**Example:**\n\n\n @interface Foo { String[] value(); }\n\n @ Foo({\"foo\"})\n public String name;\n\nAfter the quick-fix is applied:\n\n\n @interface Foo { String[] value(); }\n\n @Foo(\"foo\")\n public String name;\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LocalVariableUsedAndDeclaredInDifferentSwitchBranches", + "suppressToolId": "SimplifiableAnnotation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32537,8 +32456,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -32550,19 +32469,19 @@ ] }, { - "id": "FieldMayBeFinal", + "id": "Guava", "shortDescription": { - "text": "Field may be 'final'" + "text": "Guava's functional primitives can be replaced with Java" }, "fullDescription": { - "text": "Reports fields that can be safely made 'final'. All 'final' fields have a value and this value does not change, which can make the code easier to reason about. To avoid too expensive analysis, this inspection only reports if the field has a 'private' modifier or it is defined in a local or anonymous class. A field can be 'final' if: It is 'static' and initialized once in its declaration or in one 'static' initializer. It is non-'static' and initialized once in its declaration, in one instance initializer or in every constructor And it is not modified anywhere else. Example: 'public class Person {\n private String name; // can be final\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }' After the quick-fix is applied: 'public class Person {\n private final String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }' Use the \"Annotations\" button to modify the list of annotations that assume implicit field write.", - "markdown": "Reports fields that can be safely made `final`. All `final` fields have a value and this value does not change, which can make the code easier to reason about.\n\nTo avoid too expensive analysis, this inspection only reports if the field has a `private` modifier\nor it is defined in a local or anonymous class.\nA field can be `final` if:\n\n* It is `static` and initialized once in its declaration or in one `static` initializer.\n* It is non-`static` and initialized once in its declaration, in one instance initializer or in every constructor\n\nAnd it is not modified anywhere else.\n\n**Example:**\n\n\n public class Person {\n private String name; // can be final\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Person {\n private final String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }\n\n\nUse the \"Annotations\" button to modify the list of annotations that assume implicit field write." + "text": "Reports usages of Guava's functional primitives that can be migrated to standard Java API calls. For example, the inspection reports usages of classes and interfaces like 'FluentIterable', 'Optional', 'Function', 'Predicate', or 'Supplier'. Example: 'ImmutableList results = FluentIterable.from(List.of(1, 2, 3)).transform(Object::toString).toList();' After the quick-fix is applied: 'List results = List.of(1, 2, 3).stream().map(Object::toString).collect(Collectors.toList());' The quick-fix may change the semantics. Some lazily evaluated Guava iterables can be transformed to eagerly evaluated. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports usages of Guava's functional primitives that can be migrated to standard Java API calls.\n\nFor example, the inspection reports usages of classes and interfaces like `FluentIterable`, `Optional`, `Function`,\n`Predicate`, or `Supplier`.\n\nExample:\n\n\n ImmutableList results = FluentIterable.from(List.of(1, 2, 3)).transform(Object::toString).toList();\n\nAfter the quick-fix is applied:\n\n\n List results = List.of(1, 2, 3).stream().map(Object::toString).collect(Collectors.toList());\n\n\nThe quick-fix may change the semantics. Some lazily evaluated Guava iterables can be transformed to eagerly evaluated.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FieldMayBeFinal", + "suppressToolId": "Guava", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32570,8 +32489,8 @@ "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -32583,19 +32502,19 @@ ] }, { - "id": "SuspiciousArrayMethodCall", + "id": "NoopMethodInAbstractClass", "shortDescription": { - "text": "Suspicious 'Arrays' method call" + "text": "No-op method in 'abstract' class" }, "fullDescription": { - "text": "Reports calls to non-generic-array manipulation methods like 'Arrays.fill()' with mismatched argument types. Such calls don't do anything useful and are likely to be mistakes. Example: 'int foo(String[] strings) {\n return Arrays.binarySearch(strings, 1);\n }' New in 2017.2", - "markdown": "Reports calls to non-generic-array manipulation methods like `Arrays.fill()` with mismatched argument types. Such calls don't do anything useful and are likely to be mistakes.\n\n**Example:**\n\n\n int foo(String[] strings) {\n return Arrays.binarySearch(strings, 1);\n }\n\nNew in 2017.2" + "text": "Reports no-op (for \"no operation\") methods in 'abstract' classes. It is usually a better design to make such methods 'abstract' themselves so that classes inheriting these methods provide their implementations. Example: 'abstract class Test {\n protected void doTest() {\n }\n }'", + "markdown": "Reports no-op (for \"no operation\") methods in `abstract` classes.\n\nIt is usually a better\ndesign to make such methods `abstract` themselves so that classes inheriting these\nmethods provide their implementations.\n\n**Example:**\n\n\n abstract class Test {\n protected void doTest() {\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousArrayMethodCall", + "suppressToolId": "NoopMethodInAbstractClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32603,8 +32522,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -32616,19 +32535,19 @@ ] }, { - "id": "ClassHasNoToStringMethod", + "id": "OverridableMethodCallDuringObjectConstruction", "shortDescription": { - "text": "Class does not override 'toString()' method" + "text": "Overridable method called during object construction" }, "fullDescription": { - "text": "Reports classes without a 'toString()' method.", - "markdown": "Reports classes without a `toString()` method." + "text": "Reports calls to overridable 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 Methods are overridable if they are not declared as 'final', 'static', or 'private'. Package-local methods are considered safe, even though they are overridable. Such calls may result in subtle bugs, as object initialization may happen before the method call. Example: 'class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n }' This inspection shares the functionality with the following inspections: Abstract 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 overridable 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* Methods are overridable if they are not declared as `final`, `static`, or `private`. Package-local methods are considered safe, even though they are overridable. Such calls may result in subtle bugs, as object initialization may happen before the method call.\n* **Example:**\n\n\n class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n }\n\n* This inspection shares the functionality with the following inspections:\n * Abstract method called during object construction\n * Overridden method called during object construction\n* Only one inspection should be enabled at once to prevent warning duplication." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassHasNoToStringMethod", + "suppressToolId": "OverridableMethodCallDuringObjectConstruction", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32636,8 +32555,8 @@ "relationships": [ { "target": { - "id": "Java/toString() issues", - "index": 205, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -32649,19 +32568,19 @@ ] }, { - "id": "FieldAccessNotGuarded", + "id": "ImplicitCallToSuper", "shortDescription": { - "text": "Unguarded field access or method call" + "text": "Implicit call to 'super()'" }, "fullDescription": { - "text": "Reports accesses of fields declared as '@GuardedBy' that are not guarded by an appropriate synchronization structure. Example: '@GuardedBy(\"this\")\n void x() {\n notify();\n }\n void y() {\n x(); // unguarded method call\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 accesses of fields declared as `@GuardedBy` that are not guarded by an appropriate synchronization structure.\n\nExample:\n\n\n @GuardedBy(\"this\")\n void x() {\n notify();\n }\n void y() {\n x(); // unguarded method call\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`" + "text": "Reports constructors that do not begin with a call to \"super\" constructor or another constructor of the same class. Such constructors can be thought of as implicitly beginning with a call to 'super()'. Some coding standards prefer that such calls to 'super()' be made explicitly. Example: 'class Foo {\n Foo() {}\n }' After the quick-fix is applied: 'class Foo {\n Foo() {\n super();\n }\n }' Use the inspection settings to ignore classes extending directly from 'Object'. For instance: 'class Foo {\n Foo() {} // Not reported\n }\n\n class Bar extends Foo {\n Bar() {} // Implicit call to 'super()'\n }'", + "markdown": "Reports constructors that do not begin with a call to \"super\" constructor or another constructor of the same class.\n\nSuch constructors can be thought of as implicitly beginning with a\ncall to `super()`. Some coding standards prefer that such calls to\n`super()` be made explicitly.\n\n**Example:**\n\n\n class Foo {\n Foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n Foo() {\n super();\n }\n }\n\n\nUse the inspection settings to ignore classes extending directly from `Object`.\nFor instance:\n\n\n class Foo {\n Foo() {} // Not reported\n }\n\n class Bar extends Foo {\n Bar() {} // Implicit call to 'super()'\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FieldAccessNotGuarded", + "suppressToolId": "ImplicitCallToSuper", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32669,8 +32588,8 @@ "relationships": [ { "target": { - "id": "Java/Concurrency annotation issues", - "index": 100, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -32682,19 +32601,19 @@ ] }, { - "id": "PublicStaticArrayField", + "id": "MissingDeprecatedAnnotation", "shortDescription": { - "text": "'public static' array field" + "text": "Missing '@Deprecated' annotation" }, "fullDescription": { - "text": "Reports 'public' 'static' array fields. Such fields are often used to store arrays of constant values. Still, they represent a security hazard, as their contents may be modified, even if the field is declared 'final'. Example: 'public static String[] allowedPasswords = {\"foo\", \"bar\"};'", - "markdown": "Reports `public` `static` array fields.\n\n\nSuch fields are often used to store arrays of constant values. Still, they represent a security\nhazard, as their contents may be modified, even if the field is declared `final`.\n\n**Example:**\n\n\n public static String[] allowedPasswords = {\"foo\", \"bar\"};\n" + "text": "Reports module declarations, classes, fields, or methods that have the '@deprecated' Javadoc tag but do not have the '@java.lang.Deprecated' annotation. Example: '/**\n * @deprecated use {@code example()} instead\n */\n void sample(){ }' After the quick-fix is applied: '/**\n * @deprecated use {@code example()} instead\n */\n @Deprecated\n void sample(){ }' Use the checkbox below to report members annotated with '@Deprecated' without an explanation in a Javadoc '@deprecated' tag. This inspection depends on the Java feature 'Annotations', which is available since Java 5.", + "markdown": "Reports module declarations, classes, fields, or methods that have the `@deprecated` Javadoc tag but do not have the `@java.lang.Deprecated` annotation.\n\n**Example:**\n\n\n /**\n * @deprecated use {@code example()} instead\n */\n void sample(){ }\n\nAfter the quick-fix is applied:\n\n\n /**\n * @deprecated use {@code example()} instead\n */\n @Deprecated\n void sample(){ }\n\n\nUse the checkbox below to report members annotated with `@Deprecated` without\nan explanation in a Javadoc `@deprecated` tag.\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PublicStaticArrayField", + "suppressToolId": "MissingDeprecatedAnnotation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32702,8 +32621,8 @@ "relationships": [ { "target": { - "id": "Java/Security", - "index": 38, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -32715,19 +32634,19 @@ ] }, { - "id": "MagicNumber", + "id": "StringTemplateMigration", "shortDescription": { - "text": "Magic number" + "text": "String template can be used" }, "fullDescription": { - "text": "Reports \"magic numbers\": numeric literals that are not named by a constant declaration. Using magic numbers can lead to unclear code, as well as errors if a magic number is changed in one location but remains unchanged not another. The numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 0L, 1L, 2L, 0.0, 1.0, 0.0F and 1.0F are not reported by this inspection. Example: 'void checkFileSize(long bytes) {\n if (bytes > 1_048_576) {\n throw new IllegalArgumentException(\"too big\");\n }\n }' A quick-fix introduces a new constant: 'static final int MAX_SUPPORTED_FILE_SIZE = 1_048_576;\n\n void checkFileSize(long bytes) {\n if (bytes > MAX_SUPPORTED_FILE_SIZE) {\n throw new IllegalArgumentException(\"too big\");\n }\n }' Configure the inspection: Use the Ignore constants in 'hashCode()' methods option to disable this inspection within 'hashCode()' methods. Use the Ignore in annotations option to ignore magic numbers in annotations. Use the Ignore initial capacity for StringBuilders and Collections option to ignore magic numbers used as initial capacity when constructing 'Collection', 'Map', 'StringBuilder' or 'StringBuffer' objects.", - "markdown": "Reports \"magic numbers\": numeric literals that are not named by a constant declaration.\n\nUsing magic numbers can lead to unclear code, as well as errors if a magic\nnumber is changed in one location but remains unchanged not another. The numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 0L, 1L, 2L,\n0.0, 1.0, 0.0F and 1.0F are not reported by this inspection.\n\nExample:\n\n\n void checkFileSize(long bytes) {\n if (bytes > 1_048_576) {\n throw new IllegalArgumentException(\"too big\");\n }\n }\n\nA quick-fix introduces a new constant:\n\n\n static final int MAX_SUPPORTED_FILE_SIZE = 1_048_576;\n\n void checkFileSize(long bytes) {\n if (bytes > MAX_SUPPORTED_FILE_SIZE) {\n throw new IllegalArgumentException(\"too big\");\n }\n }\n\nConfigure the inspection:\n\n* Use the **Ignore constants in 'hashCode()' methods** option to disable this inspection within `hashCode()` methods.\n* Use the **Ignore in annotations** option to ignore magic numbers in annotations.\n* Use the **Ignore initial capacity for StringBuilders and Collections** option to ignore magic numbers used as initial capacity when constructing `Collection`, `Map`, `StringBuilder` or `StringBuffer` objects." + "text": "Reports 'String' concatenations that can be simplified by replacing them with a string template. Example: 'String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are \" + 29 + \" years old.\";' After the quick-fix is applied: 'String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";' This inspection depends on the Java feature 'String templates', which is available since Java 21-preview. New in 2023.3", + "markdown": "Reports `String` concatenations that can be simplified by replacing them with a string template.\n\n**Example:**\n\n\n String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are \" + 29 + \" years old.\";\n\nAfter the quick-fix is applied:\n\n\n String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";\n\nThis inspection depends on the Java feature 'String templates', which is available since Java 21-preview.\n\nNew in 2023.3" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MagicNumber", + "suppressToolId": "StringTemplateMigration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32735,8 +32654,8 @@ "relationships": [ { "target": { - "id": "Java/Abstraction issues", - "index": 85, + "id": "Java/Java language level migration aids/Java 21", + "index": 195, "toolComponent": { "name": "QDJVM" } @@ -32748,28 +32667,28 @@ ] }, { - "id": "EnumSwitchStatementWhichMissesCases", + "id": "MustAlreadyBeRemovedApi", "shortDescription": { - "text": "Enum 'switch' statement that misses case" + "text": "API must already be removed" }, "fullDescription": { - "text": "Reports 'switch' statements over enumerated types that are not exhaustive. Example: 'enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n\n }\n }\n }' After the quick-fix is applied: 'enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n case A -> {}\n case B -> {}\n case C -> {}\n }\n }\n }' Use the Ignore switch statements with a default branch option to ignore 'switch' statements that have a 'default' branch. This inspection depends on the Java feature 'Enums', which is available since Java 5.", - "markdown": "Reports `switch` statements over enumerated types that are not exhaustive.\n\n**Example:**\n\n\n enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n case A -> {}\n case B -> {}\n case C -> {}\n }\n }\n }\n\n\nUse the **Ignore switch statements with a default branch** option to ignore `switch`\nstatements that have a `default` branch.\n\n\nThis inspection depends on the Java feature 'Enums', which is available since Java 5." + "text": "Reports declarations marked with '@ApiStatus.ScheduledForRemoval' that should have been removed in the current version of the declaring library. It compares the specified scheduled removal version with the version that you can set below. Specify the version as a string separated with dots and optionally postfixed with 'alpha', 'beta', 'snapshot', or 'eap'. Examples of valid versions: '1.0', '2.3.1', '2018.1', '7.5-snapshot', '3.0-eap'. Version comparison is intuitive: '1.0 < 2.0', '1.0-eap < 1.0', '2.3-snapshot < 2.3' and so on. For detailed comparison logic, refer to the implementation of VersionComparatorUtil.", + "markdown": "Reports declarations marked with `@ApiStatus.ScheduledForRemoval` that should have been removed in the current version of the declaring library.\n\nIt compares the specified scheduled removal version with the version that you can set below.\n\n\nSpecify the version as a string separated with dots and optionally postfixed with\n`alpha`, `beta`, `snapshot`, or `eap`.\n\nExamples of valid versions: `1.0`, `2.3.1`, `2018.1`, `7.5-snapshot`, `3.0-eap`.\n\n\nVersion comparison is intuitive: `1.0 < 2.0`, `1.0-eap < 1.0`, `2.3-snapshot < 2.3` and so on.\nFor detailed comparison logic, refer to the implementation of [VersionComparatorUtil](https://github.com/JetBrains/intellij-community/blob/master/platform/util-rt/src/com/intellij/util/text/VersionComparatorUtil.java)." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "error", "parameters": { - "suppressToolId": "EnumSwitchStatementWhichMissesCases", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "MustAlreadyBeRemovedApi", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -32781,19 +32700,19 @@ ] }, { - "id": "NegativelyNamedBooleanVariable", + "id": "CachedNumberConstructorCall", "shortDescription": { - "text": "Negatively named boolean variable" + "text": "Number constructor call with primitive argument" }, "fullDescription": { - "text": "Reports negatively named variables, for example: 'disabled', 'hidden', or 'isNotChanged'. Usually, inverting the 'boolean' value and removing the negation from the name makes the code easier to understand. Example: 'boolean disabled = false;'", - "markdown": "Reports negatively named variables, for example: `disabled`, `hidden`, or `isNotChanged`.\n\nUsually, inverting the `boolean` value and removing the negation from the name makes the code easier to understand.\n\nExample:\n\n\n boolean disabled = false;\n" + "text": "Reports instantiations of new 'Long', 'Integer', 'Short', or 'Byte' objects that have a primitive 'long', 'integer', 'short', or 'byte' argument. It is recommended that you use the static method 'valueOf()' introduced in Java 5. By default, this method caches objects for values between -128 and 127 inclusive. Example: 'Integer i = new Integer(1);\n Long l = new Long(1L);' After the quick-fix is applied, the code changes to: 'Integer i = Integer.valueOf(1);\n Long l = Long.valueOf(1L);' This inspection only reports if the language level of the project or module is 5 or higher Use the Ignore new number expressions with a String argument option to ignore calls to number constructors with a 'String' argument. Use the Report only when constructor is @Deprecated option to only report calls to deprecated constructors. 'Long', 'Integer', 'Short' and 'Byte' constructors are deprecated since JDK 9.", + "markdown": "Reports instantiations of new `Long`, `Integer`, `Short`, or `Byte` objects that have a primitive `long`, `integer`, `short`, or `byte` argument.\n\nIt is recommended that you use the static method `valueOf()`\nintroduced in Java 5. By default, this method caches objects for values between -128 and\n127 inclusive.\n\n**Example:**\n\n\n Integer i = new Integer(1);\n Long l = new Long(1L);\n\nAfter the quick-fix is applied, the code changes to:\n\n\n Integer i = Integer.valueOf(1);\n Long l = Long.valueOf(1L);\n\nThis inspection only reports if the language level of the project or module is 5 or higher\n\n\nUse the **Ignore new number expressions with a String argument** option to ignore calls to number constructors with a `String` argument.\n\n\nUse the **Report only when constructor is @Deprecated** option to only report calls to deprecated constructors.\n`Long`, `Integer`, `Short` and `Byte` constructors are deprecated since JDK 9." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NegativelyNamedBooleanVariable", + "suppressToolId": "CachedNumberConstructorCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32801,8 +32720,8 @@ "relationships": [ { "target": { - "id": "Java/Data flow", - "index": 65, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -32814,28 +32733,28 @@ ] }, { - "id": "MethodWithMultipleLoops", + "id": "MarkdownDocumentationCommentsMigration", "shortDescription": { - "text": "Method with multiple loops" + "text": "Javadoc comment can be Markdown documentation comment" }, "fullDescription": { - "text": "Reports methods that contain more than one loop statement. Example: The method below will be reported because it contains two loops: 'void methodWithTwoLoops(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n System.out.println(i);\n }\n\n int j = 0;\n while (j < n2) {\n System.out.println(j);\n j++;\n }\n }' The following method will also be reported because it contains a nested loop: 'void methodWithNestedLoop(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n for (int j = 0; j < n2; j++) {\n System.out.println(i + j);\n }\n }\n }'", - "markdown": "Reports methods that contain more than one loop statement.\n\n**Example:**\n\nThe method below will be reported because it contains two loops:\n\n\n void methodWithTwoLoops(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n System.out.println(i);\n }\n\n int j = 0;\n while (j < n2) {\n System.out.println(j);\n j++;\n }\n }\n\nThe following method will also be reported because it contains a nested loop:\n\n\n void methodWithNestedLoop(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n for (int j = 0; j < n2; j++) {\n System.out.println(i + j);\n }\n }\n }\n" + "text": "Reports Javadoc comments that can be converted to Markdown documentation comments. Example: '/**\n * For blubbering of the florz.\n *\n * Similar to {@link com.deeps.Querp querping} class.\n */\n class FlorzBlubber {\n }' After the quick-fix is applied: '/// For blubbering of the florz.\n /// Similar to [querping][com.deeps.Querp] class.\n class FlorzBlubber {\n }' New in 2024.2", + "markdown": "Reports Javadoc comments that can be converted to Markdown documentation comments.\n\n**Example:**\n\n\n /**\n * For blubbering of the florz.\n *\n * Similar to {@link com.deeps.Querp querping} class.\n */\n class FlorzBlubber {\n }\n\nAfter the quick-fix is applied:\n\n\n /// For blubbering of the florz.\n /// Similar to [querping][com.deeps.Querp] class.\n class FlorzBlubber {\n }\n\nNew in 2024.2" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "MethodWithMultipleLoops", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "MarkdownDocumentationCommentsMigration", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Method metrics", - "index": 135, + "id": "Java/Java language level migration aids/Java 23", + "index": 201, "toolComponent": { "name": "QDJVM" } @@ -32847,22 +32766,19 @@ ] }, { - "id": "SuspiciousIntegerDivAssignment", + "id": "FieldHidesSuperclassField", "shortDescription": { - "text": "Suspicious integer division assignment" + "text": "Subclass field hides superclass field" }, "fullDescription": { - "text": "Reports assignments whose right side is a division that shouldn't be truncated to integer. While occasionally intended, this construction is often buggy. Example: 'int x = 18;\n x *= 3/2; // doesn't change x because of the integer division result' This code should be replaced with: 'int x = 18;\n x *= 3.0/2;' In the inspection options, you can disable warnings for suspicious but possibly correct divisions, for example, when the dividend can't be calculated statically. 'void calc(int d) {\n int x = 18;\n x *= d/2;\n }' New in 2019.2", - "markdown": "Reports assignments whose right side is a division that shouldn't be truncated to integer.\n\nWhile occasionally intended, this construction is often buggy.\n\n**Example:**\n\n\n int x = 18;\n x *= 3/2; // doesn't change x because of the integer division result\n\n\nThis code should be replaced with:\n\n\n int x = 18;\n x *= 3.0/2;\n\n\nIn the inspection options, you can disable warnings for suspicious but possibly correct divisions,\nfor example, when the dividend can't be calculated statically.\n\n\n void calc(int d) {\n int x = 18;\n x *= d/2;\n }\n\n\nNew in 2019.2" + "text": "Reports fields in a derived class that are named identically a field of a superclass. Java fields cannot be overridden in derived classes, so the field in the derived class will hide the field from the superclass. As a result of such naming, you may accidentally use the field of the derived class where the identically named field of a base class is intended. A quick-fix is suggested to rename the field in the derived class. Example: 'class Parent {\n Parent parent;\n}\nclass Child extends Parent {\n Child parent;\n}' You can configure the following options for this inspection: Ignore non-accessible fields - indicates whether this inspection should report all name clashes, or only clashes with fields which are visible from the subclass. Ignore static fields hiding static fields - ignore 'static' fields which hide 'static' fields in base classes.", + "markdown": "Reports fields in a derived class that are named identically a field of a superclass. Java fields cannot be overridden in derived classes, so the field in the derived class will hide the field from the superclass.\n\n\nAs a result of such naming, you may accidentally use the field of the derived class\nwhere the identically named field of a base class is intended.\n\nA quick-fix is suggested to rename the field in the derived class.\n\n**Example:**\n\n class Parent {\n Parent parent;\n }\n class Child extends Parent {\n Child parent;\n }\n\n\nYou can configure the following options for this inspection:\n\n1. **Ignore non-accessible fields** - indicates whether this inspection should report all name clashes, or only clashes with fields which are visible from the subclass.\n2. **Ignore static fields hiding static fields** - ignore `static` fields which hide `static` fields in base classes." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousIntegerDivAssignment", - "cweIds": [ - 682 - ], + "suppressToolId": "FieldNameHidesFieldInSuperclass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32870,8 +32786,8 @@ "relationships": [ { "target": { - "id": "Java/Probable bugs", - "index": 15, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -32883,19 +32799,19 @@ ] }, { - "id": "SleepWhileHoldingLock", + "id": "SimpleDateFormatWithoutLocale", "shortDescription": { - "text": "Call to 'Thread.sleep()' while synchronized" + "text": "'SimpleDateFormat' without locale" }, "fullDescription": { - "text": "Reports calls to 'java.lang.Thread.sleep()' methods that occur within a 'synchronized' block or method. 'sleep()' within a 'synchronized' block may result in decreased performance, poor scalability, and possibly even deadlocking. Consider using 'wait()' instead, as it will release the lock held. Example: 'synchronized (lock) {\n Thread.sleep(100);\n }'", - "markdown": "Reports calls to `java.lang.Thread.sleep()` methods that occur within a `synchronized` block or method.\n\n\n`sleep()` within a\n`synchronized` block may result in decreased performance, poor scalability, and possibly\neven deadlocking. Consider using `wait()` instead,\nas it will release the lock held.\n\n**Example:**\n\n\n synchronized (lock) {\n Thread.sleep(100);\n }\n" + "text": "Reports instantiations of 'java.util.SimpleDateFormat' or 'java.time.format.DateTimeFormatter' that do not specify a 'java.util.Locale'. These calls will use the platform default locale, which depends on the OS settings. This can lead to surprising behaviour when the code is run on a different platform or the OS settings are changed. 'Example:' 'new SimpleDateFormat(\"yyyy\");\n DateTimeFormatter.ofPattern(\"d/M/y\");'", + "markdown": "Reports instantiations of `java.util.SimpleDateFormat` or `java.time.format.DateTimeFormatter` that do not specify a `java.util.Locale`. These calls will use the platform default locale, which depends on the OS settings. This can lead to surprising behaviour when the code is run on a different platform or the OS settings are changed.\n\n`Example:`\n\n\n new SimpleDateFormat(\"yyyy\");\n DateTimeFormatter.ofPattern(\"d/M/y\");\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SleepWhileHoldingLock", + "suppressToolId": "SimpleDateFormatWithoutLocale", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32903,8 +32819,8 @@ "relationships": [ { "target": { - "id": "Java/Threading issues", - "index": 29, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -32916,19 +32832,19 @@ ] }, { - "id": "DeprecatedClassUsageInspection", + "id": "AnnotationClass", "shortDescription": { - "text": "Deprecated API usage in XML" + "text": "Annotation interface" }, "fullDescription": { - "text": "Reports usages of deprecated classes and methods in XML files.", - "markdown": "Reports usages of deprecated classes and methods in XML files." + "text": "Reports annotation interfaces. Such interfaces are not supported under Java 1.4 and earlier.", + "markdown": "Reports annotation interfaces. Such interfaces are not supported under Java 1.4 and earlier." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DeprecatedClassUsageInspection", + "suppressToolId": "AnnotationClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32936,8 +32852,8 @@ "relationships": [ { "target": { - "id": "XML", - "index": 115, + "id": "Java/Java language level issues", + "index": 147, "toolComponent": { "name": "QDJVM" } @@ -32949,19 +32865,19 @@ ] }, { - "id": "MethodReturnAlwaysConstant", + "id": "Finalize", "shortDescription": { - "text": "Method returns per-class constant" + "text": "'finalize()' should not be overridden" }, "fullDescription": { - "text": "Reports methods that only return a constant, which may differ for various inheritors. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", - "markdown": "Reports methods that only return a constant, which may differ for various inheritors.\n\nAvailable only from **Code \\| Inspect Code** or\n**Code \\| Analyze Code \\| Run Inspection by Name** and isn't reported in the editor." + "text": "Reports overriding the 'Object.finalize()' method. According to the 'Object.finalize()' documentation: The finalization mechanism is inherently problematic. Finalization can lead to performance issues, deadlocks, and hangs. Errors in finalizers can lead to resource leaks; there is no way to cancel finalization if it is no longer necessary; and no ordering is specified among calls to 'finalize' methods of different objects. Furthermore, there are no guarantees regarding the timing of finalization. The 'finalize' method might be called on a finalizable object only after an indefinite delay, if at all. Configure the inspection: Use the Ignore for trivial 'finalize()' implementations option to ignore 'finalize()' implementations with an empty method body or a body containing only 'if' statements that have a condition which evaluates to 'false' and is a compile-time constant. For performance reasons it can be beneficial to override a non-trivial 'finalize()' with an empty implementation in a subclass. An empty final 'finalize()' implementation can also be used to prevent subclasses from overriding.", + "markdown": "Reports overriding the `Object.finalize()` method.\n\nAccording to the `Object.finalize()` documentation:\n>\n> The finalization mechanism is inherently problematic. Finalization can lead\n> to performance issues, deadlocks, and hangs. Errors in finalizers can lead\n> to resource leaks; there is no way to cancel finalization if it is no longer\n> necessary; and no ordering is specified among calls to `finalize`\n> methods of different objects. Furthermore, there are no guarantees regarding\n> the timing of finalization. The `finalize` method might be called\n> on a finalizable object only after an indefinite delay, if at all.\n\nConfigure the inspection:\n\n* Use the **Ignore for trivial 'finalize()' implementations** option to ignore `finalize()` implementations with an empty method body or a body containing only `if` statements that have a condition which evaluates to `false` and is a compile-time constant. For performance reasons it can be beneficial to override a non-trivial `finalize()` with an empty implementation in a subclass. An empty final `finalize()` implementation can also be used to prevent subclasses from overriding." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MethodReturnAlwaysConstant", + "suppressToolId": "FinalizeDeclaration", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -32969,8 +32885,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Finalization", + "index": 75, "toolComponent": { "name": "QDJVM" } @@ -32982,28 +32898,28 @@ ] }, { - "id": "DuplicateBranchesInSwitch", + "id": "PointlessArithmeticExpression", "shortDescription": { - "text": "Duplicate branches in 'switch'" + "text": "Pointless arithmetic expression" }, "fullDescription": { - "text": "Reports 'switch' statements or expressions that contain the same code in different branches and suggests merging the duplicate branches. Example: 'switch (n) {\n case 1:\n System.out.println(n);\n break;\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }' After the quick-fix is applied: 'switch (n) {\n case 1:\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }' New in 2019.1", - "markdown": "Reports `switch` statements or expressions that contain the same code in different branches and suggests merging the duplicate branches.\n\nExample:\n\n\n switch (n) {\n case 1:\n System.out.println(n);\n break;\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }\n\nAfter the quick-fix is applied:\n\n\n switch (n) {\n case 1:\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }\n\nNew in 2019.1" + "text": "Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying by zero or one, and division by one. Such expressions may be the result of automated refactorings and they are unlikely to be what the developer intended to do. The quick-fix simplifies such expressions. Example: 'void f(int a) {\n int x = a - a;\n int y = a + 0;\n int res = x / x;\n }' After the quick-fix is applied: 'void f(int a) {\n int x = 0;\n int y = a;\n int res = 1;\n }' Note that in rare cases, the suggested replacement might not be completely equivalent to the original code for all possible inputs. For example, the inspection suggests replacing 'x / x' with '1'. However, if 'x' is zero, the original code throws 'ArithmeticException' or results in 'NaN'. Also, if 'x' is 'NaN', then the result is also 'NaN'. It's very unlikely that such behavior is intended.", + "markdown": "Reports pointless arithmetic expressions. Such expressions include adding or subtracting zero, multiplying by zero or one, and division by one.\n\nSuch expressions may be the result of automated refactorings and they are unlikely to be what the developer intended to do.\n\nThe quick-fix simplifies such expressions.\n\n**Example:**\n\n\n void f(int a) {\n int x = a - a;\n int y = a + 0;\n int res = x / x;\n }\n\nAfter the quick-fix is applied:\n\n\n void f(int a) {\n int x = 0;\n int y = a;\n int res = 1;\n }\n\n\nNote that in rare cases, the suggested replacement might not be completely equivalent to the original code\nfor all possible inputs. For example, the inspection suggests replacing `x / x` with `1`.\nHowever, if `x` is zero, the original code throws `ArithmeticException` or results in `NaN`.\nAlso, if `x` is `NaN`, then the result is also `NaN`. It's very unlikely that such behavior is intended." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "DuplicateBranchesInSwitch", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "PointlessArithmeticExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -33015,28 +32931,28 @@ ] }, { - "id": "SingleElementAnnotation", + "id": "OverlyLargePrimitiveArrayInitializer", "shortDescription": { - "text": "Non-normalized annotation" + "text": "Overly large initializer for array of primitive type" }, "fullDescription": { - "text": "Reports annotations in a shorthand form and suggests rewriting them in a normal form with an attribute name. Example: '@SuppressWarnings(\"foo\")' After the quick-fix is applied: '@SuppressWarnings(value = \"foo\")'", - "markdown": "Reports annotations in a shorthand form and suggests rewriting them in a normal form with an attribute name.\n\nExample:\n\n\n @SuppressWarnings(\"foo\")\n\nAfter the quick-fix is applied:\n\n\n @SuppressWarnings(value = \"foo\")\n" + "text": "Reports array initializer expressions for primitive arrays that contain too many elements. Such initializers may result in overly large class files because code must be generated to initialize each array element. In memory or bandwidth constrained environments, it may be more efficient to load large arrays of primitives from resource files. 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. Use the option to specify the maximum number of elements to allow in primitive array initializers.", + "markdown": "Reports array initializer expressions for primitive arrays that contain too many elements. Such initializers may result in overly large class files because code must be generated to initialize each array element. In memory or bandwidth constrained environments, it may be more efficient to load large arrays of primitives from resource files.\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\nUse the option to specify the maximum number of elements to allow in primitive array initializers." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SingleElementAnnotation", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "OverlyLargePrimitiveArrayInitializer", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -33048,19 +32964,19 @@ ] }, { - "id": "ManualMinMaxCalculation", + "id": "ObjectNotify", "shortDescription": { - "text": "Manual min/max calculation" + "text": "Call to 'notify()' instead of 'notifyAll()'" }, "fullDescription": { - "text": "Reports cases where the minimum or the maximum of two numbers can be calculated using a 'Math.max()' or 'Math.min()' call, instead of doing it manually. Example: 'public int min(int a, int b) {\n return b < a ? b : a;\n }' After the quick-fix is applied: 'public int min(int a, int b) {\n return Math.min(a, b);\n }' Use the Disable for float and double option to disable this inspection for 'double' and 'float' types. This is useful because the quick-fix may slightly change the semantics for 'float'/ 'double' types when handling 'NaN'. Nevertheless, in most cases this will actually fix a subtle bug where 'NaN' is not taken into account. New in 2019.2", - "markdown": "Reports cases where the minimum or the maximum of two numbers can be calculated using a `Math.max()` or `Math.min()` call, instead of doing it manually.\n\n**Example:**\n\n\n public int min(int a, int b) {\n return b < a ? b : a;\n }\n\nAfter the quick-fix is applied:\n\n\n public int min(int a, int b) {\n return Math.min(a, b);\n }\n\n\nUse the **Disable for float and double** option to disable this inspection for `double` and `float` types.\nThis is useful because the quick-fix may slightly change the semantics for `float`/\n`double` types when handling `NaN`. Nevertheless, in most cases this will actually fix\na subtle bug where `NaN` is not taken into account.\n\nNew in 2019.2" + "text": "Reports calls to 'Object.notify()'. While occasionally useful, in almost all cases 'Object.notifyAll()' is a better choice because calling 'Object.notify()' may lead to deadlocks. See Doug Lea's Concurrent Programming in Java for a discussion.", + "markdown": "Reports calls to `Object.notify()`. While occasionally useful, in almost all cases `Object.notifyAll()` is a better choice because calling `Object.notify()` may lead to deadlocks. See Doug Lea's *Concurrent Programming in Java* for a discussion." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ManualMinMaxCalculation", + "suppressToolId": "CallToNotifyInsteadOfNotifyAll", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33068,8 +32984,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -33081,19 +32997,19 @@ ] }, { - "id": "SillyAssignment", + "id": "InstanceVariableUninitializedUse", "shortDescription": { - "text": "Variable is assigned to itself" + "text": "Instance field used before initialization" }, "fullDescription": { - "text": "Reports assignments of a variable to itself. Example: 'a = a;' The quick-fix removes the assigment.", - "markdown": "Reports assignments of a variable to itself.\n\n**Example:**\n\n\n a = a;\n\nThe quick-fix removes the assigment." + "text": "Reports instance variables that are read before initialization. The inspection ignores equality checks with 'null'. Example: 'class Foo {\n int bar;\n\n Foo() {\n System.out.println(bar);\n }\n }' Note that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables reported as initialized will always be initialized. Use the Ignore if annotated by option to specify special annotations. The inspection will ignore fields annotated with one of these annotations. Use the Ignore primitive fields option to ignore uninitialized primitive fields.", + "markdown": "Reports instance variables that are read before initialization.\n\nThe inspection ignores equality checks with `null`.\n\n**Example:**\n\n\n class Foo {\n int bar;\n\n Foo() {\n System.out.println(bar);\n }\n }\n\nNote that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables\nreported as initialized will always be initialized.\n\nUse the **Ignore if annotated by** option to specify special annotations. The inspection will ignore fields\nannotated with one of these annotations.\n\nUse the **Ignore primitive fields** option to ignore uninitialized primitive fields." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SillyAssignment", + "suppressToolId": "InstanceVariableUsedBeforeInitialized", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33101,8 +33017,8 @@ "relationships": [ { "target": { - "id": "Java/Declaration redundancy", - "index": 13, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -33114,28 +33030,28 @@ ] }, { - "id": "BoundedWildcard", + "id": "ExpressionMayBeFactorized", "shortDescription": { - "text": "Can use bounded wildcard" + "text": "Expression can be factorized" }, "fullDescription": { - "text": "Reports generic method parameters that can make use of bounded wildcards. Example: 'void process(Consumer consumer);' should be replaced with: 'void process(Consumer consumer);' This method signature is more flexible because it accepts more types: not only 'Consumer', but also 'Consumer'. Likewise, type parameters in covariant position: 'T produce(Producer p);' should be replaced with: 'T produce(Producer p);' To quote Joshua Bloch in Effective Java third Edition: Item 31: Use bounded wildcards to increase API flexibility Using wildcard types in your APIs, while tricky, makes the APIs far more flexible. If you write a library that will be widely used, the proper use of wildcard types should be considered mandatory. Remember the basic rule: producer-extends, consumer-super (PECS). Also remember that all Comparables and Comparators are consumers. Use the inspection options to toggle the reporting for: invariant classes. An example of an invariant class is 'java.util.List' because it both accepts values (via the 'List.add(T)' method) and produces values (via the 'T List.get()' method). On the other hand, 'contravariant' classes only receive values, for example, 'java.util.function.Consumer' with the only method 'accept(T)'. Similarly, 'covariant' classes only produce values, for example, 'java.util.function.Supplier' with the only method 'T get()'. People often use bounded wildcards in covariant/contravariant classes but avoid wildcards in invariant classes, for example, 'void process(List l)'. Disable this option to ignore such invariant classes and leave them rigidly typed, for example, 'void process(List l)'. 'private' methods, which can be considered as not a part of the public API instance methods", - "markdown": "Reports generic method parameters that can make use of [bounded wildcards](https://en.wikipedia.org/wiki/Wildcard_(Java)).\n\n**Example:**\n\n\n void process(Consumer consumer);\n\nshould be replaced with:\n\n\n void process(Consumer consumer);\n\n\nThis method signature is more flexible because it accepts more types: not only\n`Consumer`, but also `Consumer`.\n\nLikewise, type parameters in covariant position:\n\n\n T produce(Producer p);\n\nshould be replaced with:\n\n\n T produce(Producer p);\n\n\nTo quote [Joshua Bloch](https://en.wikipedia.org/wiki/Joshua_Bloch#Effective_Java) in *Effective Java* third Edition:\n>\n> #### Item 31: Use bounded wildcards to increase API flexibility\n>\n> Using wildcard types in your APIs, while tricky, makes the APIs far more flexible. If you write a library that will be widely used, the proper use of wildcard types should be considered mandatory. Remember the basic rule: producer-extends, consumer-super (PECS). Also remember that all Comparables and Comparators are consumers.\n\n\nUse the inspection options to toggle the reporting for:\n\n*\n invariant classes. An example of an invariant class is `java.util.List` because it both accepts values\n (via the `List.add(T)` method)\n and produces values (via the `T List.get()` method).\n\n\n On the\n other hand, `contravariant` classes only receive values, for example, `java.util.function.Consumer`\n with the only method `accept(T)`. Similarly, `covariant` classes\n only produce values, for example, `java.util.function.Supplier`\n with the only method `T get()`.\n\n\n People often use bounded wildcards in covariant/contravariant\n classes but avoid wildcards in invariant classes, for example, `void process(List l)`.\n Disable this option to ignore such invariant classes and leave them rigidly typed, for example, `void\n process(List l)`.\n*\n `private` methods, which can be considered as not a part of the public API\n\n*\n instance methods" + "text": "Reports expressions that can be factorized, i.e. reorganized to pull out a common factor. This reduces redundancy and could improve the readability of your code. Example: 'a && b || a && c' After the quick-fix is applied: 'a && (b || c)' New in 2021.3", + "markdown": "Reports expressions that can be factorized, i.e. reorganized to pull out a common factor. This reduces redundancy and could improve the readability of your code.\n\n**Example:**\n\n\n a && b || a && c\n\nAfter the quick-fix is applied:\n\n\n a && (b || c)\n\nNew in 2021.3" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "BoundedWildcard", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ExpressionMayBeFactorized", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Code style issues", - "index": 11, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -33147,19 +33063,19 @@ ] }, { - "id": "InstanceVariableInitialization", + "id": "ListRemoveInLoop", "shortDescription": { - "text": "Instance field may not be initialized" + "text": "'List.remove()' called in loop" }, "fullDescription": { - "text": "Reports instance variables that may be uninitialized upon object initialization. Example: 'class Foo {\n public int bar;\n\n static { }\n }' Note that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables reported as initialized will always be initialized. Use the Ignore primitive fields option to ignore uninitialized primitive fields.", - "markdown": "Reports instance variables that may be uninitialized upon object initialization.\n\n**Example:**\n\n\n class Foo {\n public int bar;\n\n static { }\n }\n\nNote that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables\nreported as initialized will always be initialized.\n\nUse the **Ignore primitive fields** option to ignore uninitialized primitive fields." + "text": "Reports 'List.remove(index)' called in a loop that can be replaced with 'List.subList().clear()'. The replacement is more efficient for most 'List' implementations when many elements are deleted. Example: 'void removeRange(List list, int from, int to) {\n for (int i = from; i < to; i++) {\n list.remove(from);\n }\n }' After the quick-fix is applied: 'void removeRange(List list, int from, int to) {\n if (to > from) {\n list.subList(from, to).clear();\n }\n }' The quick-fix adds a range check automatically to prevent a possible 'IndexOutOfBoundsException' when the minimal value is bigger than the maximal value. It can be removed if such a situation is impossible in your code. New in 2018.2", + "markdown": "Reports `List.remove(index)` called in a loop that can be replaced with `List.subList().clear()`.\n\nThe replacement\nis more efficient for most `List` implementations when many elements are deleted.\n\nExample:\n\n\n void removeRange(List list, int from, int to) {\n for (int i = from; i < to; i++) {\n list.remove(from);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void removeRange(List list, int from, int to) {\n if (to > from) {\n list.subList(from, to).clear();\n }\n }\n\n\nThe quick-fix adds a range check automatically to prevent a possible `IndexOutOfBoundsException` when the minimal value is bigger\nthan the maximal value. It can be removed if such a situation is impossible in your code.\n\nNew in 2018.2" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "InstanceVariableMayNotBeInitialized", + "suppressToolId": "ListRemoveInLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33167,8 +33083,8 @@ "relationships": [ { "target": { - "id": "Java/Initialization", - "index": 33, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -33180,28 +33096,28 @@ ] }, { - "id": "IfStatementWithTooManyBranches", + "id": "MissingOverrideAnnotation", "shortDescription": { - "text": "'if' statement with too many branches" + "text": "Missing '@Override' annotation" }, "fullDescription": { - "text": "Reports 'if' statements with too many branches. Such statements may be confusing and are often a sign of inadequate levels of design abstraction. Use the Maximum number of branches field to specify the maximum number of branches an 'if' statement is allowed to have.", - "markdown": "Reports `if` statements with too many branches.\n\nSuch statements may be confusing and are often a sign of inadequate levels of design\nabstraction.\n\n\nUse the **Maximum number of branches** field to specify the maximum number of branches an `if` statement is allowed to have." + "text": "Reports methods overriding superclass methods but are not annotated with '@java.lang.Override'. Annotating methods with '@java.lang.Override' improves code readability since it shows the intent. In addition, the compiler emits an error when a signature of the overridden method doesn't match the superclass method. Example: 'class X {\n public String toString() {\n return \"hello world\";\n }\n }' After the quick-fix is applied: 'class X {\n @Override\n public String toString() {\n return \"hello world\";\n }\n }' Configure the inspection: Use the Ignore 'equals()', 'hashCode()' and 'toString()' option to ignore these 'java.lang.Object' methods: 'equals()', 'hashCode()', and 'toString()'. The risk that these methods will disappear and your code won't be compiling anymore due to the '@Override' annotation is relatively small. Use the Ignore methods in anonymous classes option to ignore methods in anonymous classes. Disable the Highlight method when its overriding methods do not all have the '@Override' annotation option to only warn on the methods missing an '@Override' annotation, and not on overridden methods where one or more descendants are missing an '@Override' annotation. This inspection depends on the Java feature 'Annotations', which is available since Java 5.", + "markdown": "Reports methods overriding superclass methods but are not annotated with `@java.lang.Override`.\n\n\nAnnotating methods with `@java.lang.Override` improves code readability since it shows the intent.\nIn addition, the compiler emits an error when a signature of the overridden method doesn't match the superclass method.\n\n**Example:**\n\n\n class X {\n public String toString() {\n return \"hello world\";\n }\n }\n \nAfter the quick-fix is applied:\n\n\n class X {\n @Override\n public String toString() {\n return \"hello world\";\n }\n }\n \nConfigure the inspection:\n\n* Use the **Ignore 'equals()', 'hashCode()' and 'toString()'** option to ignore these `java.lang.Object` methods: `equals()`, `hashCode()`, and `toString()`. The risk that these methods will disappear and your code won't be compiling anymore due to the `@Override` annotation is relatively small.\n* Use the **Ignore methods in anonymous classes** option to ignore methods in anonymous classes.\n* Disable the **Highlight method when its overriding methods do not all have the '@Override' annotation** option to only warn on the methods missing an `@Override` annotation, and not on overridden methods where one or more descendants are missing an `@Override` annotation.\n\nThis inspection depends on the Java feature 'Annotations', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "IfStatementWithTooManyBranches", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "override", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -33213,19 +33129,19 @@ ] }, { - "id": "NonSerializableObjectPassedToObjectStream", + "id": "CharUsedInArithmeticContext", "shortDescription": { - "text": "Non-serializable object passed to 'ObjectOutputStream'" + "text": "'char' expression used in arithmetic context" }, "fullDescription": { - "text": "Reports non-'Serializable' objects used as arguments to 'java.io.ObjectOutputStream.write()'. Such calls will result in runtime exceptions. This inspection assumes objects of the types 'java.util.Collection' and 'java.util.Map' to be 'Serializable', unless the types they are declared in are non-'Serializable'. Example: 'public class IWantToSerializeThis {\n public static void main(String[] args) throws IOException {\n try(var stream = new ObjectOutputStream(Files.newOutputStream(Paths.get(\"output\")))) {\n // Warning -- will fail with NotSerializableException\n stream.writeObject(new IWantToSerializeThis());\n }\n }\n }'", - "markdown": "Reports non-`Serializable` objects used as arguments to `java.io.ObjectOutputStream.write()`. Such calls will result in runtime exceptions.\n\n\nThis inspection assumes objects of the types `java.util.Collection` and\n`java.util.Map` to be `Serializable`, unless the types\nthey are declared in are non-`Serializable`.\n\n**Example:**\n\n\n public class IWantToSerializeThis {\n public static void main(String[] args) throws IOException {\n try(var stream = new ObjectOutputStream(Files.newOutputStream(Paths.get(\"output\")))) {\n // Warning -- will fail with NotSerializableException\n stream.writeObject(new IWantToSerializeThis());\n }\n }\n }\n" + "text": "Reports expressions of the 'char' type used in addition or subtraction expressions. Such code is not necessarily an issue but may result in bugs (for example, if a string is expected). Example: 'int a = 'a' + 42;' After the quick-fix is applied: 'int a = (int) 'a' + 42;' For the 'String' context: 'int i1 = 1;\nint i2 = 2;\nSystem.out.println(i2 + '-' + i1 + \" = \" + (i2 - i1));' After the quick-fix is applied: 'System.out.println(i2 + \"-\" + i1 + \" = \" + (i2 - i1));'", + "markdown": "Reports expressions of the `char` type used in addition or subtraction expressions.\n\nSuch code is not necessarily an issue but may result in bugs (for example,\nif a string is expected).\n\n**Example:** `int a = 'a' + 42;`\n\nAfter the quick-fix is applied: `int a = (int) 'a' + 42;`\n\nFor the `String` context:\n\n int i1 = 1;\n int i2 = 2;\n System.out.println(i2 + '-' + i1 + \" = \" + (i2 - i1));\n\nAfter the quick-fix is applied:\n`System.out.println(i2 + \"-\" + i1 + \" = \" + (i2 - i1));`" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonSerializableObjectPassedToObjectStream", + "suppressToolId": "CharUsedInArithmeticContext", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33233,8 +33149,8 @@ "relationships": [ { "target": { - "id": "Java/Serialization issues", - "index": 21, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -33246,21 +33162,21 @@ ] }, { - "id": "NullArgumentToVariableArgMethod", + "id": "StringEqualsCharSequence", "shortDescription": { - "text": "Confusing argument to varargs method" + "text": "'String.equals()' called with 'CharSequence' argument" }, "fullDescription": { - "text": "Reports calls to variable arity methods that have a single argument in the vararg parameter position, which is either a 'null' or an array of a subtype of the vararg parameter. Such an argument may be confusing as it is unclear if a varargs or non-varargs call is desired. Example: 'String[] ss = new String[]{\"foo\", \"bar\"};\n System.out.printf(\"%s\", ss);' In this example only the first element of the array will be printed, not the entire array. This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.", - "markdown": "Reports calls to variable arity methods that have a single argument in the vararg parameter position, which is either a `null` or an array of a subtype of the vararg parameter. Such an argument may be confusing as it is unclear if a varargs or non-varargs call is desired.\n\n**Example:**\n\n\n String[] ss = new String[]{\"foo\", \"bar\"};\n System.out.printf(\"%s\", ss);\n\nIn this example only the first element of the array will be printed, not the entire array.\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5." + "text": "Reports calls to 'String.equals()' with a 'CharSequence' as the argument. 'String.equals()' can only return 'true' for 'String' arguments. To compare the contents of a 'String' with a non-'String' 'CharSequence' argument, use the 'contentEquals()' method. Example: 'boolean equals(String s, CharSequence ch) {\n return s.equals(ch);\n }' After quick-fix is applied: 'boolean equals(String s, CharSequence ch) {\n return s.contentEquals(ch);\n }' New in 2017.3", + "markdown": "Reports calls to `String.equals()` with a `CharSequence` as the argument.\n\n\n`String.equals()` can only return `true` for `String` arguments.\nTo compare the contents of a `String` with a non-`String` `CharSequence` argument,\nuse the `contentEquals()` method.\n\n**Example:**\n\n\n boolean equals(String s, CharSequence ch) {\n return s.equals(ch);\n }\n\nAfter quick-fix is applied:\n\n\n boolean equals(String s, CharSequence ch) {\n return s.contentEquals(ch);\n }\n\n\nNew in 2017.3" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ConfusingArgumentToVarargsMethod", + "suppressToolId": "StringEqualsCharSequence", "cweIds": [ - 628 + 597 ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" @@ -33282,19 +33198,19 @@ ] }, { - "id": "UseOfObsoleteDateTimeApi", + "id": "TestFailedLine", "shortDescription": { - "text": "Use of obsolete date-time API" + "text": "Failed line in test" }, "fullDescription": { - "text": "Reports usages of 'java.util.Date', 'java.util.Calendar', 'java.util.GregorianCalendar', 'java.util.TimeZone', and 'java.util.SimpleTimeZone'. While still supported, these classes were made obsolete by the JDK8 Date-Time API and should probably not be used in new development.", - "markdown": "Reports usages of `java.util.Date`, `java.util.Calendar`, `java.util.GregorianCalendar`, `java.util.TimeZone`, and `java.util.SimpleTimeZone`.\n\nWhile still supported, these classes were made obsolete by the JDK8 Date-Time API and should probably\nnot be used in new development." + "text": "Reports failed method calls or assertions in tests. It helps detect the failed line in code faster and start debugging it immediately. Example: '@Test\n fun foo() {\n assertEquals(1, 0) // highlighted\n }'", + "markdown": "Reports failed method calls or assertions in tests. It helps detect the failed line in code faster and start debugging it immediately.\n\n**Example:**\n\n\n @Test\n fun foo() {\n assertEquals(1, 0) // highlighted\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UseOfObsoleteDateTimeApi", + "suppressToolId": "TestFailedLine", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33302,8 +33218,8 @@ "relationships": [ { "target": { - "id": "Java/Code maturity", - "index": 56, + "id": "JVM languages/Test frameworks", + "index": 123, "toolComponent": { "name": "QDJVM" } @@ -33315,19 +33231,22 @@ ] }, { - "id": "ModuleWithTooFewClasses", + "id": "PublicStaticCollectionField", "shortDescription": { - "text": "Module with too few classes" + "text": "'public static' collection field" }, "fullDescription": { - "text": "Reports modules that contain too few classes. Overly small modules may indicate a too fragmented design. 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 Minimum number of classes field to specify the minimum number of classes a module may have.", - "markdown": "Reports modules that contain too few classes. Overly small modules may indicate a too fragmented design. 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 **Minimum number of classes** field to specify the minimum number of classes a module may have." + "text": "Reports modifiable 'public' 'static' Collection fields. Even though they are often used to store collections of constant values, these fields nonetheless represent a security hazard, as their contents may be modified even if the field is declared as 'final'. Example: 'public static final List EVENTS = new ArrayList<>();'\n Use the table in the Options section to specify methods returning unmodifiable collections. 'public' 'static' collection fields initialized with these methods will not be reported.", + "markdown": "Reports modifiable `public` `static` Collection fields.\n\nEven though they are often used to store collections of constant values, these fields nonetheless represent a security\nhazard, as their contents may be modified even if the field is declared as `final`.\n\n**Example:**\n\n\n public static final List EVENTS = new ArrayList<>();\n \n\nUse the table in the **Options** section to specify methods returning unmodifiable collections.\n`public` `static` collection fields initialized with these methods will not be reported." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ModuleWithTooFewClasses", + "suppressToolId": "PublicStaticCollectionField", + "cweIds": [ + 732 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33335,8 +33254,8 @@ "relationships": [ { "target": { - "id": "Java/Modularization issues", - "index": 76, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -33348,19 +33267,19 @@ ] }, { - "id": "OverloadedVarargsMethod", + "id": "ExtendsConcreteCollection", "shortDescription": { - "text": "Overloaded varargs method" + "text": "Class explicitly extends a 'Collection' class" }, "fullDescription": { - "text": "Reports varargs methods with the same name as other methods in the class or in a superclass. Overloaded methods that take a variable number of arguments can be very confusing because it is often unclear which overload gets called. Example: 'public void execute(Runnable... r) {} // warning\n public void execute(Runnable r1, Runnable r2) {}' Use the option to ignore overloaded methods whose parameter types are definitely incompatible.", - "markdown": "Reports varargs methods with the same name as other methods in the class or in a superclass. Overloaded methods that take a variable number of arguments can be very confusing because it is often unclear which overload gets called.\n\n**Example:**\n\n\n public void execute(Runnable... r) {} // warning\n public void execute(Runnable r1, Runnable r2) {}\n\n\nUse the option to ignore overloaded methods whose parameter types are definitely incompatible." + "text": "Reports classes that extend concrete subclasses of the 'java.util.Collection' or 'java.util.Map' classes. Subclassing concrete collection types is a common yet poor practice. It is considerably more brittle than delegating collection calls.", + "markdown": "Reports classes that extend concrete subclasses of the `java.util.Collection` or `java.util.Map` classes.\n\n\nSubclassing concrete collection types is a common yet poor practice. It is considerably more brittle than delegating collection calls." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "OverloadedVarargsMethod", + "suppressToolId": "ClassExtendsConcreteCollection", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33368,8 +33287,8 @@ "relationships": [ { "target": { - "id": "Java/Naming conventions/Method", - "index": 108, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -33381,19 +33300,19 @@ ] }, { - "id": "AnonymousInnerClassMayBeStatic", + "id": "ObjectInstantiationInEqualsHashCode", "shortDescription": { - "text": "Anonymous class may be a named 'static' inner class" + "text": "Object instantiation inside 'equals()' or 'hashCode()'" }, "fullDescription": { - "text": "Reports anonymous classes that may be safely replaced with 'static' inner classes. An anonymous class may be a 'static' inner class if it doesn't explicitly reference its enclosing instance or local classes from its surrounding method. A 'static' inner class does not keep an implicit reference to its enclosing instance. This prevents a common cause of memory leaks and uses less memory per class instance. Since Java 18, only serializable anonymous classes keep an implicit reference to their enclosing instance, if this reference is not used. Therefore, when the module language level is Java 18 or higher, this inspection reports serializable classes only. The quick-fix extracts the anonymous class into a named 'static' inner class. Example: 'void sample() {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n }\n });\n }' After the quick-fix is applied: 'void sample() {\n Thread thread = new Thread(new Task());\n }\n\n private static class Task implements Runnable {\n @Override\n public void run() {\n }\n }'", - "markdown": "Reports anonymous classes that may be safely replaced with `static` inner classes. An anonymous class may be a `static` inner class if it doesn't explicitly reference its enclosing instance or local classes from its surrounding method.\n\n\nA `static` inner class does not keep an implicit reference to its enclosing instance.\nThis prevents a common cause of memory leaks and uses less memory per class instance.\n\n\nSince Java 18, only serializable anonymous classes keep an implicit reference to their enclosing instance,\nif this reference is not used. Therefore, when the module language level is Java 18 or higher,\nthis inspection reports serializable classes only.\n\nThe quick-fix extracts the anonymous class into a named `static` inner class.\n\n**Example:**\n\n\n void sample() {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n }\n });\n }\n\nAfter the quick-fix is applied:\n\n\n void sample() {\n Thread thread = new Thread(new Task());\n }\n\n private static class Task implements Runnable {\n @Override\n public void run() {\n }\n }\n" + "text": "Reports construction of (temporary) new objects inside 'equals()', 'hashCode()', 'compareTo()', and 'Comparator.compare()' methods. Besides constructor invocations, new objects can also be created by autoboxing or iterator creation inside a 'foreach' statement. This can cause performance problems, for example, when objects are added to a 'Set' or 'Map', where these methods will be called often. The inspection will not report when the objects are created in a 'throw' or 'assert' statement. Example: 'class Person {\n private String name;\n private int age;\n\n public boolean equals(Object o) {\n return Arrays.equals(new Object[] {name, age}, new Object[] {((Foo)o).name, ((Foo)o).age});\n }\n\n public int hashCode() {\n return (name + age).hashCode();\n }\n }' In this example, two additional arrays are created inside 'equals()', usages of 'age' field require boxing, and 'name + age' implicitly creates a new string.", + "markdown": "Reports construction of (temporary) new objects inside `equals()`, `hashCode()`, `compareTo()`, and `Comparator.compare()` methods.\n\n\nBesides constructor invocations, new objects can also be created by autoboxing or iterator creation inside a\n`foreach` statement.\nThis can cause performance problems, for example, when objects are added to a `Set` or `Map`,\nwhere these methods will be called often.\n\n\nThe inspection will not report when the objects are created in a `throw` or `assert` statement.\n\n**Example:**\n\n\n class Person {\n private String name;\n private int age;\n\n public boolean equals(Object o) {\n return Arrays.equals(new Object[] {name, age}, new Object[] {((Foo)o).name, ((Foo)o).age});\n }\n\n public int hashCode() {\n return (name + age).hashCode();\n }\n }\n\n\nIn this example, two additional arrays are created inside `equals()`, usages of `age` field require boxing,\nand `name + age` implicitly creates a new string." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AnonymousInnerClassMayBeStatic", + "suppressToolId": "ObjectInstantiationInEqualsHashCode", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33401,8 +33320,8 @@ "relationships": [ { "target": { - "id": "Java/Memory", - "index": 166, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -33414,19 +33333,19 @@ ] }, { - "id": "PublicConstructor", + "id": "UnconditionalWait", "shortDescription": { - "text": "'public' constructor can be replaced with factory method" + "text": "Unconditional 'wait()' call" }, "fullDescription": { - "text": "Reports 'public' constructors. Some coding standards discourage the use of 'public' constructors and recommend 'static' factory methods instead. This way the implementation can be swapped out without affecting the call sites. Example: 'class Test {\n private String name;\n\n public Test(String name) {\n this.name = name;\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n new Test(\"str\").test();\n }\n }' After quick-fix is applied: 'class Test {\n private String name;\n\n private Test(String name) {\n this.name = name;\n }\n\n public static Test getInstance(String name) {\n return new Test(name);\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n getInstance(\"str\").test();\n }\n }'", - "markdown": "Reports `public` constructors.\n\nSome coding standards discourage the use of `public` constructors and recommend\n`static` factory methods instead.\nThis way the implementation can be swapped out without affecting the call sites.\n\n**Example:**\n\n\n class Test {\n private String name;\n\n public Test(String name) {\n this.name = name;\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n new Test(\"str\").test();\n }\n }\n\nAfter quick-fix is applied:\n\n\n class Test {\n private String name;\n\n private Test(String name) {\n this.name = name;\n }\n\n public static Test getInstance(String name) {\n return new Test(name);\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n getInstance(\"str\").test();\n }\n }\n" + "text": "Reports 'wait()' being called unconditionally within a synchronized context. Normally, 'wait()' is used to block a thread until some condition is true. If 'wait()' is called unconditionally, it often indicates that the condition was checked before a lock was acquired. In that case a data race may occur, with the condition becoming true between the time it was checked and the time the lock was acquired. While constructs found by this inspection are not necessarily incorrect, they are certainly worth examining. Example: 'class Bar {\n void foo() throws InterruptedException {\n synchronized (this) {\n wait(); // warning\n }\n }\n }'", + "markdown": "Reports `wait()` being called unconditionally within a synchronized context.\n\n\nNormally, `wait()` is used to block a thread until some condition is true. If\n`wait()` is called unconditionally, it often indicates that the condition was\nchecked before a lock was acquired. In that case a data race may occur, with the condition\nbecoming true between the time it was checked and the time the lock was acquired.\n\n\nWhile constructs found by this inspection are not necessarily incorrect, they are certainly worth examining.\n\n**Example:**\n\n\n class Bar {\n void foo() throws InterruptedException {\n synchronized (this) {\n wait(); // warning\n }\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "PublicConstructor", + "suppressToolId": "UnconditionalWait", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33434,8 +33353,8 @@ "relationships": [ { "target": { - "id": "Java/Class structure", - "index": 20, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -33447,19 +33366,19 @@ ] }, { - "id": "RedundantEmbeddedExpression", + "id": "MethodOverridesInaccessibleMethodOfSuper", "shortDescription": { - "text": "Redundant embedded expression in string template" + "text": "Method overrides inaccessible method of superclass" }, "fullDescription": { - "text": "Reports redundant embedded expressions in 'STR' templates, such as trivial literals or empty expressions. Example: 'System.out.println(STR.\"Hello \\{\"world\"}\");' After the quick-fix is applied: 'System.out.println(STR.\"Hello world\");' This inspection depends on the Java feature 'String templates', which is available since Java 21-preview. New in 2023.3", - "markdown": "Reports redundant embedded expressions in `STR` templates, such as trivial literals or empty expressions.\n\nExample:\n\n\n System.out.println(STR.\"Hello \\{\"world\"}\");\n\nAfter the quick-fix is applied:\n\n\n System.out.println(STR.\"Hello world\");\n\nThis inspection depends on the Java feature 'String templates', which is available since Java 21-preview.\n\nNew in 2023.3" + "text": "Reports methods with the same signature as an inaccessible method of a superclass, for example, a private method, or a package-private method of a superclass in another package. Such method names may be confusing because the method in the subclass may look like an override when in fact it hides the inaccessible method of the superclass. Moreover, if the visibility of the method in the superclass changes later, it may either silently change the semantics of the subclass or cause a compilation error. A quick-fix is suggested to rename the method. Example: 'public class Super {\n private void test() {\n }\n }\n\n public class Sub extends Super {\n void test() { // making 'Super.test()' public causes a compilation error\n // making 'Super.test()' package-private makes 'Sub.test()' an override\n }\n }'", + "markdown": "Reports methods with the same signature as an inaccessible method of a superclass, for example, a private method, or a package-private method of a superclass in another package.\n\n\nSuch method names may be confusing because the method in the subclass may look like an override when in fact\nit hides the inaccessible method of the superclass.\nMoreover, if the visibility of the method in the superclass changes later,\nit may either silently change the semantics of the subclass or cause a compilation error.\n\nA quick-fix is suggested to rename the method.\n\n**Example:**\n\n\n public class Super {\n private void test() {\n }\n }\n\n public class Sub extends Super {\n void test() { // making 'Super.test()' public causes a compilation error\n // making 'Super.test()' package-private makes 'Sub.test()' an override\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantEmbeddedExpression", + "suppressToolId": "MethodOverridesInaccessibleMethodOfSuper", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33467,8 +33386,8 @@ "relationships": [ { "target": { - "id": "Java/Verbose or redundant code constructs", - "index": 47, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -33480,19 +33399,19 @@ ] }, { - "id": "SwitchStatementWithTooFewBranches", + "id": "IntLiteralMayBeLongLiteral", "shortDescription": { - "text": "Minimum 'switch' branches" + "text": "Cast to 'long' can be 'long' literal" }, "fullDescription": { - "text": "Reports 'switch' statements and expressions with too few 'case' labels, and suggests rewriting them as 'if' and 'else if' statements. Example (minimum branches == 3): 'switch (expression) {\n case \"foo\" -> foo();\n case \"bar\" -> bar();\n }' After the quick-fix is applied: 'if (\"foo\".equals(expression)) {\n foo();\n } else if (\"bar\".equals(expression)) {\n bar();\n }' Exhaustive switch expressions (Java 14+) or pattern switch statements (Java 17 preview) without the 'default' branch are not reported. That's because compile-time exhaustiveness check will be lost when the 'switch' is converted to 'if' which might be undesired. Configure the inspection: Use the Minimum number of branches field to specify the minimum expected number of 'case' labels. Use the Do not report pattern switch statements option to avoid reporting switch statements and expressions that have pattern branches. E.g.: 'String result = switch(obj) {\n case String str -> str.trim();\n default -> \"none\";\n };' It might be preferred to keep the switch even with a single pattern branch, rather than using the 'instanceof' statement.", - "markdown": "Reports `switch` statements and expressions with too few `case` labels, and suggests rewriting them as `if` and `else if` statements.\n\nExample (minimum branches == 3):\n\n\n switch (expression) {\n case \"foo\" -> foo();\n case \"bar\" -> bar();\n }\n\nAfter the quick-fix is applied:\n\n\n if (\"foo\".equals(expression)) {\n foo();\n } else if (\"bar\".equals(expression)) {\n bar();\n }\n\nExhaustive switch expressions (Java 14+) or pattern switch statements (Java 17 preview) without the 'default' branch are not reported.\nThat's because compile-time exhaustiveness check will be lost when the `switch` is converted to `if`\nwhich might be undesired.\n\nConfigure the inspection:\n\nUse the **Minimum number of branches** field to specify the minimum expected number of `case` labels.\n\nUse the **Do not report pattern switch statements** option to avoid reporting switch statements and expressions that\nhave pattern branches. E.g.:\n\n\n String result = switch(obj) {\n case String str -> str.trim();\n default -> \"none\";\n };\n\nIt might be preferred to keep the switch even with a single pattern branch, rather than using the `instanceof` statement." + "text": "Reports 'int' literal expressions that are immediately cast to 'long'. Such literal expressions can be replaced with equivalent 'long' literals. Example: 'Long l = (long)42;' After the quick-fix is applied: 'Long l = 42L;'", + "markdown": "Reports `int` literal expressions that are immediately cast to `long`.\n\nSuch literal expressions can be replaced with equivalent `long` literals.\n\n**Example:**\n\n Long l = (long)42;\n\nAfter the quick-fix is applied:\n\n Long l = 42L;\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SwitchStatementWithTooFewBranches", + "suppressToolId": "IntLiteralMayBeLongLiteral", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33500,8 +33419,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Numeric issues/Cast", + "index": 139, "toolComponent": { "name": "QDJVM" } @@ -33513,28 +33432,28 @@ ] }, { - "id": "UsagesOfObsoleteApi", + "id": "SingleCharacterStartsWith", "shortDescription": { - "text": "Usages of ApiStatus.@Obsolete" + "text": "Single character 'startsWith()' or 'endsWith()'" }, "fullDescription": { - "text": "Reports declarations (classes, methods, fields) annotated as '@ApiStatus.Obsolete'. Sometimes it's impossible to delete the current API, though it might not work correctly, there is a newer, or better, or more generic API. This way, it's a weaker variant of '@Deprecated' annotation. The annotated API is not supposed to be used in the new code, but it's permitted to postpone the migration of the existing code, therefore the usage is not considered a warning.", - "markdown": "Reports declarations (classes, methods, fields) annotated as `@ApiStatus.Obsolete`.\n\n\nSometimes it's impossible to delete the current API, though it might not work correctly, there is a newer, or better, or more generic API.\nThis way, it's a weaker variant of `@Deprecated` annotation.\nThe annotated API is not supposed to be used in the new code, but it's permitted to postpone the migration of the existing code,\ntherefore the usage is not considered a warning." + "text": "Reports calls to 'String.startsWith()' and 'String.endsWith()' where single character string literals are passed as an argument. A quick-fix is suggested to replace such calls with more efficiently implemented 'String.charAt()'. However, the performance gain of such change is minimal and the code becomes less readable because of the extra non-zero length check, so it is recommended to apply the quick-fix only inside tight loops. 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: 'boolean startsWithX(String s) {\n return s.startsWith(\"x\");\n }' After the quick-fix is applied: 'boolean startsWithX(String s) {\n return !s.isEmpty() && s.charAt(0) == 'x';\n }'", + "markdown": "Reports calls to `String.startsWith()` and `String.endsWith()` where single character string literals are passed as an argument.\n\n\nA quick-fix is suggested to replace such calls with more efficiently implemented `String.charAt()`.\n\n\nHowever, the performance gain of such change is minimal and the code becomes less readable because of the extra non-zero length check,\nso it is recommended to apply the quick-fix only inside tight loops.\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 boolean startsWithX(String s) {\n return s.startsWith(\"x\");\n }\n\nAfter the quick-fix is applied:\n\n\n boolean startsWithX(String s) {\n return !s.isEmpty() && s.charAt(0) == 'x';\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "UsagesOfObsoleteApi", - "ideaSeverity": "TEXT ATTRIBUTES", - "qodanaSeverity": "Info" + "suppressToolId": "SingleCharacterStartsWith", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JVM languages", - "index": 1, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -33546,19 +33465,19 @@ ] }, { - "id": "ConstantDeclaredInInterface", + "id": "UtilityClassCanBeEnum", "shortDescription": { - "text": "Constant declared in interface" + "text": "Utility class can be 'enum'" }, "fullDescription": { - "text": "Reports constants ('public static final' fields) declared in interfaces. Some coding standards require declaring constants in abstract classes instead.", - "markdown": "Reports constants (`public static final` fields) declared in interfaces.\n\nSome coding standards require declaring constants in abstract classes instead." + "text": "Reports utility classes that can be converted to enums. Some coding style guidelines require implementing utility classes as enums to avoid code coverage issues in 'private' constructors. Example: 'class StringUtils {\n public static final String EMPTY = \"\";\n }' After the quick-fix is applied: 'enum StringUtils {\n ;\n public static final String EMPTY = \"\";\n }' This inspection depends on the Java feature 'Enums', which is available since Java 5.", + "markdown": "Reports utility classes that can be converted to enums.\n\nSome coding style guidelines require implementing utility classes as enums\nto avoid code coverage issues in `private` constructors.\n\n**Example:**\n\n\n class StringUtils {\n public static final String EMPTY = \"\";\n }\n\nAfter the quick-fix is applied:\n\n\n enum StringUtils {\n ;\n public static final String EMPTY = \"\";\n }\n\nThis inspection depends on the Java feature 'Enums', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConstantDeclaredInInterface", + "suppressToolId": "UtilityClassCanBeEnum", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33579,19 +33498,19 @@ ] }, { - "id": "StaticImport", + "id": "ExtendsObject", "shortDescription": { - "text": "Static import" + "text": "Class explicitly extends 'Object'" }, "fullDescription": { - "text": "Reports 'import static' statements. Such 'import' statements are not supported under Java 1.4 or earlier JVMs. Configure the inspection: Use the table below to specify the classes that will be ignored by the inspection when used in an 'import static' statement. Use the Ignore single field static imports checkbox to ignore single-field 'import static' statements. Use the Ignore single method static imports checkbox to ignore single-method 'import static' statements.", - "markdown": "Reports `import static` statements.\n\nSuch `import` statements are not supported under Java 1.4 or earlier JVMs.\n\nConfigure the inspection:\n\n* Use the table below to specify the classes that will be ignored by the inspection when used in an `import static` statement.\n* Use the **Ignore single field static imports** checkbox to ignore single-field `import static` statements.\n* Use the **Ignore single method static imports** checkbox to ignore single-method `import static` statements." + "text": "Reports any classes that are explicitly declared to extend 'java.lang.Object'. Such declaration is redundant and can be safely removed. Example: 'class MyClass extends Object {\n }' The quick-fix removes the redundant 'extends Object' clause: 'class MyClass {\n }'", + "markdown": "Reports any classes that are explicitly declared to extend `java.lang.Object`.\n\nSuch declaration is redundant and can be safely removed.\n\nExample:\n\n\n class MyClass extends Object {\n }\n\nThe quick-fix removes the redundant `extends Object` clause:\n\n\n class MyClass {\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "StaticImport", + "suppressToolId": "ClassExplicitlyExtendsObject", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33599,8 +33518,8 @@ "relationships": [ { "target": { - "id": "Java/Imports", - "index": 24, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -33612,28 +33531,28 @@ ] }, { - "id": "ReplaceNullCheck", + "id": "ReassignedVariable", "shortDescription": { - "text": "Null check can be replaced with method call" + "text": "Reassigned variable" }, "fullDescription": { - "text": "Reports 'null' checks that can be replaced with a call to a static method from 'Objects' or 'Stream'. Example: 'if (message == null) {\n application.messageStorage().save(new EmptyMessage());\n } else {\n application.messageStorage().save(message);\n }' After the quick-fix is applied: 'application.messageStorage()\n .save(Objects.requireNonNullElseGet(message, () -> new EmptyMessage()));' Use the Don't warn if the replacement is longer than the original option to ignore the cases when the replacement is longer than the original code. New in 2017.3", - "markdown": "Reports `null` checks that can be replaced with a call to a static method from `Objects` or `Stream`.\n\n**Example:**\n\n\n if (message == null) {\n application.messageStorage().save(new EmptyMessage());\n } else {\n application.messageStorage().save(message);\n }\n\nAfter the quick-fix is applied:\n\n\n application.messageStorage()\n .save(Objects.requireNonNullElseGet(message, () -> new EmptyMessage()));\n\n\nUse the **Don't warn if the replacement is longer than the original** option to ignore the cases when the replacement is longer than the\noriginal code.\n\nNew in 2017.3" + "text": "Reports reassigned variables, which complicate reading and understanding the code. Example: 'int value = 2 * (height + width);\n System.out.println(\"perimeter: \" + value);\n\n value = height * width;\n System.out.println(\"area: \" + value);'", + "markdown": "Reports reassigned variables, which complicate reading and understanding the code.\n\nExample:\n\n\n int value = 2 * (height + width);\n System.out.println(\"perimeter: \" + value);\n\n value = height * width;\n System.out.println(\"area: \" + value);\n" }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ReplaceNullCheck", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "ReassignedVariable", + "ideaSeverity": "TEXT ATTRIBUTES", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Java/Java language level migration aids/Java 9", - "index": 87, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -33645,19 +33564,19 @@ ] }, { - "id": "NoExplicitFinalizeCalls", + "id": "MethodNameSameAsClassName", "shortDescription": { - "text": "'finalize()' called explicitly" + "text": "Method name same as class name" }, "fullDescription": { - "text": "Reports calls to 'Object.finalize()'. Calling 'Object.finalize()' explicitly may result in objects being placed in an inconsistent state. The garbage collector automatically calls this method on an object when it determines that there are no references to this object. The inspection doesn't report calls to 'super.finalize()' from within implementations of 'finalize()' as they're benign. Example: 'MyObject m = new MyObject();\n m.finalize();\n System.gc()'", - "markdown": "Reports calls to `Object.finalize()`.\n\nCalling `Object.finalize()` explicitly may result in objects being placed in an\ninconsistent state.\nThe garbage collector automatically calls this method on an object when it determines that there are no references to this object.\n\nThe inspection doesn't report calls to `super.finalize()` from within implementations of `finalize()` as\nthey're benign.\n\n**Example:**\n\n\n MyObject m = new MyObject();\n m.finalize();\n System.gc()\n" + "text": "Reports methods that are named identically to their class. While such naming is allowed by the Java language, by convention it is reserved for defining constructors. Using it for methods is probably a mistake or bad practice. Example: 'class MyClass {\n int val;\n\n // Method MyClass named identically to its containing class.\n // Likely, 'void' was added by mistake.\n void MyClass(int val) {\n this.val = val;\n }\n }' When appropriate, a quick-fix converts the method to a constructor: 'class MyClass {\n int val;\n\n MyClass(int val) {\n this.val = val;\n }\n }' Another quick-fix renames the method.", + "markdown": "Reports methods that are named identically to their class. While such naming is allowed by the Java language, by convention it is reserved for defining constructors. Using it for methods is probably a mistake or bad practice.\n\n**Example:**\n\n\n class MyClass {\n int val;\n\n // Method MyClass named identically to its containing class.\n // Likely, 'void' was added by mistake.\n void MyClass(int val) {\n this.val = val;\n }\n }\n\nWhen appropriate, a quick-fix converts the method to a constructor:\n\n\n class MyClass {\n int val;\n\n MyClass(int val) {\n this.val = val;\n }\n }\n\nAnother quick-fix renames the method." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FinalizeCalledExplicitly", + "suppressToolId": "MethodNameSameAsClassName", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33665,8 +33584,8 @@ "relationships": [ { "target": { - "id": "Java/Finalization", - "index": 75, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -33678,19 +33597,19 @@ ] }, { - "id": "NegatedIfElse", + "id": "LocalVariableNamingConvention", "shortDescription": { - "text": "'if' statement with negated condition" + "text": "Local variable naming convention" }, "fullDescription": { - "text": "Reports 'if' statements that contain 'else' branches and whose conditions are negated. Flipping the order of the 'if' and 'else' branches usually increases the clarity of such statements. There is a fix that inverts the current 'if' statement. Example: 'void m(Object o1, Object o2) {\n if (o1 != o2) {\n System.out.println(1);\n }\n else {\n System.out.println(2);\n }\n }' After applying the quick-fix: 'void m(Object o1, Object o2) {\n if (o1 == o2) {\n System.out.println(2);\n } else {\n System.out.println(1);\n }\n }' Use the Ignore '!= null' comparisons option to ignore comparisons of the '!= null' form. Use the Ignore '!= 0' comparisons option to ignore comparisons of the '!= 0' form.", - "markdown": "Reports `if` statements that contain `else` branches and whose conditions are negated.\n\nFlipping the order of the `if` and `else`\nbranches usually increases the clarity of such statements.\n\nThere is a fix that inverts the current `if` statement.\n\nExample:\n\n\n void m(Object o1, Object o2) {\n if (o1 != o2) {\n System.out.println(1);\n }\n else {\n System.out.println(2);\n }\n }\n\nAfter applying the quick-fix:\n\n\n void m(Object o1, Object o2) {\n if (o1 == o2) {\n System.out.println(2);\n } else {\n System.out.println(1);\n }\n }\n\nUse the **Ignore '!= null' comparisons** option to ignore comparisons of the `!= null` form.\n\nUse the **Ignore '!= 0' comparisons** option to ignore comparisons of the `!= 0` form." + "text": "Reports local variables whose names are too short, too long, or do not follow the specified regular expression pattern. Example: 'int X = 42;' should be reported if the inspection is enabled with the default settings in which a variable name should start with a lowercase letter. Configure the inspection: Use the fields in the Options section to specify the minimum length, maximum length, and a regular expression expected for local variable names. Specify 0 in order not to check the length of names. Regular expressions should be specified in the standard java.util.regex format. Use checkboxes to ignore 'for'-loop and 'catch' section parameters.", + "markdown": "Reports local variables whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:** `int X = 42;`\nshould be reported if the inspection is enabled with the default settings in which a variable name should start with a lowercase letter.\n\nConfigure the inspection:\n\n\nUse the fields in the **Options** section to specify the minimum length, maximum length, and a regular expression expected for local variable names.\nSpecify **0** in order not to check the length of names. Regular expressions should be specified in the standard **java.util.regex** format.\n\nUse checkboxes to ignore `for`-loop and `catch` section parameters." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IfStatementWithNegatedCondition", + "suppressToolId": "LocalVariableNamingConvention", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33698,8 +33617,8 @@ "relationships": [ { "target": { - "id": "Java/Control flow issues", - "index": 30, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -33711,19 +33630,19 @@ ] }, { - "id": "FieldCount", + "id": "UnnecessaryJavaDocLink", "shortDescription": { - "text": "Class with too many fields" + "text": "Unnecessary Javadoc link" }, "fullDescription": { - "text": "Reports classes whose number of fields exceeds the specified maximum. Classes with a large number of fields are often trying to do too much. Consider splitting such a class into multiple smaller classes. Configure the inspection: Use the Field count limit field to specify the maximum allowed number of fields in a class. Use the Include constant fields in count option to indicate whether constant fields should be counted. By default only immutable 'static final' objects are counted as constants. Use the 'static final' fields count as constant option to count any 'static final' field as constant. Use the Include enum constants in count option to specify whether 'enum' constants in 'enum' classes should be counted.", - "markdown": "Reports classes whose number of fields exceeds the specified maximum.\n\nClasses with a large number of fields are often trying to do too much. Consider splitting such a class into multiple smaller classes.\n\nConfigure the inspection:\n\n* Use the **Field count limit** field to specify the maximum allowed number of fields in a class.\n* Use the **Include constant fields in count** option to indicate whether constant fields should be counted.\n* By default only immutable `static final` objects are counted as constants. Use the **'static final' fields count as constant** option to count any `static final` field as constant.\n* Use the **Include enum constants in count** option to specify whether `enum` constants in `enum` classes should be counted." + "text": "Reports Javadoc '@see', '{@link}', and '{@linkplain}' tags that refer to the method owning the comment, the super method of the method owning the comment, or the class containing the comment. Such links are unnecessary and can be safely removed with this inspection's quick-fix. The quick-fix will remove the entire Javadoc comment if the tag is its only content. Example: 'class Example {\n /**\n * @see Example#method\n */\n public void method() { }\n }' After the quick-fix is applied: 'class Example {\n public void method() { }\n}' Use the checkbox below to ignore inline links ('{@link}' and '{@linkplain}') to super methods. Although a link to all super methods is automatically added by the Javadoc tool, an inline link to the super method may sometimes be needed in texts of the Javadoc comments.", + "markdown": "Reports Javadoc `@see`, `{@link}`, and `{@linkplain}` tags that refer to the method owning the comment, the super method of the method owning the comment, or the class containing the comment.\n\nSuch links are unnecessary and can be safely removed with this inspection's quick-fix. The\nquick-fix will remove the entire Javadoc comment if the tag is its only content.\n\n**Example:**\n\n\n class Example {\n /**\n * @see Example#method\n */\n public void method() { }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n public void method() { }\n }\n\n\nUse the checkbox below to ignore inline links (`{@link}` and `{@linkplain}`)\nto super methods. Although a link to all super methods is automatically added by the\nJavadoc tool, an inline link to the super method may sometimes be needed in texts of the Javadoc comments." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ClassWithTooManyFields", + "suppressToolId": "UnnecessaryJavaDocLink", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33731,8 +33650,8 @@ "relationships": [ { "target": { - "id": "Java/Class metrics", - "index": 125, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -33742,42 +33661,30 @@ ] } ] - } - ], - "language": "en-US", - "contents": [ - "localizedData", - "nonLocalizedData" - ], - "isComprehensive": false - }, - { - "name": "org.jetbrains.kotlin", - "version": "242.24024-IJ", - "rules": [ + }, { - "id": "RedundantRunCatching", + "id": "EmptyTryBlock", "shortDescription": { - "text": "Redundant 'runCatching' call" + "text": "Empty 'try' block" }, "fullDescription": { - "text": "Reports 'runCatching' calls that are immediately followed by 'getOrThrow'. Such calls can be replaced with just 'run'. Example: 'fun foo() = runCatching { doSomething() }.getOrThrow()' After the quick-fix is applied: 'fun foo() = run { doSomething() }'", - "markdown": "Reports `runCatching` calls that are immediately followed by `getOrThrow`. Such calls can be replaced with just `run`.\n\n**Example:**\n\n\n fun foo() = runCatching { doSomething() }.getOrThrow()\n\nAfter the quick-fix is applied:\n\n\n fun foo() = run { doSomething() }\n" + "text": "Reports empty 'try' blocks, including try-with-resources statements. 'try' blocks with comments are considered empty. This inspection doesn't report empty 'try' blocks found in JSP files.", + "markdown": "Reports empty `try` blocks, including try-with-resources statements.\n\n`try` blocks with comments are considered empty.\n\n\nThis inspection doesn't report empty `try` blocks found in JSP files." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantRunCatching", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "EmptyTryBlock", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -33789,19 +33696,19 @@ ] }, { - "id": "SimpleRedundantLet", + "id": "NestedSwitchStatement", "shortDescription": { - "text": "Redundant receiver-based 'let' call" + "text": "Nested 'switch' statement" }, "fullDescription": { - "text": "Reports redundant receiver-based 'let' calls. The quick-fix removes the redundant 'let' call. Example: 'fun test(s: String?): Int? = s?.let { it.length }' After the quick-fix is applied: 'fun test(s: String?): Int? = s?.length'", - "markdown": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + "text": "Reports nested 'switch' statements or expressions. Nested 'switch' statements may result in extremely confusing code. These statements may be extracted to a separate method. Example: 'int res = switch (i) {\n case 0 -> 0;\n default -> switch (i) {\n case 100 -> 0;\n default -> i;\n };\n };'", + "markdown": "Reports nested `switch` statements or expressions.\n\nNested `switch` statements\nmay result in extremely confusing code. These statements may be extracted to a separate method.\n\nExample:\n\n\n int res = switch (i) {\n case 0 -> 0;\n default -> switch (i) {\n case 100 -> 0;\n default -> i;\n };\n };\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SimpleRedundantLet", + "suppressToolId": "NestedSwitchStatement", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33809,8 +33716,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -33822,19 +33729,19 @@ ] }, { - "id": "RemoveSingleExpressionStringTemplate", + "id": "CollectionsFieldAccessReplaceableByMethodCall", "shortDescription": { - "text": "Redundant string template" + "text": "Reference to empty collection field can be replaced with method call" }, "fullDescription": { - "text": "Reports single-expression string templates that can be safely removed. Example: 'val x = \"Hello\"\n val y = \"$x\"' After the quick-fix is applied: 'val x = \"Hello\"\n val y = x // <== Updated'", - "markdown": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + "text": "Reports usages of 'java.util.Collections' fields: 'EMPTY_LIST', 'EMPTY_MAP' or 'EMPTY_SET'. These field usages may be replaced with the following method calls: 'emptyList()', 'emptyMap()', or 'emptySet()'. Such method calls prevent unchecked warnings by the compiler because the type parameters can be inferred. Example: 'List emptyList = Collections.EMPTY_LIST;' After the quick-fix is applied: 'List emptyList = Collections.emptyList();' This inspection only reports if the language level of the project or module is 5 or higher.", + "markdown": "Reports usages of `java.util.Collections` fields: `EMPTY_LIST`, `EMPTY_MAP` or `EMPTY_SET`. These field usages may be replaced with the following method calls: `emptyList()`, `emptyMap()`, or `emptySet()`. Such method calls prevent unchecked warnings by the compiler because the type parameters can be inferred.\n\n**Example:**\n\n\n List emptyList = Collections.EMPTY_LIST;\n\nAfter the quick-fix is applied:\n\n\n List emptyList = Collections.emptyList();\n\nThis inspection only reports if the language level of the project or module is 5 or higher." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RemoveSingleExpressionStringTemplate", + "suppressToolId": "CollectionsFieldAccessReplaceableByMethodCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33842,8 +33749,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -33855,19 +33762,19 @@ ] }, { - "id": "NonExhaustiveWhenStatementMigration", + "id": "AssertWithSideEffects", "shortDescription": { - "text": "Non-exhaustive 'when' statements will be prohibited since 1.7" + "text": "'assert' statement with side effects" }, "fullDescription": { - "text": "Reports a non-exhaustive 'when' statements that will lead to compilation error since 1.7. Motivation types: Problematic/meaningless usage patterns need to be discouraged/blocked (e.g. counterintuitive behaviors) Code is error-prone Inconsistency in the design (things are done differently in different contexts) Impact types: Compilation. Some code that used to compile won't compile any more There were cases when such code worked with no exceptions Some such code could compile without any warnings More details: KT-47709: Make when statements with enum, sealed, and Boolean subjects exhaustive by default The quick-fix adds the missing 'else -> {}' branch. Example: 'sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n }\n }' After the quick-fix is applied: 'sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n else -> {}\n }\n }' This inspection only reports if the Kotlin language level of the project or module is 1.6 or higher.", - "markdown": "Reports a non-exhaustive `when` statements that will lead to compilation error since 1.7.\n\nMotivation types:\n\n* Problematic/meaningless usage patterns need to be discouraged/blocked (e.g. counterintuitive behaviors)\n * Code is error-prone\n* Inconsistency in the design (things are done differently in different contexts)\n\nImpact types:\n\n* Compilation. Some code that used to compile won't compile any more\n * There were cases when such code worked with no exceptions\n * Some such code could compile without any warnings\n\n**More details:** [KT-47709: Make when statements with enum, sealed, and Boolean subjects exhaustive by default](https://youtrack.jetbrains.com/issue/KT-47709)\n\nThe quick-fix adds the missing `else -> {}` branch.\n\n**Example:**\n\n\n sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n sealed class Base {\n class A : Base()\n class B : Base()\n }\n\n fun test(base: Base) {\n when (base) {\n is Base.A -> \"\"\n else -> {}\n }\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.6 or higher." + "text": "Reports 'assert' statements that cause side effects. Since assertions can be switched off, these side effects are not guaranteed, which can cause subtle bugs. Common unwanted side effects detected by this inspection are modifications of variables and fields. When methods calls are involved, they are analyzed one level deep. Example: 'assert i++ < 10;' This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", + "markdown": "Reports `assert` statements that cause side effects.\n\n\nSince assertions can be switched off,\nthese side effects are not guaranteed, which can cause subtle bugs. Common unwanted side effects detected by this inspection are\nmodifications of variables and fields. When methods calls are involved, they are analyzed one level deep.\n\n**Example:**\n\n\n assert i++ < 10;\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "NonExhaustiveWhenStatementMigration", + "suppressToolId": "AssertWithSideEffects", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33875,8 +33782,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -33888,19 +33795,19 @@ ] }, { - "id": "IncompleteDestructuring", + "id": "WaitOrAwaitWithoutTimeout", "shortDescription": { - "text": "Incomplete destructuring declaration" + "text": "'wait()' or 'await()' without timeout" }, "fullDescription": { - "text": "Reports incomplete destructuring declaration. Example: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person' The quick fix completes destructuring declaration with new variables: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person'", - "markdown": "Reports incomplete destructuring declaration.\n\n**Example:**\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person\n\nThe quick fix completes destructuring declaration with new variables:\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person\n" + "text": "Reports calls to 'Object.wait()' or 'Condition.await()' without specifying a timeout. Such calls may be dangerous in high-availability programs, as failures in one component may result in blockages of the waiting component if 'notify()'/'notifyAll()' or 'signal()'/'signalAll()' never get called. Example: 'void foo(Object bar) throws InterruptedException {\n bar.wait();\n }'", + "markdown": "Reports calls to `Object.wait()` or `Condition.await()` without specifying a timeout.\n\n\nSuch calls may be dangerous in high-availability programs, as failures in one\ncomponent may result in blockages of the waiting component\nif `notify()`/`notifyAll()`\nor `signal()`/`signalAll()` never get called.\n\n**Example:**\n\n\n void foo(Object bar) throws InterruptedException {\n bar.wait();\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "IncompleteDestructuring", + "suppressToolId": "WaitOrAwaitWithoutTimeout", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -33908,8 +33815,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -33921,28 +33828,28 @@ ] }, { - "id": "ScopeFunctionConversion", + "id": "FinalClass", "shortDescription": { - "text": "Scope function can be converted to another one" + "text": "Class is closed to inheritance" }, "fullDescription": { - "text": "Reports scope functions ('let', 'run', 'apply', 'also') that can be converted between each other. Using corresponding functions makes your code simpler. The quick-fix replaces the scope function to another one. Example: 'val x = \"\".let {\n it.length\n }' After the quick-fix is applied: 'val x = \"\".run {\n length\n }'", - "markdown": "Reports scope functions (`let`, `run`, `apply`, `also`) that can be converted between each other.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the scope function to another one.\n\n**Example:**\n\n\n val x = \"\".let {\n it.length\n }\n\nAfter the quick-fix is applied:\n\n\n val x = \"\".run {\n length\n }\n" + "text": "Reports classes that are declared 'final'. Final classes that extend a 'sealed' class or interface are not reported. Such classes can't be inherited and may indicate a lack of object-oriented design. Some coding standards discourage 'final' classes. Example: 'public final class Main {\n }' After the quick-fix is applied: 'public class Main {\n }'", + "markdown": "Reports classes that are declared `final`. Final classes that extend a `sealed` class or interface are not reported. Such classes can't be inherited and may indicate a lack of object-oriented design. Some coding standards discourage `final` classes.\n\n**Example:**\n\n\n public final class Main {\n }\n\nAfter the quick-fix is applied:\n\n\n public class Main {\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ScopeFunctionConversion", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "FinalClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -33954,28 +33861,28 @@ ] }, { - "id": "TrailingComma", + "id": "UnnecessaryEmptyArrayUsage", "shortDescription": { - "text": "Trailing comma recommendations" + "text": "Unnecessary zero length array usage" }, "fullDescription": { - "text": "Reports trailing commas that do not follow the recommended style guide.", - "markdown": "Reports trailing commas that do not follow the recommended [style guide](https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)." + "text": "Reports allocations of arrays with known lengths of zero when there is a constant for that in the class of the array's element type. As zero-length arrays are immutable, you can save memory reusing the same array instance. Example: 'class Item {\n // Public zero-length array constant that can be reused \n public static final Item[] EMPTY_ARRAY = new Item[0];\n }\n class EmptyNode {\n Item[] getChildren() {\n // Unnecessary zero-length array creation\n return new Item[0];\n }\n }' After the quick-fix is applied: 'class EmptyNode {\n Item[] getChildren() {\n return Item.EMPTY_ARRAY;\n }\n }'", + "markdown": "Reports allocations of arrays with known lengths of zero when there is a constant for that in the class of the array's element type. As zero-length arrays are immutable, you can save memory reusing the same array instance.\n\n**Example:**\n\n\n class Item {\n // Public zero-length array constant that can be reused \n public static final Item[] EMPTY_ARRAY = new Item[0];\n }\n class EmptyNode {\n Item[] getChildren() {\n // Unnecessary zero-length array creation\n return new Item[0];\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class EmptyNode {\n Item[] getChildren() {\n return Item.EMPTY_ARRAY;\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "TrailingComma", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConstantForZeroLengthArrayAllocation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -33987,28 +33894,28 @@ ] }, { - "id": "FoldInitializerAndIfToElvis", + "id": "LiteralAsArgToStringEquals", "shortDescription": { - "text": "If-Null return/break/... foldable to '?:'" + "text": "String literal may be 'equals()' qualifier" }, "fullDescription": { - "text": "Reports an 'if' expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer. Example: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }' The quick-fix converts the 'if' expression with an initializer into an elvis expression: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }'", - "markdown": "Reports an `if` expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.\n\n**Example:**\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }\n\nThe quick-fix converts the `if` expression with an initializer into an elvis expression:\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }\n" + "text": "Reports 'String.equals()' or 'String.equalsIgnoreCase()' calls with a string literal argument. Some coding standards specify that string literals should be the qualifier of 'equals()', rather than argument, thus minimizing 'NullPointerException'-s. A quick-fix is available to exchange the literal and the expression. Example: 'boolean isFoo(String value) {\n return value.equals(\"foo\");\n }' After the quick-fix is applied: 'boolean isFoo(String value) {\n return \"foo\".equals(value);\n }'", + "markdown": "Reports `String.equals()` or `String.equalsIgnoreCase()` calls with a string literal argument.\n\nSome coding standards specify that string literals should be the qualifier of `equals()`, rather than\nargument, thus minimizing `NullPointerException`-s.\n\nA quick-fix is available to exchange the literal and the expression.\n\n**Example:**\n\n\n boolean isFoo(String value) {\n return value.equals(\"foo\");\n }\n\nAfter the quick-fix is applied:\n\n\n boolean isFoo(String value) {\n return \"foo\".equals(value);\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "FoldInitializerAndIfToElvis", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "LiteralAsArgToStringEquals", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -34020,19 +33927,19 @@ ] }, { - "id": "AmbiguousNonLocalJump", + "id": "DuplicateExpressions", "shortDescription": { - "text": "Ambiguous non-local 'break' or 'continue'" + "text": "Multiple occurrences of the same expression" }, "fullDescription": { - "text": "Reports 'break' or 'continue' usages inside of lambdas of loop-like functions. 'break' and 'continue' keywords always apply to the real loops ('for', 'while', 'do-while'). 'break' and 'continue' never apply to any function; for example, 'break' and 'continue' don't apply to 'forEach', 'filter', 'map'. Using 'break' or 'continue' inside a loop-like function (for example, 'forEach') may be confusing. The inspection suggests adding a label to clarify to which statement 'break' or 'continue' applies to. Since Kotlin doesn't have a concept of loop-like functions, the inspection uses the heuristic. It assumes that functions that don't have one of 'callsInPlace(EXACTLY_ONCE)' or 'callsInPlace(AT_LEAST_ONCE)' contracts are loop-like functions. Example: 'for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue\n println(line)\n }\n }' The quick-fix adds clarifying labels: 'loop@ for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue@loop\n println(line)\n }\n }'", - "markdown": "Reports `break` or `continue` usages inside of lambdas of loop-like functions.\n\n\n`break` and `continue` keywords always apply to the real loops (`for`,\n`while`, `do-while`). `break` and `continue` never apply to any function; for example,\n`break` and `continue` don't apply to `forEach`, `filter`, `map`.\n\n\nUsing `break` or `continue` inside a loop-like function (for example, `forEach`) may be confusing.\nThe inspection suggests adding a label to clarify to which statement `break` or `continue` applies to.\n\n\nSince Kotlin doesn't have a concept of loop-like functions, the inspection uses the heuristic. It assumes that functions that don't\nhave one of `callsInPlace(EXACTLY_ONCE)` or `callsInPlace(AT_LEAST_ONCE)` contracts are loop-like functions.\n\n**Example:**\n\n\n for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue\n println(line)\n }\n }\n\nThe quick-fix adds clarifying labels:\n\n\n loop@ for (file in files) {\n file.readLines().forEach { line ->\n if (line == commentMarkerLine) continue@loop\n println(line)\n }\n }\n" + "text": "Reports multiple equivalent occurrences of the same expression within a method (or constructor, or class initializer) if the result of the expression can be reused. The expression is reported if it's free of side effects and its result is always the same (in terms of 'Object.equals()'). The examples of such expressions are 'a + b', 'Math.max(a, b)', 'a.equals(b)', 's.substring(a,b)'. To make sure the result is always the same, it's verified that the variables used in the expression don't change their values between the occurrences of the expression. Such expressions may contain methods of immutable classes like 'String', 'BigDecimal', and so on, and of utility classes like 'Objects', 'Math' (except 'random()'). The well-known methods, such as 'Object.equals()', 'Object.hashCode()', 'Object.toString()', 'Comparable.compareTo()', and 'Comparator.compare()' are OK as well because they normally don't have any observable side effects. Use the Expression complexity threshold option to specify the minimal expression complexity threshold. Specifying bigger numbers will remove reports on short expressions. 'Path.of' and 'Paths.get' calls are treated as equivalent calls if they have the same arguments. These calls are always reported no matter how complex their arguments are. This behaviour can be tweaked using different complexity threshold. New in 2018.3", + "markdown": "Reports multiple equivalent occurrences of the same expression within a method (or constructor, or class initializer) if the result of the expression can be reused.\n\n\nThe expression is reported if it's free of side effects and its result is always the same (in terms of `Object.equals()`).\nThe examples of such expressions are `a + b`, `Math.max(a, b)`, `a.equals(b)`,\n`s.substring(a,b)`. To make sure the result is always the same, it's verified that the variables used in the expression don't\nchange their values between the occurrences of the expression.\n\n\nSuch expressions may contain methods of immutable classes like `String`, `BigDecimal`, and so on,\nand of utility classes like `Objects`, `Math` (except `random()`).\nThe well-known methods, such as `Object.equals()`, `Object.hashCode()`, `Object.toString()`,\n`Comparable.compareTo()`, and `Comparator.compare()` are OK as well because they normally don't have\nany observable side effects.\n\n\nUse the **Expression complexity threshold** option to specify the minimal expression complexity threshold. Specifying bigger\nnumbers will remove reports on short expressions.\n\n\n`Path.of` and `Paths.get` calls are treated as equivalent calls if they have the same arguments. These calls\nare always reported no matter how complex their arguments are. This behaviour can be tweaked using different complexity threshold.\n\nNew in 2018.3" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "note", "parameters": { - "suppressToolId": "AmbiguousNonLocalJump", + "suppressToolId": "DuplicateExpressions", "ideaSeverity": "WEAK WARNING", "qodanaSeverity": "Moderate" } @@ -34040,8 +33947,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -34053,19 +33960,19 @@ ] }, { - "id": "ReplaceWithStringBuilderAppendRange", + "id": "BooleanConstructor", "shortDescription": { - "text": "'StringBuilder.append(CharArray, offset, len)' call on the JVM" + "text": "Boolean constructor call" }, "fullDescription": { - "text": "Reports a 'StringBuilder.append(CharArray, offset, len)' function call on the JVM platform that should be replaced with a 'StringBuilder.appendRange(CharArray, startIndex, endIndex)' function call. The 'append' function behaves differently on the JVM, JS and Native platforms, so using the 'appendRange' function is recommended. Example: 'fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n append(charArray, offset, len)\n }\n }' After the quick-fix is applied: 'fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n appendRange(charArray, offset, offset + len)\n }\n }'", - "markdown": "Reports a `StringBuilder.append(CharArray, offset, len)` function call on the JVM platform that should be replaced with a `StringBuilder.appendRange(CharArray, startIndex, endIndex)` function call.\n\nThe `append` function behaves differently on the JVM, JS and Native platforms, so using the `appendRange` function is recommended.\n\n**Example:**\n\n\n fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n append(charArray, offset, len)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun f(charArray: CharArray, offset: Int, len: Int): String {\n return buildString {\n appendRange(charArray, offset, offset + len)\n }\n }\n" + "text": "Reports creation of 'Boolean' objects. Constructing new 'Boolean' objects is rarely necessary, and may cause performance problems if done often enough. Also, 'Boolean' constructors are deprecated since Java 9 and could be removed or made inaccessible in future Java versions. Example: 'Boolean b1 = new Boolean(true);\n Boolean b2 = new Boolean(str);' After the quick-fix is applied: 'Boolean b1 = Boolean.TRUE;\n Boolean b2 = Boolean.valueOf(str);'", + "markdown": "Reports creation of `Boolean` objects.\n\n\nConstructing new `Boolean` objects is rarely necessary,\nand may cause performance problems if done often enough. Also, `Boolean`\nconstructors are deprecated since Java 9 and could be removed or made\ninaccessible in future Java versions.\n\n**Example:**\n\n\n Boolean b1 = new Boolean(true);\n Boolean b2 = new Boolean(str);\n\nAfter the quick-fix is applied:\n\n\n Boolean b1 = Boolean.TRUE;\n Boolean b2 = Boolean.valueOf(str);\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ReplaceWithStringBuilderAppendRange", + "suppressToolId": "BooleanConstructorCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34073,8 +33980,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -34086,28 +33993,28 @@ ] }, { - "id": "KotlinInvalidBundleOrProperty", + "id": "TooBroadScope", "shortDescription": { - "text": "Invalid property key" + "text": "Scope of variable is too broad" }, "fullDescription": { - "text": "Reports unresolved references to '.properties' file keys and resource bundles in Kotlin files.", - "markdown": "Reports unresolved references to `.properties` file keys and resource bundles in Kotlin files." + "text": "Reports any variable declarations that can be moved to a smaller scope. This inspection is especially useful for Pascal style declarations at the beginning of a method. Additionally variables with too broad a scope are also often left behind after refactorings. Example: 'StringBuilder sb = new StringBuilder();\n System.out.println();\n sb.append(1);' After the quick-fix is applied: 'System.out.println();\n StringBuilder sb = new StringBuilder();\n sb.append(1);' Configure the inspection: Use the Only report variables that can be moved into inner blocks option to report only those variables that can be moved inside deeper code blocks. For example, when the option is enabled, the movement will not be suggested for the 'sb' variable above. However, it will be suggested for the following code: 'StringBuilder sb = new StringBuilder(a);\n if (flag) {\n sb.append(1);\n }' Use the Report variables with a new expression as initializer (potentially unsafe) option to report variables that are initialized with a new expression. This makes the inspection potentially unsafe when the constructor has non-local side effects. For example, when the option is enabled, the movement will be suggested for the 'foo' variable: 'class Foo {\n static List fooList = new ArrayList<>();\n String bar;\n\n Foo(String bar) {\n this.bar = bar;\n fooList.add(this);\n }\n\n public static void main(String[] args) {\n // movement is possible even though is unsafe\n Foo foo = new Foo(\"bar\");\n System.out.println(fooList.size());\n System.out.println(foo.bar);\n }\n }'", + "markdown": "Reports any variable declarations that can be moved to a smaller scope.\n\nThis inspection is especially\nuseful for *Pascal style* declarations at the beginning of a method. Additionally variables with too broad a\nscope are also often left behind after refactorings.\n\n**Example:**\n\n\n StringBuilder sb = new StringBuilder();\n System.out.println();\n sb.append(1);\n\nAfter the quick-fix is applied:\n\n\n System.out.println();\n StringBuilder sb = new StringBuilder();\n sb.append(1);\n\nConfigure the inspection:\n\n* Use the **Only report variables that can be moved into inner blocks** option to report only those variables that can be moved inside deeper code blocks. For example, when the option is enabled, the movement will not be suggested for the `sb` variable above. However, it will be suggested for the following code:\n\n\n StringBuilder sb = new StringBuilder(a);\n if (flag) {\n sb.append(1);\n }\n\n* Use the **Report variables with a new expression as initializer\n (potentially unsafe)** option to report variables that are initialized with a new expression. This makes the inspection potentially unsafe when the constructor has non-local side effects. For example, when the option is enabled, the movement will be suggested for the `foo` variable:\n\n\n class Foo {\n static List fooList = new ArrayList<>();\n String bar;\n\n Foo(String bar) {\n this.bar = bar;\n fooList.add(this);\n }\n\n public static void main(String[] args) {\n // movement is possible even though is unsafe\n Foo foo = new Foo(\"bar\");\n System.out.println(fooList.size());\n System.out.println(foo.bar);\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "error", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "InvalidBundleOrProperty", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "TooBroadScope", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Data flow", + "index": 65, "toolComponent": { "name": "QDJVM" } @@ -34119,19 +34026,19 @@ ] }, { - "id": "UselessCallOnCollection", + "id": "IfStatementMissingBreakInLoop", "shortDescription": { - "text": "Useless call on collection type" + "text": "Early loop exit in 'if' condition" }, "fullDescription": { - "text": "Reports 'filter…' calls from the standard library on already filtered collections. Several functions from the standard library such as 'filterNotNull()' or 'filterIsInstance' have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise, such calls can be omitted as the result will be the same. Remove redundant call quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }'", - "markdown": "Reports `filter...` calls from the standard library on already filtered collections.\n\nSeveral functions from the standard library such as `filterNotNull()` or `filterIsInstance`\nhave sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,\nsuch calls can be omitted as the result will be the same.\n\n**Remove redundant call** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }\n" + "text": "Reports loops with an 'if' statement that can end with 'break' without changing the semantics. This prevents redundant loop iterations. Example: 'boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n }\n }' After the quick-fix is applied: 'boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n break;\n }\n }' New in 2019.2", + "markdown": "Reports loops with an `if` statement that can end with `break` without changing the semantics. This prevents redundant loop iterations.\n\n**Example:**\n\n\n boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n boolean found = false;\n for (int i = 0; i < arr.length; i++) {\n if (Objects.equals(value, arr[i])) {\n found = true;\n break;\n }\n }\n\nNew in 2019.2" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UselessCallOnCollection", + "suppressToolId": "IfStatementMissingBreakInLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34139,8 +34046,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -34152,28 +34059,28 @@ ] }, { - "id": "RedundantRequireNotNullCall", + "id": "ThrowableSupplierOnlyThrowException", "shortDescription": { - "text": "Redundant 'requireNotNull' or 'checkNotNull' call" + "text": "Throwable supplier never returns a value" }, "fullDescription": { - "text": "Reports redundant 'requireNotNull' or 'checkNotNull' call on non-nullable expressions. Example: 'fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }' After the quick-fix is applied: 'fun foo(i: Int) {\n ...\n }'", - "markdown": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + "text": "Reports 'Supplier' lambdas in 'Optional.orElseThrow()' calls that throw an exception, instead of returning it. Example: 'optional.orElseThrow(() -> {\n throw new RuntimeException();\n});' After the quick-fix is applied: 'optional.orElseThrow(() -> new RuntimeException());' New in 2023.1", + "markdown": "Reports `Supplier` lambdas in `Optional.orElseThrow()` calls that throw an exception, instead of returning it.\n\n**Example:**\n\n\n optional.orElseThrow(() -> {\n throw new RuntimeException();\n });\n\nAfter the quick-fix is applied:\n\n\n optional.orElseThrow(() -> new RuntimeException());\n\nNew in 2023.1" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantRequireNotNullCall", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ThrowableSupplierOnlyThrowException", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -34185,61 +34092,28 @@ ] }, { - "id": "ObjectPropertyName", + "id": "RedundantStreamOptionalCall", "shortDescription": { - "text": "Object property naming convention" + "text": "Redundant step in 'Stream' or 'Optional' call chain" }, "fullDescription": { - "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Top-level properties Properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores. Example: '// top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }'", - "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Top-level properties\n* Properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an uppercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n // top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }\n" + "text": "Reports redundant 'Stream' or 'Optional' calls like 'map(x -> x)', 'filter(x -> true)' or redundant 'sorted()' or 'distinct()' calls. Note that a mapping operation in code like 'streamOfIntegers.map(Integer::valueOf)' works as 'requireNonNull()' check: if the stream contains 'null', it throws a 'NullPointerException', thus it's not absolutely redundant. Disable the Report redundant boxing in Stream.map() option if you do not want such cases to be reported. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports redundant `Stream` or `Optional` calls like `map(x -> x)`, `filter(x -> true)` or redundant `sorted()` or `distinct()` calls.\n\nNote that a mapping operation in code like `streamOfIntegers.map(Integer::valueOf)`\nworks as `requireNonNull()` check:\nif the stream contains `null`, it throws a `NullPointerException`, thus it's not absolutely redundant.\nDisable the **Report redundant boxing in Stream.map()** option if you do not want such cases to be reported.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "note", - "parameters": { - "suppressToolId": "ObjectPropertyName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" - } - }, - "relationships": [ - { - "target": { - "id": "Kotlin/Naming conventions", - "index": 71, - "toolComponent": { - "name": "QDJVM" - } - }, - "kinds": [ - "superset" - ] - } - ] - }, - { - "id": "PackageDirectoryMismatch", - "shortDescription": { - "text": "Package name does not match containing directory" - }, - "fullDescription": { - "text": "Reports 'package' directives that do not match the location of the file. When applying fixes, \"Move refactoring\" defaults are used to update usages of changed declarations, namely: \"Search in comments and strings\" \"Search for text occurrences\"", - "markdown": "Reports `package` directives that do not match the location of the file.\n\n\nWhen applying fixes, \"Move refactoring\" defaults are used to update usages of changed declarations, namely:\n\n* \"Search in comments and strings\"\n* \"Search for text occurrences\"" - }, - "defaultConfiguration": { - "enabled": true, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "PackageDirectoryMismatch", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "RedundantStreamOptionalCall", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -34251,19 +34125,19 @@ ] }, { - "id": "KotlinCovariantEquals", + "id": "ThreadPriority", "shortDescription": { - "text": "Covariant 'equals()'" + "text": "Call to 'Thread.setPriority()'" }, "fullDescription": { - "text": "Reports 'equals()' that takes an argument type other than 'Any?' if the class does not have another 'equals()' that takes 'Any?' as its argument type. Example: 'class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }' To fix the problem create 'equals()' method that takes an argument of type 'Any?'.", - "markdown": "Reports `equals()` that takes an argument type other than `Any?` if the class does not have another `equals()` that takes `Any?` as its argument type.\n\n**Example:**\n\n\n class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }\n\nTo fix the problem create `equals()` method that takes an argument of type `Any?`." + "text": "Reports calls to 'Thread.setPriority()'. Modifying priorities of threads is an inherently non-portable operation, as no guarantees are given in the Java specification of how priorities are used in scheduling threads, or even whether they are used at all.", + "markdown": "Reports calls to `Thread.setPriority()`. Modifying priorities of threads is an inherently non-portable operation, as no guarantees are given in the Java specification of how priorities are used in scheduling threads, or even whether they are used at all." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CovariantEquals", + "suppressToolId": "CallToThreadSetPriority", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34271,8 +34145,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -34284,28 +34158,28 @@ ] }, { - "id": "ReplaceSizeZeroCheckWithIsEmpty", + "id": "NonFinalFieldOfException", "shortDescription": { - "text": "Size zero check can be replaced with 'isEmpty()'" + "text": "Non-final field of 'Exception' class" }, "fullDescription": { - "text": "Reports 'size == 0' checks on 'Collections/Array/String' that should be replaced with 'isEmpty()'. Using 'isEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }'", - "markdown": "Reports `size == 0` checks on `Collections/Array/String` that should be replaced with `isEmpty()`.\n\nUsing `isEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }\n" + "text": "Reports fields in subclasses of 'java.lang.Exception' that are not declared 'final'. Data on exception objects should not be modified because this may result in losing the error context for later debugging and logging. Example: 'public class EditorException extends Exception {\n private String message; // warning: Non-final field 'message' of exception class\n }'", + "markdown": "Reports fields in subclasses of `java.lang.Exception` that are not declared `final`.\n\nData on exception objects should not be modified\nbecause this may result in losing the error context for later debugging and logging.\n\n**Example:**\n\n\n public class EditorException extends Exception {\n private String message; // warning: Non-final field 'message' of exception class\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceSizeZeroCheckWithIsEmpty", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NonFinalFieldOfException", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -34317,19 +34191,19 @@ ] }, { - "id": "AmbiguousExpressionInWhenBranchMigration", + "id": "RedundantStringFormatCall", "shortDescription": { - "text": "Ambiguous logical expressions in 'when' branches since 1.7" + "text": "Redundant call to 'String.format()'" }, "fullDescription": { - "text": "Reports ambiguous logical expressions in 'when' branches which cause compilation errors in Kotlin 1.8 and later. 'fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n this in (4..7) -> true // is ambiguous\n else -> false\n }' After the quick-fix is applied: 'fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n (this in (4..7)) -> true // wrapped in parentheses\n else -> false\n }' Inspection is available for Kotlin language level starting from 1.7.", - "markdown": "Reports ambiguous logical expressions in `when` branches which cause compilation errors in Kotlin 1.8 and later.\n\n\n fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n this in (4..7) -> true // is ambiguous\n else -> false\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.matches(strict: Boolean): Boolean = when (strict) {\n true -> this == 6\n (this in (4..7)) -> true // wrapped in parentheses\n else -> false\n }\n\nInspection is available for Kotlin language level starting from 1.7." + "text": "Reports calls to methods like 'format()' and 'printf()' that can be safely removed or simplified. Example: 'System.out.println(String.format(\"Total count: %d\", 42));' After the quick-fix is applied: 'System.out.printf(\"Total count: %d%n\", 42);'", + "markdown": "Reports calls to methods like `format()` and `printf()` that can be safely removed or simplified.\n\n**Example:**\n\n\n System.out.println(String.format(\"Total count: %d\", 42));\n\nAfter the quick-fix is applied:\n\n\n System.out.printf(\"Total count: %d%n\", 42);\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "AmbiguousExpressionInWhenBranchMigration", + "suppressToolId": "RedundantStringFormatCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34337,8 +34211,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -34350,28 +34224,28 @@ ] }, { - "id": "RedundantEnumConstructorInvocation", + "id": "PointlessNullCheck", "shortDescription": { - "text": "Redundant enum constructor invocation" + "text": "Unnecessary 'null' check before method call" }, "fullDescription": { - "text": "Reports redundant constructor invocation on an enum entry. Example: 'enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }' After the quick-fix is applied: 'enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }'", - "markdown": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + "text": "Reports 'null' checks followed by a method call that will definitely return 'false' when 'null' is passed (e.g. 'Class.isInstance'). Such a check seems excessive as the method call will always return 'false' in this case. Example: 'if (x != null && myClass.isInstance(x)) { ... }' After the quick-fix is applied: 'if (myClass.isInstance(x)) { ... }'", + "markdown": "Reports `null` checks followed by a method call that will definitely return `false` when `null` is passed (e.g. `Class.isInstance`).\n\nSuch a check seems excessive as the method call will always return `false` in this case.\n\n**Example:**\n\n\n if (x != null && myClass.isInstance(x)) { ... }\n\nAfter the quick-fix is applied:\n\n\n if (myClass.isInstance(x)) { ... }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantEnumConstructorInvocation", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "PointlessNullCheck", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -34383,19 +34257,19 @@ ] }, { - "id": "FakeJvmFieldConstant", + "id": "MethodOverridesStaticMethod", "shortDescription": { - "text": "Kotlin non-const property used as Java constant" + "text": "Method tries to override 'static' method of superclass" }, "fullDescription": { - "text": "Reports Kotlin properties that are not 'const' and used as Java annotation arguments. For example, a property with the '@JvmField' annotation has an initializer that can be evaluated at compile-time, and it has a primitive or 'String' type. Such properties have a 'ConstantValue' attribute in bytecode in Kotlin 1.1-1.2. This attribute allows javac to fold usages of the corresponding field and use that field in annotations. This can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code. This behavior is subject to change in Kotlin 1.3 (no 'ConstantValue' attribute any more). Example: Kotlin code in foo.kt file: 'annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"' Java code: 'public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }' To fix the problem replace the '@JvmField' annotation with the 'const' modifier on a relevant Kotlin property or inline it.", - "markdown": "Reports Kotlin properties that are not `const` and used as Java annotation arguments.\n\n\nFor example, a property with the `@JvmField` annotation has an initializer that can be evaluated at compile-time,\nand it has a primitive or `String` type.\n\n\nSuch properties have a `ConstantValue` attribute in bytecode in Kotlin 1.1-1.2.\nThis attribute allows javac to fold usages of the corresponding field and use that field in annotations.\nThis can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code.\nThis behavior is subject to change in Kotlin 1.3 (no `ConstantValue` attribute any more).\n\n**Example:**\n\nKotlin code in foo.kt file:\n\n\n annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"\n\nJava code:\n\n\n public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }\n\nTo fix the problem replace the `@JvmField` annotation with the `const` modifier on a relevant Kotlin property or inline it." + "text": "Reports 'static' methods with a signature identical to a 'static' method of a superclass. Such a method may look like an override when in fact it hides the method from the superclass because 'static' methods in Java cannot be overridden. Example: 'class Parent {\n static void method(){}\n }\n\n class Example extends Parent {\n static void method(){} //warning\n }'", + "markdown": "Reports `static` methods with a signature identical to a `static` method of a superclass. Such a method may look like an override when in fact it hides the method from the superclass because `static` methods in Java cannot be overridden.\n\n**Example:**\n\n\n class Parent {\n static void method(){}\n }\n\n class Example extends Parent {\n static void method(){} //warning\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "FakeJvmFieldConstant", + "suppressToolId": "MethodOverridesStaticMethodOfSuperclass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34403,8 +34277,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -34416,28 +34290,28 @@ ] }, { - "id": "WhenWithOnlyElse", + "id": "RedundantCompareToJavaTime", "shortDescription": { - "text": "'when' has only 'else' branch and can be simplified" + "text": "Expression with 'java.time' 'compareTo()' call can be simplified" }, "fullDescription": { - "text": "Reports 'when' expressions with only an 'else' branch that can be simplified. Simplify expression quick-fix can be used to amend the code automatically. Example: 'fun redundant() {\n val x = when { // <== redundant, the quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }'", - "markdown": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, the quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + "text": "Reports 'java.time' comparisons with 'compareTo()' calls that can be replaced with 'isAfter()', 'isBefore()' or 'isEqual()' calls. Example: 'LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.compareTo(date2) > 0;' After the quick-fix is applied: 'LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.isAfter(date2);' New in 2022.3", + "markdown": "Reports `java.time` comparisons with `compareTo()` calls that can be replaced with `isAfter()`, `isBefore()` or `isEqual()` calls.\n\nExample:\n\n\n LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.compareTo(date2) > 0;\n\nAfter the quick-fix is applied:\n\n\n LocalDate date1 = LocalDate.now();\n LocalDate date2 = LocalDate.now();\n boolean t = date1.isAfter(date2);\n\nNew in 2022.3" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "WhenWithOnlyElse", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "RedundantCompareToJavaTime", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -34449,19 +34323,19 @@ ] }, { - "id": "InfixCallToOrdinary", + "id": "UnclearBinaryExpression", "shortDescription": { - "text": "Infix call may be dot call" + "text": "Multiple operators with different precedence" }, "fullDescription": { - "text": "Reports for infix function calls that can be replaced with dot-qualified function calls. Example: '1 xor 2' '1.xor(2)'", - "markdown": "Reports for infix function calls that can be replaced with dot-qualified function calls.\n\nExample:\n\n\n 1 xor 2\n\n\n 1.xor(2)\n" + "text": "Reports binary, conditional, or 'instanceof' expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: 'int n = 3 + 9 * 8 + 1;' After quick-fix is applied: 'int n = 3 + (9 * 8) + 1;'", + "markdown": "Reports binary, conditional, or `instanceof` expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators.\n\nExample:\n\n\n int n = 3 + 9 * 8 + 1;\n\nAfter quick-fix is applied:\n\n\n int n = 3 + (9 * 8) + 1;\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "InfixCallToOrdinary", + "suppressToolId": "UnclearExpression", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -34469,8 +34343,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Code migration", - "index": 109, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -34482,19 +34356,19 @@ ] }, { - "id": "KotlinTestJUnit", + "id": "ChainedMethodCall", "shortDescription": { - "text": "kotlin-test-junit could be used" + "text": "Chained method calls" }, "fullDescription": { - "text": "Reports usage of 'kotlin-test' and 'junit' dependency without 'kotlin-test-junit'. It is recommended to use 'kotlin-test-junit' dependency to work with Kotlin and JUnit.", - "markdown": "Reports usage of `kotlin-test` and `junit` dependency without `kotlin-test-junit`.\n\nIt is recommended to use `kotlin-test-junit` dependency to work with Kotlin and JUnit." + "text": "Reports method calls whose target is another method call. The quick-fix suggests to introduce a local variable. Example: 'class X {\n int foo(File f) {\n return f.getName().length();\n }\n }' After the quick-fix is applied: 'class X {\n int foo(File f) {\n final String name = f.getName();\n return name.length();\n }\n }' Use the inspection options to toggle warnings for the following cases: chained method calls in field initializers, for instance, 'private final int i = new Random().nextInt();' chained method calls operating on the same type, for instance, 'new StringBuilder().append(\"x: \").append(new X()).append(\"y: \").append(new Y()).toString();'.", + "markdown": "Reports method calls whose target is another method call. The quick-fix suggests to introduce a local variable.\n\n**Example:**\n\n\n class X {\n int foo(File f) {\n return f.getName().length();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n int foo(File f) {\n final String name = f.getName();\n return name.length();\n }\n }\n\nUse the inspection options to toggle warnings for the following cases:\n\n*\n chained method calls in field initializers,\n for instance, `private final int i = new Random().nextInt();`\n\n*\n chained method calls operating on the same type,\n for instance, `new StringBuilder().append(\"x: \").append(new X()).append(\"y: \").append(new Y()).toString();`." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KotlinTestJUnit", + "suppressToolId": "ChainedMethodCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34502,8 +34376,8 @@ "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -34515,28 +34389,28 @@ ] }, { - "id": "SafeCastWithReturn", + "id": "ExtendsUtilityClass", "shortDescription": { - "text": "Safe cast with 'return' should be replaced with 'if' type check" + "text": "Class extends utility class" }, "fullDescription": { - "text": "Reports safe cast with 'return' that can be replaced with 'if' type check. Using corresponding functions makes your code simpler. The quick-fix replaces the safe cast with 'if' type check. Example: 'fun test(x: Any) {\n x as? String ?: return\n }' After the quick-fix is applied: 'fun test(x: Any) {\n if (x !is String) return\n }'", - "markdown": "Reports safe cast with `return` that can be replaced with `if` type check.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the safe cast with `if` type check.\n\n**Example:**\n\n\n fun test(x: Any) {\n x as? String ?: return\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(x: Any) {\n if (x !is String) return\n }\n" + "text": "Reports classes that extend a utility class. A utility class is a non-empty class in which all fields and methods are static. Extending a utility class also allows for inadvertent object instantiation of the utility class, because the constructor cannot be made private in order to allow extension. Configure the inspection: Use the Ignore if overriding class is a utility class option to ignore any classes that override a utility class but are also utility classes themselves.", + "markdown": "Reports classes that extend a utility class.\n\n\nA utility class is a non-empty class in which all fields and methods are static.\nExtending a utility class also allows for inadvertent object instantiation of the\nutility class, because the constructor cannot be made private in order to allow extension.\n\n\nConfigure the inspection:\n\n* Use the **Ignore if overriding class is a utility class** option to ignore any classes that override a utility class but are also utility classes themselves." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SafeCastWithReturn", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ExtendsUtilityClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -34548,28 +34422,28 @@ ] }, { - "id": "ReplaceAssertBooleanWithAssertEquality", + "id": "UtilityClassWithoutPrivateConstructor", "shortDescription": { - "text": "Assert boolean could be replaced with assert equality" + "text": "Utility class without 'private' constructor" }, "fullDescription": { - "text": "Reports calls to 'assertTrue()' and 'assertFalse()' that can be replaced with assert equality functions. 'assertEquals()', 'assertSame()', and their negating counterparts (-Not-) provide more informative messages on failure. Example: 'assertTrue(a == b)' After the quick-fix is applied: 'assertEquals(a, b)'", - "markdown": "Reports calls to `assertTrue()` and `assertFalse()` that can be replaced with assert equality functions.\n\n\n`assertEquals()`, `assertSame()`, and their negating counterparts (-Not-) provide more informative messages on\nfailure.\n\n**Example:**\n\n assertTrue(a == b)\n\nAfter the quick-fix is applied:\n\n assertEquals(a, b)\n" + "text": "Reports utility classes without 'private' constructors. Utility classes have all fields and methods declared as 'static'. Creating 'private' constructors in utility classes prevents them from being accidentally instantiated. Use the Ignore if annotated by option to specify special annotations. The inspection ignores classes marked with one of these annotations. Use the Ignore classes with only a main method option to ignore classes with no methods other than the main one.", + "markdown": "Reports utility classes without `private` constructors.\n\nUtility classes have all fields and methods declared as `static`. Creating `private`\nconstructors in utility classes prevents them from being accidentally instantiated.\n\n\nUse the **Ignore if annotated by** option to specify special annotations. The inspection ignores classes marked with one of\nthese annotations.\n\n\nUse the **Ignore classes with only a main method** option to ignore classes with no methods other than the main one." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceAssertBooleanWithAssertEquality", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UtilityClassWithoutPrivateConstructor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -34581,28 +34455,28 @@ ] }, { - "id": "UnnecessaryOptInAnnotation", + "id": "AssertMessageNotString", "shortDescription": { - "text": "Unnecessary '@OptIn' annotation" + "text": "'assert' message is not a string" }, "fullDescription": { - "text": "Reports unnecessary opt-in annotations that can be safely removed. '@OptIn' annotation is required for the code using experimental APIs that can change any time in the future. This annotation becomes useless and possibly misleading if no such API is used (e.g., when the experimental API becomes stable and does not require opting in its usage anymore). Remove annotation quick-fix can be used to remove the unnecessary '@OptIn' annotation. Example: '@OptIn(ExperimentalApi::class)\n fun foo(x: Bar) {\n x.baz()\n }' After the quick-fix is applied: 'fun foo(x: Bar) {\n x.baz()\n }'", - "markdown": "Reports unnecessary opt-in annotations that can be safely removed.\n\n`@OptIn` annotation is required for the code using experimental APIs that can change\nany time in the future. This annotation becomes useless and possibly misleading if no such API is used\n(e.g., when the experimental API becomes stable and does not require opting in its usage anymore).\n\n\n**Remove annotation** quick-fix can be used to remove the unnecessary `@OptIn` annotation.\n\nExample:\n\n\n @OptIn(ExperimentalApi::class)\n fun foo(x: Bar) {\n x.baz()\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Bar) {\n x.baz()\n }\n" + "text": "Reports 'assert' messages that are not of the 'java.lang.String' type. Using a string provides more information to help diagnose the failure or the assertion reason. Example: 'void foo(List myList) {\n assert myList.isEmpty() : false;\n }' Use the Only warn when the 'assert' message type is 'boolean' or 'java.lang.Boolean' option to only warn when the 'assert' message type is 'boolean' or 'java.lang.Boolean'. A 'boolean' detail message is unlikely to provide additional information about an assertion failure and could result from a mistakenly entered ':' instead of '&'. This inspection depends on the Java feature 'Assertions', which is available since Java 1.4.", + "markdown": "Reports `assert` messages that are not of the `java.lang.String` type.\n\nUsing a string provides more information to help diagnose the failure\nor the assertion reason.\n\n**Example:**\n\n\n void foo(List myList) {\n assert myList.isEmpty() : false;\n }\n\n\nUse the **Only warn when the `assert` message type is 'boolean' or 'java.lang.Boolean'** option to only warn when the `assert` message type is `boolean` or `java.lang.Boolean`.\nA `boolean` detail message is unlikely to provide additional information about an assertion failure\nand could result from a mistakenly entered `:` instead of `&`.\n\nThis inspection depends on the Java feature 'Assertions', which is available since Java 1.4." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryOptInAnnotation", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AssertMessageNotString", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -34614,19 +34488,19 @@ ] }, { - "id": "NonVarPropertyInExternalInterface", + "id": "PatternVariableCanBeUsed", "shortDescription": { - "text": "External interface contains val property" + "text": "Pattern variable can be used" }, "fullDescription": { - "text": "Reports not var properties in external interface. Read more in the migration guide.", - "markdown": "Reports not var properties in external interface. Read more in the [migration guide](https://kotlinlang.org/docs/js-ir-migration.html#convert-properties-of-external-interfaces-to-var)." + "text": "Reports local variable declarations that can be replaced with pattern variables, which are usually more compact. Example: 'if (obj instanceof String) {\n String str = (String) obj;\n System.out.println(str);\n }' Can be replaced with: 'if (obj instanceof String str) {\n System.out.println(str);\n }' This inspection depends on the Java feature 'Patterns in 'instanceof'', which is available since Java 16. New in 2020.1", + "markdown": "Reports local variable declarations that can be replaced with pattern variables, which are usually more compact.\n\n**Example:**\n\n\n if (obj instanceof String) {\n String str = (String) obj;\n System.out.println(str);\n }\n\nCan be replaced with:\n\n\n if (obj instanceof String str) {\n System.out.println(str);\n }\n\nThis inspection depends on the Java feature 'Patterns in 'instanceof'', which is available since Java 16.\n\nNew in 2020.1" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonVarPropertyInExternalInterface", + "suppressToolId": "PatternVariableCanBeUsed", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34634,8 +34508,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Java language level migration aids/Java 16", + "index": 188, "toolComponent": { "name": "QDJVM" } @@ -34647,19 +34521,19 @@ ] }, { - "id": "ReplaceStringFormatWithLiteral", + "id": "ImplicitToExplicitClassBackwardMigration", "shortDescription": { - "text": "'String.format' call can be replaced with string templates" + "text": "Implicitly declared class can be replaced with ordinary class" }, "fullDescription": { - "text": "Reports 'String.format' calls that can be replaced with string templates. Using string templates makes your code simpler. The quick-fix replaces the call with a string template. Example: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }' After the quick-fix is applied: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }'", - "markdown": "Reports `String.format` calls that can be replaced with string templates.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces the call with a string template.\n\n**Example:**\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }\n" + "text": "Reports implicitly declared classes and suggests replacing them with regular classes. Example (in file Sample.java): 'public static void main() {\n System.out.println(\"Hello, world!\");\n }' After the quick-fix is applied: 'public class Sample {\n public static void main() {\n System.out.println(\"Hello, world!\");\n }\n}' This inspection can help to downgrade for backward compatibility with earlier Java versions. This inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview. New in 2024.1", + "markdown": "Reports implicitly declared classes and suggests replacing them with regular classes.\n\n**Example (in file Sample.java):**\n\n\n public static void main() {\n System.out.println(\"Hello, world!\");\n }\n\nAfter the quick-fix is applied:\n\n\n public class Sample {\n public static void main() {\n System.out.println(\"Hello, world!\");\n }\n }\n\n\nThis inspection can help to downgrade for backward compatibility with earlier Java versions.\n\nThis inspection depends on the Java feature 'Implicitly declared classes', which is available since Java 21-preview.\n\nNew in 2024.1" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceStringFormatWithLiteral", + "suppressToolId": "ImplicitToExplicitClassBackwardMigration", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -34667,8 +34541,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level migration aids/Java 21", + "index": 195, "toolComponent": { "name": "QDJVM" } @@ -34680,28 +34554,28 @@ ] }, { - "id": "ReplaceNotNullAssertionWithElvisReturn", + "id": "AnonymousClassVariableHidesContainingMethodVariable", "shortDescription": { - "text": "Not-null assertion can be replaced with 'return'" + "text": "Anonymous class variable hides variable in containing method" }, "fullDescription": { - "text": "Reports not-null assertion ('!!') calls that can be replaced with the elvis operator and return ('?: return'). A not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of '!!' is good practice. The quick-fix replaces the not-null assertion with 'return' or 'return null'. Example: 'fun test(number: Int?) {\n val x = number!!\n }' After the quick-fix is applied: 'fun test(number: Int?) {\n val x = number ?: return\n }'", - "markdown": "Reports not-null assertion (`!!`) calls that can be replaced with the elvis operator and return (`?: return`).\n\nA not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of `!!` is good practice.\n\nThe quick-fix replaces the not-null assertion with `return` or `return null`.\n\n**Example:**\n\n\n fun test(number: Int?) {\n val x = number!!\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(number: Int?) {\n val x = number ?: return\n }\n" + "text": "Reports fields in an anonymous class that are named identically to local variables or parameters of the containing method or lambda expression. As a result of such naming, you may accidentally use the anonymous class field where the identically named variable or parameter from the containing method is intended. A quick-fix is suggested to rename the field. Example: 'class Test {\n public Test(String value) {\n Object foo = new Object() {\n private String value = \"TEST\";\n public void foo() {\n System.out.println(value); //the field is accessed, not the parameter\n }\n };\n }\n }'", + "markdown": "Reports fields in an anonymous class that are named identically to local variables or parameters of the containing method or lambda expression.\n\n\nAs a result of such naming, you may accidentally use the anonymous class field where\nthe identically named variable or parameter from the containing method is intended.\n\nA quick-fix is suggested to rename the field.\n\n**Example:**\n\n\n class Test {\n public Test(String value) {\n Object foo = new Object() {\n private String value = \"TEST\";\n public void foo() {\n System.out.println(value); //the field is accessed, not the parameter\n }\n };\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceNotNullAssertionWithElvisReturn", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AnonymousClassVariableHidesContainingMethodVariable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -34713,19 +34587,19 @@ ] }, { - "id": "ReplaceSubstringWithSubstringBefore", + "id": "MethodRefCanBeReplacedWithLambda", "shortDescription": { - "text": "'substring' call should be replaced with 'substringBefore'" + "text": "Method reference can be replaced with lambda" }, "fullDescription": { - "text": "Reports calls like 's.substring(0, s.indexOf(x))' that can be replaced with 's.substringBefore(x)'. Using 'substringBefore()' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringBefore'. Example: 'fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringBefore('x')\n }'", - "markdown": "Reports calls like `s.substring(0, s.indexOf(x))` that can be replaced with `s.substringBefore(x)`.\n\nUsing `substringBefore()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringBefore`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringBefore('x')\n }\n" + "text": "Reports method references, like 'MyClass::myMethod' and 'myObject::myMethod', and suggests replacing them with an equivalent lambda expression. Lambda expressions can be easier to modify than method references. Example: 'System.out::println' After the quick-fix is applied: 's -> System.out.println(s)' By default, this inspection does not highlight the code in the editor, but only provides a quick-fix. This inspection depends on the following Java features: Lambda expressions Method references These features are available since Java 8.", + "markdown": "Reports method references, like `MyClass::myMethod` and `myObject::myMethod`, and suggests replacing them with an equivalent lambda expression.\n\nLambda expressions can be easier to modify than method references.\n\nExample:\n\n\n System.out::println\n\nAfter the quick-fix is applied:\n\n\n s -> System.out.println(s)\n\nBy default, this inspection does not highlight the code in the editor, but only provides a quick-fix.\n\nThis inspection depends on the following Java features:\n\n* Lambda expressions\n* Method references\n\nThese features are available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceSubstringWithSubstringBefore", + "suppressToolId": "MethodRefCanBeReplacedWithLambda", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -34733,8 +34607,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -34746,28 +34620,28 @@ ] }, { - "id": "ReplaceWithOperatorAssignment", + "id": "NestedSynchronizedStatement", "shortDescription": { - "text": "Assignment can be replaced with operator assignment" + "text": "Nested 'synchronized' statement" }, "fullDescription": { - "text": "Reports modifications of variables with a simple assignment (such as 'y = y + x') that can be replaced with an operator assignment. The quick-fix replaces the assignment with an assignment operator. Example: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }' After the quick-fix is applied: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }'", - "markdown": "Reports modifications of variables with a simple assignment (such as `y = y + x`) that can be replaced with an operator assignment.\n\nThe quick-fix replaces the assignment with an assignment operator.\n\n**Example:**\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }\n" + "text": "Reports nested 'synchronized' statements. It is recommended to avoid nested synchronization if possible, because in some cases it may lead to a deadlock. Example: 'synchronized (lockA){\n //thread 1 is waiting for lockB\n synchronized (lockB){ //warning\n }\n }\n ...\n synchronized (lockB) {\n //thread 2 is waiting for lockA\n synchronized (lockA) { //warning\n }\n }'", + "markdown": "Reports nested `synchronized` statements. It is recommended to avoid nested synchronization if possible, because in some cases it may lead to a deadlock.\n\n**Example:**\n\n\n synchronized (lockA){\n //thread 1 is waiting for lockB\n synchronized (lockB){ //warning\n }\n }\n ...\n synchronized (lockB) {\n //thread 2 is waiting for lockA\n synchronized (lockA) { //warning\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceWithOperatorAssignment", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NestedSynchronizedStatement", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -34779,19 +34653,19 @@ ] }, { - "id": "UnusedSymbol", + "id": "IncorrectDateTimeFormat", "shortDescription": { - "text": "Unused symbol" + "text": "Incorrect 'DateTimeFormat' pattern" }, "fullDescription": { - "text": "Reports symbols that are not used or not reachable from entry points.", - "markdown": "Reports symbols that are not used or not reachable from entry points." + "text": "Reports incorrect date time format patterns. The following errors are reported: Unsupported pattern letters, like \"TT\" Using reserved characters, like \"#\" Incorrect use of padding Unbalanced brackets Incorrect amount of consecutive pattern letters Examples: 'DateTimeFormatter.ofPattern(\"[][]]\"); // Closing ']' without previous opening '['\n DateTimeFormatter.ofPattern(\"TT\"); // Illegal pattern letter 'T'\n DateTimeFormatter.ofPattern(\"{\"); // Use of reserved character '{'\n DateTimeFormatter.ofPattern(\"MMMMMM\"); // Too many consecutive pattern letters 'M'' New in 2022.3", + "markdown": "Reports incorrect date time format patterns.\n\nThe following errors are reported:\n\n* Unsupported pattern letters, like \"TT\"\n* Using reserved characters, like \"#\"\n* Incorrect use of padding\n* Unbalanced brackets\n* Incorrect amount of consecutive pattern letters\n\nExamples:\n\n\n DateTimeFormatter.ofPattern(\"[][]]\"); // Closing ']' without previous opening '['\n DateTimeFormatter.ofPattern(\"TT\"); // Illegal pattern letter 'T'\n DateTimeFormatter.ofPattern(\"{\"); // Use of reserved character '{'\n DateTimeFormatter.ofPattern(\"MMMMMM\"); // Too many consecutive pattern letters 'M'\n\nNew in 2022.3" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "unused", + "suppressToolId": "IncorrectDateTimeFormat", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34799,8 +34673,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -34812,28 +34686,28 @@ ] }, { - "id": "ReplaceCollectionCountWithSize", + "id": "UnnecessaryFullyQualifiedName", "shortDescription": { - "text": "Collection count can be converted to size" + "text": "Unnecessary fully qualified name" }, "fullDescription": { - "text": "Reports calls to 'Collection.count()'. This function call can be replaced with '.size'. '.size' form ensures that the operation is O(1) and won't allocate extra objects, whereas 'count()' could be confused with 'Iterable.count()', which is O(n) and allocating. Example: 'fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }' After the quick-fix is applied: 'fun foo() {\n var list = listOf(1,2,3)\n list.size\n }'", - "markdown": "Reports calls to `Collection.count()`.\n\n\nThis function call can be replaced with `.size`.\n\n\n`.size` form ensures that the operation is O(1) and won't allocate extra objects, whereas\n`count()` could be confused with `Iterable.count()`, which is O(n) and allocating.\n\n\n**Example:**\n\n fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }\n\nAfter the quick-fix is applied:\n\n fun foo() {\n var list = listOf(1,2,3)\n list.size\n }\n" + "text": "Reports fully qualified class names that can be shortened. The quick-fix shortens fully qualified names and adds import statements if necessary. Example: 'class ListWrapper {\n java.util.List l;\n }' After the quick-fix is applied: 'import java.util.List;\n class ListWrapper {\n List l;\n }' Configure the inspection: Use the Ignore in Java 9 module statements option to ignore fully qualified names inside the Java 9 'provides' and 'uses' module statements. In Settings | Editor | Code Style | Java | Imports, use the following options to configure the inspection: Use the Insert imports for inner classes option if references to inner classes should be qualified with the outer class. Use the Use fully qualified class names in JavaDoc option to allow fully qualified names in Javadocs.", + "markdown": "Reports fully qualified class names that can be shortened.\n\nThe quick-fix shortens fully qualified names and adds import statements if necessary.\n\nExample:\n\n\n class ListWrapper {\n java.util.List l;\n }\n\nAfter the quick-fix is applied:\n\n\n import java.util.List;\n class ListWrapper {\n List l;\n }\n\nConfigure the inspection:\n\n\nUse the **Ignore in Java 9 module statements** option to ignore fully qualified names inside the Java 9\n`provides` and `uses` module statements.\n\n\nIn [Settings \\| Editor \\| Code Style \\| Java \\| Imports](settings://preferences.sourceCode.Java?JavaDoc%20Inner),\nuse the following options to configure the inspection:\n\n* Use the **Insert imports for inner classes** option if references to inner classes should be qualified with the outer class.\n* Use the **Use fully qualified class names in JavaDoc** option to allow fully qualified names in Javadocs." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceCollectionCountWithSize", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnnecessaryFullyQualifiedName", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -34845,19 +34719,19 @@ ] }, { - "id": "ReplaceArrayEqualityOpWithArraysEquals", + "id": "NegatedConditional", "shortDescription": { - "text": "Arrays comparison via '==' and '!='" + "text": "Conditional expression with negated condition" }, "fullDescription": { - "text": "Reports usages of '==' or '!=' operator for arrays that should be replaced with 'contentEquals()'. The '==' and '!='operators compare array references instead of their content. Examples: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }' After the quick-fix is applied: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }'", - "markdown": "Reports usages of `==` or `!=` operator for arrays that should be replaced with `contentEquals()`.\n\n\nThe `==` and `!=`operators compare array references instead of their content.\n\n**Examples:**\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }\n\nAfter the quick-fix is applied:\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }\n" + "text": "Reports conditional expressions whose conditions are negated. Flipping the order of the conditional expression branches usually increases the clarity of such statements. Use the Ignore '!= null' comparisons and Ignore '!= 0' comparisons options to ignore comparisons of the form 'obj != null' or 'num != 0'. Since 'obj != null' effectively means \"obj exists\", the meaning of the whole expression does not involve any negation and is therefore easy to understand. The same reasoning applies to 'num != 0' expressions, especially when using bit masks. These forms have the added benefit of mentioning the interesting case first. In most cases, the value for the '== null' branch is 'null' itself, like in the following examples: 'static String getName(Person p) {\n return p != null ? p.getName() : null;\n }\n\n static String getExecutableString(int fileMode) {\n return (fileMode & 0b001001001) != 0 ? \"executable\" : \"non-executable\";\n }'", + "markdown": "Reports conditional expressions whose conditions are negated.\n\nFlipping the order of the conditional expression branches usually increases the clarity of such statements.\n\n\nUse the **Ignore '!= null' comparisons** and **Ignore '!= 0' comparisons** options to ignore comparisons of the form\n`obj != null` or `num != 0`.\nSince `obj != null` effectively means \"obj exists\",\nthe meaning of the whole expression does not involve any negation\nand is therefore easy to understand.\n\n\nThe same reasoning applies to `num != 0` expressions, especially when using bit masks.\n\n\nThese forms have the added benefit of mentioning the interesting case first.\nIn most cases, the value for the `== null` branch is `null` itself,\nlike in the following examples:\n\n\n static String getName(Person p) {\n return p != null ? p.getName() : null;\n }\n\n static String getExecutableString(int fileMode) {\n return (fileMode & 0b001001001) != 0 ? \"executable\" : \"non-executable\";\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ReplaceArrayEqualityOpWithArraysEquals", + "suppressToolId": "ConditionalExpressionWithNegatedCondition", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34865,8 +34739,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -34878,19 +34752,19 @@ ] }, { - "id": "DeprecatedGradleDependency", + "id": "BooleanParameter", "shortDescription": { - "text": "Deprecated library is used in Gradle" + "text": "'public' method with 'boolean' parameter" }, "fullDescription": { - "text": "Reports deprecated dependencies in Gradle build scripts. Example: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }' After the quick-fix applied: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }'", - "markdown": "Reports deprecated dependencies in Gradle build scripts.\n\n**Example:**\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }\n\nAfter the quick-fix applied:\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }\n" + "text": "Reports public methods that accept a 'boolean' parameter. It's almost always bad practice to add a 'boolean' parameter to a public method (part of an API) if that method is not a setter. When reading code using such a method, it can be difficult to decipher what the 'boolean' stands for without looking at the source or documentation. This problem is also known as the boolean trap. The 'boolean' parameter can often be replaced with an 'enum'. Example: '// Warning: it's hard to understand what the\n // boolean parameters mean when looking at\n // a call to this method\n public boolean setPermission(File f,\n int access,\n boolean enable,\n boolean ownerOnly) {\n // ...\n }' Use the Only report methods with multiple boolean parameters option to warn only when a method contains more than one boolean parameter.", + "markdown": "Reports public methods that accept a `boolean` parameter.\n\nIt's almost always bad practice to add a `boolean` parameter to a public method (part of an API) if that method is not a setter.\nWhen reading code using such a method, it can be difficult to decipher what the `boolean` stands for without looking at\nthe source or documentation.\n\nThis problem is also known as [the boolean trap](https://ariya.io/2011/08/hall-of-api-shame-boolean-trap).\nThe `boolean` parameter can often be replaced with an `enum`.\n\nExample:\n\n\n // Warning: it's hard to understand what the\n // boolean parameters mean when looking at\n // a call to this method\n public boolean setPermission(File f,\n int access,\n boolean enable,\n boolean ownerOnly) {\n // ...\n }\n\n\nUse the **Only report methods with multiple boolean parameters** option to warn only when a method contains more than one boolean parameter." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DeprecatedGradleDependency", + "suppressToolId": "BooleanParameter", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34898,8 +34772,8 @@ "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -34911,19 +34785,19 @@ ] }, { - "id": "CastDueToProgressionResolutionChangeMigration", + "id": "TestInProductSource", "shortDescription": { - "text": "Progression resolution change since 1.9" + "text": "Test in product source" }, "fullDescription": { - "text": "Reports overloaded function calls where an argument requires an explicit cast to resolve to a proper declaration. The current compiler warning (available since Kotlin 1.6.20) will become an error in Kotlin 1.8. Progressions and ranges types ('kotlin.ranges') will start implementing the 'Collection' interface in Kotlin 1.9 and later. This update will cause a change in resolution for overloaded functions. For instance, in the example below, the 'test(1..5)' call will be resolved to 'test(t: Any)' in Kotlin 1.8 and earlier and to 'test(t: Collection<*>)' in Kotlin 1.9 and later. 'fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n fun invoke() {\n test(1..5) // IntRange becomes Collection in 1.9\n }' The provided quick-fix captures the behaviour specific to the compiler of version 1.8 and earlier: 'fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test(1..5) // resolved to 'test(t: T)' before Kotlin 1.9\n }' After the quick-fix is applied: 'fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test((1..5) as Iterable) // resolved to 'test(t: T)' in Kotlin 1.9\n }' Inspection is available for the Kotlin language level starting from 1.6.", - "markdown": "Reports overloaded function calls where an argument requires an explicit cast to resolve to a proper declaration.\nThe current compiler warning (available since Kotlin 1.6.20) will become an error in Kotlin 1.8.\n\n\nProgressions and ranges types (`kotlin.ranges`) will start implementing the `Collection` interface in Kotlin\n1.9 and later. This update will cause a change in resolution for overloaded functions. For instance, in the example below, the\n`test(1..5)` call will be resolved to `test(t: Any)` in Kotlin 1.8 and earlier and to\n`test(t: Collection<*>)` in Kotlin 1.9 and later.\n\n\n fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n fun invoke() {\n test(1..5) // IntRange becomes Collection in 1.9\n }\n\nThe provided quick-fix captures the behaviour specific to the compiler of version 1.8 and earlier:\n\n\n fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test(1..5) // resolved to 'test(t: T)' before Kotlin 1.9\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(t: Any) { }\n fun test(t: Collection<*>) { }\n\n fun invoke() {\n test((1..5) as Iterable) // resolved to 'test(t: T)' in Kotlin 1.9\n }\n\nInspection is available for the Kotlin language level starting from 1.6." + "text": "Reports test classes and test methods that are located in production source trees. This most likely a mistake and can result in test code being shipped into production.", + "markdown": "Reports test classes and test methods that are located in production source trees. This most likely a mistake and can result in test code being shipped into production." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CastDueToProgressionResolutionChangeMigration", + "suppressToolId": "TestInProductSource", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -34931,8 +34805,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "JVM languages/Test frameworks", + "index": 123, "toolComponent": { "name": "QDJVM" } @@ -34944,28 +34818,31 @@ ] }, { - "id": "ConvertReferenceToLambda", + "id": "CopyConstructorMissesField", "shortDescription": { - "text": "Can be replaced with lambda" + "text": "Copy constructor misses field" }, "fullDescription": { - "text": "Reports a function reference expression that can be replaced with a function literal (lambda). Sometimes, passing a lambda looks more straightforward and more consistent with the rest of the code. Also, the fix might be handy if you need to replace a simple call with something more complex. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }'", - "markdown": "Reports a function reference expression that can be replaced with a function literal (lambda).\n\n\nSometimes, passing a lambda looks more straightforward and more consistent with the rest of the code.\nAlso, the fix might be handy if you need to replace a simple call with something more complex.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n" + "text": "Reports copy constructors that don't copy all the fields of the class. 'final' fields with initializers and 'transient' fields are considered unnecessary to copy. Example: 'class Point {\n\n private int x;\n private int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n Point(Point other) {\n // fields x and y are not initialized\n }\n }' New in 2018.1", + "markdown": "Reports copy constructors that don't copy all the fields of the class.\n\n\n`final` fields with initializers and `transient` fields are considered unnecessary to copy.\n\n**Example:**\n\n\n class Point {\n\n private int x;\n private int y;\n\n Point(int x, int y) {\n this.x = x;\n this.y = y;\n }\n\n Point(Point other) {\n // fields x and y are not initialized\n }\n }\n\nNew in 2018.1" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ConvertReferenceToLambda", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CopyConstructorMissesField", + "cweIds": [ + 665 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -34977,28 +34854,28 @@ ] }, { - "id": "UnlabeledReturnInsideLambda", + "id": "CastCanBeRemovedNarrowingVariableType", "shortDescription": { - "text": "Unlabeled return inside lambda" + "text": "Too weak variable type leads to unnecessary cast" }, "fullDescription": { - "text": "Reports unlabeled 'return' expressions inside inline lambda. Such expressions can be confusing because it might be unclear which scope belongs to 'return'. Change to return@… quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }'", - "markdown": "Reports unlabeled `return` expressions inside inline lambda.\n\nSuch expressions can be confusing because it might be unclear which scope belongs to `return`.\n\n**Change to return@...** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }\n" + "text": "Reports type casts that can be removed if the variable type is narrowed to the cast type. Example: 'Object x = \" string \";\n System.out.println(((String)x).trim());' Here, changing the type of 'x' to 'String' makes the cast redundant. The suggested quick-fix updates the variable type and removes all redundant casts on that variable: 'String x = \" string \";\n System.out.println(x.trim());' New in 2018.2", + "markdown": "Reports type casts that can be removed if the variable type is narrowed to the cast type.\n\nExample:\n\n\n Object x = \" string \";\n System.out.println(((String)x).trim());\n\n\nHere, changing the type of `x` to `String` makes the cast redundant. The suggested quick-fix updates the variable type and\nremoves all redundant casts on that variable:\n\n\n String x = \" string \";\n System.out.println(x.trim());\n\nNew in 2018.2" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "UnlabeledReturnInsideLambda", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CastCanBeRemovedNarrowingVariableType", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -35010,19 +34887,19 @@ ] }, { - "id": "AddConversionCallMigration", + "id": "AssignmentToStaticFieldFromInstanceMethod", "shortDescription": { - "text": "Explicit conversion from `Int` needed since 1.9" + "text": "Assignment to static field from instance context" }, "fullDescription": { - "text": "Reports expressions that will be of type 'Int', thus causing compilation errors in Kotlin 1.9 and later. Example: 'fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte(1 + 1) // will be resolved to Int in 1.9\n }' After the quick-fix is applied: 'fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte((1 + 1).toByte()) // will be resolved to Int in 1.9\n }' Inspection is available for Kotlin language level starting from 1.7.", - "markdown": "Reports expressions that will be of type `Int`, thus causing compilation errors in Kotlin 1.9 and later.\n\nExample:\n\n\n fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte(1 + 1) // will be resolved to Int in 1.9\n }\n\nAfter the quick-fix is applied:\n\n\n fun takeByte(x: Byte) {}\n\n fun foo() {\n takeByte((1 + 1).toByte()) // will be resolved to Int in 1.9\n }\n\nInspection is available for Kotlin language level starting from 1.7." + "text": "Reports assignment to, or modification of 'static' fields from within an instance method. Although legal, such assignments are tricky to do safely and are often a result of marking fields 'static' inadvertently. Example: 'class Counter {\n private static int count = 0;\n\n void increment() {\n // Warning: updating a static field\n // from an instance method\n count++;\n }\n }'", + "markdown": "Reports assignment to, or modification of `static` fields from within an instance method.\n\nAlthough legal, such assignments are tricky to do\nsafely and are often a result of marking fields `static` inadvertently.\n\n**Example:**\n\n\n class Counter {\n private static int count = 0;\n\n void increment() {\n // Warning: updating a static field\n // from an instance method\n count++;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "AddConversionCallMigration", + "suppressToolId": "AssignmentToStaticFieldFromInstanceMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35030,8 +34907,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -35043,19 +34920,19 @@ ] }, { - "id": "LateinitVarOverridesLateinitVar", + "id": "AbstractClassWithOnlyOneDirectInheritor", "shortDescription": { - "text": "'lateinit var' property overrides 'lateinit var' property" + "text": "Abstract class with a single direct inheritor" }, "fullDescription": { - "text": "Reports 'lateinit var' properties that override other 'lateinit var' properties. A subclass instance will have two fields for a single property, and the one from the superclass will remain effectively unused. Example: 'open class BaseClass {\n open lateinit var name: String\n }\n\n class RealClass : BaseClass() {\n override lateinit var name: String\n }'", - "markdown": "Reports `lateinit var` properties that override other `lateinit var` properties.\n\nA subclass instance will have two fields for a single property, and the one from the superclass will remain effectively unused.\n\n**Example:**\n\n\n open class BaseClass {\n open lateinit var name: String\n }\n\n class RealClass : BaseClass() {\n override lateinit var name: String\n }\n" + "text": "Reports abstract classes that have precisely one direct inheritor. While such classes may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the abstract class with its inheritor. 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: 'abstract class Base {} // will be reported\n\n class Inheritor extends Base {}'", + "markdown": "Reports abstract classes that have precisely one direct inheritor. While such classes may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the abstract class with its inheritor.\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 abstract class Base {} // will be reported\n\n class Inheritor extends Base {}\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LateinitVarOverridesLateinitVar", + "suppressToolId": "AbstractClassWithOnlyOneDirectInheritor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35063,8 +34940,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -35076,28 +34953,31 @@ ] }, { - "id": "VerboseNullabilityAndEmptiness", + "id": "UnsecureRandomNumberGeneration", "shortDescription": { - "text": "Verbose nullability and emptiness check" + "text": "Insecure random number generation" }, "fullDescription": { - "text": "Reports combination of 'null' and emptiness checks that can be simplified into a single check. The quick-fix replaces highlighted checks with a combined check call, such as 'isNullOrEmpty()'. Example: 'fun test(list: List?) {\n if (list == null || list.isEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }' After the quick-fix is applied: 'fun test(list: List?) {\n if (list.isNullOrEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }'", - "markdown": "Reports combination of `null` and emptiness checks that can be simplified into a single check.\n\nThe quick-fix replaces highlighted checks with a combined check call, such as `isNullOrEmpty()`.\n\n**Example:**\n\n\n fun test(list: List?) {\n if (list == null || list.isEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List?) {\n if (list.isNullOrEmpty()) {\n println(\"List is empty!\")\n } else {\n println(list.joinToString())\n }\n }\n" + "text": "Reports any uses of 'java.lang.Random' or 'java.lang.Math.random()'. In secure environments, 'java.secure.SecureRandom' is a better choice, since is offers cryptographically secure random number generation. Example: 'long token = new Random().nextLong();'", + "markdown": "Reports any uses of `java.lang.Random` or `java.lang.Math.random()`.\n\n\nIn secure environments,\n`java.secure.SecureRandom` is a better choice, since is offers cryptographically secure\nrandom number generation.\n\n**Example:**\n\n\n long token = new Random().nextLong();\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "VerboseNullabilityAndEmptiness", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnsecureRandomNumberGeneration", + "cweIds": [ + 330 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -35109,19 +34989,23 @@ ] }, { - "id": "DifferentKotlinGradleVersion", + "id": "NullableProblems", "shortDescription": { - "text": "Kotlin Gradle and IDE plugins versions are different" + "text": "@NotNull/@Nullable problems" }, "fullDescription": { - "text": "Reports that Gradle plugin version isn't properly supported in the current IDE plugin. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }' To fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin.", - "markdown": "Reports that Gradle plugin version isn't properly supported in the current IDE plugin.\n\nThis can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }\n\nTo fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin." + "text": "Reports problems related to nullability annotations. Examples: Overriding methods are not annotated: 'abstract class A {\n @NotNull abstract String m();\n}\nclass B extends A {\n String m() { return \"empty string\"; }\n}' Annotated primitive types: '@NotNull int myFoo;' Both '@Nullable' and '@NotNull' are present on the same member: '@Nullable @NotNull String myFooString;' Collection of nullable elements is assigned into a collection of non-null elements: 'void testList(List<@Nullable String> nullableList) {\n List<@NotNull String> list2 = nullableList;\n}' Use the Configure Annotations button to specify nullability annotations and the checkboxes to fine-tune where the inspection should provide warnings. This inspection only reports if the language level of the project or module is 5 or higher, and nullability annotations are available on the classpath.", + "markdown": "Reports problems related to nullability annotations.\n\n**Examples:**\n\n* Overriding methods are not annotated:\n\n\n abstract class A {\n @NotNull abstract String m();\n }\n class B extends A {\n String m() { return \"empty string\"; }\n }\n \n* Annotated primitive types: `@NotNull int myFoo;`\n* Both `@Nullable` and `@NotNull` are present on the same member: `@Nullable @NotNull String myFooString;`\n* Collection of nullable elements is assigned into a collection of non-null elements:\n\n\n void testList(List<@Nullable String> nullableList) {\n List<@NotNull String> list2 = nullableList;\n }\n \nUse the **Configure Annotations** button to specify nullability annotations and the checkboxes to fine-tune where the inspection should provide warnings.\n\nThis inspection only reports if the language level of the project or module is 5 or higher,\nand nullability annotations are available on the classpath." }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "DifferentKotlinGradleVersion", + "suppressToolId": "NullableProblems", + "cweIds": [ + 476, + 754 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35129,8 +35013,8 @@ "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Probable bugs/Nullability problems", + "index": 172, "toolComponent": { "name": "QDJVM" } @@ -35142,13 +35026,13 @@ ] }, { - "id": "KotlinEqualsBetweenInconvertibleTypes", + "id": "EqualsBetweenInconvertibleTypes", "shortDescription": { "text": "'equals()' between objects of inconvertible types" }, "fullDescription": { - "text": "Reports calls to 'equals()' where the receiver and the argument are of incompatible primitive, enum, or string types. While such a call might theoretically be useful, most likely it represents a bug. Example: '5.equals(\"\");'", - "markdown": "Reports calls to `equals()` where the receiver and the argument are of incompatible primitive, enum, or string types.\n\nWhile such a call might theoretically be useful, most likely it represents a bug.\n\n**Example:**\n\n 5.equals(\"\");\n" + "text": "Reports calls to 'equals()' where the target and argument are of incompatible types. While such a call might theoretically be useful, most likely it is a bug. Example: 'new HashSet().equals(new TreeSet());'", + "markdown": "Reports calls to `equals()` where the target and argument are of incompatible types.\n\nWhile such a call might theoretically be useful, most likely it is a bug.\n\n**Example:**\n\n\n new HashSet().equals(new TreeSet());\n" }, "defaultConfiguration": { "enabled": true, @@ -35162,8 +35046,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -35175,28 +35059,28 @@ ] }, { - "id": "JoinDeclarationAndAssignment", + "id": "DuplicateCondition", "shortDescription": { - "text": "Join declaration and assignment" + "text": "Duplicate condition" }, "fullDescription": { - "text": "Reports property declarations that can be joined with the following assignment. Example: 'val x: String\n x = System.getProperty(\"\")' The quick fix joins the declaration with the assignment: 'val x = System.getProperty(\"\")' Configure the inspection: You can disable the option Report with complex initialization of member properties to skip properties with complex initialization. This covers two cases: The property initializer is complex (it is a multiline or a compound/control-flow expression) The property is first initialized and then immediately used in subsequent code (for example, to call additional initialization methods)", - "markdown": "Reports property declarations that can be joined with the following assignment.\n\n**Example:**\n\n\n val x: String\n x = System.getProperty(\"\")\n\nThe quick fix joins the declaration with the assignment:\n\n\n val x = System.getProperty(\"\")\n\nConfigure the inspection:\n\nYou can disable the option **Report with complex initialization of member properties** to skip properties with complex initialization. This covers two cases:\n\n1. The property initializer is complex (it is a multiline or a compound/control-flow expression)\n2. The property is first initialized and then immediately used in subsequent code (for example, to call additional initialization methods)" + "text": "Reports duplicate conditions in '&&' and '||' expressions and branches of 'if' statements. While sometimes duplicate conditions are intended, in most cases they are the result of an oversight. Example: 'boolean result = digit1 != digit2 || digit1 != digit2;' To ignore conditions that may produce side effects, use the Ignore conditions with side effects option. Disabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations. Example: 'native boolean unknownMethod();\n \n ...\n \n if (unknownMethod() || unknownMethod()) {\n System.out.println(\"Got it\");\n }' Due to possible side effects of 'unknownMethod()' (on the example), the warning will only be triggered if the Ignore conditions with side effects option is disabled.", + "markdown": "Reports duplicate conditions in `&&` and `||` expressions and branches of `if` statements. While sometimes duplicate conditions are intended, in most cases they are the result of an oversight.\n\nExample:\n\n\n boolean result = digit1 != digit2 || digit1 != digit2;\n\n\nTo ignore conditions that may produce side effects, use the **Ignore conditions with side effects** option.\nDisabling this option may lead to false-positives, for example, when the same method returns different values on subsequent invocations.\n\nExample:\n\n\n native boolean unknownMethod();\n \n ...\n \n if (unknownMethod() || unknownMethod()) {\n System.out.println(\"Got it\");\n }\n\nDue to possible side effects of `unknownMethod()` (on the example), the warning will only be\ntriggered if the **Ignore conditions with side effects** option is disabled." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "JoinDeclarationAndAssignment", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "DuplicateCondition", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -35208,28 +35092,28 @@ ] }, { - "id": "HasPlatformType", + "id": "SynchronizationOnGetClass", "shortDescription": { - "text": "Function or property has platform type" + "text": "Synchronization on 'getClass()'" }, "fullDescription": { - "text": "Reports functions and properties that have a platform type. To prevent unexpected errors, the type should be declared explicitly. Example: 'fun foo() = java.lang.String.valueOf(1)' The quick fix allows you to specify the return type: 'fun foo(): String = java.lang.String.valueOf(1)'", - "markdown": "Reports functions and properties that have a platform type.\n\nTo prevent unexpected errors, the type should be declared explicitly.\n\n**Example:**\n\n\n fun foo() = java.lang.String.valueOf(1)\n\nThe quick fix allows you to specify the return type:\n\n\n fun foo(): String = java.lang.String.valueOf(1)\n" + "text": "Reports synchronization on a call to 'getClass()'. If the class containing the synchronization is subclassed, the subclass will synchronize on a different class object. Usually the call to 'getClass()' can be replaced with a class literal expression, for example 'String.class'. An even better solution is synchronizing on a 'private static final' lock object, access to which can be completely controlled. Example: 'synchronized(getClass()) {}'", + "markdown": "Reports synchronization on a call to `getClass()`.\n\n\nIf the class containing the synchronization is subclassed, the subclass\nwill\nsynchronize on a different class object. Usually the call to `getClass()` can be replaced with a class literal expression, for\nexample `String.class`. An even better solution is synchronizing on a `private static final` lock object, access to\nwhich can be completely controlled.\n\n**Example:**\n\n synchronized(getClass()) {}\n" }, "defaultConfiguration": { "enabled": true, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "HasPlatformType", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SynchronizationOnGetClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -35241,28 +35125,28 @@ ] }, { - "id": "DataClassPrivateConstructor", + "id": "StringTemplateReverseMigration", "shortDescription": { - "text": "Private data class constructor is exposed via the 'copy' method" + "text": "String template can be concatenated string" }, "fullDescription": { - "text": "Reports the 'private' primary constructor in data classes. 'data' classes have a 'copy()' factory method that can be used similarly to a constructor. A constructor should not be marked as 'private' to provide enough safety. Example: 'data class User private constructor(val name: String)' The quick-fix changes the constructor visibility modifier to 'public': 'data class User(val name: String)'", - "markdown": "Reports the `private` primary constructor in data classes.\n\n\n`data` classes have a `copy()` factory method that can be used similarly to a constructor.\nA constructor should not be marked as `private` to provide enough safety.\n\n**Example:**\n\n\n data class User private constructor(val name: String)\n\nThe quick-fix changes the constructor visibility modifier to `public`:\n\n\n data class User(val name: String)\n" + "text": "Reports string template expressions using the 'STR' processor and offers a quick-fix to migrate back to a plain string concatenation. Example: 'String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";' After the quick-fix is applied: 'String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are 29 years old.\";' New in 2024.2", + "markdown": "Reports string template expressions using the `STR` processor and offers a quick-fix to migrate back to a plain string concatenation.\n\n**Example:**\n\n\n String name = \"Bob\";\n String greeting = STR.\"Hello, \\{name}. You are 29 years old.\";\n\nAfter the quick-fix is applied:\n\n\n String name = \"Bob\";\n String greeting = \"Hello, \" + name + \". You are 29 years old.\";\n\nNew in 2024.2" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "DataClassPrivateConstructor", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "StringTemplateReverseMigration", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Java language level migration aids/Java 21", + "index": 195, "toolComponent": { "name": "QDJVM" } @@ -35274,19 +35158,19 @@ ] }, { - "id": "RedundantInnerClassModifier", + "id": "ThrownExceptionsPerMethod", "shortDescription": { - "text": "Redundant 'inner' modifier" + "text": "Method with too many exceptions declared" }, "fullDescription": { - "text": "Reports the 'inner' modifier on a class as redundant if it doesn't reference members of its outer class. Example: 'class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }' After the quick-fix is applied: 'class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }'", - "markdown": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + "text": "Reports methods that have too many types of exceptions in its 'throws' list. Methods with too many exceptions declared are a good sign that your error handling code is getting overly complex. Use the Exceptions thrown limit field to specify the maximum number of exception types a method is allowed to have in its 'throws' list.", + "markdown": "Reports methods that have too many types of exceptions in its `throws` list.\n\nMethods with too many exceptions declared are a good sign that your error handling code is getting overly complex.\n\nUse the **Exceptions thrown limit** field to specify the maximum number of exception types a method is allowed to have in its `throws` list." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantInnerClassModifier", + "suppressToolId": "MethodWithTooExceptionsDeclared", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35294,8 +35178,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -35307,19 +35191,19 @@ ] }, { - "id": "JavaCollectionsStaticMethodOnImmutableList", + "id": "RedundantThrows", "shortDescription": { - "text": "Call of Java mutator method on immutable Kotlin collection" + "text": "Redundant 'throws' clause" }, "fullDescription": { - "text": "Reports Java mutator methods calls (like 'fill', 'reverse', 'shuffle', 'sort') on an immutable Kotlin collection. This can lead to 'UnsupportedOperationException' at runtime. Example: 'import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }' To fix the problem make the list mutable.", - "markdown": "Reports Java mutator methods calls (like `fill`, `reverse`, `shuffle`, `sort`) on an immutable Kotlin collection.\n\nThis can lead to `UnsupportedOperationException` at runtime.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }\n\nTo fix the problem make the list mutable." + "text": "Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods. The inspection ignores methods related to serialization, for example the methods 'readObject()' and 'writeObject()'. Example: 'void method() throws InterruptedException {\n System.out.println();\n }' The quick-fix removes unnecessary exceptions from the declaration and normalizes redundant 'try'-'catch' statements: 'void method() {\n System.out.println();\n }' Note: Some exceptions may not be reported during in-editor highlighting for performance reasons. To see all results, run the inspection by selecting Code | Inspect Code or Code | Analyze Code | Run Inspection by Name from the main menu. Use the Ignore exceptions thrown by entry point methods option to not report exceptions thrown by for example 'main()' methods. Entry point methods can be configured in the settings of the Java | Declaration redundancy | Unused declaration inspection.", + "markdown": "Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods.\n\nThe inspection ignores methods related to serialization, for example the methods `readObject()` and `writeObject()`.\n\n**Example:**\n\n\n void method() throws InterruptedException {\n System.out.println();\n }\n\nThe quick-fix removes unnecessary exceptions from the declaration and normalizes redundant `try`-`catch` statements:\n\n\n void method() {\n System.out.println();\n }\n\n\n**Note:** Some exceptions may not be reported during in-editor highlighting for performance reasons.\nTo see all results, run the inspection by selecting **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name** from the main menu.\n\nUse the **Ignore exceptions thrown by entry point methods** option to not report exceptions thrown by\nfor example `main()` methods.\nEntry point methods can be configured in the settings of the\n[Java \\| Declaration redundancy \\| Unused declaration](settings://Errors?Unused%20Declaration%20entry%20point) inspection." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JavaCollectionsStaticMethodOnImmutableList", + "suppressToolId": "RedundantThrows", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35327,8 +35211,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -35340,28 +35224,28 @@ ] }, { - "id": "MavenCoroutinesDeprecation", + "id": "UseOfAnotherObjectsPrivateField", "shortDescription": { - "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Maven" + "text": "Accessing a non-public field of another object" }, "fullDescription": { - "text": "Reports kotlinx.coroutines library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later.", - "markdown": "Reports **kotlinx.coroutines** library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later." + "text": "Reports accesses to 'private' or 'protected' fields of another object. Java allows access to such fields for objects of the same class as the current object but some coding styles discourage this use. Additionally, such direct access to 'private' fields may fail in component-oriented architectures, such as Spring or Hibernate, that expect all access to other objects to be through method calls so the framework can mediate access using proxies. Example: 'public class Base {\n protected int bar;\n\n void increment(Base base) {\n bar++;\n base.bar++; // warning: direct access to another object's non-public field\n }\n }' A quick-fix to encapsulate the field is available. Configure the inspection: Use the Ignore accesses from the same class option to ignore access from the same class and only report access from inner or outer classes. To ignore access from inner classes as well, use the nested Ignore accesses from inner classes. Use the Ignore accesses from 'equals()' method to ignore access from an 'equals()' method.", + "markdown": "Reports accesses to `private` or `protected` fields of another object. Java allows access to such fields for objects of the same class as the current object but some coding styles discourage this use. Additionally, such direct access to `private` fields may fail in component-oriented architectures, such as Spring or Hibernate, that expect all access to other objects to be through method calls so the framework can mediate access using proxies.\n\n**Example:**\n\n\n public class Base {\n protected int bar;\n\n void increment(Base base) {\n bar++;\n base.bar++; // warning: direct access to another object's non-public field\n }\n }\n\nA quick-fix to encapsulate the field is available.\n\nConfigure the inspection:\n\n* Use the **Ignore accesses from the same class** option to ignore access from the same class and only report access from inner or outer classes.\n\n To ignore access from inner classes as well, use the nested **Ignore accesses from inner classes**.\n* Use the **Ignore accesses from 'equals()' method** to ignore access from an `equals()` method." }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "MavenCoroutinesDeprecation", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "AccessingNonPublicFieldOfAnotherObject", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration/Maven", - "index": 157, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -35373,28 +35257,28 @@ ] }, { - "id": "NullableBooleanElvis", + "id": "PointlessBitwiseExpression", "shortDescription": { - "text": "Equality check can be used instead of elvis for nullable boolean check" + "text": "Pointless bitwise expression" }, "fullDescription": { - "text": "Reports cases when an equality check should be used instead of the elvis operator. Example: 'fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n}' After the quick-fix is applied: 'fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n}'", - "markdown": "Reports cases when an equality check should be used instead of the elvis operator.\n\n**Example:**\n\n\n fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n }\n\nAfter the quick-fix is applied:\n\n\n fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n }\n" + "text": "Reports pointless bitwise expressions. Such expressions include applying the '&' operator to the maximum value for the given type, applying the 'or' operator to zero, and shifting by zero. Such expressions may be the result of automated refactorings not followed through to completion and are unlikely to be originally intended. Examples: '// Warning: operation is pointless and can be replaced with just `flags`\n // 0xFFFF_FFFF is the maximum value for an integer, and both literals are treated\n // as 32 bit integer literals.\n int bits = flags & 0xFFFF_FFFF;\n\n // Warning: operation is pointless and can be replaced with just `bits`\n // OR-ing with 0 always outputs the other operand.\n int or = bits | 0x0;\n\n // Warning: operation is pointless, as always results in 0\n int xor = or ^ or;'", + "markdown": "Reports pointless bitwise expressions.\n\n\nSuch expressions include applying the `&` operator to the maximum value for the given type, applying the\n`or` operator to zero, and shifting by zero. Such expressions may be the result of automated\nrefactorings not followed through to completion and are unlikely to be originally intended.\n\n**Examples:**\n\n\n // Warning: operation is pointless and can be replaced with just `flags`\n // 0xFFFF_FFFF is the maximum value for an integer, and both literals are treated\n // as 32 bit integer literals.\n int bits = flags & 0xFFFF_FFFF;\n\n // Warning: operation is pointless and can be replaced with just `bits`\n // OR-ing with 0 always outputs the other operand.\n int or = bits | 0x0;\n\n // Warning: operation is pointless, as always results in 0\n int xor = or ^ or;\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "NullableBooleanElvis", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "PointlessBitwiseExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Bitwise operation issues", + "index": 199, "toolComponent": { "name": "QDJVM" } @@ -35406,28 +35290,28 @@ ] }, { - "id": "UnnecessaryVariable", + "id": "DuplicateThrows", "shortDescription": { - "text": "Unnecessary local variable" + "text": "Duplicate throws" }, "fullDescription": { - "text": "Reports local variables that are used only in the very next 'return' statement or are exact copies of other variables. Such variables can be safely inlined to make the code more clear. Example: 'fun sum(a: Int, b: Int): Int {\n val c = a + b\n return c\n }' After the quick-fix is applied: 'fun sum(a: Int, b: Int): Int {\n return a + b\n }' Configure the inspection: Use the Report immediately returned variables option to report immediately returned variables. When given descriptive names, such variables may improve the code readability in some cases, that's why this option is disabled by default.", - "markdown": "Reports local variables that are used only in the very next `return` statement or are exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int): Int {\n val c = a + b\n return c\n }\n\nAfter the quick-fix is applied:\n\n\n fun sum(a: Int, b: Int): Int {\n return a + b\n }\n\nConfigure the inspection:\n\nUse the **Report immediately returned variables** option to report immediately returned variables.\nWhen given descriptive names, such variables may improve the code readability in some cases, that's why this option is disabled by default." + "text": "Reports duplicate exceptions in a method 'throws' list. Example: 'void f() throws Exception, Exception {}' After the quick-fix is applied: 'void f() throws Exception {}' Use the Ignore exceptions subclassing others option to ignore exceptions subclassing other exceptions.", + "markdown": "Reports duplicate exceptions in a method `throws` list.\n\nExample:\n\n\n void f() throws Exception, Exception {}\n\nAfter the quick-fix is applied:\n\n\n void f() throws Exception {}\n\n\nUse the **Ignore exceptions subclassing others** option to ignore exceptions subclassing other exceptions." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "UnnecessaryVariable", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "DuplicateThrows", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -35439,19 +35323,19 @@ ] }, { - "id": "DeprecatedMavenDependency", + "id": "UnstableTypeUsedInSignature", "shortDescription": { - "text": "Deprecated library is used in Maven" + "text": "Unstable type is used in signature" }, "fullDescription": { - "text": "Reports deprecated maven dependency. Example: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n ' The quick fix changes the deprecated dependency to a maintained one: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n '", - "markdown": "Reports deprecated maven dependency.\n\n**Example:**\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n \n\nThe quick fix changes the deprecated dependency to a maintained one:\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n \n" + "text": "Reports declarations of classes, methods, and fields that reference an unstable API type in the signature, but are not marked with the same unstable annotation. This inspection ensures that the signatures of a public API do not expose any unstable (internal, experimental) types. For example, if a method returns an experimental class, the method itself is considered experimental because incompatible changes of the type (deletion or move to another package) lead to incompatible method signature changes. Use the list below to specify which annotations mark an unstable API.", + "markdown": "Reports declarations of classes, methods, and fields that reference an unstable API type in the signature, but are not marked with the same unstable annotation.\n\n\nThis inspection ensures that the signatures of a public API do not expose any *unstable* (internal, experimental) types.\nFor example, if a method returns an *experimental* class, the method itself is considered *experimental*\nbecause incompatible changes of the type (deletion or move to another package) lead to incompatible method signature changes.\n\nUse the list below to specify which annotations mark an unstable API." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DeprecatedMavenDependency", + "suppressToolId": "UnstableTypeUsedInSignature", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35459,8 +35343,8 @@ "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -35472,28 +35356,28 @@ ] }, { - "id": "RedundantEmptyInitializerBlock", + "id": "PrivateMemberAccessBetweenOuterAndInnerClass", "shortDescription": { - "text": "Redundant empty initializer block" + "text": "Synthetic accessor call" }, "fullDescription": { - "text": "Reports redundant empty initializer blocks. Example: 'class Foo {\n init {\n // Empty init block\n }\n }' After the quick-fix is applied: 'class Foo {\n }'", - "markdown": "Reports redundant empty initializer blocks.\n\n**Example:**\n\n\n class Foo {\n init {\n // Empty init block\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n }\n" + "text": "Reports references from a nested class to non-constant 'private' members of an outer class. For such references, javac will generate package-private synthetic accessor methods, which may compromise the security because members appearing to be private will in fact be accessible from the entire package. A nested class and its outer class are compiled to separate class files. The Java virtual machine normally prohibits access from a class to private fields and methods of another class. To enable access from a nested class to private members of an outer class, javac creates a package-private synthetic accessor method. By making the 'private' member package-private instead, the actual accessibility is made explicit. This also saves a little bit of memory, which may improve performance in resource constrained environments. This inspection only reports if the language level of the project or module is 10 or lower. Under Java 11 and higher accessor methods are not generated anymore, because of nest-based access control (JEP 181). Example: 'class Outer {\n private void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }' After the quick fix is applied: 'class Outer {\n void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }'", + "markdown": "Reports references from a nested class to non-constant `private` members of an outer class. For such references, javac will generate package-private synthetic accessor methods, which may compromise the security because members appearing to be private will in fact be accessible from the entire package.\n\n\nA nested class and its outer class are compiled to separate\nclass files. The Java virtual machine normally prohibits access from a class to private fields and methods of\nanother class. To enable access from a nested class to private members of an outer class, javac creates a package-private\nsynthetic accessor method.\n\n\nBy making the `private` member package-private instead, the actual accessibility is made explicit.\nThis also saves a little bit of memory, which may improve performance in resource constrained environments.\n\n\nThis inspection only reports if the language level of the project or module is 10 or lower.\nUnder Java 11 and higher accessor methods are not generated anymore,\nbecause of nest-based access control ([JEP 181](https://openjdk.org/jeps/181)).\n\n**Example:**\n\n\n class Outer {\n private void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }\n\nAfter the quick fix is applied:\n\n\n class Outer {\n void x() {}\n\n class Inner {\n void y() {\n x();\n }\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "RedundantEmptyInitializerBlock", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SyntheticAccessorCall", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -35505,28 +35389,28 @@ ] }, { - "id": "RedundantLabeledReturnOnLastExpressionInLambda", + "id": "SystemRunFinalizersOnExit", "shortDescription": { - "text": "Redundant labeled return on the last expression in a lambda" + "text": "Call to 'System.runFinalizersOnExit()'" }, "fullDescription": { - "text": "Reports labeled returns used on the last expressions in lambdas. Such returns are redundant and can be safely removed. Example: 'fun foo() {\n listOf(1,2,3).find {\n return@find true\n }\n}' After the quick-fix is applied: 'fun foo() {\n listOf(1,2,3).find {\n true\n }\n}'", - "markdown": "Reports labeled returns used on the last expressions in lambdas.\n\nSuch returns are redundant and can be safely removed.\n\n**Example:**\n\n\n fun foo() {\n listOf(1,2,3).find {\n return@find true\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1,2,3).find {\n true\n }\n }\n" + "text": "Reports calls to 'System.runFinalizersOnExit()'. This call is one of the most dangerous in the Java language. It is inherently non-thread-safe, may result in data corruption, a deadlock, and may affect parts of the program far removed from its call point. It is deprecated and was removed in JDK 11, and its use is strongly discouraged. This inspection only reports if the language level of the project or module is 10 or lower.", + "markdown": "Reports calls to `System.runFinalizersOnExit()`.\n\n\nThis call is one of the most dangerous in the Java language. It is inherently non-thread-safe,\nmay result in data corruption, a deadlock, and may affect parts of the program far removed from its call point.\nIt is deprecated and was removed in JDK 11, and its use is strongly discouraged.\n\nThis inspection only reports if the language level of the project or module is 10 or lower." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantLabeledReturnOnLastExpressionInLambda", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "CallToSystemRunFinalizersOnExit", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -35538,28 +35422,28 @@ ] }, { - "id": "GradleKotlinxCoroutinesDeprecation", + "id": "ClassIndependentOfModule", "shortDescription": { - "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Gradle" + "text": "Class independent of its module" }, "fullDescription": { - "text": "Reports 'kotlinx.coroutines' library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+. Example: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }' The quick fix changes the 'kotlinx.coroutines' library version to a compatible with Kotlin 1.3: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }'", - "markdown": "Reports `kotlinx.coroutines` library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+.\n\n**Example:**\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }\n\nThe quick fix changes the `kotlinx.coroutines` library version to a compatible with Kotlin 1.3:\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }\n" + "text": "Reports classes that: do not depend on any other class in their module are not a dependency for any other class in their module Such classes are an indication of ad-hoc or incoherent modularisation strategies, and may often profitably be moved. 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* are not a dependency for any other class in their module\n\nSuch classes are an indication of ad-hoc or incoherent modularisation strategies,\nand may often profitably be moved.\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": "error", + "level": "warning", "parameters": { - "suppressToolId": "GradleKotlinxCoroutinesDeprecation", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "ClassIndependentOfModule", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration/Gradle", - "index": 165, + "id": "Java/Modularization issues", + "index": 76, "toolComponent": { "name": "QDJVM" } @@ -35571,28 +35455,28 @@ ] }, { - "id": "RedundantWith", + "id": "ReplaceInefficientStreamCount", "shortDescription": { - "text": "Redundant 'with' call" + "text": "Inefficient Stream API call chains ending with count()" }, "fullDescription": { - "text": "Reports redundant 'with' function calls that don't access anything from the receiver. Examples: 'class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }'", - "markdown": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + "text": "Reports Stream API call chains ending with a 'count()' operation, that are optimizable. The following call chains can be replaced by this inspection: 'Collection.stream().count()' → 'Collection.size()'. In Java 8 'Collection.stream().count()' actually iterates over the collection elements to count them, while 'Collection.size()' is much faster for most of the collections. 'Stream.flatMap(Collection::stream).count()' → 'Stream.mapToLong(Collection::size).sum()'. Similarly, there's no need to iterate over all the nested collections. Instead, their sizes could be summed up. 'Stream.filter(o -> ...).count() > 0' → 'Stream.anyMatch(o -> ...)'. Unlike the original call, 'anyMatch()' may stop the computation as soon as a matching element is found. 'Stream.filter(o -> ...).count() == 0' → 'Stream.noneMatch(o -> ...)'. Similar to the above. Note that if the replacement involves a short-circuiting operation like 'anyMatch()', there could be a visible behavior change, if the intermediate stream operations produce side effects. In general, side effects should be avoided in Stream API calls. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports Stream API call chains ending with a `count()` operation, that are optimizable.\n\n\nThe following call chains can be replaced by this inspection:\n\n* `Collection.stream().count()` → `Collection.size()`. In Java 8 `Collection.stream().count()` actually iterates over the collection elements to count them, while `Collection.size()` is much faster for most of the collections.\n* `Stream.flatMap(Collection::stream).count()` → `Stream.mapToLong(Collection::size).sum()`. Similarly, there's no need to iterate over all the nested collections. Instead, their sizes could be summed up.\n* `Stream.filter(o -> ...).count() > 0` → `Stream.anyMatch(o -> ...)`. Unlike the original call, `anyMatch()` may stop the computation as soon as a matching element is found.\n* `Stream.filter(o -> ...).count() == 0` → `Stream.noneMatch(o -> ...)`. Similar to the above.\n\n\nNote that if the replacement involves a short-circuiting operation like `anyMatch()`, there could be a visible behavior change,\nif the intermediate stream operations produce side effects. In general, side effects should be avoided in Stream API calls.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantWith", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ReplaceInefficientStreamCount", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -35604,28 +35488,28 @@ ] }, { - "id": "WarningOnMainUnusedParameterMigration", + "id": "ParameterTypePreventsOverriding", "shortDescription": { - "text": "Unused 'args' on 'main' since 1.4" + "text": "Parameter type prevents overriding" }, "fullDescription": { - "text": "Reports 'main' function with an unused single parameter. Since Kotlin 1.4, it is possible to use the 'main' function without parameter as the entry point to the Kotlin program. The compiler reports a warning for the 'main' function with an unused parameter.", - "markdown": "Reports `main` function with an unused single parameter.\n\nSince Kotlin 1.4, it is possible to use the `main` function without parameter as the entry point to the Kotlin program.\nThe compiler reports a warning for the `main` function with an unused parameter." + "text": "Reports parameter types of a subclass method that have the same name as the parameter type of the corresponding super method but belong to a different package. In these cases, the subclass method cannot override the super method. Example: 'public class A {\n public void method(Object o) {}\n}\n\npublic class B extends A {\n public void method(Object o) {} // warning on parameter type\n class Object {}\n}' After the quick-fix is applied: 'public class A {\n public void method(Object o) {}\n}\n\npublic class B extends A {\n public void method(java.lang.Object o) {} // new parameter type\n class Object {}\n}'", + "markdown": "Reports parameter types of a subclass method that have the same name as the parameter type of the corresponding super method but belong to a different package. In these cases, the subclass method cannot override the super method.\n\n**Example:**\n\n\n public class A {\n public void method(Object o) {}\n }\n\n public class B extends A {\n public void method(Object o) {} // warning on parameter type\n class Object {}\n }\n\nAfter the quick-fix is applied:\n\n\n public class A {\n public void method(Object o) {}\n }\n\n public class B extends A {\n public void method(java.lang.Object o) {} // new parameter type\n class Object {}\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "WarningOnMainUnusedParameterMigration", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ParameterTypePreventsOverriding", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -35637,28 +35521,28 @@ ] }, { - "id": "RedundantLabelMigration", + "id": "ExtractMethodRecommender", "shortDescription": { - "text": "Redundant label" + "text": "Method can be extracted" }, "fullDescription": { - "text": "Reports redundant labels which cause compilation errors since Kotlin 1.4. Since Kotlin 1.0, one can mark any statement with a label: 'fun foo() {\n L1@ val x = L2@bar()\n }' However, these labels can be referenced only in a limited number of ways: break / continue from a loop non-local return from an inline lambda or inline anonymous function sssss Such labels are prohibited since Kotlin 1.4. This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", - "markdown": "Reports redundant labels which cause compilation errors since Kotlin 1.4.\n\nSince Kotlin 1.0, one can mark any statement with a label:\n\n\n fun foo() {\n L1@ val x = L2@bar()\n }\n\nHowever, these labels can be referenced only in a limited number of ways:\n\n* break / continue from a loop\n* non-local return from an inline lambda or inline anonymous function\nsssss\n\nSuch labels are prohibited since Kotlin 1.4.\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + "text": "Suggests extracting fragments of code to a separate method to make code more clear. This inspection has a number of heuristics to select good candidates for extraction, including the following ones. The extracted fragment has no non-local control flow The extracted fragment has exactly one output variable There are no similar uses of output variable inside the extracted fragment and outside it The extracted fragment has only few input parameters (no more than three by default; configured with the inspection option) The extracted fragment is not smaller than the configured length (500 characters by default) but no bigger than 60% of the containing method body", + "markdown": "Suggests extracting fragments of code to a separate method to make code more clear. This inspection has a number of heuristics to select good candidates for extraction, including the following ones.\n\n* The extracted fragment has no non-local control flow\n* The extracted fragment has exactly one output variable\n* There are no similar uses of output variable inside the extracted fragment and outside it\n* The extracted fragment has only few input parameters (no more than three by default; configured with the inspection option)\n* The extracted fragment is not smaller than the configured length (500 characters by default) but no bigger than 60% of the containing method body" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantLabelMigration", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ExtractMethodRecommender", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -35670,19 +35554,19 @@ ] }, { - "id": "KotlinRedundantDiagnosticSuppress", + "id": "StringOperationCanBeSimplified", "shortDescription": { - "text": "Redundant diagnostic suppression" + "text": "Redundant 'String' operation" }, "fullDescription": { - "text": "Reports usages of '@Suppress' annotations that can be safely removed because the compiler diagnostic they affect is no longer applicable in this context. Example: 'fun doSmth(@Suppress(\"UNUSED_PARAMETER\") used: Int) {\n println(used)\n }' After the quick-fix is applied: 'fun doSmth(used: Int) {\n println(used)\n }'", - "markdown": "Reports usages of `@Suppress` annotations that can be safely removed because the compiler diagnostic they affect is no longer applicable in this context.\n\n**Example:**\n\n\n fun doSmth(@Suppress(\"UNUSED_PARAMETER\") used: Int) {\n println(used)\n }\n\nAfter the quick-fix is applied:\n\n\n fun doSmth(used: Int) {\n println(used)\n }\n" + "text": "Reports redundant calls to 'String' constructors and methods like 'toString()' or 'substring()' that can be replaced with a simpler expression. For example, calls to these methods can be safely removed in code like '\"string\".substring(0)', '\"string\".toString()', or 'new StringBuilder().toString().substring(1,3)'. Example: 'System.out.println(new String(\"message\"));' After the quick-fix is applied: 'System.out.println(\"message\");' Note that the quick-fix removes the redundant constructor call, and this may affect 'String' referential equality. If you need to preserve it, even though it is considered bad practice, suppress the warning or use the inspection setting to ignore redundant 'String' constructor calls. Use the Do not report String constructor calls option below to not report code like the example above. This will avoid changing the outcome of String comparisons with '==' or '!=' after applying the quick-fix in code that uses 'new String()' calls to guarantee a different object identity. Use the Do not report single argument substring() calls option below to not report code like the following. 'stringBuilder.append(string.substring(5));' which can be replaced with the following. 'stringBuilder.append(string, 5, string.length());' New in 2018.1", + "markdown": "Reports redundant calls to `String` constructors and methods like `toString()` or `substring()` that can be replaced with a simpler expression.\n\nFor example, calls to these methods can be safely removed in code\nlike `\"string\".substring(0)`, `\"string\".toString()`, or\n`new StringBuilder().toString().substring(1,3)`.\n\nExample:\n\n\n System.out.println(new String(\"message\"));\n\nAfter the quick-fix is applied:\n\n\n System.out.println(\"message\");\n\n\nNote that the quick-fix removes the redundant constructor call, and this may affect `String` referential equality.\nIf you need to preserve it, even though it is considered bad practice, suppress the warning or use the inspection setting to ignore\nredundant `String` constructor calls.\n\n\nUse the **Do not report String constructor calls** option below to not report code like the example above.\nThis will avoid changing the outcome of String comparisons with `==` or `!=` after applying\nthe quick-fix in code that uses `new String()` calls to guarantee a different object identity.\n\n\nUse the **Do not report single argument substring() calls** option below to not report code like the following.\n\n\n stringBuilder.append(string.substring(5));\n\nwhich can be replaced with the following.\n\n\n stringBuilder.append(string, 5, string.length());\n\nNew in 2018.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KotlinRedundantDiagnosticSuppress", + "suppressToolId": "StringOperationCanBeSimplified", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35690,8 +35574,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -35703,28 +35587,28 @@ ] }, { - "id": "ReplaceNegatedIsEmptyWithIsNotEmpty", + "id": "ClassReferencesSubclass", "shortDescription": { - "text": "Negated call can be simplified" + "text": "Class references one of its subclasses" }, "fullDescription": { - "text": "Reports negation 'isEmpty()' and 'isNotEmpty()' for collections and 'String', or 'isBlank()' and 'isNotBlank()' for 'String'. Using corresponding functions makes your code simpler. The quick-fix replaces the negation call with the corresponding call from the Standard Library. Example: 'fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }' After the quick-fix is applied: 'fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }'", - "markdown": "Reports negation `isEmpty()` and `isNotEmpty()` for collections and `String`, or `isBlank()` and `isNotBlank()` for `String`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the negation call with the corresponding call from the Standard Library.\n\n**Example:**\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }\n" + "text": "Reports classes which contain references to one of their subclasses. Such references may be confusing and violate several rules of object-oriented design. Example: 'class Entity {\n // Warning: the class references its subclass\n void compare(SimpleEntity entity) {\n ...\n }\n }\n class SimpleEntity extends Entity {\n ...\n }'", + "markdown": "Reports classes which contain references to one of their subclasses. Such references may be confusing and violate several rules of object-oriented design.\n\nExample:\n\n\n class Entity {\n // Warning: the class references its subclass\n void compare(SimpleEntity entity) {\n ...\n }\n }\n class SimpleEntity extends Entity {\n ...\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceNegatedIsEmptyWithIsNotEmpty", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ClassReferencesSubclass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -35736,19 +35620,19 @@ ] }, { - "id": "DelegationToVarProperty", + "id": "DateToString", "shortDescription": { - "text": "Delegating to 'var' property" + "text": "Call to 'Date.toString()'" }, "fullDescription": { - "text": "Reports interface delegation to a 'var' property. Only initial value of a property is used for delegation, any later assignments do not affect it. Example: 'class Example(var text: CharSequence): CharSequence by text' The quick-fix replaces a property with immutable one: 'class Example(val text: CharSequence): CharSequence by text' Alternative way, if you rely on mutability for some reason: 'class Example(text: CharSequence): CharSequence by text {\n var text = text\n }'", - "markdown": "Reports interface delegation to a `var` property.\n\nOnly initial value of a property is used for delegation, any later assignments do not affect it.\n\n**Example:**\n\n\n class Example(var text: CharSequence): CharSequence by text\n\nThe quick-fix replaces a property with immutable one:\n\n\n class Example(val text: CharSequence): CharSequence by text\n\nAlternative way, if you rely on mutability for some reason:\n\n\n class Example(text: CharSequence): CharSequence by text {\n var text = text\n }\n" + "text": "Reports 'toString()' calls on 'java.util.Date' objects. Such calls are usually incorrect in an internationalized environment.", + "markdown": "Reports `toString()` calls on `java.util.Date` objects. Such calls are usually incorrect in an internationalized environment." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DelegationToVarProperty", + "suppressToolId": "CallToDateToString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -35756,8 +35640,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -35769,28 +35653,31 @@ ] }, { - "id": "ConstantConditionIf", + "id": "IterableUsedAsVararg", "shortDescription": { - "text": "Condition of 'if' expression is constant" + "text": "Iterable is used as vararg" }, "fullDescription": { - "text": "Reports 'if' expressions that have 'true' or 'false' constant literal condition and can be simplified. While occasionally intended, this construction is confusing and often the result of a typo or previous refactoring. Example: 'fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }' The quick-fix removes the 'if' condition: 'fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }'", - "markdown": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nThe quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + "text": "Reports suspicious usages of 'Collection' or 'Iterable' in vararg method calls. For example, in the following method: ' boolean contains(T needle, T... haystack) {...}' a call like 'if(contains(\"item\", listOfStrings)) {...}' looks suspicious as the list will be wrapped into a single element array. Such code can be successfully compiled and will likely run without exceptions, but it's probably used by mistake. This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5. New in 2019.2", + "markdown": "Reports suspicious usages of `Collection` or `Iterable` in vararg method calls.\n\nFor example, in the following method:\n\n\n boolean contains(T needle, T... haystack) {...}\n\na call like\n\n\n if(contains(\"item\", listOfStrings)) {...}\n\nlooks suspicious as the list will be wrapped into a single element array.\nSuch code can be successfully compiled and will likely run without\nexceptions, but it's probably used by mistake.\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.\n\nNew in 2019.2" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ConstantConditionIf", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "IterableUsedAsVararg", + "cweIds": [ + 628 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -35802,28 +35689,28 @@ ] }, { - "id": "RedundantLambdaArrow", + "id": "MethodNameSameAsParentName", "shortDescription": { - "text": "Redundant lambda arrow" + "text": "Method name same as parent class name" }, "fullDescription": { - "text": "Reports redundant lambda arrows in lambdas without parameters. Example: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }' After the quick-fix is applied: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }'", - "markdown": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + "text": "Reports methods that have the same name as the superclass of the method's class, as such a method name may be confusing. This inspection doesn't check interfaces or superclasses deep in the hierarchy. Example: 'class Parent {}\n class Child extends Parent {\n public Parent Parent() {\n return null;\n }\n }' A quick-fix that renames such methods is available only in the editor.", + "markdown": "Reports methods that have the same name as the superclass of the method's class, as such a method name may be confusing.\n\nThis inspection doesn't check interfaces or superclasses deep in the hierarchy.\n\n**Example:**\n\n\n class Parent {}\n class Child extends Parent {\n public Parent Parent() {\n return null;\n }\n }\n\nA quick-fix that renames such methods is available only in the editor." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantLambdaArrow", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "MethodNameSameAsParentName", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -35835,28 +35722,28 @@ ] }, { - "id": "KotlinInternalInJava", + "id": "LambdaParameterNamingConvention", "shortDescription": { - "text": "Usage of Kotlin internal declarations from Java" + "text": "Lambda parameter naming convention" }, "fullDescription": { - "text": "Reports usages of Kotlin 'internal' declarations in Java code that is located in a different module. The 'internal' keyword is designed to restrict access to a class, function, or property from other modules. Due to JVM limitations, 'internal' classes, functions, and properties can still be accessed from outside Kotlin, which may later lead to compatibility problems.", - "markdown": "Reports usages of Kotlin `internal` declarations in Java code that is located in a different module.\n\n\nThe `internal` keyword is designed to restrict access to a class, function, or property from other modules.\nDue to JVM limitations, `internal` classes, functions, and properties can still be\naccessed from outside Kotlin, which may later lead to compatibility problems." + "text": "Reports lambda parameters whose names are too short, too long, or do not follow the specified regular expression pattern. Example: 'Function id = X -> X;' should be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter. Configure the inspection: Use the fields in the Options section to specify the minimum length, maximum length, and a regular expression expected for lambda parameter names. Specify 0 in order not to check the length of names. Regular expressions should be specified in the standard 'java.util.regex' format.", + "markdown": "Reports lambda parameters whose names are too short, too long, or do not follow the specified regular expression pattern.\n\n**Example:** `Function id = X -> X;`\nshould be reported if the inspection is enabled with the default settings in which a parameter name should start with a lowercase letter.\n\nConfigure the inspection:\n\n\nUse the fields in the **Options** section to specify the minimum length, maximum length, and a regular expression expected for lambda parameter names.\nSpecify **0** in order not to check the length of names.\n\nRegular expressions should be specified in the standard `java.util.regex` format." }, "defaultConfiguration": { - "enabled": true, - "level": "error", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "KotlinInternalInJava", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "LambdaParameterNamingConvention", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -35868,28 +35755,28 @@ ] }, { - "id": "NoConstructorMigration", + "id": "LawOfDemeter", "shortDescription": { - "text": "Forbidden constructor call" + "text": "Law of Demeter" }, "fullDescription": { - "text": "Reports a constructor calls on functional supertypes that will lead to compilation error since 1.9. Motivation types: The implementation does not abide by a published spec or documentation More details: KT-46344: No error for a super class constructor call on a function interface in supertypes list The quick-fix removes a constructor call. Example: 'abstract class A : () -> Int()' After the quick-fix is applied: 'abstract class A : () -> Int' This inspection only reports if the Kotlin language level of the project or module is 1.7 or higher.", - "markdown": "Reports a constructor calls on functional supertypes that will lead to compilation error since 1.9.\n\nMotivation types:\n\n* The implementation does not abide by a published spec or documentation\n\n**More details:** [KT-46344: No error for a super class constructor call on a function interface in supertypes list](https://youtrack.jetbrains.com/issue/KT-46344)\n\nThe quick-fix removes a constructor call.\n\n**Example:**\n\n\n abstract class A : () -> Int()\n\nAfter the quick-fix is applied:\n\n\n abstract class A : () -> Int\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.7 or higher." + "text": "Reports Law of Demeter violations. The Law of Demeter is not really a law, but specifies a style guideline: never call a method on an object received from another call. The code that follows this guideline is easier to maintain, adapt, and refactor, has less coupling between methods, less duplication, and better information hiding. On the other hand, you may need to write many wrapper methods to meet this guideline. Example: 'boolean pay(Customer c, Invoice invoice) {\n int dollars = c.getWallet().contents; // violation\n if (dollars >= invoice.getAmount()) {\n Wallet w = c.getWallet();\n w.subtract(invoice.getAmount()); // violation\n return true;\n }\n return false;\n }' The above example might be better implemented as a method 'payInvoice(Invoice invoice)' in 'Customer'. Use the Ignore calls to library methods and access to library fields option to ignore Law of Demeter violations that can't be fixed without changing a library.", + "markdown": "Reports [Law of Demeter](https://en.wikipedia.org/wiki/Law_of_Demeter) violations.\n\n\nThe Law of Demeter is not really a law, but specifies a style guideline: never call a method on an object received from another call.\nThe code that follows this guideline is easier to maintain, adapt, and refactor, has less coupling between methods, less duplication,\nand better information hiding. On the other hand, you may need to write many wrapper methods to meet this guideline.\n\n**Example:**\n\n\n boolean pay(Customer c, Invoice invoice) {\n int dollars = c.getWallet().contents; // violation\n if (dollars >= invoice.getAmount()) {\n Wallet w = c.getWallet();\n w.subtract(invoice.getAmount()); // violation\n return true;\n }\n return false;\n }\n\nThe above example might be better implemented as a method `payInvoice(Invoice invoice)` in `Customer`.\n\n\nUse the **Ignore calls to library methods and access to library fields** option to ignore Law of Demeter violations\nthat can't be fixed without changing a library." }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "NoConstructorMigration", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "LawOfDemeter", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Data flow", + "index": 65, "toolComponent": { "name": "QDJVM" } @@ -35901,28 +35788,28 @@ ] }, { - "id": "RedundantValueArgument", + "id": "AmbiguousFieldAccess", "shortDescription": { - "text": "Redundant value argument" + "text": "Access to inherited field looks like access to element from surrounding code" }, "fullDescription": { - "text": "Reports arguments that are equal to the default values of the corresponding parameters. Example: 'fun foo(x: Int, y: Int = 2) {}\n\nfun bar() {\n foo(1, 2)\n}' After the quick-fix is applied: 'fun bar() {\n foo(1)\n}'", - "markdown": "Reports arguments that are equal to the default values of the corresponding parameters.\n\n**Example:**\n\n\n fun foo(x: Int, y: Int = 2) {}\n\n fun bar() {\n foo(1, 2)\n }\n\nAfter the quick-fix is applied:\n\n\n fun bar() {\n foo(1)\n }\n" + "text": "Reports access to a superclass field from an anonymous, inner or local class, if a local variable, parameter, or field with the same name is available in the code surrounding the class. In this case it may seem that an element from the surrounding code is accessed, when in fact it is an access to a field from the superclass. To clarify the intent of the code, it is recommended to add an explicit 'super' qualifier to the field access. Example: 'class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(ambiguous); // the field is accessed, not the parameter\n }\n };\n }\n }' After the quick-fix is applied: 'class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(super.ambiguous);\n }\n };\n }\n }'", + "markdown": "Reports access to a superclass field from an anonymous, inner or local class, if a local variable, parameter, or field with the same name is available in the code surrounding the class. In this case it may seem that an element from the surrounding code is accessed, when in fact it is an access to a field from the superclass.\n\n\nTo clarify the intent of the code, it is recommended to add an explicit\n`super` qualifier to the field access.\n\n**Example:**\n\n\n class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(ambiguous); // the field is accessed, not the parameter\n }\n };\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class First {\n protected String ambiguous;\n }\n class Second {\n void foo(String ambiguous) {\n new First() {\n {\n System.out.println(super.ambiguous);\n }\n };\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantValueArgument", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AmbiguousFieldAccess", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -35934,28 +35821,28 @@ ] }, { - "id": "UseWithIndex", + "id": "NonProtectedConstructorInAbstractClass", "shortDescription": { - "text": "Manually incremented index variable can be replaced with use of 'withIndex()'" + "text": "Public constructor in abstract class" }, "fullDescription": { - "text": "Reports 'for' loops with a manually incremented index variable. 'for' loops with a manually incremented index variable can be simplified with the 'withIndex()' function. Use withIndex() instead of manual index increment quick-fix can be used to amend the code automatically. Example: 'fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }' After the quick-fix is applied: 'fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }'", - "markdown": "Reports `for` loops with a manually incremented index variable.\n\n`for` loops with a manually incremented index variable can be simplified with the `withIndex()` function.\n\n**Use withIndex() instead of manual index increment** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }\n" + "text": "Reports 'public' constructors of 'abstract' classes. Constructors of 'abstract' classes can only be called from the constructors of their subclasses, declaring them 'public' may be confusing. The quick-fix makes such constructors protected. Example: 'public abstract class Foo {\n public Foo () { // warning: has 'public' modifier\n /* ... */\n }\n }' After the quick-fix is applied: 'public abstract class Foo {\n protected Foo () {\n /* ... */\n }\n }' Configure the inspection: Use the Ignore for non-public classes option below to ignore 'public' constructors in non-public classes.", + "markdown": "Reports `public` constructors of `abstract` classes.\n\n\nConstructors of `abstract` classes can only be called from the constructors of\ntheir subclasses, declaring them `public` may be confusing.\n\nThe quick-fix makes such constructors protected.\n\n**Example:**\n\n\n public abstract class Foo {\n public Foo () { // warning: has 'public' modifier\n /* ... */\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public abstract class Foo {\n protected Foo () {\n /* ... */\n }\n }\n\nConfigure the inspection:\n\nUse the **Ignore for non-public classes** option below to ignore `public` constructors in non-public classes." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "UseWithIndex", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConstructorNotProtectedInAbstractClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -35967,28 +35854,31 @@ ] }, { - "id": "ImplicitThis", + "id": "ComparableImplementedButEqualsNotOverridden", "shortDescription": { - "text": "Implicit 'this'" + "text": "'Comparable' implemented but 'equals()' not overridden" }, "fullDescription": { - "text": "Reports usages of implicit this. Example: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }' The quick fix specifies this explicitly: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }'", - "markdown": "Reports usages of implicit **this** .\n\n**Example:**\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }\n\nThe quick fix specifies **this** explicitly:\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }\n" + "text": "Reports classes that implement 'java.lang.Comparable' but do not override 'equals()'. If 'equals()' is not overridden, the 'equals()' implementation is not consistent with the 'compareTo()' implementation. If an object of such a class is added to a collection such as 'java.util.SortedSet', this collection will violate the contract of 'java.util.Set', which is defined in terms of 'equals()'. Example: 'class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n }' After the quick fix is applied: 'class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n\n @Override\n public boolean equals(Object o) {\n return o instanceof Length && compareTo((Length) o) == 0;\n }\n }'", + "markdown": "Reports classes that implement `java.lang.Comparable` but do not override `equals()`.\n\n\nIf `equals()`\nis not overridden, the `equals()` implementation is not consistent with\nthe `compareTo()` implementation. If an object of such a class is added\nto a collection such as `java.util.SortedSet`, this collection will violate\nthe contract of `java.util.Set`, which is defined in terms of\n`equals()`.\n\n**Example:**\n\n\n class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n }\n\nAfter the quick fix is applied:\n\n\n class Length implements Comparable {\n private int cm = 0;\n\n @Override\n public int compareTo(@NotNull Length o) {\n if (cm == o.cm) return 0;\n return cm < o.cm ? -1 : 1;\n }\n\n @Override\n public boolean equals(Object o) {\n return o instanceof Length && compareTo((Length) o) == 0;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ImplicitThis", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ComparableImplementedButEqualsNotOverridden", + "cweIds": [ + 697 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -36000,19 +35890,19 @@ ] }, { - "id": "KotlinCatchMayIgnoreException", + "id": "MapReplaceableByEnumMap", "shortDescription": { - "text": "'catch' block may ignore exception" + "text": "'Map' can be replaced with 'EnumMap'" }, "fullDescription": { - "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. The inspection won't report any 'catch' parameters named 'ignore', 'ignored', or '_'. You can use the quick-fix to change the exception name to '_'. Example: 'try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }' After the quick-fix is applied: 'try {\n throwingMethod()\n } catch (_: IOException) {\n\n }' Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments.", - "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\n\n\nThe inspection won't report any `catch` parameters named `ignore`, `ignored`, or `_`.\n\n\nYou can use the quick-fix to change the exception name to `_`.\n\n**Example:**\n\n\n try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throwingMethod()\n } catch (_: IOException) {\n\n }\n\nUse the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments." + "text": "Reports instantiations of 'java.util.Map' objects whose key types are enumerated classes. Such 'java.util.Map' objects can be replaced with 'java.util.EnumMap' objects. 'java.util.EnumMap' implementations can be much more efficient because the underlying data structure is a simple array. Example: 'Map myEnums = new HashMap<>();' After the quick-fix is applied: 'Map myEnums = new EnumMap<>(MyEnum.class);'", + "markdown": "Reports instantiations of `java.util.Map` objects whose key types are enumerated classes. Such `java.util.Map` objects can be replaced with `java.util.EnumMap` objects.\n\n\n`java.util.EnumMap` implementations can be much more efficient\nbecause the underlying data structure is a simple array.\n\n**Example:**\n\n\n Map myEnums = new HashMap<>();\n\nAfter the quick-fix is applied:\n\n\n Map myEnums = new EnumMap<>(MyEnum.class);\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CatchMayIgnoreException", + "suppressToolId": "MapReplaceableByEnumMap", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36020,8 +35910,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -36033,19 +35923,23 @@ ] }, { - "id": "DifferentStdlibGradleVersion", + "id": "ReturnNull", "shortDescription": { - "text": "Kotlin library and Gradle plugin versions are different" + "text": "Return of 'null'" }, "fullDescription": { - "text": "Reports different Kotlin stdlib and compiler versions. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }' To fix the problem change the kotlin stdlib version to match the kotlin compiler version.", - "markdown": "Reports different Kotlin stdlib and compiler versions.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }\n\nTo fix the problem change the kotlin stdlib version to match the kotlin compiler version." + "text": "Reports 'return' statements with 'null' return values. While occasionally useful, this construct may make the code more prone to failing with a 'NullPointerException'. If a method is designed to return 'null', it is suggested to mark it with the '@Nullable' annotation - such methods will be ignored by this inspection. Example: 'class Person {\n public String getName () {\n return null;\n }\n }' After the quick-fix is applied: 'class Person {\n public @Nullable String getName () {\n return null;\n }\n }' If the return type is 'java.util.Optional', an additional quick-fix to convert 'null' to 'Optional.empty()' is suggested. Use the following options to configure the inspection: Whether to ignore 'private' methods. This will also ignore return of 'null' from anonymous classes and lambdas. Whether 'null' values on array returns, collection object returns, plain object returns, or a combination of the three should be reported. Return of 'null' in methods with return type 'java.util.Optional' are always reported. Click Configure annotations to specify which annotations should be considered 'nullable'.", + "markdown": "Reports `return` statements with `null` return values. While occasionally useful, this construct may make the code more prone to failing with a `NullPointerException`.\n\n\nIf a method is designed to return `null`, it is suggested to mark it with the\n`@Nullable` annotation - such methods will be ignored by this inspection.\n\n**Example:**\n\n\n class Person {\n public String getName () {\n return null;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Person {\n public @Nullable String getName () {\n return null;\n }\n }\n\n\nIf the return type is `java.util.Optional`, an additional quick-fix to convert\n`null` to `Optional.empty()` is suggested.\n\n\nUse the following options to configure the inspection:\n\n* Whether to ignore `private` methods. This will also ignore return of `null` from anonymous classes and lambdas.\n* Whether `null` values on array returns, collection object returns, plain object returns, or a combination of the three should be reported. Return of `null` in methods with return type `java.util.Optional` are always reported.\n* Click **Configure annotations** to specify which annotations should be considered 'nullable'." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DifferentStdlibGradleVersion", + "suppressToolId": "ReturnOfNull", + "cweIds": [ + 252, + 476 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36053,8 +35947,8 @@ "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Probable bugs/Nullability problems", + "index": 172, "toolComponent": { "name": "QDJVM" } @@ -36066,19 +35960,19 @@ ] }, { - "id": "CanBeVal", + "id": "LoggingStringTemplateAsArgument", "shortDescription": { - "text": "Local 'var' is never modified and can be declared as 'val'" + "text": "String template as argument to logging call" }, "fullDescription": { - "text": "Reports local variables declared with the 'var' keyword that are never modified. Kotlin encourages to declare practically immutable variables using the 'val' keyword, ensuring that their value will never change. Example: 'fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }' The quick-fix replaces the 'var' keyword with 'val': 'fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }'", - "markdown": "Reports local variables declared with the `var` keyword that are never modified.\n\nKotlin encourages to declare practically immutable variables using the `val` keyword, ensuring that their value will never change.\n\n**Example:**\n\n\n fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n\nThe quick-fix replaces the `var` keyword with `val`:\n\n\n fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n" + "text": "Reports string templates that are used as arguments to SLF4J and Log4j 2 logging methods. The method 'org.apache.logging.log4j.Logger.log()' and its overloads are supported only for all log levels option. String templates 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 (for Kotlin): 'val variable1 = getVariable()\n logger.info(\"variable1: $variable1\")' After the quick-fix is applied (for Kotlin): 'val variable1 = getVariable()\n logger.info(\"variable1: {}\", variable1)' Note that the suggested replacement might not be equivalent to the original code, for example, when string templates contain method calls or assignment expressions. Use the Warn on list to ignore certain higher logging levels. Higher logging levels may be always enabled, and the arguments will always be evaluated. Use the Do not warn when only expressions with primitive types, their wrappers or String are included option to ignore string templates, which contain only expressions with primitive types, their wrappers or String. For example, it could be useful to prevent loading lazy collections. Note that, creating string even only with expressions with primitive types, their wrappers or String at runtime can negatively impact performance. Use the Do not warn when call only with an exception as argument after message argument option to ignore calls, which only contain an exception as an argument after the message argument. For example, it could be useful to adjust the inspection's behavior with a custom code style. New in 2023.1", + "markdown": "Reports string templates that are used as arguments to **SLF4J** and **Log4j 2** logging methods. The method `org.apache.logging.log4j.Logger.log()` and its overloads are supported only for **all log levels** option. String templates 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 (for Kotlin):**\n\n\n val variable1 = getVariable()\n logger.info(\"variable1: $variable1\")\n\n**After the quick-fix is applied (for Kotlin):**\n\n\n val variable1 = getVariable()\n logger.info(\"variable1: {}\", variable1)\n\n\nNote that the suggested replacement might not be equivalent to the original code, for example,\nwhen string templates contain method calls or assignment expressions.\n\n* Use the **Warn on** list to ignore certain higher logging levels. Higher logging levels may be always enabled, and the arguments will always be evaluated.\n* Use the **Do not warn when only expressions with primitive types, their wrappers or String are included** option to ignore string templates, which contain only expressions with primitive types, their wrappers or String. For example, it could be useful to prevent loading lazy collections. Note that, creating string even only with expressions with primitive types, their wrappers or String at runtime can negatively impact performance.\n* Use the **Do not warn when call only with an exception as argument after message argument** option to ignore calls, which only contain an exception as an argument after the message argument. For example, it could be useful to adjust the inspection's behavior with a custom code style.\n\nNew in 2023.1" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CanBeVal", + "suppressToolId": "LoggingStringTemplateAsArgument", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36086,8 +35980,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "JVM languages/Logging", + "index": 52, "toolComponent": { "name": "QDJVM" } @@ -36099,28 +35993,28 @@ ] }, { - "id": "ReplaceWithIgnoreCaseEquals", + "id": "UnpredictableBigDecimalConstructorCall", "shortDescription": { - "text": "Should be replaced with 'equals(..., ignoreCase = true)'" + "text": "Unpredictable 'BigDecimal' constructor call" }, "fullDescription": { - "text": "Reports case-insensitive comparisons that can be replaced with 'equals(..., ignoreCase = true)'. By using 'equals()' you don't have to allocate extra strings with 'toLowerCase()' or 'toUpperCase()' to compare strings. The quick-fix replaces the case-insensitive comparison that uses 'toLowerCase()' or 'toUpperCase()' with 'equals(..., ignoreCase = true)'. Note: May change semantics for some locales. Example: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }' After the quick-fix is applied: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }'", - "markdown": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + "text": "Reports calls to 'BigDecimal' constructors that accept a 'double' value. These constructors produce 'BigDecimal' that is exactly equal to the supplied 'double' value. However, because doubles are encoded in the IEEE 754 64-bit double-precision binary floating-point format, the exact value can be unexpected. For example, 'new BigDecimal(0.1)' yields a 'BigDecimal' object. Its value is '0.1000000000000000055511151231257827021181583404541015625' which is the nearest number to 0.1 representable as a double. To get 'BigDecimal' that stores the same value as written in the source code, use either 'new BigDecimal(\"0.1\")' or 'BigDecimal.valueOf(0.1)'. Example: 'class Constructor {\n void foo() {\n new BigDecimal(0.1);\n }\n }' After the quick-fix is applied: 'class Constructor {\n void foo() {\n new BigDecimal(\"0.1\");\n }\n }'", + "markdown": "Reports calls to `BigDecimal` constructors that accept a `double` value. These constructors produce `BigDecimal` that is exactly equal to the supplied `double` value. However, because doubles are encoded in the IEEE 754 64-bit double-precision binary floating-point format, the exact value can be unexpected.\n\nFor example, `new BigDecimal(0.1)` yields a `BigDecimal` object. Its value is\n`0.1000000000000000055511151231257827021181583404541015625`\nwhich is the nearest number to 0.1 representable as a double.\nTo get `BigDecimal` that stores the same value as written in the source code,\nuse either `new BigDecimal(\"0.1\")` or `BigDecimal.valueOf(0.1)`.\n\n**Example:**\n\n\n class Constructor {\n void foo() {\n new BigDecimal(0.1);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Constructor {\n void foo() {\n new BigDecimal(\"0.1\");\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ReplaceWithIgnoreCaseEquals", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnpredictableBigDecimalConstructorCall", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -36132,28 +36026,28 @@ ] }, { - "id": "ReplaceSubstringWithSubstringAfter", + "id": "IntegerDivisionInFloatingPointContext", "shortDescription": { - "text": "'substring' call should be replaced with 'substringAfter'" + "text": "Integer division in floating-point context" }, "fullDescription": { - "text": "Reports calls like 's.substring(s.indexOf(x))' that can be replaced with 's.substringAfter(x)'. Using 's.substringAfter(x)' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringAfter'. Example: 'fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringAfter('x')\n }'", - "markdown": "Reports calls like `s.substring(s.indexOf(x))` that can be replaced with `s.substringAfter(x)`.\n\nUsing `s.substringAfter(x)` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringAfter`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringAfter('x')\n }\n" + "text": "Reports integer divisions where the result is used as a floating-point number. Such division is often an error and may have unexpected results due to the truncation that happens in integer division. Example: 'float x = 3.0F + 3 * 2 / 5;' After the quick-fix is applied: 'float x = 3.0F + ((float) (3 * 2)) /5;'", + "markdown": "Reports integer divisions where the result is used as a floating-point number. Such division is often an error and may have unexpected results due to the truncation that happens in integer division.\n\n**Example:**\n\n\n float x = 3.0F + 3 * 2 / 5;\n\nAfter the quick-fix is applied:\n\n\n float x = 3.0F + ((float) (3 * 2)) /5;\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ReplaceSubstringWithSubstringAfter", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "IntegerDivisionInFloatingPointContext", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -36165,19 +36059,19 @@ ] }, { - "id": "RedundantCompanionReference", + "id": "AssertWithoutMessage", "shortDescription": { - "text": "Redundant 'Companion' reference" + "text": "Message missing on assertion" }, "fullDescription": { - "text": "Reports redundant 'Companion' reference. Example: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }' After the quick-fix is applied: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }'", - "markdown": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" + "text": "Reports calls to 'assertXXX()' or 'fail()' without an error message string argument. An error message on assertion failure may help clarify the test case's intent. Example: 'assertTrue(checkValid());' After the quick-fix is applied: 'assertTrue(checkValid(), \"|\");' The message argument is added before or after the existing arguments according to the assertions framework that you use.", + "markdown": "Reports calls to `assertXXX()` or `fail()` without an error message string argument. An error message on assertion failure may help clarify the test case's intent.\n\n**Example:**\n\n\n assertTrue(checkValid());\n\nAfter the quick-fix is applied:\n\n assertTrue(checkValid(), \"|\");\n\n\nThe message argument is added before or after the existing arguments according to the assertions framework that you use." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantCompanionReference", + "suppressToolId": "AssertWithoutMessage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36185,8 +36079,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Test frameworks", + "index": 130, "toolComponent": { "name": "QDJVM" } @@ -36198,19 +36092,19 @@ ] }, { - "id": "KDocUnresolvedReference", + "id": "ConditionalBreakInInfiniteLoop", "shortDescription": { - "text": "Unresolved reference in KDoc" + "text": "Conditional break inside loop" }, "fullDescription": { - "text": "Reports unresolved references in KDoc comments. Example: '/**\n * [unresolvedLink]\n */\n fun foo() {}' To fix the problem make the link valid.", - "markdown": "Reports unresolved references in KDoc comments.\n\n**Example:**\n\n\n /**\n * [unresolvedLink]\n */\n fun foo() {}\n\nTo fix the problem make the link valid." + "text": "Reports conditional breaks at the beginning or at the end of a loop and suggests adding a loop condition instead to shorten the code. Example: 'while (true) {\n if (i == 23) break;\n i++;\n }' After the quick fix is applied: 'while (i != 23) {\n i++;\n }'", + "markdown": "Reports conditional breaks at the beginning or at the end of a loop and suggests adding a loop condition instead to shorten the code.\n\nExample:\n\n\n while (true) {\n if (i == 23) break;\n i++;\n }\n\nAfter the quick fix is applied:\n\n\n while (i != 23) {\n i++;\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KDocUnresolvedReference", + "suppressToolId": "ConditionalBreakInInfiniteLoop", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36218,8 +36112,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -36231,28 +36125,28 @@ ] }, { - "id": "NestedLambdaShadowedImplicitParameter", + "id": "UnqualifiedInnerClassAccess", "shortDescription": { - "text": "Nested lambda has shadowed implicit parameter" + "text": "Unqualified inner class access" }, "fullDescription": { - "text": "Reports nested lambdas with shadowed implicit parameters. Example: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n}' After the quick-fix is applied: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n}'", - "markdown": "Reports nested lambdas with shadowed implicit parameters.\n\n**Example:**\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n }\n" + "text": "Reports references to inner classes that are not qualified with the name of the enclosing class. Example: 'import foo.Foo.Bar;\n\n class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Bar bar) {}\n }' After the quick-fix is applied: 'class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Foo.Bar bar) {}\n }' Use the inspection settings to ignore references to inner classes within the same class, which therefore do not require an import.", + "markdown": "Reports references to inner classes that are not qualified with the name of the enclosing class.\n\n**Example:**\n\n\n import foo.Foo.Bar;\n\n class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Bar bar) {}\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class Bar {}\n }\n\n class Baz {\n void f(Foo.Bar bar) {}\n }\n\n\nUse the inspection settings to ignore references to inner classes within the same class,\nwhich therefore do not require an import." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "NestedLambdaShadowedImplicitParameter", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnqualifiedInnerClassAccess", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -36264,19 +36158,19 @@ ] }, { - "id": "RedundantSamConstructor", + "id": "RedundantClassCall", "shortDescription": { - "text": "Redundant SAM constructor" + "text": "Redundant 'isInstance()' or 'cast()' call" }, "fullDescription": { - "text": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas. Example: 'fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}' After the quick-fix is applied: 'fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}'", - "markdown": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.\n\n**Example:**\n\n\n fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n" + "text": "Reports redundant calls of 'java.lang.Class' methods. For example, 'Xyz.class.isInstance(object)' can be replaced with 'object instanceof Xyz'. The instanceof check is preferred: even though the performance will probably be the same as these methods are intrinsics, they better indicate a static check. New in 2018.2", + "markdown": "Reports redundant calls of `java.lang.Class` methods.\n\nFor example, `Xyz.class.isInstance(object)` can be replaced with `object instanceof Xyz`.\nThe instanceof check is preferred: even though the performance will probably be the same as these methods are intrinsics,\nthey better indicate a static check.\n\nNew in 2018.2" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantSamConstructor", + "suppressToolId": "RedundantClassCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36284,8 +36178,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -36297,19 +36191,19 @@ ] }, { - "id": "InconsistentCommentForJavaParameter", + "id": "UnnecessaryStringEscape", "shortDescription": { - "text": "Inconsistent comment for Java parameter" + "text": "Unnecessarily escaped character" }, "fullDescription": { - "text": "Reports inconsistent parameter names for Java method calls specified in a comment block. Examples: '// Java\n public class JavaService {\n public void invoke(String command) {}\n }' '// Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }' The quick fix corrects the parameter name in the comment block: 'fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }'", - "markdown": "Reports inconsistent parameter names for **Java** method calls specified in a comment block.\n\n**Examples:**\n\n\n // Java\n public class JavaService {\n public void invoke(String command) {}\n }\n\n\n // Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }\n\nThe quick fix corrects the parameter name in the comment block:\n\n\n fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }\n" + "text": "Reports unnecessarily escaped characters in 'String' and optionally 'char' literals. Escaped tab characters '\\t' are not reported, because tab characters are invisible. Examples: 'String s = \"\\'Scare\\' quotes\";\n String t = \"\"\"\n All you need is\\n\\tLove\\n\"\"\";' After the quick-fix is applied: 'String s = \"'Scare' quotes\";\n String t = \"\"\"\n All you need is\n \\tLove\n \"\"\";' New in 2019.3", + "markdown": "Reports unnecessarily escaped characters in `String` and optionally `char` literals.\n\nEscaped tab characters `\\t` are not reported, because tab characters are invisible.\n\nExamples:\n\n\n String s = \"\\'Scare\\' quotes\";\n String t = \"\"\"\n All you need is\\n\\tLove\\n\"\"\";\n\nAfter the quick-fix is applied:\n\n\n String s = \"'Scare' quotes\";\n String t = \"\"\"\n All you need is\n \\tLove\n \"\"\";\n\nNew in 2019.3" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InconsistentCommentForJavaParameter", + "suppressToolId": "UnnecessaryStringEscape", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36317,8 +36211,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -36330,19 +36224,19 @@ ] }, { - "id": "RemoveRedundantCallsOfConversionMethods", + "id": "FieldCanBeLocal", "shortDescription": { - "text": "Redundant call of conversion method" + "text": "Field can be local" }, "fullDescription": { - "text": "Reports redundant calls to conversion methods (for example, 'toString()' on a 'String' or 'toDouble()' on a 'Double'). Use the 'Remove redundant calls of the conversion method' quick-fix to clean up the code.", - "markdown": "Reports redundant calls to conversion methods (for example, `toString()` on a `String` or `toDouble()` on a `Double`).\n\nUse the 'Remove redundant calls of the conversion method' quick-fix to clean up the code." + "text": "Reports redundant class fields that can be replaced with local variables. If all local usages of a field are preceded by assignments to that field, the field can be removed, and its usages can be replaced with local variables.", + "markdown": "Reports redundant class fields that can be replaced with local variables.\n\nIf all local usages of a field are preceded by assignments to that field, the\nfield can be removed, and its usages can be replaced with local variables." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RemoveRedundantCallsOfConversionMethods", + "suppressToolId": "FieldCanBeLocal", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36350,8 +36244,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -36363,19 +36257,19 @@ ] }, { - "id": "KotlinThrowableNotThrown", + "id": "UrlHashCode", "shortDescription": { - "text": "Throwable not thrown" + "text": "Call to 'equals()' or 'hashCode()' on 'URL' object" }, "fullDescription": { - "text": "Reports instantiations of 'Throwable' or its subclasses, when the created 'Throwable' is never actually thrown. The reported code indicates mistakes that are hard to catch in tests. Also, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the resulting 'Throwable' instance is not thrown. Example: 'fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }'", - "markdown": "Reports instantiations of `Throwable` or its subclasses, when the created `Throwable` is never actually thrown.\n\nThe reported code indicates mistakes that are hard to catch in tests.\n\n\nAlso, this inspection reports method calls that return instances of `Throwable` or its subclasses,\nwhen the resulting `Throwable` instance is not thrown.\n\n**Example:**\n\n\n fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }\n" + "text": "Reports 'hashCode()' and 'equals()' calls on 'java.net.URL' objects and calls that add 'URL' objects to maps and sets. 'URL''s 'equals()' and 'hashCode()' methods can perform a DNS lookup to resolve the host name. This may cause significant delays, depending on the availability and speed of the network and the DNS server. Using 'java.net.URI' instead of 'java.net.URL' will avoid the DNS lookup. Example: 'boolean urlEquals(URL url1, URL url2) {\n return url1.equals(url2);\n }'", + "markdown": "Reports `hashCode()` and `equals()` calls on `java.net.URL` objects and calls that add `URL` objects to maps and sets.\n\n\n`URL`'s `equals()` and `hashCode()` methods can perform a DNS lookup to resolve the host name.\nThis may cause significant delays, depending on the availability and speed of the network and the DNS server.\nUsing `java.net.URI` instead of `java.net.URL` will avoid the DNS lookup.\n\n**Example:**\n\n\n boolean urlEquals(URL url1, URL url2) {\n return url1.equals(url2);\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ThrowableNotThrown", + "suppressToolId": "UrlHashCode", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36383,8 +36277,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -36396,28 +36290,28 @@ ] }, { - "id": "KotlinSealedInheritorsInJava", + "id": "IfStatementWithIdenticalBranches", "shortDescription": { - "text": "Inheritance of Kotlin sealed interface/class from Java" + "text": "'if' statement with identical branches or common parts" }, "fullDescription": { - "text": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code. Example: '// Kotlin file: MathExpression.kt\n\nsealed class MathExpression\n\ndata class Const(val number: Double) : MathExpression()\ndata class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()' '// Java file: NotANumber.java\n\npublic class NotANumber extends MathExpression {\n}'", - "markdown": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code.\n\n**Example:**\n\n\n // Kotlin file: MathExpression.kt\n\n sealed class MathExpression\n\n data class Const(val number: Double) : MathExpression()\n data class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()\n\n\n // Java file: NotANumber.java\n\n public class NotANumber extends MathExpression {\n }\n" + "text": "Reports 'if' statements in which common parts can be extracted from the branches. These common parts are independent from the condition and make 'if' statements harder to understand. Example: 'if (x > 12) {\n doSomethingBefore();\n doSomethingDifferent1();\n doSomethingAfter();\n } else {\n doSomethingBefore();\n doSomethingDifferent2();\n doSomethingAfter();\n }' After the quick-fix is applied: 'doSomethingBefore();\n if (x > 12) {\n doSomethingDifferent1();\n } else {\n doSomethingDifferent2();\n }\n doSomethingAfter();' Updated in 2018.1", + "markdown": "Reports `if` statements in which common parts can be extracted from the branches.\n\nThese common parts are independent from the condition and make `if` statements harder to understand.\n\nExample:\n\n\n if (x > 12) {\n doSomethingBefore();\n doSomethingDifferent1();\n doSomethingAfter();\n } else {\n doSomethingBefore();\n doSomethingDifferent2();\n doSomethingAfter();\n }\n\nAfter the quick-fix is applied:\n\n\n doSomethingBefore();\n if (x > 12) {\n doSomethingDifferent1();\n } else {\n doSomethingDifferent2();\n }\n doSomethingAfter();\n\nUpdated in 2018.1" }, "defaultConfiguration": { "enabled": true, - "level": "error", + "level": "note", "parameters": { - "suppressToolId": "KotlinSealedInheritorsInJava", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "IfStatementWithIdenticalBranches", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -36429,28 +36323,28 @@ ] }, { - "id": "SimplifyNegatedBinaryExpression", + "id": "InterfaceWithOnlyOneDirectInheritor", "shortDescription": { - "text": "Negated boolean expression can be simplified" + "text": "Interface with a single direct inheritor" }, "fullDescription": { - "text": "Reports negated boolean expressions that can be simplified. The quick-fix simplifies the boolean expression. Example: 'fun test(n: Int) {\n !(0 == 1)\n }' After the quick-fix is applied: 'fun test(n: Int) {\n 0 != 1\n }' Please note that this action may change code semantics if IEEE-754 NaN values are involved: 'fun main() {\n println(!(Double.NaN >= 0)) // true\n }' After the quick-fix is applied: 'fun main() {\n println(Double.NaN < 0) // false\n }'", - "markdown": "Reports negated boolean expressions that can be simplified.\n\nThe quick-fix simplifies the boolean expression.\n\n**Example:**\n\n\n fun test(n: Int) {\n !(0 == 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(n: Int) {\n 0 != 1\n }\n\nPlease note that this action may change code semantics if IEEE-754 NaN values are involved:\n\n\n fun main() {\n println(!(Double.NaN >= 0)) // true\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n println(Double.NaN < 0) // false\n }\n" + "text": "Reports interfaces that have precisely one direct inheritor. While such interfaces may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the interface with its inheritor. 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.", + "markdown": "Reports interfaces that have precisely one direct inheritor. While such interfaces may offer admirable clarity of design, in memory-constrained or bandwidth-limited environments, they needlessly increase the total footprint of the application. Consider merging the interface with its inheritor.\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." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SimplifyNegatedBinaryExpression", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "InterfaceWithOnlyOneDirectInheritor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -36462,28 +36356,28 @@ ] }, { - "id": "MemberVisibilityCanBePrivate", + "id": "InstanceofChain", "shortDescription": { - "text": "Class member can have 'private' visibility" + "text": "Chain of 'instanceof' checks" }, "fullDescription": { - "text": "Reports declarations that can be made 'private' to follow the encapsulation principle. Example: 'class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}' After the quick-fix is applied (considering there are no usages of 'url' outside of 'Service' class): 'class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}'", - "markdown": "Reports declarations that can be made `private` to follow the encapsulation principle.\n\n**Example:**\n\n\n class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n\nAfter the quick-fix is applied (considering there are no usages of `url` outside of `Service` class):\n\n\n class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n" + "text": "Reports any chains of 'if'-'else' statements all of whose conditions are 'instanceof' expressions or class equality expressions (e.g. comparison with 'String.class'). Such constructions usually indicate a failure in object-oriented design which dictates that such type-based dispatch should be done via polymorphic method calls rather than explicit chains of type tests. Example: 'double getArea(Shape shape) {\n // Warning: abstraction failure.\n // It would be better to declare a getArea()\n // abstract method in the shape interface\n // and implement it in every inheritor.\n if (shape instanceof Point) {\n return 0;\n }\n if (shape instanceof Circle) {\n return Math.PI *\n Math.pow(((Circle) shape).radius(), 2);\n }\n if (shape instanceof Rectangle) {\n return ((Rectangle) shape).width() *\n ((Rectangle) shape).height();\n }\n throw new IllegalArgumentException();\n }' Use the checkbox below to ignore 'instanceof' expressions on library classes.", + "markdown": "Reports any chains of `if`-`else` statements all of whose conditions are `instanceof` expressions or class equality expressions (e.g. comparison with `String.class`). Such constructions usually indicate a failure in object-oriented design which dictates that such type-based dispatch should be done via polymorphic method calls rather than explicit chains of type tests.\n\nExample:\n\n\n double getArea(Shape shape) {\n // Warning: abstraction failure.\n // It would be better to declare a getArea()\n // abstract method in the shape interface\n // and implement it in every inheritor.\n if (shape instanceof Point) {\n return 0;\n }\n if (shape instanceof Circle) {\n return Math.PI *\n Math.pow(((Circle) shape).radius(), 2);\n }\n if (shape instanceof Rectangle) {\n return ((Rectangle) shape).width() *\n ((Rectangle) shape).height();\n }\n throw new IllegalArgumentException();\n }\n\n\nUse the checkbox below to ignore `instanceof` expressions on library classes." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MemberVisibilityCanBePrivate", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ChainOfInstanceofChecks", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -36495,19 +36389,19 @@ ] }, { - "id": "SelfAssignment", + "id": "BlockMarkerComments", "shortDescription": { - "text": "Redundant assignment" + "text": "Block marker comment" }, "fullDescription": { - "text": "Reports assignments of a variable to itself. The quick-fix removes the redundant assignment. Example: 'fun test() {\n var bar = 1\n bar = bar\n }' After the quick-fix is applied: 'fun test() {\n var bar = 1\n }'", - "markdown": "Reports assignments of a variable to itself.\n\nThe quick-fix removes the redundant assignment.\n\n**Example:**\n\n\n fun test() {\n var bar = 1\n bar = bar\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n var bar = 1\n }\n" + "text": "Reports comments which are used as code block markers. The quick-fix removes such comments. Example: 'while (i < 10) {\n i++;\n } // end while' After the quick-fix is applied: 'while (i < 10) {\n i++;\n }'", + "markdown": "Reports comments which are used as code block markers. The quick-fix removes such comments.\n\nExample:\n\n\n while (i < 10) {\n i++;\n } // end while\n\nAfter the quick-fix is applied:\n\n\n while (i < 10) {\n i++;\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SelfAssignment", + "suppressToolId": "BlockMarkerComments", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36515,8 +36409,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -36528,19 +36422,19 @@ ] }, { - "id": "RecursiveEqualsCall", + "id": "SerializableHasSerializationMethods", "shortDescription": { - "text": "Recursive equals call" + "text": "Serializable class without 'readObject()' and 'writeObject()'" }, "fullDescription": { - "text": "Reports recursive 'equals'('==') calls. In Kotlin, '==' compares object values by calling 'equals' method under the hood. '===', on the other hand, compares objects by reference. '===' is commonly used in 'equals' method implementation. But '===' may be mistakenly mixed up with '==' leading to infinite recursion. Example: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }' After the quick-fix is applied: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }'", - "markdown": "Reports recursive `equals`(`==`) calls.\n\n\nIn Kotlin, `==` compares object values by calling `equals` method under the hood.\n`===`, on the other hand, compares objects by reference.\n\n\n`===` is commonly used in `equals` method implementation.\nBut `===` may be mistakenly mixed up with `==` leading to infinite recursion.\n\n**Example:**\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }\n" + "text": "Reports 'Serializable' classes that do not implement 'readObject()' and 'writeObject()' methods. If 'readObject()' and 'writeObject()' methods are not implemented, the default serialization algorithms are used, which may be sub-optimal for performance and compatibility in many environments. 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' classes without non-static fields. Whether to ignore 'Serializable' anonymous classes.", + "markdown": "Reports `Serializable` classes that do not implement `readObject()` and `writeObject()` methods.\n\n\nIf `readObject()` and `writeObject()` methods are not implemented,\nthe default serialization algorithms are used,\nwhich may be sub-optimal for performance and compatibility in many environments.\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` classes without non-static fields.\n* Whether to ignore `Serializable` anonymous classes." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RecursiveEqualsCall", + "suppressToolId": "SerializableHasSerializationMethods", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -36548,8 +36442,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -36561,28 +36455,28 @@ ] }, { - "id": "ExplicitThis", + "id": "IdempotentLoopBody", "shortDescription": { - "text": "Redundant explicit 'this'" + "text": "Idempotent loop body" }, "fullDescription": { - "text": "Reports an explicit 'this' when it can be omitted. Example: 'class C {\n private val i = 1\n fun f() = this.i\n }' The quick-fix removes the redundant 'this': 'class C {\n private val i = 1\n fun f() = i\n }'", - "markdown": "Reports an explicit `this` when it can be omitted.\n\n**Example:**\n\n\n class C {\n private val i = 1\n fun f() = this.i\n }\n\nThe quick-fix removes the redundant `this`:\n\n\n class C {\n private val i = 1\n fun f() = i\n }\n" + "text": "Reports loops whose second and all subsequent iterations do not produce any additional side effects other than the one produced by the first iteration, which can indicate a programming error. Such loops may iterate only zero, one, or infinite number of times. If the infinite number of times case is unreachable, such a loop can be replaced with an 'if' statement. Otherwise, there's a possibility that the program can get stuck. Example: 'public void foo(String baseName, String names) {\n int suffix = 1;\n String name = baseName;\n while (names.contains(name)) {\n // error: suffix is not updated making loop body idempotent\n name = baseName + suffix;\n }\n }' New in 2018.1", + "markdown": "Reports loops whose second and all subsequent iterations do not produce any additional side effects other than the one produced by the first iteration, which can indicate a programming error.\n\nSuch loops may iterate only zero, one, or infinite number of times.\nIf the infinite number of times case is unreachable, such a loop can be replaced with an `if` statement.\nOtherwise, there's a possibility that the program can get stuck.\n\nExample:\n\n\n public void foo(String baseName, String names) {\n int suffix = 1;\n String name = baseName;\n while (names.contains(name)) {\n // error: suffix is not updated making loop body idempotent\n name = baseName + suffix;\n }\n }\n\nNew in 2018.1" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ExplicitThis", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "IdempotentLoopBody", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -36594,28 +36488,28 @@ ] }, { - "id": "NullChecksToSafeCall", + "id": "RedundantImplements", "shortDescription": { - "text": "Null-checks can be replaced with safe-calls" + "text": "Redundant interface declaration" }, "fullDescription": { - "text": "Reports chained null-checks that can be replaced with safe-calls. Example: 'fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }' After the quick-fix is applied: 'fun test(my: My?) {\n if (my?.foo() != null) {}\n }'", - "markdown": "Reports chained null-checks that can be replaced with safe-calls.\n\n**Example:**\n\n\n fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(my: My?) {\n if (my?.foo() != null) {}\n }\n" + "text": "Reports interfaces in a class' 'implements' list or an interface's 'extends' list that are already implemented by a superclass or extended by a superinterface. Such declarations are unnecessary and may be safely removed. Example: 'class X implements One, Two {\n }\n interface One {}\n interface Two extends One {}' After the quick-fix is applied: 'class X implements Two {\n }\n interface One {}\n interface Two extends One {}' Use the options to not report on 'Serializable' or 'Externalizable' in an 'extends' or 'implements' list.", + "markdown": "Reports interfaces in a class' `implements` list or an interface's `extends` list that are already implemented by a superclass or extended by a superinterface. Such declarations are unnecessary and may be safely removed.\n\n**Example:**\n\n\n class X implements One, Two {\n }\n interface One {}\n interface Two extends One {}\n\nAfter the quick-fix is applied:\n\n\n class X implements Two {\n }\n interface One {}\n interface Two extends One {}\n\n\nUse the options to not report on `Serializable` or `Externalizable`\nin an `extends` or `implements` list." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "NullChecksToSafeCall", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "RedundantInterfaceDeclaration", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -36627,28 +36521,28 @@ ] }, { - "id": "UnusedMainParameter", + "id": "FrequentlyUsedInheritorInspection", "shortDescription": { - "text": "Main parameter is not necessary" + "text": "Class may extend a commonly used base class" }, "fullDescription": { - "text": "Reports 'main' function with an unused single parameter.", - "markdown": "Reports `main` function with an unused single parameter." + "text": "Reports classes or interfaces that can be replaced with an implementation or extension of a more specific commonly used class or interface. For this inspection to work, a superclass needs to be in project source files and the project needs to use the IntelliJ IDEA build system. Example: 'class MyInheritor implements A {} // B suggested on the A reference\n\n interface A {}\n\n abstract class B implements A {}\n\n abstract class C1 extends B {}\n abstract class C2 extends B {}\n abstract class C3 extends B {}\n abstract class C4 extends B {}\n abstract class C5 extends B {}' By default, this inspection doesn't highlight issues in the editor but only provides a quick-fix. New in 2017.2", + "markdown": "Reports classes or interfaces that can be replaced with an implementation or extension of a more specific commonly used class or interface.\n\nFor this inspection to work, a superclass needs to be in project source files and the project needs to use the IntelliJ IDEA build system.\n\n**Example:**\n\n\n class MyInheritor implements A {} // B suggested on the A reference\n\n interface A {}\n\n abstract class B implements A {}\n\n abstract class C1 extends B {}\n abstract class C2 extends B {}\n abstract class C3 extends B {}\n abstract class C4 extends B {}\n abstract class C5 extends B {}\n\nBy default, this inspection doesn't highlight issues in the editor but only provides a quick-fix.\n\nNew in 2017.2" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "UnusedMainParameter", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "FrequentlyUsedInheritorInspection", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -36660,28 +36554,28 @@ ] }, { - "id": "FunctionWithLambdaExpressionBody", + "id": "FieldNamingConvention", "shortDescription": { - "text": "Function with '= { ... }' and inferred return type" + "text": "Field naming convention" }, "fullDescription": { - "text": "Reports functions with '= { ... }' and inferred return type. Example: 'fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.' The quick fix removes braces: 'fun sum(a: Int, b: Int) = a + b'", - "markdown": "Reports functions with `= { ... }` and inferred return type.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.\n\nThe quick fix removes braces:\n\n\n fun sum(a: Int, b: Int) = a + b\n" + "text": "Reports fields whose names are too short, too long, or do not follow the specified regular expression pattern. Example: if the inspection is enabled for constants, and the minimum specified length for a field name is 5 (the default), the following constant produces a warning because the length of its name is 3, which is less than 5: 'public static final int MAX = 42;'. A quick-fix that renames such fields is available only in the editor. Configure the inspection: Use the list in the Options section to specify which fields should be checked. Deselect the checkboxes for the fields for which you want to skip the check. For each field type, specify the minimum length, maximum length, and the regular expression expected for field names using the provided input fields. 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 fields 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 constants, and the minimum specified length for a field name is 5 (the default), the following constant\nproduces a warning because the length of its name is 3, which is less than 5: `public static final int MAX = 42;`.\n\nA quick-fix that renames such fields is available only in the editor.\n\nConfigure the inspection:\n\nUse the list in the **Options** section to specify which fields should be checked. Deselect the checkboxes for the fields for which\nyou want to skip the check.\n\nFor each field type, specify the minimum length, maximum length, and the regular expression expected for field names using the\nprovided input fields.\nSpecify **0** in the length fields to skip the corresponding checks.\n\nRegular expressions should be specified in the standard\n`java.util.regex` format." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "FunctionWithLambdaExpressionBody", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "FieldNamingConvention", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Naming conventions", + "index": 79, "toolComponent": { "name": "QDJVM" } @@ -36693,28 +36587,28 @@ ] }, { - "id": "ArrayInDataClass", + "id": "ClassNamePrefixedWithPackageName", "shortDescription": { - "text": "Array property in data class" + "text": "Class name prefixed with package name" }, "fullDescription": { - "text": "Reports properties with an 'Array' type in a 'data' class without overridden 'equals()' or 'hashCode()'. Array parameters are compared by reference equality, which is likely an unexpected behavior. It is strongly recommended to override 'equals()' and 'hashCode()' in such cases. Example: 'data class Text(val lines: Array)' The quick-fix generates missing 'equals()' and 'hashCode()' implementations: 'data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }'", - "markdown": "Reports properties with an `Array` type in a `data` class without overridden `equals()` or `hashCode()`.\n\n\nArray parameters are compared by reference equality, which is likely an unexpected behavior.\nIt is strongly recommended to override `equals()` and `hashCode()` in such cases.\n\n**Example:**\n\n\n data class Text(val lines: Array)\n\nThe quick-fix generates missing `equals()` and `hashCode()` implementations:\n\n\n data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }\n" + "text": "Reports classes whose names are prefixed with their package names, ignoring differences in capitalization. While occasionally having such names is reasonable, they are often used due to a poor naming scheme, may be redundant and annoying. Example: 'package byteCode;\n class ByteCodeAnalyzer {}' A quick-fix that renames such classes is available only in the editor.", + "markdown": "Reports classes whose names are prefixed with their package names, ignoring differences in capitalization.\n\nWhile occasionally having such names is reasonable, they are often used due to a poor naming scheme, may be redundant and\nannoying.\n\n**Example:**\n\n\n package byteCode;\n class ByteCodeAnalyzer {}\n\nA quick-fix that renames such classes is available only in the editor." }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "ArrayInDataClass", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ClassNamePrefixedWithPackageName", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Naming conventions/Class", + "index": 80, "toolComponent": { "name": "QDJVM" } @@ -36726,28 +36620,28 @@ ] }, { - "id": "ConvertTwoComparisonsToRangeCheck", + "id": "ConstantConditionalExpression", "shortDescription": { - "text": "Two comparisons should be converted to a range check" + "text": "Constant conditional expression" }, "fullDescription": { - "text": "Reports two consecutive comparisons that can be converted to a range check. Checking against a range makes code simpler by removing test subject duplication. Example: 'fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }' The quick-fix replaces the comparison-based check with a range one: 'fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }'", - "markdown": "Reports two consecutive comparisons that can be converted to a range check.\n\nChecking against a range makes code simpler by removing test subject duplication.\n\n**Example:**\n\n\n fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }\n\nThe quick-fix replaces the comparison-based check with a range one:\n\n\n fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }\n" + "text": "Reports conditional expressions in which the condition is either a 'true' or 'false' constant. These expressions sometimes occur as a result of automatic refactorings and may be simplified. Example: 'return true ? \"Yes\" : \"No\";' After quick-fix is applied: 'return \"Yes\";'", + "markdown": "Reports conditional expressions in which the condition is either a `true` or `false` constant. These expressions sometimes occur as a result of automatic refactorings and may be simplified.\n\nExample:\n\n\n return true ? \"Yes\" : \"No\";\n\nAfter quick-fix is applied:\n\n\n return \"Yes\";\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ConvertTwoComparisonsToRangeCheck", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConstantConditionalExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -36759,28 +36653,28 @@ ] }, { - "id": "LocalVariableName", + "id": "SameParameterValue", "shortDescription": { - "text": "Local variable naming convention" + "text": "Method parameter always has the same value" }, "fullDescription": { - "text": "Reports local variables that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with a lowercase letter, use camel case and no underscores. Example: 'fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }'", - "markdown": "Reports local variables that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#function-names): it has to start with a lowercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }\n" + "text": "Reports method parameters that always have the same constant value. Example: 'static void printPoint(int x, int y) { // x is always 0\n System.out.println(x + \", \" + y);\n }\n\n public static void main(String[] args) {\n printPoint(0, 1);\n printPoint(0, 2);\n }' The quick-fix inlines the constant value. This may simplify the method implementation. Use the Ignore when a quick-fix can not be provided option to suppress the inspections when: the parameter is modified inside the method the parameter value that is being passed is a reference to an inaccessible field (Java ony) the parameter is a vararg (Java only) Use the Maximal method visibility option to control the maximum visibility of methods to be reported. Use the Minimal method usage count to report parameter field to specify the minimal number of method usages with the same parameter value.", + "markdown": "Reports method parameters that always have the same constant value.\n\nExample:\n\n\n static void printPoint(int x, int y) { // x is always 0\n System.out.println(x + \", \" + y);\n }\n\n public static void main(String[] args) {\n printPoint(0, 1);\n printPoint(0, 2);\n }\n\nThe quick-fix inlines the constant value. This may simplify the method implementation.\n\n\nUse the **Ignore when a quick-fix can not be provided** option to suppress the inspections when:\n\n* the parameter is modified inside the method\n* the parameter value that is being passed is a reference to an inaccessible field (Java ony)\n* the parameter is a vararg (Java only)\n\n\nUse the **Maximal method visibility** option to control the maximum visibility of methods to be reported.\n\n\nUse the **Minimal method usage count to report parameter** field to specify the minimal number of method usages with the same parameter value." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "LocalVariableName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SameParameterValue", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -36792,28 +36686,28 @@ ] }, { - "id": "ReplaceUntilWithRangeUntil", + "id": "CatchMayIgnoreException", "shortDescription": { - "text": "Replace 'until' with '..<' operator" + "text": "Catch block may ignore exception" }, "fullDescription": { - "text": "Reports 'until' that can be replaced with '..<' operator. Every 'until' to '..<' replacement doesn't change the semantic in any way. The UX research shows that developers make ~20-30% fewer errors when reading code containing '..<' compared to 'until'. Example: 'fun main(args: Array) {\n for (index in 0 until args.size) {\n println(index)\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (index in 0..) {\n for (index in 0 until args.size) {\n println(index)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (index in 0.. Int) {\n b(a * a)\n}\n\nfun foo() {\n square(2, { it })\n}' After the quick-fix is applied: 'fun foo() {\n square(2){ it }\n}'", - "markdown": "Reports lambda expressions in parentheses which can be moved outside.\n\n**Example:**\n\n\n fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n }\n\n fun foo() {\n square(2, { it })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n square(2){ it }\n }\n" + "text": "Reports 'equals()' methods taking an argument type other than 'java.lang.Object' if the containing class does not have other overloads of 'equals()' that take 'java.lang.Object' as its argument type. A covariant version of 'equals()' does not override the 'Object.equals(Object)' method. It may cause unexpected behavior at runtime. For example, if the class is used to construct one of the standard collection classes, which expect that the 'Object.equals(Object)' method is overridden. Example: 'class Foo {\n public boolean equals(Foo foo) { // warning\n return false;\n }\n }\n class Bar {\n public boolean equals(Bar bar) { // no warning here\n return false;\n }\n @Override\n public boolean equals(Object obj) {\n return false;\n }\n }'", + "markdown": "Reports `equals()` methods taking an argument type other than `java.lang.Object` if the containing class does not have other overloads of `equals()` that take `java.lang.Object` as its argument type.\n\n\nA covariant version of `equals()` does not override the\n`Object.equals(Object)` method. It may cause unexpected\nbehavior at runtime. For example, if the class is used to construct\none of the standard collection classes, which expect that the\n`Object.equals(Object)` method is overridden.\n\n**Example:**\n\n\n class Foo {\n public boolean equals(Foo foo) { // warning\n return false;\n }\n }\n class Bar {\n public boolean equals(Bar bar) { // no warning here\n return false;\n }\n @Override\n public boolean equals(Object obj) {\n return false;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MoveLambdaOutsideParentheses", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "CovariantEquals", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -36957,28 +36851,28 @@ ] }, { - "id": "ProhibitTypeParametersForLocalVariablesMigration", + "id": "Convert2Lambda", "shortDescription": { - "text": "Local variable with type parameters" + "text": "Anonymous type can be replaced with lambda" }, "fullDescription": { - "text": "Reports local variables with type parameters. A type parameter for a local variable doesn't make sense because it can't be specialized. Example: 'fun main() {\n val x = \"\"\n }' After the quick-fix is applied: 'fun main() {\n val x = \"\"\n }' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", - "markdown": "Reports local variables with type parameters.\n\nA type parameter for a local variable doesn't make sense because it can't be specialized.\n\n**Example:**\n\n\n fun main() {\n val x = \"\"\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val x = \"\"\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + "text": "Reports anonymous classes which can be replaced with lambda expressions. Example: 'new Thread(new Runnable() {\n @Override\n public void run() {\n // run thread\n }\n });' After the quick-fix is applied: 'new Thread(() -> {\n // run thread\n });' Note that if an anonymous class is converted into a stateless lambda, the same lambda object can be reused by 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. Use the Report when interface is not annotated with @FunctionalInterface option to ignore the cases in which an anonymous class implements an interface without '@FunctionalInterface' annotation. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "markdown": "Reports anonymous classes which can be replaced with lambda expressions.\n\nExample:\n\n\n new Thread(new Runnable() {\n @Override\n public void run() {\n // run thread\n }\n });\n\nAfter the quick-fix is applied:\n\n\n new Thread(() -> {\n // run thread\n });\n\n\nNote that if an anonymous class is converted into a stateless lambda, the same lambda object\ncan be reused by 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\nUse the **Report when interface is not annotated with @FunctionalInterface** option to ignore the cases in which an anonymous\nclass implements an interface without `@FunctionalInterface` annotation.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "ProhibitTypeParametersForLocalVariablesMigration", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "Convert2Lambda", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -36990,28 +36884,28 @@ ] }, { - "id": "TestFunctionName", + "id": "SimplifiableIfStatement", "shortDescription": { - "text": "Test function naming convention" + "text": "'if' statement can be replaced with conditional or boolean expression" }, "fullDescription": { - "text": "Reports test function names that do not follow the recommended naming conventions.", - "markdown": "Reports test function names that do not follow the [recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods)." + "text": "Reports 'if' statements that can be replaced with conditions using the '&&', '||', '==', '!=', or '?:' operator. The result is usually shorter, but not always clearer, so it's not advised to apply the fix in every case. Example: 'if (condition) return true; else return foo;' After the quick-fix is applied: 'return condition || foo;' Configure the inspection: Use the Don't suggest '?:' operator option to disable the warning when the '?:' operator is suggested. In this case, only '&&', '||', '==', and '!=' suggestions will be highlighted. The quick-fix will still be available in the editor. Use the Ignore chained 'if' statements option to disable the warning for 'if-else' chains. The quick-fix will still be available in the editor. New in 2018.2", + "markdown": "Reports `if` statements that can be replaced with conditions using the `&&`, `||`, `==`, `!=`, or `?:` operator.\n\nThe result is usually shorter, but not always clearer, so it's not advised to apply the fix in every case.\n\nExample:\n\n\n if (condition) return true; else return foo;\n\nAfter the quick-fix is applied:\n\n\n return condition || foo;\n\nConfigure the inspection:\n\n* Use the **Don't suggest '?:' operator** option to disable the warning when the `?:` operator is suggested. In this case, only `&&`, `||`, `==`, and `!=` suggestions will be highlighted. The quick-fix will still be available in the editor.\n* Use the **Ignore chained 'if' statements** option to disable the warning for `if-else` chains. The quick-fix will still be available in the editor.\n\nNew in 2018.2" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "TestFunctionName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SimplifiableIfStatement", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -37023,19 +36917,19 @@ ] }, { - "id": "RecursivePropertyAccessor", + "id": "ThrowCaughtLocally", "shortDescription": { - "text": "Recursive property accessor" + "text": "'throw' caught by containing 'try' statement" }, "fullDescription": { - "text": "Reports recursive property accessor calls which can end up with a 'StackOverflowError'. Such calls are usually confused with backing field access. Example: 'var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }' After the quick-fix is applied: 'var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }'", - "markdown": "Reports recursive property accessor calls which can end up with a `StackOverflowError`.\nSuch calls are usually confused with backing field access.\n\n**Example:**\n\n\n var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }\n\nAfter the quick-fix is applied:\n\n\n var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }\n" + "text": "Reports 'throw' statements whose exceptions are always caught by containing 'try' statements. Using 'throw' statements as a \"goto\" to change the local flow of control is confusing and results in poor performance. Example: 'try {\n if (!Files.isDirectory(PROJECTS)) {\n throw new IllegalStateException(\"Directory not found.\"); // warning: 'throw' caught by containing 'try' statement\n }\n ...\n } catch (Exception e) {\n LOG.error(\"run failed\");\n }' Use the Ignore rethrown exceptions option to ignore exceptions that are rethrown.", + "markdown": "Reports `throw` statements whose exceptions are always caught by containing `try` statements.\n\nUsing `throw`\nstatements as a \"goto\" to change the local flow of control is confusing and results in poor performance.\n\n**Example:**\n\n\n try {\n if (!Files.isDirectory(PROJECTS)) {\n throw new IllegalStateException(\"Directory not found.\"); // warning: 'throw' caught by containing 'try' statement\n }\n ...\n } catch (Exception e) {\n LOG.error(\"run failed\");\n }\n\nUse the **Ignore rethrown exceptions** option to ignore exceptions that are rethrown." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RecursivePropertyAccessor", + "suppressToolId": "ThrowCaughtLocally", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37043,8 +36937,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -37056,19 +36950,19 @@ ] }, { - "id": "RedundantUnitExpression", + "id": "NonSerializableWithSerialVersionUIDField", "shortDescription": { - "text": "Redundant 'Unit'" + "text": "Non-serializable class with 'serialVersionUID'" }, "fullDescription": { - "text": "Reports redundant 'Unit' expressions. 'Unit' in Kotlin can be used as the return type of functions that do not return anything meaningful. The 'Unit' type has only one possible value, which is the 'Unit' object. Examples: 'fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }'", - "markdown": "Reports redundant `Unit` expressions.\n\n\n`Unit` in Kotlin can be used as the return type of functions that do not return anything meaningful.\nThe `Unit` type has only one possible value, which is the `Unit` object.\n\n**Examples:**\n\n\n fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }\n" + "text": "Reports non-'Serializable' classes that define a 'serialVersionUID' field. A 'serialVersionUID' field in that context normally indicates an error because the field will be ignored and the class will not be serialized. Example: 'public class IWantToSerializeThis {\n private static final long serialVersionUID = 2669293150219020249L;\n }'", + "markdown": "Reports non-`Serializable` classes that define a `serialVersionUID` field. A `serialVersionUID` field in that context normally indicates an error because the field will be ignored and the class will not be serialized.\n\n**Example:**\n\n\n public class IWantToSerializeThis {\n private static final long serialVersionUID = 2669293150219020249L;\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantUnitExpression", + "suppressToolId": "NonSerializableClassWithSerialVersionUID", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37076,8 +36970,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -37089,19 +36983,19 @@ ] }, { - "id": "PlatformExtensionReceiverOfInline", + "id": "SynchronizeOnValueBasedClass", "shortDescription": { - "text": "'inline fun' with nullable receiver until Kotlin 1.2" + "text": "Value-based warnings" }, "fullDescription": { - "text": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). It's recommended to add an explicit '!!' you want an exception to be thrown, or consider changing the function's receiver type to nullable if it should work without exceptions. Example: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }' After the quick-fix is applied: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", - "markdown": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nIt's recommended to add an explicit `!!` you want an exception to be thrown,\nor consider changing the function's receiver type to nullable if it should work without exceptions.\n\n**Example:**\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + "text": "Reports attempts to synchronize on an instance of a value-based class that produce compile-time warnings and raise run-time exceptions starting from Java 16. For example, 'java.lang.Double' is annotated with 'jdk.internal.ValueBased', so the following code will produce a compile-time warning: 'Double d = 20.0;\nsynchronized (d) { ... } // javac warning' New in 2021.1", + "markdown": "Reports attempts to synchronize on an instance of a value-based class that produce compile-time warnings and raise run-time exceptions starting from Java 16.\n\n\nFor example, `java.lang.Double` is annotated with `jdk.internal.ValueBased`, so the following code will\nproduce a compile-time warning:\n\n\n Double d = 20.0;\n synchronized (d) { ... } // javac warning\n\nNew in 2021.1" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "PlatformExtensionReceiverOfInline", + "suppressToolId": "synchronization", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37109,8 +37003,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Compiler issues", + "index": 162, "toolComponent": { "name": "QDJVM" } @@ -37122,28 +37016,28 @@ ] }, { - "id": "SuspiciousEqualsCombination", + "id": "SwitchStatementsWithoutDefault", "shortDescription": { - "text": "Suspicious combination of == and ===" + "text": "'switch' statement without 'default' branch" }, "fullDescription": { - "text": "Reports '==' and '===' comparisons that are both used on the same variable within a single expression. Due to similarities '==' and '===' could be mixed without notice, and it takes a close look to check that '==' used instead of '===' Example: 'if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return'", - "markdown": "Reports `==` and `===` comparisons that are both used on the same variable within a single expression.\n\nDue to similarities `==` and `===` could be mixed without notice, and\nit takes a close look to check that `==` used instead of `===`\n\nExample:\n\n\n if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return\n" + "text": "Reports 'switch' statements that do not contain 'default' labels. Adding the 'default' label guarantees that all possible scenarios are covered, and it becomes easier to make assumptions about the current state of the program. Note that by default, the inspection does not report 'switch' statements if all cases for enums or 'sealed' classes are covered. Use the Ignore exhaustive switch statements option if you want to change this behavior.", + "markdown": "Reports `switch` statements that do not contain `default` labels.\n\nAdding the `default` label guarantees that all possible scenarios are covered, and it becomes\neasier to make assumptions about the current state of the program.\n\n\nNote that by default, the inspection does not report `switch` statements if all cases for enums or `sealed` classes are covered.\nUse the **Ignore exhaustive switch statements** option if you want to change this behavior." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "note", "parameters": { - "suppressToolId": "SuspiciousEqualsCombination", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SwitchStatementWithoutDefaultBranch", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -37155,19 +37049,19 @@ ] }, { - "id": "UnusedDataClassCopyResult", + "id": "IncompatibleMask", "shortDescription": { - "text": "Unused result of data class copy" + "text": "Incompatible bitwise mask operation" }, "fullDescription": { - "text": "Reports calls to data class 'copy' function without using its result.", - "markdown": "Reports calls to data class `copy` function without using its result." + "text": "Reports bitwise mask expressions which are guaranteed to evaluate to 'true' or 'false'. The inspection checks the expressions of the form '(var & constant1) == constant2' or '(var | constant1) == constant2', where 'constant1' and 'constant2' are incompatible bitmask constants. Example: '// Incompatible mask: as the mask ends in 00,\n // the result could be 0x1200 but not 0x1234\n if ((mask & 0xFF00) == 0x1234) {...}'", + "markdown": "Reports bitwise mask expressions which are guaranteed to evaluate to `true` or `false`.\n\n\nThe inspection checks the expressions of the form `(var & constant1) == constant2` or\n`(var | constant1) == constant2`, where `constant1`\nand `constant2` are incompatible bitmask constants.\n\n**Example:**\n\n // Incompatible mask: as the mask ends in 00,\n // the result could be 0x1200 but not 0x1234\n if ((mask & 0xFF00) == 0x1234) {...}\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnusedDataClassCopyResult", + "suppressToolId": "IncompatibleBitwiseMaskOperation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37175,8 +37069,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Bitwise operation issues", + "index": 199, "toolComponent": { "name": "QDJVM" } @@ -37188,19 +37082,19 @@ ] }, { - "id": "RedundantElseInIf", + "id": "ExplicitArgumentCanBeLambda", "shortDescription": { - "text": "Redundant 'else' in 'if'" + "text": "Explicit argument can be lambda" }, "fullDescription": { - "text": "Reports redundant 'else' in 'if' with 'return' Example: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }' After the quick-fix is applied: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }'", - "markdown": "Reports redundant `else` in `if` with `return`\n\n**Example:**\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }\n" + "text": "Reports method calls that accept a non-trivial expression and can be replaced with an equivalent method call which accepts a lambda instead. Converting an expression to a lambda ensures that the expression won't be evaluated if it's not used inside the method. For example, 'optional.orElse(createDefaultValue())' can be converted to 'optional.orElseGet(this::createDefaultValue)'. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8. New in 2018.1", + "markdown": "Reports method calls that accept a non-trivial expression and can be replaced with an equivalent method call which accepts a lambda instead.\n\n\nConverting an expression to a lambda ensures that the expression won't be evaluated\nif it's not used inside the method. For example, `optional.orElse(createDefaultValue())` can be converted\nto `optional.orElseGet(this::createDefaultValue)`.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.\n\nNew in 2018.1" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "RedundantElseInIf", + "suppressToolId": "ExplicitArgumentCanBeLambda", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -37208,8 +37102,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -37221,19 +37115,19 @@ ] }, { - "id": "JavaIoSerializableObjectMustHaveReadResolve", + "id": "EqualsCalledOnEnumConstant", "shortDescription": { - "text": "Serializable object must implement 'readResolve'" + "text": "'equals()' called on enum value" }, "fullDescription": { - "text": "Reports 'object's ('data object' including) that implement 'java.io.Serializable' but don't implement readResolve Example: 'import java.io.Serializable\n\n object Foo : Serializable' The quick fix implements 'readResolve' method: 'import java.io.Serializable\n\n object Foo : Serializable {\n private fun readResolve() = Foo\n }'", - "markdown": "Reports `object`s (`data object` including) that implement `java.io.Serializable` but don't implement\n[readResolve](https://docs.oracle.com/en/java/javase/11/docs/specs/serialization/input.html#the-readresolve-method)\n\n**Example:**\n\n\n import java.io.Serializable\n\n object Foo : Serializable\n\nThe quick fix implements `readResolve` method:\n\n\n import java.io.Serializable\n\n object Foo : Serializable {\n private fun readResolve() = Foo\n }\n" + "text": "Reports 'equals()' calls on enum constants. Such calls can be replaced by an identity comparison ('==') because two enum constants are equal only when they have the same identity. A quick-fix is available to change the call to a comparison. Example: 'boolean foo(MyEnum value) {\n return value.equals(MyEnum.FOO);\n }' After the quick-fix is applied: 'boolean foo(MyEnum value) {\n return value == MyEnum.FOO;\n }'", + "markdown": "Reports `equals()` calls on enum constants.\n\nSuch calls can be replaced by an identity comparison (`==`) because two\nenum constants are equal only when they have the same identity.\n\nA quick-fix is available to change the call to a comparison.\n\n**Example:**\n\n\n boolean foo(MyEnum value) {\n return value.equals(MyEnum.FOO);\n }\n\nAfter the quick-fix is applied:\n\n\n boolean foo(MyEnum value) {\n return value == MyEnum.FOO;\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JavaIoSerializableObjectMustHaveReadResolve", + "suppressToolId": "EqualsCalledOnEnumConstant", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37241,8 +37135,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -37254,28 +37148,28 @@ ] }, { - "id": "ReplacePutWithAssignment", + "id": "HardcodedLineSeparators", "shortDescription": { - "text": "'map.put()' can be converted to assignment" + "text": "Hardcoded line separator" }, "fullDescription": { - "text": "Reports 'map.put' function calls that can be replaced with indexing operator ('[]'). Using syntactic sugar makes your code simpler. The quick-fix replaces 'put' call with the assignment. Example: 'fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }' After the quick-fix is applied: 'fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }'", - "markdown": "Reports `map.put` function calls that can be replaced with indexing operator (`[]`).\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces `put` call with the assignment.\n\n**Example:**\n\n\n fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }\n" + "text": "Reports linefeed ('\\n') and carriage return ('\\r') character escape sequences used in string literals, character literals or text blocks. These characters are commonly used as line separators, and portability may suffer if they are hardcoded. Example: 'String count = \"first\\nsecond\\rthird\";'", + "markdown": "Reports linefeed (`\\n`) and carriage return (`\\r`) character escape sequences used in string literals, character literals or text blocks. These characters are commonly used as line separators, and portability may suffer if they are hardcoded.\n\n**Example:**\n\n\n String count = \"first\\nsecond\\rthird\";\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplacePutWithAssignment", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "HardcodedLineSeparator", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -37287,28 +37181,28 @@ ] }, { - "id": "KotlinDoubleNegation", + "id": "UnnecessaryConstantArrayCreationExpression", "shortDescription": { - "text": "Redundant double negation" + "text": "Redundant 'new' expression in constant array creation" }, "fullDescription": { - "text": "Reports redundant double negations. Example: 'val truth = !!true'", - "markdown": "Reports redundant double negations.\n\n**Example:**\n\n val truth = !!true\n" + "text": "Reports constant new array expressions that can be replaced with an array initializer. Array initializers can omit the type because it is already specified in the left side of the assignment. Example: 'int[] foo = new int[] {42};' After the quick-fix is applied: 'int[] foo = {42};'", + "markdown": "Reports constant new array expressions that can be replaced with an array initializer. Array initializers can omit the type because it is already specified in the left side of the assignment.\n\n**Example:**\n\n\n int[] foo = new int[] {42};\n\nAfter the quick-fix is applied:\n\n\n int[] foo = {42};\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "DoubleNegation", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnnecessaryConstantArrayCreationExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -37320,28 +37214,28 @@ ] }, { - "id": "FunctionName", + "id": "LabeledStatement", "shortDescription": { - "text": "Function naming convention" + "text": "Labeled statement" }, "fullDescription": { - "text": "Reports function names that do not follow the recommended naming conventions. Example: 'fun Foo() {}' To fix the problem change the name of the function to match the recommended naming conventions.", - "markdown": "Reports function names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n fun Foo() {}\n\nTo fix the problem change the name of the function to match the recommended naming conventions." + "text": "Reports labeled statements that can complicate refactorings and control flow of the method. Example: 'label:\n while (true) {\n // code\n }'", + "markdown": "Reports labeled statements that can complicate refactorings and control flow of the method.\n\nExample:\n\n\n label:\n while (true) {\n // code\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "FunctionName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "LabeledStatement", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -37353,19 +37247,22 @@ ] }, { - "id": "DifferentKotlinMavenVersion", + "id": "SuspiciousNameCombination", "shortDescription": { - "text": "Maven and IDE plugins versions are different" + "text": "Suspicious variable/parameter name combination" }, "fullDescription": { - "text": "Reports that Maven plugin version isn't properly supported in the current IDE plugin. This inconsistency may lead to different error reporting behavior in the IDE and the compiler", - "markdown": "Reports that Maven plugin version isn't properly supported in the current IDE plugin.\n\nThis inconsistency may lead to different error reporting behavior in the IDE and the compiler" + "text": "Reports assignments and function calls in which the name of the target variable or the function parameter does not match the name of the value assigned to it. Example 1: 'int x = 0;\n int y = x; // x is used as a y-coordinate' Example 2: 'int x = 0, y = 0;\n // x is used as a y-coordinate and y as an x-coordinate\n Rectangle rc = new Rectangle(y, x, 20, 20);' Configure the inspection: Use the Group of names area to specify the names which should not be used together: an error is reported if the parameter name or assignment target name contains words from one group and the name of the assigned or passed variable contains words from a different group. Use the Ignore methods area to specify the methods that should not be checked but have a potentially suspicious name. For example, the 'Integer.compare()' parameters are named 'x' and 'y' but are unrelated to coordinates.", + "markdown": "Reports assignments and function calls in which the name of the target variable or the function parameter does not match the name of the value assigned to it.\n\nExample 1:\n\n\n int x = 0;\n int y = x; // x is used as a y-coordinate\n \nExample 2:\n\n\n int x = 0, y = 0;\n // x is used as a y-coordinate and y as an x-coordinate\n Rectangle rc = new Rectangle(y, x, 20, 20);\n\nConfigure the inspection:\n\nUse the **Group of names** area to specify the names which should not be used together: an error is reported\nif the parameter name or assignment target name contains words from one group and the name of the assigned or passed\nvariable contains words from a different group.\n\nUse the **Ignore methods** area to specify the methods that should not be checked but have a potentially suspicious name.\nFor example, the `Integer.compare()` parameters are named `x` and `y` but are unrelated to coordinates." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "DifferentKotlinMavenVersion", + "suppressToolId": "SuspiciousNameCombination", + "cweIds": [ + 628 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37373,8 +37270,8 @@ "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -37386,19 +37283,19 @@ ] }, { - "id": "RedundantUnitReturnType", + "id": "ImplicitDefaultCharsetUsage", "shortDescription": { - "text": "Redundant 'Unit' return type" + "text": "Implicit platform default charset" }, "fullDescription": { - "text": "Reports a redundant 'Unit' return type which can be omitted.", - "markdown": "Reports a redundant `Unit` return type which can be omitted." + "text": "Reports method and constructor calls that implicitly use the platform default charset. Such calls can produce different results on systems that use a different default charset and may result in unexpected behaviour. Example: 'void foo(byte[] bytes) {\n String s = new String(bytes);\n}'\n You can use a quick-fix that specifies the explicit UTF-8 charset if the corresponding overloaded method is available. After the quick-fix is applied: 'void foo(byte[] bytes) {\n String s = new String(bytes, StandardCharsets.UTF_8);\n}'", + "markdown": "Reports method and constructor calls that implicitly use the platform default charset. Such calls can produce different results on systems that use a different default charset and may result in unexpected behaviour.\n\n**Example:**\n\n void foo(byte[] bytes) {\n String s = new String(bytes);\n }\n\nYou can use a quick-fix that specifies the explicit UTF-8 charset if the corresponding overloaded method is available.\nAfter the quick-fix is applied:\n\n void foo(byte[] bytes) {\n String s = new String(bytes, StandardCharsets.UTF_8);\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantUnitReturnType", + "suppressToolId": "ImplicitDefaultCharsetUsage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37406,8 +37303,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -37419,28 +37316,31 @@ ] }, { - "id": "ReplaceRangeToWithUntil", + "id": "DesignForExtension", "shortDescription": { - "text": "'rangeTo' or the '..' call should be replaced with 'until'" + "text": "Design for extension" }, "fullDescription": { - "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with 'until'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }'", - "markdown": "Reports calls to `rangeTo` or the `..` operator instead of calls to `until`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces `rangeTo` or the `..` call with `until`.\n\n**Example:**\n\n\n fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }\n" + "text": "Reports methods which are not 'static', 'private', 'final' or 'abstract', and whose bodies are not empty. Coding in a style that avoids such methods protects the contracts of classes from being broken by their subclasses. The benefit of this style is that subclasses cannot corrupt the state of the superclass by forgetting to call the super method. The cost is that subclasses are limited in their flexibility, in particular they cannot prevent execution of code in the superclass. Use the quick-fix to add the missing modifiers. Example: 'class Foo {\n public boolean equals(Object o) { return true; }\n }' After the quick-fix is applied: 'class Foo {\n public final boolean equals(Object o) { return true; }\n }' This inspection is intended for code that is going to be used in secure environments, and is probably not appropriate for less restrictive environments.", + "markdown": "Reports methods which are not `static`, `private`, `final` or `abstract`, and whose bodies are not empty.\n\n\nCoding in a style that avoids such methods protects the contracts of classes from being broken by their subclasses. The\nbenefit of this style is that subclasses cannot corrupt the state of the superclass by forgetting to call the super method. The cost is\nthat\nsubclasses are limited in their flexibility, in particular they cannot prevent execution of code in the superclass. Use the quick-fix to\nadd\nthe missing modifiers.\n\n**Example:**\n\n\n class Foo {\n public boolean equals(Object o) { return true; }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n public final boolean equals(Object o) { return true; }\n }\n\nThis inspection is intended for code that is going to be used in secure environments, and is probably not appropriate for less restrictive environments." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceRangeToWithUntil", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "DesignForExtension", + "cweIds": [ + 668 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -37452,19 +37352,19 @@ ] }, { - "id": "UnusedEquals", + "id": "SimplifyStreamApiCallChains", "shortDescription": { - "text": "Unused equals expression" + "text": "Stream API call chain can be simplified" }, "fullDescription": { - "text": "Reports unused 'equals'('==') expressions.", - "markdown": "Reports unused `equals`(`==`) expressions." + "text": "Reports stream API call chains that can be simplified. Simplification will often avoid some temporary object creation during collection traversal. The inspection replaces the following call chains: 'collection.stream().forEach()' → 'collection.forEach()' 'collection.stream().collect(toList/toSet/toCollection())' → 'new CollectionType<>(collection)' 'collection.stream().toArray()' → 'collection.toArray()' 'Arrays.asList().stream()' → 'Arrays.stream()' or 'Stream.of()' 'IntStream.range(0, array.length).mapToObj(idx -> array[idx])' → 'Arrays.stream(array)' 'IntStream.range(0, list.size()).mapToObj(idx -> list.get(idx))' → 'list.stream()' 'Collections.singleton().stream()' → 'Stream.of()' 'Collections.emptyList().stream()' → 'Stream.empty()' 'stream.filter().findFirst().isPresent()' → 'stream.anyMatch()' 'stream.collect(counting())' → 'stream.count()' 'stream.collect(maxBy())' → 'stream.max()' 'stream.collect(mapping())' → 'stream.map().collect()' 'stream.collect(reducing())' → 'stream.reduce()' 'stream.collect(summingInt())' → 'stream.mapToInt().sum()' 'stream.mapToObj(x -> x)' → 'stream.boxed()' 'stream.map(x -> {...; return x;})' → 'stream.peek(x -> ...)' '!stream.anyMatch()' → 'stream.noneMatch()' '!stream.anyMatch(x -> !(...))' → 'stream.allMatch()' 'stream.map().anyMatch(Boolean::booleanValue)' → 'stream.anyMatch()' 'IntStream.range(expr1, expr2).mapToObj(x -> array[x])' → 'Arrays.stream(array, expr1, expr2)' 'Collection.nCopies(count, ...)' → 'Stream.generate().limit(count)' 'stream.sorted(comparator).findFirst()' → 'Stream.min(comparator)' 'optional.orElseGet(() -> { throw new ...; })' → 'optional.orElseThrow()' Note that the replacement semantics may have minor differences in some cases. For example, 'Collections.synchronizedList(...).stream().forEach()' is not synchronized while 'Collections.synchronizedList(...).forEach()' is synchronized. Also, 'collect(Collectors.maxBy())' returns an empty 'Optional' if the resulting element is 'null' while 'Stream.max()' throws 'NullPointerException' in this case. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports stream API call chains that can be simplified. Simplification will often avoid some temporary object creation during collection traversal.\n\n\nThe inspection replaces the following call chains:\n\n* `collection.stream().forEach()` → `collection.forEach()`\n* `collection.stream().collect(toList/toSet/toCollection())` → `new CollectionType<>(collection)`\n* `collection.stream().toArray()` → `collection.toArray()`\n* `Arrays.asList().stream()` → `Arrays.stream()` or `Stream.of()`\n* `IntStream.range(0, array.length).mapToObj(idx -> array[idx])` → `Arrays.stream(array)`\n* `IntStream.range(0, list.size()).mapToObj(idx -> list.get(idx))` → `list.stream()`\n* `Collections.singleton().stream()` → `Stream.of()`\n* `Collections.emptyList().stream()` → `Stream.empty()`\n* `stream.filter().findFirst().isPresent()` → `stream.anyMatch()`\n* `stream.collect(counting())` → `stream.count()`\n* `stream.collect(maxBy())` → `stream.max()`\n* `stream.collect(mapping())` → `stream.map().collect()`\n* `stream.collect(reducing())` → `stream.reduce()`\n* `stream.collect(summingInt())` → `stream.mapToInt().sum()`\n* `stream.mapToObj(x -> x)` → `stream.boxed()`\n* `stream.map(x -> {...; return x;})` → `stream.peek(x -> ...)`\n* `!stream.anyMatch()` → `stream.noneMatch()`\n* `!stream.anyMatch(x -> !(...))` → `stream.allMatch()`\n* `stream.map().anyMatch(Boolean::booleanValue)` → `stream.anyMatch()`\n* `IntStream.range(expr1, expr2).mapToObj(x -> array[x])` → `Arrays.stream(array, expr1, expr2)`\n* `Collection.nCopies(count, ...)` → `Stream.generate().limit(count)`\n* `stream.sorted(comparator).findFirst()` → `Stream.min(comparator)`\n* `optional.orElseGet(() -> { throw new ...; })` → `optional.orElseThrow()`\n\n\nNote that the replacement semantics may have minor differences in some cases. For example,\n`Collections.synchronizedList(...).stream().forEach()` is not synchronized while\n`Collections.synchronizedList(...).forEach()` is synchronized.\nAlso, `collect(Collectors.maxBy())` returns an empty `Optional` if the resulting element is\n`null` while `Stream.max()` throws `NullPointerException` in this case.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "UnusedEquals", + "suppressToolId": "SimplifyStreamApiCallChains", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37472,8 +37372,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -37485,19 +37385,19 @@ ] }, { - "id": "UnclearPrecedenceOfBinaryExpression", + "id": "UnknownGuard", "shortDescription": { - "text": "Multiple operators with different precedence" + "text": "Unknown '@GuardedBy' field" }, "fullDescription": { - "text": "Reports binary expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }", - "markdown": "Reports binary expressions that consist of different operators without parentheses.\n\nSuch expressions can be less readable due to different [precedence rules](https://kotlinlang.org/docs/reference/grammar.html#expressions) of operators.\n\nExample:\n\n```\n fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }\n```" + "text": "Reports '@GuardedBy' annotations in which the specified guarding field is unknown. Example: 'private Object state;\n\n @GuardedBy(\"lock\") //unknown guard reference\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 specified guarding field is unknown.\n\nExample:\n\n\n private Object state;\n\n @GuardedBy(\"lock\") //unknown guard reference\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": "UnclearPrecedenceOfBinaryExpression", + "suppressToolId": "UnknownGuard", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37505,8 +37405,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Concurrency annotation issues", + "index": 100, "toolComponent": { "name": "QDJVM" } @@ -37518,19 +37418,19 @@ ] }, { - "id": "UnusedLambdaExpressionBody", + "id": "AbstractClassExtendsConcreteClass", "shortDescription": { - "text": "Unused return value of a function with lambda expression body" + "text": "Abstract class extends concrete class" }, "fullDescription": { - "text": "Reports calls with an unused return value when the called function returns a lambda from an expression body. If there is '=' between function header and body block, code from the function will not be evaluated which can lead to incorrect behavior. Remove = token from function declaration can be used to amend the code automatically. Example: 'fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }' After the quick-fix is applied: 'fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }'", - "markdown": "Reports calls with an unused return value when the called function returns a lambda from an expression body.\n\n\nIf there is `=` between function header and body block,\ncode from the function will not be evaluated which can lead to incorrect behavior.\n\n**Remove = token from function declaration** can be used to amend the code automatically.\n\nExample:\n\n\n fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }\n\nAfter the quick-fix is applied:\n\n\n fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }\n" + "text": "Reports 'abstract' classes that extend concrete classes.", + "markdown": "Reports `abstract` classes that extend concrete classes." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnusedLambdaExpressionBody", + "suppressToolId": "AbstractClassExtendsConcreteClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37538,8 +37438,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -37551,28 +37451,28 @@ ] }, { - "id": "ConvertLambdaToReference", + "id": "Java8CollectionRemoveIf", "shortDescription": { - "text": "Can be replaced with function reference" + "text": "Loop can be replaced with 'Collection.removeIf()'" }, "fullDescription": { - "text": "Reports function literal expressions that can be replaced with function references. Replacing lambdas with function references often makes code look more concise and understandable. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }'", - "markdown": "Reports function literal expressions that can be replaced with function references.\n\nReplacing lambdas with function references often makes code look more concise and understandable.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n" + "text": "Reports loops which can be collapsed into a single 'Collection.removeIf()' call. Example: 'for (Iterator it = collection.iterator(); it.hasNext(); ) {\n String aValue = it.next();\n if(shouldBeRemoved(aValue)) {\n it.remove();\n }\n }' After the quick-fix is applied: 'collection.removeIf(aValue -> shouldBeRemoved(aValue));' This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.", + "markdown": "Reports loops which can be collapsed into a single `Collection.removeIf()` call.\n\nExample:\n\n\n for (Iterator it = collection.iterator(); it.hasNext(); ) {\n String aValue = it.next();\n if(shouldBeRemoved(aValue)) {\n it.remove();\n }\n }\n\nAfter the quick-fix is applied:\n\n\n collection.removeIf(aValue -> shouldBeRemoved(aValue));\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ConvertLambdaToReference", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "Java8CollectionRemoveIf", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -37584,28 +37484,28 @@ ] }, { - "id": "RedundantSetter", + "id": "LogStatementNotGuardedByLogCondition", "shortDescription": { - "text": "Redundant property setter" + "text": "Logging call not guarded by log condition" }, "fullDescription": { - "text": "Reports redundant property setters. Setter is considered to be redundant in one of the following cases: Setter has no body. Accessor visibility isn't changed, declaration isn't 'external' and has no annotations. 'var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated' Setter body is a block with a single statement assigning the parameter to the backing field. 'var prop: Int = 0\n set(value) { // redundant\n field = value\n }'", - "markdown": "Reports redundant property setters.\n\n\nSetter is considered to be redundant in one of the following cases:\n\n1. Setter has no body. Accessor visibility isn't changed, declaration isn't `external` and has no annotations.\n\n\n var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated\n \n2. Setter body is a block with a single statement assigning the parameter to the backing field.\n\n\n var prop: Int = 0\n set(value) { // redundant\n field = value\n }\n \n" + "text": "Reports logging calls that are not surrounded by a guard condition. The evaluation of a call's arguments 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 TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }' After a quick-fix is applied: 'public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }' This inspection supports Log4j2 and the SLF4J logging frameworks (except builders). New in 2024.2", + "markdown": "Reports logging calls that are not surrounded by a guard condition. The evaluation of a call's arguments 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 TestObject {\n void test(Object object) {\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n\nAfter a quick-fix is applied:\n\n\n public class TestObject {\n void test(Object object) {\n if(LOG.isDebugEnabled()){\n LOG.debug(\"some logging \" + expensiveCalculation(1));\n }\n }\n }\n\nThis inspection supports *Log4j2* and the *SLF4J* logging frameworks (except builders).\n\nNew in 2024.2" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "RedundantSetter", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "LogStatementNotGuardedByLogCondition", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "JVM languages/Logging", + "index": 52, "toolComponent": { "name": "QDJVM" } @@ -37617,28 +37517,64 @@ ] }, { - "id": "CanSealedSubClassBeObject", + "id": "SafeVarargsDetector", "shortDescription": { - "text": "Sealed subclass without state and overridden equals" + "text": "Possible heap pollution from parameterized vararg type" }, "fullDescription": { - "text": "Reports direct inheritors of 'sealed' classes that have no state and overridden 'equals()' method. It's highly recommended to override 'equals()' to provide comparison stability, or convert the 'class' to an 'object' to reach the same effect. Example: 'sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }' The quick-fix converts a 'class' into an 'object': 'sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }'", - "markdown": "Reports direct inheritors of `sealed` classes that have no state and overridden `equals()` method.\n\nIt's highly recommended to override `equals()` to provide comparison stability, or convert the `class` to an `object` to reach the same effect.\n\n**Example:**\n\n\n sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n\nThe quick-fix converts a `class` into an `object`:\n\n\n sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n" + "text": "Reports methods with variable arity, which can be annotated as '@SafeVarargs'. The '@SafeVarargs' annotation suppresses unchecked warnings about parameterized array creation at call sites. Example: 'public class Foo {\n private List list = new ArrayList<>();\n\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }' After the quick-fix is applied: 'public class Foo {\n private List list = new ArrayList<>();\n\n @SafeVarargs\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }' This annotation is not supported under Java 1.6 or earlier JVMs.", + "markdown": "Reports methods with variable arity, which can be annotated as `@SafeVarargs`. The `@SafeVarargs` annotation suppresses unchecked warnings about parameterized array creation at call sites.\n\n**Example:**\n\n\n public class Foo {\n private List list = new ArrayList<>();\n\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Foo {\n private List list = new ArrayList<>();\n\n @SafeVarargs\n public final void safeVarargs(T... elements) {\n Collections.addAll(list, elements);\n }\n }\n\n\nThis annotation is not supported under Java 1.6 or earlier JVMs." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "unchecked", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Java/Java language level migration aids/Java 7", + "index": 161, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ComparatorMethodParameterNotUsed", + "shortDescription": { + "text": "Suspicious 'Comparator.compare()' implementation" + }, + "fullDescription": { + "text": "Reports problems in 'Comparator.compare()' and 'Comparable.compareTo()' implementations. The following cases are reported: A parameter is not used. Most likely this is a typo and the other parameter is compared with itself, or the method is not implemented correctly. It's evident that the method does not return '0' for the same elements. Such a comparison method violates the contract and can produce unpredictable results when equal elements are encountered. In particular, sorting may fail with an exception on some data. The comparison method never returns positive or negative value. To fulfill the contract, if the comparison method returns positive values, it should also return negative ones if arguments are supplied in reversed order. The comparison method returns 'Integer.MIN_VALUE'. While allowed by the contract, it may be error-prone, as some call sites may incorrectly try to invert the return value of the comparison method using the unary minus operator. The negated value of 'Integer.MIN_VALUE' is 'Integer.MIN_VALUE'. Example: 'Comparator lambda =\n (a, b) -> a.length() > b.length()\n ? 0\n : Math.random() > 0.5 ? -1 : 1;'", + "markdown": "Reports problems in `Comparator.compare()` and `Comparable.compareTo()` implementations.\n\nThe following cases are reported:\n\n* A parameter is not used. Most likely this is a typo and the other parameter is compared with itself, or the method is not implemented correctly.\n* It's evident that the method does not return `0` for the same elements. Such a comparison method violates the contract and can produce unpredictable results when equal elements are encountered. In particular, sorting may fail with an exception on some data.\n* The comparison method never returns positive or negative value. To fulfill the contract, if the comparison method returns positive values, it should also return negative ones if arguments are supplied in reversed order.\n* The comparison method returns `Integer.MIN_VALUE`. While allowed by the contract, it may be error-prone, as some call sites may incorrectly try to invert the return value of the comparison method using the unary minus operator. The negated value of `Integer.MIN_VALUE` is `Integer.MIN_VALUE`.\n\n**Example:**\n\n\n Comparator lambda =\n (a, b) -> a.length() > b.length()\n ? 0\n : Math.random() > 0.5 ? -1 : 1;\n" }, "defaultConfiguration": { "enabled": true, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "CanSealedSubClassBeObject", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ComparatorMethodParameterNotUsed", + "cweIds": [ + 628 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -37650,28 +37586,28 @@ ] }, { - "id": "PropertyName", + "id": "Annotation", "shortDescription": { - "text": "Property naming convention" + "text": "Annotation" }, "fullDescription": { - "text": "Reports property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, property names should start with a lowercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val My_Cool_Property = \"\"' The quick-fix renames the class according to the Kotlin naming conventions: 'val myCoolProperty = \"\"'", - "markdown": "Reports property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nproperty names should start with a lowercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val My_Cool_Property = \"\"\n\nThe quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val myCoolProperty = \"\"\n" + "text": "Reports annotations. Annotations are not supported in Java 1.4 and earlier JVM.", + "markdown": "Reports annotations. Annotations are not supported in Java 1.4 and earlier JVM." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "PropertyName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "Annotation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Java language level issues", + "index": 147, "toolComponent": { "name": "QDJVM" } @@ -37683,19 +37619,19 @@ ] }, { - "id": "InlineClassDeprecatedMigration", + "id": "StringTokenizer", "shortDescription": { - "text": "Inline classes are deprecated since 1.5" + "text": "Use of 'StringTokenizer'" }, "fullDescription": { - "text": "Reports inline classes that are deprecated and cause compilation warnings in Kotlin 1.5 and later. See What's new in Kotlin 1.5.0 Example: 'inline class Password(val s: String)' After the quick-fix is applied: '@JvmInline\n value class Password(val s: String)' Inspection is available for Kotlin language level starting from 1.5.", - "markdown": "Reports inline classes that are deprecated and cause compilation warnings in Kotlin 1.5 and later.\nSee [What's new in Kotlin 1.5.0](https://kotlinlang.org/docs/whatsnew15.html#inline-classes)\n\nExample:\n\n\n inline class Password(val s: String)\n\nAfter the quick-fix is applied:\n\n\n @JvmInline\n value class Password(val s: String)\n\nInspection is available for Kotlin language level starting from 1.5." + "text": "Reports usages of the 'StringTokenizer' class. Excessive use of 'StringTokenizer' is incorrect in an internationalized environment.", + "markdown": "Reports usages of the `StringTokenizer` class. Excessive use of `StringTokenizer` is incorrect in an internationalized environment." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InlineClassDeprecatedMigration", + "suppressToolId": "UseOfStringTokenizer", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37703,8 +37639,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -37716,19 +37652,19 @@ ] }, { - "id": "KotlinMavenPluginPhase", + "id": "UnnecessaryUnicodeEscape", "shortDescription": { - "text": "Kotlin Maven Plugin misconfigured" + "text": "Unnecessary unicode escape sequence" }, "fullDescription": { - "text": "Reports kotlin-maven-plugin configuration issues", - "markdown": "Reports kotlin-maven-plugin configuration issues" + "text": "Reports unnecessary unicode escape sequences. For example, when the file encoding can handle the character without escaping it. Unicode control characters are not reported by this inspection (except for a line feed and a tab). Example: 'String s = \"\\u0062\";'", + "markdown": "Reports unnecessary unicode escape sequences. For example, when the file encoding can handle the character without escaping it. Unicode control characters are not reported by this inspection (except for a line feed and a tab).\n\n**Example:**\n\n String s = \"\\u0062\";\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KotlinMavenPluginPhase", + "suppressToolId": "UnnecessaryUnicodeEscape", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -37736,8 +37672,8 @@ "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -37749,28 +37685,28 @@ ] }, { - "id": "ConvertToStringTemplate", + "id": "PrimitiveArrayArgumentToVariableArgMethod", "shortDescription": { - "text": "String concatenation that can be converted to string template" + "text": "Confusing primitive array argument to varargs method" }, "fullDescription": { - "text": "Reports string concatenation that can be converted to a string template. Using string templates is recommended as it makes code easier to read. Example: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }' After the quick-fix is applied: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }'", - "markdown": "Reports string concatenation that can be converted to a string template.\n\nUsing string templates is recommended as it makes code easier to read.\n\n**Example:**\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }\n" + "text": "Reports any calls to a variable arity method where the call has a primitive array in the variable arity parameter position (for example, 'System.out.printf(\"%s\", new int[]{1, 2, 3})'). Such a primitive-array argument may be confusing, as it will be wrapped as a single-element array, rather than each individual element being boxed, as might be expected. Example: 'String.format(\"%s\", new int[]{1, 2, 3});' After the quick-fix is applied: 'String.format(\"%s\", (Object) new int[]{1, 2, 3});' This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.", + "markdown": "Reports any calls to a variable arity method where the call has a primitive array in the variable arity parameter position (for example, `System.out.printf(\"%s\", new int[]{1, 2, 3})`). Such a primitive-array argument may be confusing, as it will be wrapped as a single-element array, rather than each individual element being boxed, as might be expected.\n\n**Example:**\n\n\n String.format(\"%s\", new int[]{1, 2, 3});\n\nAfter the quick-fix is applied:\n\n\n String.format(\"%s\", (Object) new int[]{1, 2, 3});\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ConvertToStringTemplate", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "PrimitiveArrayArgumentToVarargsMethod", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -37782,28 +37718,28 @@ ] }, { - "id": "SimplifiableCall", + "id": "UseBulkOperation", "shortDescription": { - "text": "Library function call could be simplified" + "text": "Bulk operation can be used instead of iteration" }, "fullDescription": { - "text": "Reports library function calls which could be replaced by simplified one. Using corresponding functions makes your code simpler. The quick-fix replaces the function calls with another one. Example: 'fun test(list: List) {\n list.filter { it is String }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.filterIsInstance()\n }'", - "markdown": "Reports library function calls which could be replaced by simplified one.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the function calls with another one.\n\n**Example:**\n\n\n fun test(list: List) {\n list.filter { it is String }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.filterIsInstance()\n }\n" + "text": "Reports single operations inside loops that could be replaced with a bulk method. Not only are bulk methods shorter, but in some cases they may be more performant as well. Example: 'void test(Collection numbers) {\n List result = new ArrayList<>();\n for (Integer i : numbers) {\n result.add(i);\n }\n }' After the fix is applied: 'void test(Collection numbers) {\n List result = new ArrayList<>();\n result.addAll(numbers);\n }' The Use Arrays.asList() to wrap arrays option allows to report arrays, even if the bulk method requires a collection. In this case the quick-fix will automatically wrap the array in 'Arrays.asList()' call. New in 2017.1", + "markdown": "Reports single operations inside loops that could be replaced with a bulk method.\n\n\nNot only are bulk methods shorter, but in some cases they may be more performant as well.\n\n**Example:**\n\n void test(Collection numbers) {\n List result = new ArrayList<>();\n for (Integer i : numbers) {\n result.add(i);\n }\n }\n\nAfter the fix is applied:\n\n\n void test(Collection numbers) {\n List result = new ArrayList<>();\n result.addAll(numbers);\n }\n\n\nThe **Use Arrays.asList() to wrap arrays** option allows to report arrays, even if the bulk method requires a collection.\nIn this case the quick-fix will automatically wrap the array in `Arrays.asList()` call.\n\nNew in 2017.1" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "SimplifiableCall", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UseBulkOperation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -37815,28 +37751,28 @@ ] }, { - "id": "ObjectLiteralToLambda", + "id": "BigDecimalEquals", "shortDescription": { - "text": "Object literal can be converted to lambda" + "text": "'equals()' called on 'BigDecimal'" }, "fullDescription": { - "text": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression. Example: 'class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n}' After the quick-fix is applied: 'fun foo() {\n threadPool.submit { println(\"hello\") }\n }'", - "markdown": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.\n\n**Example:**\n\n\n class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n threadPool.submit { println(\"hello\") }\n }\n" + "text": "Reports 'equals()' calls that compare two 'java.math.BigDecimal' numbers. This is normally a mistake, as two 'java.math.BigDecimal' numbers are only equal if they are equal in both value and scale. Example: 'if (new BigDecimal(\"2.0\").equals(\n new BigDecimal(\"2.00\"))) {} // false' After the quick-fix is applied: 'if (new BigDecimal(\"2.0\").compareTo(\n new BigDecimal(\"2.00\")) == 0) {} // true'", + "markdown": "Reports `equals()` calls that compare two `java.math.BigDecimal` numbers. This is normally a mistake, as two `java.math.BigDecimal` numbers are only equal if they are equal in both value and scale.\n\n**Example:**\n\n\n if (new BigDecimal(\"2.0\").equals(\n new BigDecimal(\"2.00\"))) {} // false\n\nAfter the quick-fix is applied:\n\n\n if (new BigDecimal(\"2.0\").compareTo(\n new BigDecimal(\"2.00\")) == 0) {} // true\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ObjectLiteralToLambda", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "BigDecimalEquals", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -37848,28 +37784,28 @@ ] }, { - "id": "RedundantLambdaOrAnonymousFunction", + "id": "AccessToNonThreadSafeStaticFieldFromInstance", "shortDescription": { - "text": "Redundant creation of lambda or anonymous function" + "text": "Non-thread-safe 'static' field access" }, "fullDescription": { - "text": "Reports lambdas or anonymous functions that are created and used immediately. 'fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }'", - "markdown": "Reports lambdas or anonymous functions that are created and used immediately.\n\n\n fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }\n" + "text": "Reports access to 'static' fields that are of a non-thread-safe type. When a 'static' field is accessed from an instance method or a non-synchronized block, multiple threads can access that field. This can lead to unspecified side effects, like exceptions and incorrect results. Example: 'class Sample {\n private static final SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");\n String method() {\n return df.format(\"\");\n }\n }' You can specify which types should be considered not thread-safe. Only fields with these exact types or initialized with these exact types are reported, because there may exist thread-safe subclasses of these types.", + "markdown": "Reports access to `static` fields that are of a non-thread-safe type.\n\n\nWhen a `static` field is accessed from an instance method or a non-synchronized block,\nmultiple threads can access that field.\nThis can lead to unspecified side effects, like exceptions and incorrect results.\n\n**Example:**\n\n\n class Sample {\n private static final SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");\n String method() {\n return df.format(\"\");\n }\n }\n\n\nYou can specify which types should be considered not thread-safe.\nOnly fields with these exact types or initialized with these exact types are reported,\nbecause there may exist thread-safe subclasses of these types." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantLambdaOrAnonymousFunction", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AccessToNonThreadSafeStaticField", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -37881,28 +37817,28 @@ ] }, { - "id": "ConvertObjectToDataObject", + "id": "AssignmentToCatchBlockParameter", "shortDescription": { - "text": "Convert 'object' to 'data object'" + "text": "Assignment to 'catch' block parameter" }, "fullDescription": { - "text": "Reports 'object' that can be converted to 'data object' 'data object' auto-generates 'toString', 'equals' and 'hashCode' The inspection suggests to convert 'object' to 'data object' in 2 cases: When custom 'toString' returns name of the class When 'object' inherits sealed 'class'/'interface' Example: 'object Foo {\n override fun toString(): String = \"Foo\"\n }' After the quick-fix is applied: 'data object Foo' This inspection only reports if the Kotlin language level of the project or module is 1.9 or higher", - "markdown": "Reports `object` that can be converted to `data object`\n\n`data object` auto-generates `toString`, `equals` and `hashCode`\n\nThe inspection suggests to convert `object` to `data object` in 2 cases:\n\n* When custom `toString` returns name of the class\n* When `object` inherits sealed `class`/`interface`\n\n**Example:**\n\n\n object Foo {\n override fun toString(): String = \"Foo\"\n }\n\nAfter the quick-fix is applied:\n\n\n data object Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.9 or higher" + "text": "Reports assignments to, 'catch' block parameters. Changing a 'catch' block parameter is very confusing and should be discouraged. The quick-fix adds a declaration of a new variable. Example: 'void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n if (ex instanceof UncheckedIOException) {\n // Warning: catch block parameter reassigned\n ex = ((UncheckedIOException) ex).getCause();\n }\n throw ex;\n }\n }' After the quick-fix is applied: 'void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n Exception unwrapped = ex;\n if (unwrapped instanceof UncheckedIOException) {\n unwrapped = ((UncheckedIOException)\n unwrapped).getCause();\n }\n throw unwrapped;\n }\n }'", + "markdown": "Reports assignments to, `catch` block parameters.\n\nChanging a `catch` block parameter is very confusing and should be discouraged.\n\nThe quick-fix adds a declaration of a new variable.\n\n**Example:**\n\n\n void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n if (ex instanceof UncheckedIOException) {\n // Warning: catch block parameter reassigned\n ex = ((UncheckedIOException) ex).getCause();\n }\n throw ex;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void processFile(String fileName) throws Exception {\n try {\n doProcessFile(fileName);\n } catch(Exception ex) {\n Exception unwrapped = ex;\n if (unwrapped instanceof UncheckedIOException) {\n unwrapped = ((UncheckedIOException)\n unwrapped).getCause();\n }\n throw unwrapped;\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "ConvertObjectToDataObject", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AssignmentToCatchBlockParameter", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -37914,28 +37850,28 @@ ] }, { - "id": "BooleanLiteralArgument", + "id": "AbstractMethodOverridesAbstractMethod", "shortDescription": { - "text": "Boolean literal argument without parameter name" + "text": "Abstract method overrides abstract method" }, "fullDescription": { - "text": "Reports call arguments with 'Boolean' type without explicit parameter names specified. When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding. Example: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }' The quick-fix adds missing parameter names: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }'", - "markdown": "Reports call arguments with `Boolean` type without explicit parameter names specified.\n\n\nWhen multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes.\nExplicit parameter names allow for easier code reading and understanding.\n\n**Example:**\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }\n\nThe quick-fix adds missing parameter names:\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }\n" + "text": "Reports 'abstract' methods that override 'abstract' methods. Such methods don't make sense because any concrete child class will have to implement the abstract method anyway. Methods whose return types, exception declarations, annotations, or modifiers differ from the overridden method are not reported by this inspection. Configure the inspection: Use the Ignore methods with different Javadoc than their super methods option to ignore any abstract methods whose JavaDoc comment differs from their super method.", + "markdown": "Reports `abstract` methods that override `abstract` methods.\n\nSuch methods don't make sense because any concrete child class will have to implement the abstract method anyway.\n\n\nMethods whose return types, exception declarations, annotations, or modifiers differ from the overridden method are not reported by this inspection.\n\n\nConfigure the inspection:\n\n* Use the **Ignore methods with different Javadoc than their super methods** option to ignore any abstract methods whose JavaDoc comment differs from their super method." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "BooleanLiteralArgument", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AbstractMethodOverridesAbstractMethod", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -37947,28 +37883,28 @@ ] }, { - "id": "ConvertArgumentToSet", + "id": "LoopStatementsThatDontLoop", "shortDescription": { - "text": "Argument could be converted to 'Set' to improve performance" + "text": "Loop statement that does not loop" }, "fullDescription": { - "text": "Detects the function calls that could work faster with an argument converted to 'Set'. Operations like 'minus' or 'intersect' are more effective when their argument is a set. An explicit conversion of an 'Iterable' or an 'Array' into a 'Set' can often make code more effective. The quick-fix adds an explicit conversion to the function call. Example: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size' After the quick-fix is applied: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size'", - "markdown": "Detects the function calls that could work faster with an argument converted to `Set`.\n\n\nOperations like 'minus' or 'intersect' are more effective when their argument is a set.\nAn explicit conversion of an `Iterable` or an `Array`\ninto a `Set` can often make code more effective.\n\n\nThe quick-fix adds an explicit conversion to the function call.\n\n**Example:**\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size\n\nAfter the quick-fix is applied:\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size\n" + "text": "Reports any instance of 'for', 'while', and 'do' statements whose bodies will be executed once at most. Normally, this is an indication of a bug. Use the Ignore enhanced for loops option to ignore the foreach loops. They are sometimes used to perform an action only on the first item of an iterable in a compact way. Example: 'for (String s : stringIterable) {\n doSomethingOnFirstString(s);\n break;\n }'", + "markdown": "Reports any instance of `for`, `while`, and `do` statements whose bodies will be executed once at most. Normally, this is an indication of a bug.\n\n\nUse the **Ignore enhanced for loops** option to ignore the foreach loops.\nThey are sometimes used to perform an action only on the first item of an iterable in a compact way.\n\nExample:\n\n\n for (String s : stringIterable) {\n doSomethingOnFirstString(s);\n break;\n }\n" }, "defaultConfiguration": { "enabled": true, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ConvertArgumentToSet", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "LoopStatementThatDoesntLoop", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -37980,19 +37916,19 @@ ] }, { - "id": "ReplaceGuardClauseWithFunctionCall", + "id": "ArrayCreationWithoutNewKeyword", "shortDescription": { - "text": "Guard clause can be replaced with Kotlin's function call" + "text": "Array creation without 'new' expression" }, "fullDescription": { - "text": "Reports guard clauses that can be replaced with a function call. Example: 'fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }' After the quick-fix is applied: 'fun test(foo: Int?) {\n checkNotNull(foo)\n }'", - "markdown": "Reports guard clauses that can be replaced with a function call.\n\n**Example:**\n\n fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }\n\nAfter the quick-fix is applied:\n\n fun test(foo: Int?) {\n checkNotNull(foo)\n }\n" + "text": "Reports array initializers without 'new' array expressions and suggests adding them. Example: 'int[] a = {42}' After the quick-fix is applied: 'int[] a = new int[]{42}'", + "markdown": "Reports array initializers without `new` array expressions and suggests adding them.\n\nExample:\n\n\n int[] a = {42}\n\nAfter the quick-fix is applied:\n\n\n int[] a = new int[]{42}\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceGuardClauseWithFunctionCall", + "suppressToolId": "ArrayCreationWithoutNewKeyword", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -38000,8 +37936,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -38013,28 +37949,28 @@ ] }, { - "id": "ReplaceToStringWithStringTemplate", + "id": "ConfusingOctalEscape", "shortDescription": { - "text": "Call of 'toString' could be replaced with string template" + "text": "Confusing octal escape sequence" }, "fullDescription": { - "text": "Reports 'toString' function calls that can be replaced with a string template. Using string templates makes your code simpler. The quick-fix replaces 'toString' with a string template. Example: 'fun test(): String {\n val x = 1\n return x.toString()\n }' After the quick-fix is applied: 'fun test(): String {\n val x = 1\n return \"$x\"\n }'", - "markdown": "Reports `toString` function calls that can be replaced with a string template.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces `toString` with a string template.\n\n**Example:**\n\n\n fun test(): String {\n val x = 1\n return x.toString()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): String {\n val x = 1\n return \"$x\"\n }\n" + "text": "Reports string literals containing an octal escape sequence immediately followed by a digit. Such strings may be confusing, and are often the result of errors in escape code creation. Example: 'System.out.println(\"\\1234\"); // Octal escape sequence '\\123' immediately followed by a digit'", + "markdown": "Reports string literals containing an octal escape sequence immediately followed by a digit.\n\nSuch strings may be confusing, and are often the result of errors in escape code creation.\n\n**Example:**\n\n\n System.out.println(\"\\1234\"); // Octal escape sequence '\\123' immediately followed by a digit\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceToStringWithStringTemplate", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ConfusingOctalEscapeSequence", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -38046,28 +37982,28 @@ ] }, { - "id": "ProtectedInFinal", + "id": "LambdaParameterHidingMemberVariable", "shortDescription": { - "text": "'protected' visibility is effectively 'private' in a final class" + "text": "Lambda parameter hides field" }, "fullDescription": { - "text": "Reports 'protected' visibility used inside of a 'final' class. In such cases 'protected' members are accessible only in the class itself, so they are effectively 'private'. Example: 'class FinalClass {\n protected fun foo() {}\n }' After the quick-fix is applied: 'class FinalClass {\n private fun foo() {}\n }'", - "markdown": "Reports `protected` visibility used inside of a `final` class. In such cases `protected` members are accessible only in the class itself, so they are effectively `private`.\n\n**Example:**\n\n\n class FinalClass {\n protected fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class FinalClass {\n private fun foo() {}\n }\n" + "text": "Reports lambda parameters named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the lambda parameter when using the identically named field is intended. A quick-fix is suggested to rename the lambda parameter. Example: 'public class MyClass {\n public Object foo;\n\n void sort(List list) {\n list.sort((foo, bar) -> foo - bar);\n }\n }' Use the option to choose whether to ignore fields that are not visible from the lambda expression. For example, private fields of a superclass. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "markdown": "Reports lambda parameters named identically to a field of a surrounding class. As a result of such naming, you may accidentally use the lambda parameter when using the identically named field is intended.\n\nA quick-fix is suggested to rename the lambda parameter.\n\n**Example:**\n\n\n public class MyClass {\n public Object foo;\n\n void sort(List list) {\n list.sort((foo, bar) -> foo - bar);\n }\n }\n\n\nUse the option to choose whether to ignore fields that are not visible from the lambda expression.\nFor example, private fields of a superclass.\n\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ProtectedInFinal", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "LambdaParameterHidesMemberVariable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -38079,28 +38015,28 @@ ] }, { - "id": "ReplaceRangeStartEndInclusiveWithFirstLast", + "id": "ConstantMathCall", "shortDescription": { - "text": "Boxed properties should be replaced with unboxed" + "text": "Constant call to 'Math'" }, "fullDescription": { - "text": "Reports boxed 'Range.start' and 'Range.endInclusive' properties. These properties can be replaced with unboxed 'first' and 'last' properties to avoid redundant calls. The quick-fix replaces 'start' and 'endInclusive' properties with the corresponding 'first' and 'last'. Example: 'fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }' After the quick-fix is applied: 'fun foo(range: CharRange) {\n val lastElement = range.last\n }'", - "markdown": "Reports **boxed** `Range.start` and `Range.endInclusive` properties.\n\nThese properties can be replaced with **unboxed** `first` and `last` properties to avoid redundant calls.\n\nThe quick-fix replaces `start` and `endInclusive` properties with the corresponding `first` and `last`.\n\n**Example:**\n\n\n fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(range: CharRange) {\n val lastElement = range.last\n }\n" + "text": "Reports calls to 'java.lang.Math' or 'java.lang.StrictMath' methods that can be replaced with simple compile-time constants. Example: 'double v = Math.sin(0.0);' After the quick-fix is applied: 'double v = 0.0;'", + "markdown": "Reports calls to `java.lang.Math` or `java.lang.StrictMath` methods that can be replaced with simple compile-time constants.\n\n**Example:**\n\n double v = Math.sin(0.0);\n\nAfter the quick-fix is applied:\n\n double v = 0.0;\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceRangeStartEndInclusiveWithFirstLast", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConstantMathCall", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -38112,28 +38048,28 @@ ] }, { - "id": "ReplaceSizeCheckWithIsNotEmpty", + "id": "MissortedModifiers", "shortDescription": { - "text": "Size check can be replaced with 'isNotEmpty()'" + "text": "Missorted modifiers" }, "fullDescription": { - "text": "Reports size checks of 'Collections/Array/String' that should be replaced with 'isNotEmpty()'. Using 'isNotEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isNotEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }'", - "markdown": "Reports size checks of `Collections/Array/String` that should be replaced with `isNotEmpty()`.\n\nUsing `isNotEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isNotEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }\n" + "text": "Reports declarations whose modifiers are not in the canonical preferred order (as stated in the Java Language Specification). Example: 'class Foo {\n native public final void foo();\n }' After the quick-fix is applied: 'class Foo {\n public final native void foo();\n }'", + "markdown": "Reports declarations whose modifiers are not in the canonical preferred order (as stated in the Java Language Specification).\n\n**Example:**\n\n\n class Foo {\n native public final void foo();\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n public final native void foo();\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceSizeCheckWithIsNotEmpty", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "MissortedModifiers", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -38145,19 +38081,19 @@ ] }, { - "id": "RedundantSemicolon", + "id": "TransientFieldInNonSerializableClass", "shortDescription": { - "text": "Redundant semicolon" + "text": "Transient field in non-serializable class" }, "fullDescription": { - "text": "Reports redundant semicolons (';') that can be safely removed. Kotlin does not require a semicolon at the end of each statement or expression. The quick-fix is suggested to remove redundant semicolons. Example: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};' After the quick-fix is applied: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}' There are two cases though where a semicolon is required: Several statements placed on a single line need to be separated with semicolons: 'map.forEach { val (key, value) = it; println(\"$key -> $value\") }' 'enum' classes that also declare properties or functions, require a semicolon after the list of enum constants: 'enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }'", - "markdown": "Reports redundant semicolons (`;`) that can be safely removed.\n\n\nKotlin does not require a semicolon at the end of each statement or expression.\nThe quick-fix is suggested to remove redundant semicolons.\n\n**Example:**\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};\n\nAfter the quick-fix is applied:\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}\n\nThere are two cases though where a semicolon is required:\n\n1. Several statements placed on a single line need to be separated with semicolons:\n\n\n map.forEach { val (key, value) = it; println(\"$key -> $value\") }\n\n2. `enum` classes that also declare properties or functions, require a semicolon after the list of enum constants:\n\n\n enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }\n \n" + "text": "Reports 'transient' fields in classes that do not implement 'java.io.Serializable'. Example: 'public class NonSerializableClass {\n private transient String password;\n }' After the quick-fix is applied: 'public class NonSerializableClass {\n private String password;\n }'", + "markdown": "Reports `transient` fields in classes that do not implement `java.io.Serializable`.\n\n**Example:**\n\n\n public class NonSerializableClass {\n private transient String password;\n }\n\nAfter the quick-fix is applied:\n\n\n public class NonSerializableClass {\n private String password;\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantSemicolon", + "suppressToolId": "TransientFieldInNonSerializableClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38165,8 +38101,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -38178,28 +38114,28 @@ ] }, { - "id": "IntroduceWhenSubject", + "id": "SlowListContainsAll", "shortDescription": { - "text": "'when' that can be simplified by introducing an argument" + "text": "Call to 'list.containsAll(collection)' may have poor performance" }, "fullDescription": { - "text": "Reports a 'when' expression that can be simplified by introducing a subject argument. Example: 'fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }' The quick fix introduces a subject argument: 'fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }'", - "markdown": "Reports a `when` expression that can be simplified by introducing a subject argument.\n\n**Example:**\n\n\n fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n\nThe quick fix introduces a subject argument:\n\n\n fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n" + "text": "Reports calls to 'containsAll()' on 'java.util.List'. The time complexity of this method call is O(n·m), where n is the number of elements in the list on which the method is called, and m is the number of elements in the collection passed to the method as a parameter. When the list is large, this can be an expensive operation. The quick-fix wraps the list in 'new java.util.HashSet<>()' since the time required to create 'java.util.HashSet' from 'java.util.List' and execute 'containsAll()' on 'java.util.HashSet' is O(n+m). Example: 'public boolean check(List list, Collection collection) {\n // O(n·m) complexity\n return list.containsAll(collection);\n }' After the quick-fix is applied: 'public boolean check(List list, Collection collection) {\n // O(n+m) complexity\n return new HashSet<>(list).containsAll(collection);\n }' New in 2022.1", + "markdown": "Reports calls to `containsAll()` on `java.util.List`.\n\n\nThe time complexity of this method call is O(n·m), where n is the number of elements in the list on which\nthe method is called, and m is the number of elements in the collection passed to the method as a parameter.\nWhen the list is large, this can be an expensive operation.\n\n\nThe quick-fix wraps the list in `new java.util.HashSet<>()` since the time required to create\n`java.util.HashSet` from `java.util.List` and execute `containsAll()` on\n`java.util.HashSet` is O(n+m).\n\n**Example:**\n\n public boolean check(List list, Collection collection) {\n // O(n·m) complexity\n return list.containsAll(collection);\n }\n\nAfter the quick-fix is applied:\n\n public boolean check(List list, Collection collection) {\n // O(n+m) complexity\n return new HashSet<>(list).containsAll(collection);\n }\n\nNew in 2022.1" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "IntroduceWhenSubject", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SlowListContainsAll", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -38211,28 +38147,28 @@ ] }, { - "id": "DeprecatedCallableAddReplaceWith", + "id": "ExceptionPackage", "shortDescription": { - "text": "@Deprecated annotation without 'replaceWith' argument" + "text": "Exception package" }, "fullDescription": { - "text": "Reports deprecated functions and properties that do not have the 'kotlin.ReplaceWith' argument in its 'kotlin.deprecated' annotation and suggests to add one based on their body. Kotlin provides the 'ReplaceWith' argument to replace deprecated declarations automatically. It is recommended to use the argument to fix deprecation issues in code. Example: '@Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42' The quick-fix adds the 'ReplaceWith()' argument: '@Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42'", - "markdown": "Reports deprecated functions and properties that do not have the `kotlin.ReplaceWith` argument in its `kotlin.deprecated` annotation and suggests to add one based on their body.\n\n\nKotlin provides the `ReplaceWith` argument to replace deprecated declarations automatically.\nIt is recommended to use the argument to fix deprecation issues in code.\n\n**Example:**\n\n\n @Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42\n\nThe quick-fix adds the `ReplaceWith()` argument:\n\n\n @Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42\n" + "text": "Reports packages that only contain classes that extend 'java.lang.Throwable', either directly or indirectly. Although exceptions usually don't depend on other classes for their implementation, they are normally not used separately. It is often a better design to locate exceptions in the same package as the classes that use them. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", + "markdown": "Reports packages that only contain classes that extend `java.lang.Throwable`, either directly or indirectly.\n\nAlthough exceptions usually don't depend on other classes for their implementation, they are normally not used separately.\nIt is often a better design to locate exceptions in the same package as the classes that use them.\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": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "DeprecatedCallableAddReplaceWith", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ExceptionPackage", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Packaging issues", + "index": 46, "toolComponent": { "name": "QDJVM" } @@ -38244,28 +38180,28 @@ ] }, { - "id": "ComplexRedundantLet", + "id": "TypeParameterExtendsObject", "shortDescription": { - "text": "Redundant argument-based 'let' call" + "text": "Type parameter explicitly extends 'Object'" }, "fullDescription": { - "text": "Reports a redundant argument-based 'let' call. 'let' is redundant when the lambda parameter is only used as a qualifier in a call expression. If you need to give a name to the qualifying expression, declare a local variable. Example: 'fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }' The quick-fix removes the extra 'let()' call: 'fun example() {\n \"1,2,3\".split(',')\n }' Alternative: 'fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }'", - "markdown": "Reports a redundant argument-based `let` call.\n\n`let` is redundant when the lambda parameter is only used as a qualifier in a call expression.\n\nIf you need to give a name to the qualifying expression, declare a local variable.\n\n**Example:**\n\n\n fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }\n\nThe quick-fix removes the extra `let()` call:\n\n\n fun example() {\n \"1,2,3\".split(',')\n }\n\nAlternative:\n\n\n fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }\n" + "text": "Reports type parameters and wildcard type arguments that are explicitly declared to extend 'java.lang.Object'. Such 'extends' clauses are redundant as 'java.lang.Object' is a supertype for all classes. Example: 'class ClassA {}' If you need to preserve the 'extends Object' clause because of annotations, disable the Ignore when java.lang.Object is annotated option. This might be useful, for example, when you use a nullness analyzer, and the 'extends Object' clause holds a '@Nullable'/'@NotNull' annotation. Example: 'class MyClass {}'", + "markdown": "Reports type parameters and wildcard type arguments that are explicitly declared to extend `java.lang.Object`.\n\nSuch 'extends' clauses are redundant as `java.lang.Object` is a supertype for all classes.\n\n**Example:**\n\n class ClassA {}\n\n\nIf you need to preserve the 'extends Object' clause because of annotations, disable the\n**Ignore when java.lang.Object is annotated** option.\nThis might be useful, for example, when you use a nullness analyzer, and the 'extends Object' clause\nholds a `@Nullable`/`@NotNull` annotation.\n\n**Example:**\n\n class MyClass {}\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ComplexRedundantLet", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "TypeParameterExplicitlyExtendsObject", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -38277,19 +38213,19 @@ ] }, { - "id": "RemoveRedundantSpreadOperator", + "id": "StringConcatenationInsideStringBufferAppend", "shortDescription": { - "text": "Redundant spread operator" + "text": "String concatenation as argument to 'StringBuilder.append()' call" }, "fullDescription": { - "text": "Reports the use of a redundant spread operator for a family of 'arrayOf' function calls. Use the 'Remove redundant spread operator' quick-fix to clean up the code. Examples: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }' After the quick-fix is applied: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }'", - "markdown": "Reports the use of a redundant spread operator for a family of `arrayOf` function calls.\n\nUse the 'Remove redundant spread operator' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }\n" + "text": "Reports 'String' concatenation used as the argument to 'StringBuffer.append()', 'StringBuilder.append()' or 'Appendable.append()'. Such calls may profitably be turned into chained append calls on the existing 'StringBuffer/Builder/Appendable' saving the cost of an extra 'StringBuffer/Builder' allocation. This inspection ignores compile-time evaluated 'String' concatenations, in which case the conversion would only worsen performance. Example: 'void bar(StringBuilder builder, String name) {\n builder.append(\"Hello,\" + name); //warning\n builder.append(\"Hello,\" + \"world\"); //no warning\n }'", + "markdown": "Reports `String` concatenation used as the argument to `StringBuffer.append()`, `StringBuilder.append()` or `Appendable.append()`.\n\n\nSuch calls may profitably be turned into chained append calls on the existing `StringBuffer/Builder/Appendable`\nsaving the cost of an extra `StringBuffer/Builder` allocation.\nThis inspection ignores compile-time evaluated `String` concatenations, in which case the conversion would only\nworsen performance.\n\n**Example:**\n\n\n void bar(StringBuilder builder, String name) {\n builder.append(\"Hello,\" + name); //warning\n builder.append(\"Hello,\" + \"world\"); //no warning\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RemoveRedundantSpreadOperator", + "suppressToolId": "StringConcatenationInsideStringBufferAppend", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38297,8 +38233,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -38310,28 +38246,28 @@ ] }, { - "id": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", + "id": "FeatureEnvy", "shortDescription": { - "text": "'@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4" + "text": "Feature envy" }, "fullDescription": { - "text": "Reports '@JvmOverloads' on constructors of annotation classes because it's meaningless. There is no footprint of '@JvmOverloads' in the generated bytecode and Kotlin metadata, so '@JvmOverloads' doesn't affect the generated bytecode and the code behavior. '@JvmOverloads' on constructors of annotation classes causes a compilation error since Kotlin 1.4. Example: 'annotation class A @JvmOverloads constructor(val x: Int = 1)' After the quick-fix is applied: 'annotation class A constructor(val x: Int = 1)'", - "markdown": "Reports `@JvmOverloads` on constructors of annotation classes because it's meaningless.\n\n\nThere is no footprint of `@JvmOverloads` in the generated bytecode and Kotlin metadata,\nso `@JvmOverloads` doesn't affect the generated bytecode and the code behavior.\n\n`@JvmOverloads` on constructors of annotation classes causes a compilation error since Kotlin 1.4.\n\n**Example:**\n\n\n annotation class A @JvmOverloads constructor(val x: Int = 1)\n\nAfter the quick-fix is applied:\n\n\n annotation class A constructor(val x: Int = 1)\n" + "text": "Reports the Feature Envy code smell. The warning is thrown when a method calls methods on another class three or more times. Calls to library classes, parent classes, contained or containing classes are not counted by this inspection. Feature envy is often an indication of the fact that this functionality is located in a wrong class. Example: 'class JobManager {\n // Warning: this method calls three methods\n // of the Job class\n // It would be better to move this chain of\n // calls to the Job class itself.\n void performJob(Job job) {\n job.beforeStart();\n job.process();\n job.afterProcessing();\n }\n }'", + "markdown": "Reports the *Feature Envy* code smell. The warning is thrown when a method calls methods on another class three or more times. Calls to library classes, parent classes, contained or containing classes are not counted by this inspection. Feature envy is often an indication of the fact that this functionality is located in a wrong class.\n\nExample:\n\n\n class JobManager {\n // Warning: this method calls three methods\n // of the Job class\n // It would be better to move this chain of\n // calls to the Job class itself.\n void performJob(Job job) {\n job.beforeStart();\n job.process();\n job.afterProcessing();\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "FeatureEnvy", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -38343,19 +38279,19 @@ ] }, { - "id": "RemoveSetterParameterType", + "id": "BoxingBoxedValue", "shortDescription": { - "text": "Redundant setter parameter type" + "text": "Boxing of already boxed value" }, "fullDescription": { - "text": "Reports explicitly specified parameter types in property setters. Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly. Examples: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted' After the quick-fix is applied: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)'", - "markdown": "Reports explicitly specified parameter types in property setters.\n\n\nSetter parameter type always matches the property type, so it's not required to be explicit.\nThe 'Remove explicit type specification' quick-fix allows amending the code accordingly.\n\n**Examples:**\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted\n\nAfter the quick-fix is applied:\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)\n" + "text": "Reports boxing of already boxed values. This is a redundant operation since any boxed value will first be auto-unboxed before boxing the value again. If done inside an inner loop, such code may cause performance problems. Example: 'Integer value = 1;\n method(Integer.valueOf(value));' After the quick fix is applied: 'Integer value = 1;\n method(value);'", + "markdown": "Reports boxing of already boxed values.\n\n\nThis is a redundant\noperation since any boxed value will first be auto-unboxed before boxing the\nvalue again. If done inside an inner loop, such code may cause performance\nproblems.\n\n**Example:**\n\n\n Integer value = 1;\n method(Integer.valueOf(value));\n\nAfter the quick fix is applied:\n\n\n Integer value = 1;\n method(value);\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RemoveSetterParameterType", + "suppressToolId": "BoxingBoxedValue", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38363,8 +38299,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -38376,28 +38312,28 @@ ] }, { - "id": "ObjectPrivatePropertyName", + "id": "RedundantCollectionOperation", "shortDescription": { - "text": "Object private property naming convention" + "text": "Redundant 'Collection' operation" }, "fullDescription": { - "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Private properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an underscore or an uppercase letter, use camel case. Example: 'class Person {\n companion object {\n // property in companion object\n private val NO_NAME = Person()\n }\n }'", - "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Private properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an underscore or an uppercase letter, use camel case.\n\n**Example:**\n\n\n class Person {\n companion object {\n // property in companion object\n private val NO_NAME = Person()\n }\n }\n" + "text": "Reports unnecessarily complex collection operations which have simpler alternatives. Example: 'void f(String[] array, Collection collection) {\n String[] strings = Arrays.asList(array).subList(0, 10).toArray(new String[0]);\n boolean contains = collection.containsAll(Collections.singletonList(\"x\"));\n }' After the quick-fix is applied: 'void f(String[] array, Collection collection) {\n String[] strings = Arrays.copyOf(array, 10);\n boolean contains = collection.contains(\"x\");\n }' New in 2018.1", + "markdown": "Reports unnecessarily complex collection operations which have simpler alternatives.\n\nExample:\n\n\n void f(String[] array, Collection collection) {\n String[] strings = Arrays.asList(array).subList(0, 10).toArray(new String[0]);\n boolean contains = collection.containsAll(Collections.singletonList(\"x\"));\n }\n\nAfter the quick-fix is applied:\n\n\n void f(String[] array, Collection collection) {\n String[] strings = Arrays.copyOf(array, 10);\n boolean contains = collection.contains(\"x\");\n }\n\nNew in 2018.1" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ObjectPrivatePropertyName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "RedundantCollectionOperation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -38409,28 +38345,28 @@ ] }, { - "id": "IfThenToElvis", + "id": "OverriddenMethodCallDuringObjectConstruction", "shortDescription": { - "text": "If-Then foldable to '?:'" + "text": "Overridden method called during object construction" }, "fullDescription": { - "text": "Reports 'if-then' expressions that can be folded into elvis ('?:') expressions. Example: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo' The quick fix converts the 'if-then' expression into an elvis ('?:') expression: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"'", - "markdown": "Reports `if-then` expressions that can be folded into elvis (`?:`) expressions.\n\n**Example:**\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo\n\nThe quick fix converts the `if-then` expression into an elvis (`?:`) expression:\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"\n" + "text": "Reports any calls to overridden methods of the current class during object construction. This happens if an object construction is inside: A constructor A non-static instance initializer A non-static field initializer 'clone()' 'readObject()' 'readObjectNoData()' Such calls may result in subtle bugs, as the object is not guaranteed to be initialized before the method call occurs. Example: 'abstract class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n\n @Override\n void someMethod() { }\n }' This inspection shares its functionality with: The Abstract method called during object construction inspection The Overridable method called during object construction inspection Only one inspection should be enabled at the same time to prevent duplicate warnings.", + "markdown": "Reports any calls to overridden methods of the current class during object construction. This happens if an object construction is inside:\n\n* A constructor\n* A non-static instance initializer\n* A non-static field initializer\n* `clone()`\n* `readObject()`\n* `readObjectNoData()`\n\nSuch calls may result in subtle bugs, as the object is not guaranteed to be initialized before the method call occurs.\n\nExample:\n\n\n abstract class Parent {\n void someMethod() { }\n }\n\n class Child extends Parent {\n Child() {\n someMethod();\n }\n\n @Override\n void someMethod() { }\n }\n\nThis inspection shares its functionality with:\n\n* The **Abstract method called during object construction** inspection\n* The **Overridable method called during object construction** inspection\n\nOnly one inspection should be enabled at the same time to prevent duplicate warnings." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "IfThenToElvis", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "OverriddenMethodCallDuringObjectConstruction", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -38442,28 +38378,28 @@ ] }, { - "id": "WrapUnaryOperator", + "id": "AbstractClassWithoutAbstractMethods", "shortDescription": { - "text": "Ambiguous unary operator use with number constant" + "text": "Abstract class without 'abstract' methods" }, "fullDescription": { - "text": "Reports an unary operator followed by a dot qualifier such as '-1.inc()'. Code like '-1.inc()' can be misleading because '-' has a lower precedence than '.inc()'. As a result, '-1.inc()' evaluates to '-2' and not '0' as it might be expected. Wrap unary operator and value with () quick-fix can be used to amend the code automatically.", - "markdown": "Reports an unary operator followed by a dot qualifier such as `-1.inc()`.\n\nCode like `-1.inc()` can be misleading because `-` has a lower precedence than `.inc()`.\nAs a result, `-1.inc()` evaluates to `-2` and not `0` as it might be expected.\n\n**Wrap unary operator and value with ()** quick-fix can be used to amend the code automatically." + "text": "Reports 'abstract' classes that have no 'abstract' methods. In most cases it does not make sense to have an 'abstract' class without any 'abstract' methods, and the 'abstract' modifier can be removed from the class. If the class was declared 'abstract' to prevent instantiation, it is often a better option to use a 'private' constructor to prevent instantiation instead. Example: 'abstract class Example {\n public String getName() {\n return \"IntelliJ IDEA\";\n }\n }' Use the option to ignore utility classes.", + "markdown": "Reports `abstract` classes that have no `abstract` methods. In most cases it does not make sense to have an `abstract` class without any `abstract` methods, and the `abstract` modifier can be removed from the class. If the class was declared `abstract` to prevent instantiation, it is often a better option to use a `private` constructor to prevent instantiation instead.\n\n**Example:**\n\n\n abstract class Example {\n public String getName() {\n return \"IntelliJ IDEA\";\n }\n }\n\nUse the option to ignore utility classes." }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "WrapUnaryOperator", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AbstractClassWithoutAbstractMethods", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -38475,19 +38411,19 @@ ] }, { - "id": "ConflictingExtensionProperty", + "id": "CastThatLosesPrecision", "shortDescription": { - "text": "Extension property conflicting with synthetic one" + "text": "Numeric cast that loses precision" }, "fullDescription": { - "text": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java 'get' or 'set' methods. Such properties should be either removed or renamed to avoid breaking code by future changes in the compiler. The quick-fix deletes an extention property. Example: 'val File.name: String\n get() = getName()' The quick-fix adds the '@Deprecated' annotation: '@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()'", - "markdown": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java `get` or `set` methods.\n\nSuch properties should be either removed or renamed to avoid breaking code by future changes in the compiler.\n\nThe quick-fix deletes an extention property.\n\n**Example:**\n\n\n val File.name: String\n get() = getName()\n\nThe quick-fix adds the `@Deprecated` annotation:\n\n\n @Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()\n" + "text": "Reports cast operations between primitive numeric types that may result in precision loss. Such casts are not necessarily a problem but may result in difficult to trace bugs if the loss of precision is unexpected. Example: 'int a = 420;\n byte b = (byte) a;' Use the Ignore casts from int to char option to ignore casts from 'int' to 'char'. This type of cast is often used when implementing I/O operations because the 'read()' method of the 'java.io.Reader' class returns an 'int'. Use the Ignore casts from int 128-255 to byte option to ignore casts of constant values (128-255) from 'int' to 'byte'. Such values will overflow to negative numbers that still fit inside a byte.", + "markdown": "Reports cast operations between primitive numeric types that may result in precision loss.\n\nSuch casts are not necessarily a problem but may result in difficult to\ntrace bugs if the loss of precision is unexpected.\n\n**Example:**\n\n\n int a = 420;\n byte b = (byte) a;\n\nUse the **Ignore casts from int to char** option to ignore casts from `int` to `char`.\nThis type of cast is often used when implementing I/O operations because the `read()` method of the\n`java.io.Reader` class returns an `int`.\n\nUse the **Ignore casts from int 128-255 to byte** option to ignore casts of constant values (128-255) from `int` to\n`byte`.\nSuch values will overflow to negative numbers that still fit inside a byte." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConflictingExtensionProperty", + "suppressToolId": "NumericCastThatLosesPrecision", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38495,8 +38431,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Numeric issues/Cast", + "index": 139, "toolComponent": { "name": "QDJVM" } @@ -38508,28 +38444,28 @@ ] }, { - "id": "ReplaceJavaStaticMethodWithKotlinAnalog", + "id": "SameReturnValue", "shortDescription": { - "text": "Java methods should be replaced with Kotlin analog" + "text": "Method always returns the same value" }, "fullDescription": { - "text": "Reports a Java method call that can be replaced with a Kotlin function, for example, 'System.out.println()'. Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code. The quick-fix replaces the Java method calls on the same Kotlin call. Example: 'import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }' After the quick-fix is applied: 'fun main() {\n val a = listOf(1, 3, null)\n }'", - "markdown": "Reports a Java method call that can be replaced with a Kotlin function, for example, `System.out.println()`.\n\nReplacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.\n\nThe quick-fix replaces the Java method calls on the same Kotlin call.\n\n**Example:**\n\n\n import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = listOf(1, 3, null)\n }\n" + "text": "Reports methods and method hierarchies that always return the same constant. The inspection works differently in batch-mode (from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name) and on-the-fly in the editor: In batch-mode, the inspection reports methods and method hierarchies that always return the same constant. In the editor, the inspection only reports methods that have more than one 'return' statement, do not have super methods, and cannot be overridden. If a method overrides or implements a method, a contract may require it to return a specific constant, but at the same time, we may want to have several exit points. If a method can be overridden, it is possible that a different value will be returned in subclasses. Example: 'class X {\n // Warn only in batch-mode:\n int xxx() { // Method 'xxx()' and all its overriding methods always return '0'\n return 0;\n }\n }\n\n class Y extends X {\n @Override\n int xxx() {\n return 0;\n }\n\n // Warn only in batch-mode:\n int yyy() { // Method 'yyy()' always returns '0'\n return 0;\n }\n\n // Warn both in batch-mode and on-the-fly:\n final int zzz(boolean flag) { // Method 'zzz()' always returns '0'\n if (Math.random() > 0.5) {\n return 0;\n }\n return 0;\n }\n }'", + "markdown": "Reports methods and method hierarchies that always return the same constant.\n\n\nThe inspection works differently in batch-mode\n(from **Code \\| Inspect Code** or **Code \\| Analyze Code \\| Run Inspection by Name**)\nand on-the-fly in the editor:\n\n* In batch-mode, the inspection reports methods and method hierarchies that always return the same constant.\n* In the editor, the inspection only reports methods that have more than one `return` statement, do not have super methods, and cannot be overridden. If a method overrides or implements a method, a contract may require it to return a specific constant, but at the same time, we may want to have several exit points. If a method can be overridden, it is possible that a different value will be returned in subclasses.\n\n**Example:**\n\n\n class X {\n // Warn only in batch-mode:\n int xxx() { // Method 'xxx()' and all its overriding methods always return '0'\n return 0;\n }\n }\n\n class Y extends X {\n @Override\n int xxx() {\n return 0;\n }\n\n // Warn only in batch-mode:\n int yyy() { // Method 'yyy()' always returns '0'\n return 0;\n }\n\n // Warn both in batch-mode and on-the-fly:\n final int zzz(boolean flag) { // Method 'zzz()' always returns '0'\n if (Math.random() > 0.5) {\n return 0;\n }\n return 0;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceJavaStaticMethodWithKotlinAnalog", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SameReturnValue", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -38541,28 +38477,28 @@ ] }, { - "id": "RemoveEmptyParenthesesFromLambdaCall", + "id": "StringBufferMustHaveInitialCapacity", "shortDescription": { - "text": "Unnecessary parentheses in function call with lambda" + "text": "'StringBuilder' without initial capacity" }, "fullDescription": { - "text": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses. Use the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code. Examples: 'fun foo() {\n listOf(1).forEach() { }\n }' After the quick-fix is applied: 'fun foo() {\n listOf(1).forEach { }\n }'", - "markdown": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.\n\nUse the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo() {\n listOf(1).forEach() { }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1).forEach { }\n }\n" + "text": "Reports attempts to instantiate a new 'StringBuffer' or 'StringBuilder' object without specifying its initial capacity. If no initial capacity is specified, a default capacity is used, which will rarely be optimal. Failing to specify the initial capacity for 'StringBuffer' may result in performance issues if space needs to be reallocated and memory copied when the initial capacity is exceeded. Example: '// Capacity is not specified\n var sb = new StringBuilder();'", + "markdown": "Reports attempts to instantiate a new `StringBuffer` or `StringBuilder` object without specifying its initial capacity.\n\n\nIf no initial capacity is specified, a default capacity is used, which will rarely be optimal.\nFailing to specify the initial capacity for `StringBuffer` may result\nin performance issues if space needs to be reallocated and memory copied\nwhen the initial capacity is exceeded.\n\nExample:\n\n\n // Capacity is not specified\n var sb = new StringBuilder();\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RemoveEmptyParenthesesFromLambdaCall", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "StringBufferWithoutInitialCapacity", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Performance", + "index": 10, "toolComponent": { "name": "QDJVM" } @@ -38574,28 +38510,28 @@ ] }, { - "id": "RemoveExplicitSuperQualifier", + "id": "ThrowablePrintStackTrace", "shortDescription": { - "text": "Unnecessary supertype qualification" + "text": "Call to 'printStackTrace()'" }, "fullDescription": { - "text": "Reports 'super' member calls with redundant supertype qualification. Code in a derived class can call its superclass functions and property accessors implementations using the 'super' keyword. To specify the supertype from which the inherited implementation is taken, 'super' can be qualified by the supertype name in angle brackets, e.g. 'super'. Sometimes this qualification is redundant and can be omitted. Use the 'Remove explicit supertype qualification' quick-fix to clean up the code. Examples: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }' After the quick-fix is applied: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }'", - "markdown": "Reports `super` member calls with redundant supertype qualification.\n\n\nCode in a derived class can call its superclass functions and property accessors implementations using the `super` keyword.\nTo specify the supertype from which the inherited implementation is taken, `super` can be qualified by the supertype name in\nangle brackets, e.g. `super`. Sometimes this qualification is redundant and can be omitted.\nUse the 'Remove explicit supertype qualification' quick-fix to clean up the code.\n\n**Examples:**\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }\n" + "text": "Reports calls to 'Throwable.printStackTrace()' without arguments. Such statements are often used for temporary debugging and should be either removed from the production code or replaced with a more robust logging facility.", + "markdown": "Reports calls to `Throwable.printStackTrace()` without arguments.\n\nSuch statements are often used for temporary debugging and should be either removed from the production code\nor replaced with a more robust logging facility." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RemoveExplicitSuperQualifier", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "CallToPrintStackTrace", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -38607,19 +38543,19 @@ ] }, { - "id": "RedundantExplicitType", + "id": "ThreeNegationsPerMethod", "shortDescription": { - "text": "Obvious explicit type" + "text": "Method with more than three negations" }, "fullDescription": { - "text": "Reports local variables' explicitly given types which are obvious and thus redundant, like 'val f: Foo = Foo()'. Example: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }' After the quick-fix is applied: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }'", - "markdown": "Reports local variables' explicitly given types which are obvious and thus redundant, like `val f: Foo = Foo()`.\n\n**Example:**\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }\n\nAfter the quick-fix is applied:\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }\n" + "text": "Reports methods with three or more negations. Such methods may be confusing. Example: 'void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (!flag && !flag2) {\n if (a != b) {\n doOther();\n }\n }\n }' Without negations, the method becomes easier to understand: 'void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (flag1 || flag2 || a == b) return;\n doOther();\n }' Configure the inspection: Use the Ignore negations in 'equals()' methods option to disable the inspection within 'equals()' methods. Use the Ignore negations in 'assert' statements to disable the inspection within 'assert' statements.", + "markdown": "Reports methods with three or more negations. Such methods may be confusing.\n\n**Example:**\n\n\n void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (!flag && !flag2) {\n if (a != b) {\n doOther();\n }\n }\n }\n\nWithout negations, the method becomes easier to understand:\n\n\n void doSmth(int a, int b, boolean flag1, boolean flag2) {\n if (flag1 || flag2 || a == b) return;\n doOther();\n }\n\nConfigure the inspection:\n\n* Use the **Ignore negations in 'equals()' methods** option to disable the inspection within `equals()` methods.\n* Use the **Ignore negations in 'assert' statements** to disable the inspection within `assert` statements." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantExplicitType", + "suppressToolId": "MethodWithMoreThanThreeNegations", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38627,8 +38563,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -38640,19 +38576,19 @@ ] }, { - "id": "SuspiciousVarProperty", + "id": "ThreadWithDefaultRunMethod", "shortDescription": { - "text": "Suspicious 'var' property: its setter does not influence its getter result" + "text": "Instantiating a 'Thread' with default 'run()' method" }, "fullDescription": { - "text": "Reports 'var' properties with default setter and getter that do not reference backing field. Such properties do not affect calling its setter; therefore, it will be clearer to change such property to 'val' and delete the initializer. Change to val and delete initializer quick-fix can be used to amend the code automatically. Example: '// This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1'", - "markdown": "Reports `var` properties with default setter and getter that do not reference backing field.\n\n\nSuch properties do not affect calling its setter; therefore, it will be clearer to change such property to `val` and delete the initializer.\n\n**Change to val and delete initializer** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1\n" + "text": "Reports instantiations of 'Thread' or an inheritor without specifying a 'Runnable' parameter or overriding the 'run()' method. Such threads do nothing useful. Example: 'new Thread().start();'", + "markdown": "Reports instantiations of `Thread` or an inheritor without specifying a `Runnable` parameter or overriding the `run()` method. Such threads do nothing useful.\n\n**Example:**\n\n\n new Thread().start();\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SuspiciousVarProperty", + "suppressToolId": "InstantiatingAThreadWithDefaultRunMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38660,8 +38596,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -38673,28 +38609,28 @@ ] }, { - "id": "JavaCollectionsStaticMethod", + "id": "TestOnlyProblems", "shortDescription": { - "text": "Java Collections static method call can be replaced with Kotlin stdlib" + "text": "Test-only usage in production code" }, "fullDescription": { - "text": "Reports a Java 'Collections' static method call that can be replaced with Kotlin stdlib. Example: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }' The quick fix replaces Java 'Collections' static method call with the corresponding Kotlin stdlib method call: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }'", - "markdown": "Reports a Java `Collections` static method call that can be replaced with Kotlin stdlib.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }\n\nThe quick fix replaces Java `Collections` static method call with the corresponding Kotlin stdlib method call:\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }\n" + "text": "Reports '@TestOnly'- and '@VisibleForTesting'-annotated methods and classes that are used in production code. Also reports usage of applying '@TestOnly' '@VisibleForTesting' to the same element. The problems are not reported if such method or class is referenced from: Code under the Test Sources folder A test class (JUnit/TestNG) Another '@TestOnly'-annotated method Example (in production code): '@TestOnly\n fun foo() { ... }\n\n fun main () {\n foo()\n }'", + "markdown": "Reports `@TestOnly`- and `@VisibleForTesting`-annotated methods and classes that are used in production code. Also reports usage of applying `@TestOnly` `@VisibleForTesting` to the same element.\n\nThe problems are not reported if such method or class is referenced from:\n\n* Code under the **Test Sources** folder\n* A test class (JUnit/TestNG)\n* Another `@TestOnly`-annotated method\n\n**Example (in production code):**\n\n\n @TestOnly\n fun foo() { ... }\n\n fun main () {\n foo()\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "JavaCollectionsStaticMethod", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "TestOnlyProblems", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "JVM languages/Test frameworks", + "index": 123, "toolComponent": { "name": "QDJVM" } @@ -38706,28 +38642,28 @@ ] }, { - "id": "MoveVariableDeclarationIntoWhen", + "id": "Java8MapApi", "shortDescription": { - "text": "Variable declaration could be moved inside 'when'" + "text": "Simplifiable 'Map' operations" }, "fullDescription": { - "text": "Reports variable declarations that can be moved inside a 'when' expression. Example: 'fun someCalc(x: Int) = x * 42\n\nfun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}' After the quick-fix is applied: 'fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}'", - "markdown": "Reports variable declarations that can be moved inside a `when` expression.\n\n**Example:**\n\n\n fun someCalc(x: Int) = x * 42\n\n fun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n" + "text": "Reports common usage patterns of 'java.util.Map' and suggests replacing them with: 'getOrDefault()', 'computeIfAbsent()', 'putIfAbsent()', 'merge()', or 'replaceAll()'. Example: 'map.containsKey(key) ? map.get(key) : \"default\";' After the quick-fix is applied: 'map.getOrDefault(key, \"default\");' Example: 'List list = map.get(key);\n if (list == null) {\n list = new ArrayList<>();\n map.put(key, list);\n }' After the quick-fix is applied: 'map.computeIfAbsent(key, localKey -> new ArrayList<>());' Example: 'Integer val = map.get(key);\n if (val == null) map.put(key, 1);\n else map.put(key, val + 1);' After the quick-fix is applied: 'map.merge(key, 1, (localKey, localValue) -> localValue + 1);' Example: 'for (Map.Entry entry : map.entrySet()) {\n map.put(entry.getKey(), transform(entry.getValue()));\n }' After the quick-fix is applied: 'map.replaceAll((localKey, localValue) -> transform(localValue));' Note that the replacement with 'computeIfAbsent()' or 'merge()' might work incorrectly for some 'Map' implementations if the code extracted to the lambda expression modifies the same 'Map'. By default, the warning doesn't appear if this code might have side effects. If necessary, enable the Suggest replacement even if lambda may have side effects option to always show the warning. Also, due to different handling of the 'null' value in old methods like 'put()' and newer methods like 'computeIfAbsent()' or 'merge()', semantics might change if storing the 'null' value into given 'Map' is important. The inspection won't suggest the replacement when the value is statically known to be nullable, but for values with unknown nullability the replacement is still suggested. In these cases, we recommended suppressing the warning and adding an explanatory comment. This inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8.", + "markdown": "Reports common usage patterns of `java.util.Map` and suggests replacing them with: `getOrDefault()`, `computeIfAbsent()`, `putIfAbsent()`, `merge()`, or `replaceAll()`.\n\nExample:\n\n\n map.containsKey(key) ? map.get(key) : \"default\";\n\nAfter the quick-fix is applied:\n\n\n map.getOrDefault(key, \"default\");\n\nExample:\n\n\n List list = map.get(key);\n if (list == null) {\n list = new ArrayList<>();\n map.put(key, list);\n }\n\nAfter the quick-fix is applied:\n\n\n map.computeIfAbsent(key, localKey -> new ArrayList<>());\n\nExample:\n\n\n Integer val = map.get(key);\n if (val == null) map.put(key, 1);\n else map.put(key, val + 1);\n\nAfter the quick-fix is applied:\n\n\n map.merge(key, 1, (localKey, localValue) -> localValue + 1);\n\nExample:\n\n\n for (Map.Entry entry : map.entrySet()) {\n map.put(entry.getKey(), transform(entry.getValue()));\n }\n\nAfter the quick-fix is applied:\n\n\n map.replaceAll((localKey, localValue) -> transform(localValue));\n\nNote that the replacement with `computeIfAbsent()` or `merge()` might work incorrectly for some `Map`\nimplementations if the code extracted to the lambda expression modifies the same `Map`. By default,\nthe warning doesn't appear if this code might have side effects. If necessary, enable the\n**Suggest replacement even if lambda may have side effects** option to always show the warning.\n\nAlso, due to different handling of the `null` value in old methods like `put()` and newer methods like\n`computeIfAbsent()` or `merge()`, semantics might change if storing the `null` value into given\n`Map` is important. The inspection won't suggest the replacement when the value is statically known to be nullable,\nbut for values with unknown nullability the replacement is still suggested. In these cases, we recommended suppressing the warning\nand adding an explanatory comment.\n\nThis inspection depends on the Java feature 'Lambda methods in collections', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MoveVariableDeclarationIntoWhen", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "Java8MapApi", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level migration aids/Java 8", + "index": 122, "toolComponent": { "name": "QDJVM" } @@ -38739,28 +38675,28 @@ ] }, { - "id": "RemoveEmptyParenthesesFromAnnotationEntry", + "id": "MeaninglessRecordAnnotationInspection", "shortDescription": { - "text": "Remove unnecessary parentheses" + "text": "Meaningless record annotation" }, "fullDescription": { - "text": "Reports redundant empty parentheses in annotation entries. Use the 'Remove unnecessary parentheses' quick-fix to clean up the code. Examples: 'annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }'", - "markdown": "Reports redundant empty parentheses in annotation entries.\n\nUse the 'Remove unnecessary parentheses' quick-fix to clean up the code.\n\n**Examples:**\n\n\n annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }\n" + "text": "Reports annotations used on record components that have no effect. This can happen in two cases: The reported annotation has the METHOD target, but the corresponding accessor is explicitly defined. The reported annotation has the PARAMETER target, but the canonical constructor is explicitly defined. Example: '@Target(ElementType.METHOD)\n@interface A { }\n \n// The annotation will not appear in bytecode at all,\n// as it should be propagated to the accessor but accessor is explicitly defined \nrecord R(@A int x) {\n public int x() { return x; }\n}' This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2021.1", + "markdown": "Reports annotations used on record components that have no effect.\n\nThis can happen in two cases:\n\n* The reported annotation has the METHOD target, but the corresponding accessor is explicitly defined.\n* The reported annotation has the PARAMETER target, but the canonical constructor is explicitly defined.\n\nExample:\n\n\n @Target(ElementType.METHOD)\n @interface A { }\n \n // The annotation will not appear in bytecode at all,\n // as it should be propagated to the accessor but accessor is explicitly defined \n record R(@A int x) {\n public int x() { return x; }\n }\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2021.1" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RemoveEmptyParenthesesFromAnnotationEntry", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "MeaninglessRecordAnnotationInspection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -38772,28 +38708,28 @@ ] }, { - "id": "SimplifiableCallChain", + "id": "FillPermitsList", "shortDescription": { - "text": "Call chain on collection type can be simplified" + "text": "Same file subclasses are missing from permits clause of a sealed class" }, "fullDescription": { - "text": "Reports two-call chains replaceable by a single call. It can help you to avoid redundant code execution. The quick-fix replaces the call chain with a single call. Example: 'fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }' After the quick-fix is applied: 'fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }'", - "markdown": "Reports two-call chains replaceable by a single call.\n\nIt can help you to avoid redundant code execution.\n\nThe quick-fix replaces the call chain with a single call.\n\n**Example:**\n\n\n fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }\n" + "text": "Reports 'sealed' classes without an explicit 'permits' list. Sealed classes that only have subclasses in the same file are not required to have an explicit 'permits' list. By default, this inspection does not highlight in the editor, but only provides a fix. Example: 'sealed class A {}\n final class B extends A {}' After the quick-fix is applied: 'sealed class A permits B {}\n final class B extends A {}' This inspection depends on the Java feature 'Sealed classes', which is available since Java 17. New in 2020.3", + "markdown": "Reports `sealed` classes without an explicit `permits` list. Sealed classes that only have subclasses in the same file are not required to have an explicit `permits` list. By default, this inspection does not highlight in the editor, but only provides a fix.\n\nExample:\n\n\n sealed class A {}\n final class B extends A {}\n\nAfter the quick-fix is applied:\n\n\n sealed class A permits B {}\n final class B extends A {}\n\nThis inspection depends on the Java feature 'Sealed classes', which is available since Java 17.\n\nNew in 2020.3" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "SimplifiableCallChain", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "FillPermitsList", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -38805,28 +38741,31 @@ ] }, { - "id": "ReplaceCallWithBinaryOperator", + "id": "MagicConstant", "shortDescription": { - "text": "Can be replaced with binary operator" + "text": "Magic constant" }, "fullDescription": { - "text": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones. Example: 'fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return 2 > 1\n }'", - "markdown": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones.\n\n**Example:**\n\n fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }\n\nAfter the quick-fix is applied:\n\n fun test(): Boolean {\n return 2 > 1\n }\n" + "text": "Reports expressions that can be replaced with \"magic\" constants. Example 1: '// Bare literal \"2\" is used, warning:\n Font font = new Font(\"Arial\", 2)' Example 2: '// Predefined constant is used, good:\n Font font = new Font(\"Arial\", Font.ITALIC)' When possible, the quick-fix inserts an appropriate predefined constant. The behavior of this inspection is controlled by 'org.intellij.lang.annotations.MagicConstant' annotation. Some standard Java library methods are pre-annotated, but you can use this annotation in your code as well.", + "markdown": "Reports expressions that can be replaced with \"magic\" constants.\n\nExample 1:\n\n\n // Bare literal \"2\" is used, warning:\n Font font = new Font(\"Arial\", 2)\n\nExample 2:\n\n\n // Predefined constant is used, good:\n Font font = new Font(\"Arial\", Font.ITALIC)\n\n\nWhen possible, the quick-fix inserts an appropriate predefined constant.\n\n\nThe behavior of this inspection is controlled by `org.intellij.lang.annotations.MagicConstant` annotation.\nSome standard Java library methods are pre-annotated, but you can use this annotation in your code as well." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ReplaceCallWithBinaryOperator", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "MagicConstant", + "cweIds": [ + 489 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -38838,19 +38777,52 @@ ] }, { - "id": "ReplacePrintlnWithLogging", + "id": "SuspiciousDateFormat", "shortDescription": { - "text": "Call to 'print()' or 'println()'" + "text": "Suspicious date format pattern" }, "fullDescription": { - "text": "Reports usages of 'print' or 'println'. 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 `print` or `println`.\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." + "text": "Reports date format patterns that are likely used by mistake. The following patterns are reported: Uppercase \"Y\", unless \"w\" appears nearby. It stands for \"Week year\" that is almost always the same as normal \"Year\" (lowercase \"y\" pattern), but may point to the next year at the end of December. Uppercase \"M\" (month) close to \"H\", \"K\", \"h\", or \"k\" (hour). It's likely that a lowercase \"m\" (minute) was intended. Lowercase \"m\" (minute) close to \"y\" (year) or \"d\" (day in month). It's likely that an uppercase \"M\" (month) was intended. Uppercase \"D\" (day in year) close to \"M\", or \"L\" (month). It's likely that a lowercase \"d\" (day in month) was intended. Uppercase \"S\" (milliseconds) close to \"m\" (minutes). It's likely that a lowercase \"s\" (seconds) was intended. Examples: 'new SimpleDateFormat(\"YYYY-MM-dd\")': likely '\"yyyy-MM-dd\"' was intended. 'new SimpleDateFormat(\"yyyy-MM-DD\")': likely '\"yyyy-MM-dd\"' was intended. 'new SimpleDateFormat(\"HH:MM\")': likely '\"HH:mm\"' was intended. New in 2020.1", + "markdown": "Reports date format patterns that are likely used by mistake.\n\nThe following patterns are reported:\n\n* Uppercase \"Y\", unless \"w\" appears nearby. It stands for \"Week year\" that is almost always the same as normal \"Year\" (lowercase \"y\" pattern), but may point to the next year at the end of December.\n* Uppercase \"M\" (month) close to \"H\", \"K\", \"h\", or \"k\" (hour). It's likely that a lowercase \"m\" (minute) was intended.\n* Lowercase \"m\" (minute) close to \"y\" (year) or \"d\" (day in month). It's likely that an uppercase \"M\" (month) was intended.\n* Uppercase \"D\" (day in year) close to \"M\", or \"L\" (month). It's likely that a lowercase \"d\" (day in month) was intended.\n* Uppercase \"S\" (milliseconds) close to \"m\" (minutes). It's likely that a lowercase \"s\" (seconds) was intended.\n\n\nExamples: \n\n`new SimpleDateFormat(\"YYYY-MM-dd\")`: likely `\"yyyy-MM-dd\"` was intended. \n\n`new SimpleDateFormat(\"yyyy-MM-DD\")`: likely `\"yyyy-MM-dd\"` was intended. \n\n`new SimpleDateFormat(\"HH:MM\")`: likely `\"HH:mm\"` was intended.\n\nNew in 2020.1" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "suppressToolId": "SuspiciousDateFormat", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Java/Probable bugs", + "index": 15, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NumericToString", + "shortDescription": { + "text": "Call to 'Number.toString()'" + }, + "fullDescription": { + "text": "Reports 'toString()' calls on objects of a class extending 'Number'. Such calls are usually incorrect in an internationalized environment and some locale specific formatting should be used instead. Example: 'void print(Double d) {\n System.out.println(d.toString());\n }' A possible way to fix this problem could be: 'void print(Double d) {\n System.out.printf(\"%f%n\", d);\n }' This formats the number using the default locale which is set during the startup of the JVM and is based on the host environment.", + "markdown": "Reports `toString()` calls on objects of a class extending `Number`. Such calls are usually incorrect in an internationalized environment and some locale specific formatting should be used instead.\n\n**Example:**\n\n\n void print(Double d) {\n System.out.println(d.toString());\n }\n\nA possible way to fix this problem could be:\n\n\n void print(Double d) {\n System.out.printf(\"%f%n\", d);\n }\n\nThis formats the number using the default locale which is set during the startup of the JVM and is based on the host environment." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ReplacePrintlnWithLogging", + "suppressToolId": "CallToNumericToString", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38858,8 +38830,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -38871,19 +38843,19 @@ ] }, { - "id": "UnusedUnaryOperator", + "id": "UnnecessaryDefault", "shortDescription": { - "text": "Unused unary operator" + "text": "Unnecessary 'default' for enum 'switch' statement" }, "fullDescription": { - "text": "Reports unary operators for number types on unused expressions. Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading. Example: 'fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }'", - "markdown": "Reports unary operators for number types on unused expressions.\n\nUnary operators break previous expression if they are used without braces.\nAs a result, mathematical expressions spanning multi lines can be misleading.\n\nExample:\n\n\n fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }\n" + "text": "Reports enum 'switch' statements or expression with 'default' branches which can never be taken, because all possible values are covered by a 'case' branch. Such elements are redundant, especially for 'switch' expressions, because they don't compile when all enum constants are not covered by a 'case' branch. The language level needs to be configured to 14 to report 'switch' expressions. The provided quick-fix removes 'default' branches. Example: 'enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n default -> 3;\n };\n }' After the quick-fix is applied: 'enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n };\n }' Use the Only report switch expressions option to report only redundant 'default' branches in switch expressions.", + "markdown": "Reports enum `switch` statements or expression with `default` branches which can never be taken, because all possible values are covered by a `case` branch.\n\nSuch elements are redundant, especially for `switch` expressions, because they don't compile when all\nenum constants are not covered by a `case` branch.\n\n\nThe language level needs to be configured to 14 to report `switch` expressions.\n\nThe provided quick-fix removes `default` branches.\n\nExample:\n\n\n enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n default -> 3;\n };\n }\n\nAfter the quick-fix is applied:\n\n\n enum E { A, B }\n int foo(E e) {\n return switch (e) {\n case A -> 1;\n case B -> 2;\n };\n }\n\nUse the **Only report switch expressions** option to report only redundant `default` branches in switch expressions." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnusedUnaryOperator", + "suppressToolId": "UnnecessaryDefault", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -38891,8 +38863,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -38904,28 +38876,28 @@ ] }, { - "id": "ClassName", + "id": "VolatileArrayField", "shortDescription": { - "text": "Class naming convention" + "text": "Volatile array field" }, "fullDescription": { - "text": "Reports class names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, class names should start with an uppercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'class user(val name: String)' The quick-fix renames the class according to the Kotlin naming conventions: 'class User(val name: String)'", - "markdown": "Reports class names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nclass names should start with an uppercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n class user(val name: String)\n\nThe quick-fix renames the class according to the Kotlin naming conventions:\n\n\n class User(val name: String)\n" + "text": "Reports array fields that are declared 'volatile'. Such declarations may be confusing because accessing the array itself follows the rules for 'volatile' fields, but accessing the array's contents does not. Example: 'class Data {\n private volatile int[] idx = new int[0];\n }' If such volatile access is needed for array contents, consider using 'java.util.concurrent.atomic' classes instead: 'class Data {\n private final AtomicIntegerArray idx = new AtomicIntegerArray(new int[0]);\n }'", + "markdown": "Reports array fields that are declared `volatile`. Such declarations may be confusing because accessing the array itself follows the rules for `volatile` fields, but accessing the array's contents does not.\n\n**Example:**\n\n\n class Data {\n private volatile int[] idx = new int[0];\n }\n\n\nIf such volatile access is needed for array contents, consider using\n`java.util.concurrent.atomic` classes instead:\n\n\n class Data {\n private final AtomicIntegerArray idx = new AtomicIntegerArray(new int[0]);\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ClassName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "VolatileArrayField", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -38937,28 +38909,28 @@ ] }, { - "id": "RemoveEmptyPrimaryConstructor", + "id": "UnnecessaryInheritDoc", "shortDescription": { - "text": "Redundant empty primary constructor" + "text": "Unnecessary '{@inheritDoc}' Javadoc comment" }, "fullDescription": { - "text": "Reports empty primary constructors when they are implicitly available anyway. A primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers. Use the 'Remove empty primary constructor' quick-fix to clean up the code. Examples: 'class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier'", - "markdown": "Reports empty primary constructors when they are implicitly available anyway.\n\n\nA primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers.\nUse the 'Remove empty primary constructor' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier\n" + "text": "Reports Javadoc comments that contain only an '{@inheritDoc}' tag. Since Javadoc copies the super class' comment if no comment is present, a comment containing only '{@inheritDoc}' adds nothing. Also, it reports the '{@inheritDoc}' usages in invalid locations, for example, in fields. Suggests removing the unnecessary Javadoc comment. Example: 'class Example implements Comparable {\n /**\n * {@inheritDoc}\n */\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }' After the quick-fix is applied: 'class Example implements Comparable {\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }'", + "markdown": "Reports Javadoc comments that contain only an `{@inheritDoc}` tag. Since Javadoc copies the super class' comment if no comment is present, a comment containing only `{@inheritDoc}` adds nothing.\n\nAlso, it reports the `{@inheritDoc}` usages in invalid locations, for example, in fields.\n\nSuggests removing the unnecessary Javadoc comment.\n\n**Example:**\n\n\n class Example implements Comparable {\n /**\n * {@inheritDoc}\n */\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example implements Comparable {\n @Override\n public int compareTo(Example o) {\n return 0;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RemoveEmptyPrimaryConstructor", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnnecessaryInheritDoc", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -38970,28 +38942,28 @@ ] }, { - "id": "RemoveEmptySecondaryConstructorBody", + "id": "ParametersPerConstructor", "shortDescription": { - "text": "Redundant constructor body" + "text": "Constructor with too many parameters" }, "fullDescription": { - "text": "Reports empty bodies of secondary constructors.", - "markdown": "Reports empty bodies of secondary constructors." + "text": "Reports constructors whose number of parameters exceeds the specified maximum. Such objects are hard to instantiate, especially if some parameters are optional. Constructors with too many parameters may indicate that refactoring is necessary. Consider applying the builder pattern, for example. Example: 'public BankAccount(long accountNumber,\n String owner,\n double balance,\n double interestRate) {\n // fields initialization\n }' Configure the inspection: Use the Parameter limit field to specify the maximum allowed number of parameters in a constructor. Use the Ignore constructors with visibility list to specify whether the inspection should ignore constructors with specific visibility.", + "markdown": "Reports constructors whose number of parameters exceeds the specified maximum. Such objects are hard to instantiate, especially if some parameters are optional. Constructors with too many parameters may indicate that refactoring is necessary. Consider applying the builder pattern, for example.\n\n**Example:**\n\n\n public BankAccount(long accountNumber,\n String owner,\n double balance,\n double interestRate) {\n // fields initialization\n }\n\nConfigure the inspection:\n\n* Use the **Parameter limit** field to specify the maximum allowed number of parameters in a constructor.\n* Use the **Ignore constructors with visibility** list to specify whether the inspection should ignore constructors with specific visibility." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RemoveEmptySecondaryConstructorBody", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConstructorWithTooManyParameters", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -39003,28 +38975,28 @@ ] }, { - "id": "FloatingPointLiteralPrecision", + "id": "NonReproducibleMathCall", "shortDescription": { - "text": "Floating-point literal exceeds the available precision" + "text": "Non-reproducible call to 'Math'" }, "fullDescription": { - "text": "Reports floating-point literals that cannot be represented with the required precision using IEEE 754 'Float' and 'Double' types. For example, '1.9999999999999999999' has too many significant digits, so its representation as a 'Double' will be rounded to '2.0'. Specifying excess digits may be misleading as it hides the fact that computations use rounded values instead. The quick-fix replaces the literal with a rounded value that matches the actual representation of the constant. Example: 'val x: Float = 3.14159265359f' After the quick-fix is applied: 'val x: Float = 3.1415927f'", - "markdown": "Reports floating-point literals that cannot be represented with the required precision using [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) `Float` and `Double` types.\n\n\nFor example, `1.9999999999999999999` has too many significant digits,\nso its representation as a `Double` will be rounded to `2.0`.\nSpecifying excess digits may be misleading as it hides the fact that computations\nuse rounded values instead.\n\n\nThe quick-fix replaces the literal with a rounded value that matches the actual representation\nof the constant.\n\n**Example:**\n\n\n val x: Float = 3.14159265359f\n\nAfter the quick-fix is applied:\n\n\n val x: Float = 3.1415927f\n" + "text": "Reports calls to 'java.lang.Math' methods, which results are not guaranteed to be reproduced precisely. In environments where reproducibility of results is required, 'java.lang.StrictMath' should be used instead.", + "markdown": "Reports calls to `java.lang.Math` methods, which results are not guaranteed to be reproduced precisely.\n\nIn environments where reproducibility of results is required, `java.lang.StrictMath`\nshould be used instead." }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "FloatingPointLiteralPrecision", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NonReproducibleMathCall", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -39036,28 +39008,28 @@ ] }, { - "id": "ConvertPairConstructorToToFunction", + "id": "MappingBeforeCount", "shortDescription": { - "text": "Convert Pair constructor to 'to' function" + "text": "Mapping call before count()" }, "fullDescription": { - "text": "Reports a 'Pair' constructor invocation that can be replaced with a 'to()' infix function call. Explicit constructor invocations may add verbosity, especially if they are used multiple times. Replacing constructor calls with 'to()' makes code easier to read and maintain. Example: 'val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )' After the quick-fix is applied: 'val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )'", - "markdown": "Reports a `Pair` constructor invocation that can be replaced with a `to()` infix function call.\n\n\nExplicit constructor invocations may add verbosity, especially if they are used multiple times.\nReplacing constructor calls with `to()` makes code easier to read and maintain.\n\n**Example:**\n\n\n val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )\n\nAfter the quick-fix is applied:\n\n\n val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )\n" + "text": "Reports redundant 'Stream' API calls like 'map()', or 'boxed()' right before the 'count()' call. Such calls don't change the final count, so could be removed. It's possible that the code relies on a side effect from the lambda inside such a mapping call. However, relying on side effects inside the stream chain is extremely bad practice. There are no guarantees that the call will not be optimized out in future Java versions. Example: '// map() call is redundant\n long count = list.stream().filter(s -> !s.isEmpty()).map(s -> s.trim()).count();' This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2024.1", + "markdown": "Reports redundant `Stream` API calls like `map()`, or `boxed()` right before the `count()` call.\n\n\nSuch calls don't change the final count, so could be removed. It's possible that the code relies on\na side effect from the lambda inside such a mapping call. However, relying on side effects inside\nthe stream chain is extremely bad practice. There are no guarantees that the call will not be\noptimized out in future Java versions.\n\n**Example:**\n\n\n // map() call is redundant\n long count = list.stream().filter(s -> !s.isEmpty()).map(s -> s.trim()).count();\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2024.1" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ConvertPairConstructorToToFunction", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "MappingBeforeCount", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -39069,28 +39041,28 @@ ] }, { - "id": "RedundantGetter", + "id": "NonExtendableApiUsage", "shortDescription": { - "text": "Redundant property getter" + "text": "Class, interface, or method should not be extended" }, "fullDescription": { - "text": "Reports redundant property getters. Example: 'class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }' After the quick-fix is applied: 'class Test {\n val a = 1\n val b = 1\n }'", - "markdown": "Reports redundant property getters.\n\n**Example:**\n\n\n class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n val a = 1\n val b = 1\n }\n" + "text": "Reports classes, interfaces and methods that extend, implement, or override API elements marked with '@ApiStatus.NonExtendable'. The '@ApiStatus.NonExtendable' annotation indicates that the class, interface, or method must not be extended, implemented, or overridden. Since casting such interfaces and classes to the internal library implementation is rather common, if a client provides a different implementation, you will get 'ClassCastException'. Adding new abstract methods to such classes and interfaces will break the compatibility with the client's implementations.", + "markdown": "Reports classes, interfaces and methods that extend, implement, or override API elements marked with `@ApiStatus.NonExtendable`.\n\n\nThe `@ApiStatus.NonExtendable` annotation indicates that the class, interface, or method **must not be extended,\nimplemented, or overridden** .\nSince casting such interfaces and classes to the internal library implementation is rather common,\nif a client provides a different implementation, you will get `ClassCastException`.\nAdding new abstract methods to such classes and interfaces will break the compatibility with the client's implementations." }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantGetter", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NonExtendableApiUsage", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -39102,28 +39074,28 @@ ] }, { - "id": "RedundantIf", + "id": "UnqualifiedFieldAccess", "shortDescription": { - "text": "Redundant 'if' statement" + "text": "Instance field access not qualified with 'this'" }, "fullDescription": { - "text": "Reports 'if' statements which can be simplified to a single statement. Example: 'fun test(): Boolean {\n if (foo()) {\n return true\n } else {\n return false\n }\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return foo()\n }'", - "markdown": "Reports `if` statements which can be simplified to a single statement.\n\n**Example:**\n\n\n fun test(): Boolean {\n if (foo()) {\n return true\n } else {\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): Boolean {\n return foo()\n }\n" + "text": "Reports field access operations that are not qualified with 'this' or some other qualifier. Some coding styles mandate that all field access operations are qualified to prevent confusion with local variable or parameter access. Example: 'class Foo {\n int foo;\n\n void bar() {\n foo += 1;\n }\n }' After the quick-fix is applied: 'class Foo {\n int foo;\n\n void bar() {\n this.foo += 1;\n }\n }'", + "markdown": "Reports field access operations that are not qualified with `this` or some other qualifier.\n\n\nSome coding styles mandate that all field access operations are qualified to prevent confusion with local\nvariable or parameter access.\n\n**Example:**\n\n\n class Foo {\n int foo;\n\n void bar() {\n foo += 1;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n int foo;\n\n void bar() {\n this.foo += 1;\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantIf", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnqualifiedFieldAccess", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -39135,19 +39107,23 @@ ] }, { - "id": "KDocMissingDocumentation", + "id": "MismatchedCollectionQueryUpdate", "shortDescription": { - "text": "Missing KDoc comments for public declarations" + "text": "Mismatched query and update of collection" }, "fullDescription": { - "text": "Reports public declarations that do not have KDoc comments. Example: 'class A' The quick fix generates the comment block above the declaration: '/**\n *\n */\n class A'", - "markdown": "Reports public declarations that do not have KDoc comments.\n\n**Example:**\n\n\n class A\n\nThe quick fix generates the comment block above the declaration:\n\n\n /**\n *\n */\n class A\n" + "text": "Reports collections whose contents are either queried and not updated, or updated and not queried. Such inconsistent queries and updates are pointless and may indicate either dead code or a typo. Use the inspection settings to specify name patterns that correspond to update/query methods. Query methods that return an element are automatically detected, and only those that write data to an output parameter (for example, an 'OutputStream') need to be specified. Example: Suppose you have your custom 'FixedStack' class with method 'store()': 'public class FixedStack extends Collection {\n public T store(T t) {\n // implementation\n }\n }' You can add 'store' to the update methods table in order to report mismatched queries like: 'void test(int i) {\n FixedStack stack = new FixedStack<>();\n stack.store(i);\n }'", + "markdown": "Reports collections whose contents are either queried and not updated, or updated and not queried.\n\n\nSuch inconsistent queries and updates are pointless and may indicate\neither dead code or a typo.\n\n\nUse the inspection settings to specify name patterns that correspond to update/query methods.\nQuery methods that return an element are automatically detected, and only\nthose that write data to an output parameter (for example, an `OutputStream`) need to be specified.\n\n\n**Example:**\n\nSuppose you have your custom `FixedStack` class with method `store()`:\n\n\n public class FixedStack extends Collection {\n public T store(T t) {\n // implementation\n }\n }\n\nYou can add `store` to the update methods table in order to report mismatched queries like:\n\n\n void test(int i) {\n FixedStack stack = new FixedStack<>();\n stack.store(i);\n }\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "KDocMissingDocumentation", + "suppressToolId": "MismatchedQueryAndUpdateOfCollection", + "cweIds": [ + 561, + 563 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -39155,8 +39131,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -39168,28 +39144,28 @@ ] }, { - "id": "RemoveExplicitTypeArguments", + "id": "CharacterComparison", "shortDescription": { - "text": "Unnecessary type argument" + "text": "Character comparison" }, "fullDescription": { - "text": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted. Use the 'Remove explicit type arguments' quick-fix to clean up the code. Examples: '// 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()' After the quick-fix is applied: 'fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()'", - "markdown": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted.\n\nUse the 'Remove explicit type arguments' quick-fix to clean up the code.\n\n**Examples:**\n\n\n // 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()\n\nAfter the quick-fix is applied:\n\n\n fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()\n" + "text": "Reports ordinal comparisons of 'char' values. In an internationalized environment, such comparisons are rarely correct.", + "markdown": "Reports ordinal comparisons of `char` values. In an internationalized environment, such comparisons are rarely correct." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RemoveExplicitTypeArguments", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "CharacterComparison", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Internationalization", + "index": 6, "toolComponent": { "name": "QDJVM" } @@ -39201,19 +39177,19 @@ ] }, { - "id": "RedundantVisibilityModifier", + "id": "SynchronizeOnThis", "shortDescription": { - "text": "Redundant visibility modifier" + "text": "Synchronization on 'this'" }, "fullDescription": { - "text": "Reports visibility modifiers that match the default visibility of an element ('public' for most elements, 'protected' for members that override a protected member).", - "markdown": "Reports visibility modifiers that match the default visibility of an element (`public` for most elements, `protected` for members that override a protected member)." + "text": "Reports synchronization on 'this' or 'class' expressions. The reported constructs include 'synchronized' blocks and calls to 'wait()', 'notify()' or 'notifyAll()'. There are several reasons synchronization on 'this' or 'class' expressions may be a bad idea: it makes synchronization a part of the external interface of the class, which makes a future change to a different locking mechanism difficult, it becomes hard to track just who is locking on a given object, it makes a denial-of-service attack possible, either on purpose or it can happen easily by accident when subclassing. As an alternative, consider synchronizing on a 'private final' lock object, access to which can be completely controlled. Example: 'public void print() {\n synchronized(this) { // warning: Lock operations on 'this' may have unforeseen side-effects\n System.out.println(\"synchronized\");\n }\n }'", + "markdown": "Reports synchronization on `this` or `class` expressions. The reported constructs include `synchronized` blocks and calls to `wait()`, `notify()` or `notifyAll()`.\n\nThere are several reasons synchronization on `this` or `class` expressions may be a bad idea:\n\n1. it makes synchronization a part of the external interface of the class, which makes a future change to a different locking mechanism difficult,\n2. it becomes hard to track just who is locking on a given object,\n3. it makes a denial-of-service attack possible, either on purpose or it can happen easily by accident when subclassing.\n\nAs an alternative, consider synchronizing on a `private final` lock object, access to which can be completely controlled.\n\n**Example:**\n\n\n public void print() {\n synchronized(this) { // warning: Lock operations on 'this' may have unforeseen side-effects\n System.out.println(\"synchronized\");\n }\n }\n \n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantVisibilityModifier", + "suppressToolId": "SynchronizeOnThis", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -39221,8 +39197,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -39234,19 +39210,23 @@ ] }, { - "id": "EnumValuesSoftDeprecateInJava", + "id": "UnusedAssignment", "shortDescription": { - "text": "'Enum.values()' is recommended to be replaced by 'Enum.getEntries()' since Kotlin 1.9" + "text": "Unused assignment" }, "fullDescription": { - "text": "Reports calls from Java to 'values()' method of Kotlin enum classes that can be replaced with 'getEntries()'. Use of 'Enum.getEntries()' may improve performance of your code. More details: KT-48872 Provide modern and performant replacement for Enum.values()", - "markdown": "Reports calls from Java to `values()` method of Kotlin enum classes that can be replaced with `getEntries()`.\n\n\nUse of `Enum.getEntries()` may improve performance of your code.\n\n\n**More details:** [KT-48872 Provide modern and performant replacement for Enum.values()](https://youtrack.jetbrains.com/issue/KT-48872)" + "text": "Reports assignment values that are not used after assignment. If the assignment value is unused, it's better to remove the assignment to shorten the code and avoid redundant allocations. The following cases are reported: variables that are never read after assignment variables that are always overwritten with a new value before being read variable initializers that are redundant (for one of the two reasons above) Configure the inspection: Use the Report redundant initializers option to report redundant initializers: 'int getI() {\n int i = 0; // redundant initialization\n i = 2;\n return i;\n }' Use the Report prefix expressions that can be replaced with binary expressions option to report cases where an '++i' expression may be replaced with 'i + 1': 'int preInc(int value) {\n int res = value;\n return ++res;\n }' Use the Report postfix expressions where the changed value is not used option to report 'i++' cases where the value of 'i' is not used later: 'int postInc(int value) {\n int res = value;\n return res++;\n }' Use the Report pattern variables whose values are never used option to report cases where the value of a pattern variable is overwritten before it is read: 'if (object instanceof String s) {\n s = \"hello\";\n System.out.println(s);\n }' Use the Report iteration parameters whose values are never used option to report cases where the value of an iteration parameter of an enhanced 'for' statements is overwritten before it is read: 'for (String arg : args) {\n arg = \"test\";\n System.out.println(arg);\n }'", + "markdown": "Reports assignment values that are not used after assignment. If the assignment value is unused, it's better to remove the assignment to shorten the code and avoid redundant allocations.\n\nThe following cases are reported:\n\n* variables that are never read after assignment\n* variables that are always overwritten with a new value before being read\n* variable initializers that are redundant (for one of the two reasons above)\n\nConfigure the inspection:\n\n\nUse the **Report redundant initializers** option to report redundant initializers:\n\n\n int getI() {\n int i = 0; // redundant initialization\n i = 2;\n return i;\n }\n\n\nUse the **Report prefix expressions that can be replaced with binary expressions** option to report cases\nwhere an `++i` expression may be replaced with `i + 1`:\n\n\n int preInc(int value) {\n int res = value;\n return ++res;\n }\n\n\nUse the **Report postfix expressions where the changed value is not used** option to report `i++` cases\nwhere the value of `i` is not used later:\n\n\n int postInc(int value) {\n int res = value;\n return res++;\n }\n\n\nUse the **Report pattern variables whose values are never used** option to report cases where the value of a pattern variable\nis overwritten before it is read:\n\n\n if (object instanceof String s) {\n s = \"hello\";\n System.out.println(s);\n }\n\n\nUse the **Report iteration parameters whose values are never used** option to report cases where the value of an iteration parameter\nof an enhanced `for` statements is overwritten before it is read:\n\n\n for (String arg : args) {\n arg = \"test\";\n System.out.println(arg);\n }\n" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "EnumValuesSoftDeprecateInJava", + "suppressToolId": "UnusedAssignment", + "cweIds": [ + 561, + 563 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -39254,8 +39234,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -39267,28 +39247,28 @@ ] }, { - "id": "UsePropertyAccessSyntax", + "id": "HashCodeUsesNonFinalVariable", "shortDescription": { - "text": "Accessor call that can be replaced with property access syntax" + "text": "Non-final field referenced in 'hashCode()'" }, "fullDescription": { - "text": "Reports Java 'get' and 'set' method calls that can be replaced with the Kotlin synthetic properties. Use property access syntax quick-fix can be used to amend the code automatically. Example: '// Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }' '// Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== The quick-fix simplifies the expression to 'j.expr'\n }'", - "markdown": "Reports Java `get` and `set` method calls that can be replaced with the Kotlin synthetic properties.\n\n**Use property access syntax** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }\n\n\n // Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== The quick-fix simplifies the expression to 'j.expr'\n }\n" + "text": "Reports implementations of 'hashCode()' that access non-'final' variables. Such access may result in 'hashCode()' returning different values at different points in the object's lifecycle, which may in turn cause problems when using the standard collections classes. Example: 'class Drink {\n String name;\n Drink(String name) { this.name = name; }\n @Override public int hashCode() {\n return Objects.hash(name); //warning\n }\n }\n ...\n Drink coffee = new Drink(\"Coffee\");\n priceMap.put(coffee, 10.0);\n coffee.name = \"Tea\";\n double coffeePrice = priceMap.get(coffee); //not found' A quick-fix is suggested to make the field final: 'class Drink {\n final String name;\n ...\n }'", + "markdown": "Reports implementations of `hashCode()` that access non-`final` variables.\n\n\nSuch access may result in `hashCode()`\nreturning different values at different points in the object's lifecycle, which may in turn cause problems when\nusing the standard collections classes.\n\n**Example:**\n\n\n class Drink {\n String name;\n Drink(String name) { this.name = name; }\n @Override public int hashCode() {\n return Objects.hash(name); //warning\n }\n }\n ...\n Drink coffee = new Drink(\"Coffee\");\n priceMap.put(coffee, 10.0);\n coffee.name = \"Tea\";\n double coffeePrice = priceMap.get(coffee); //not found\n\nA quick-fix is suggested to make the field final:\n\n\n class Drink {\n final String name;\n ...\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "UsePropertyAccessSyntax", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NonFinalFieldReferencedInHashCode", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -39300,28 +39280,28 @@ ] }, { - "id": "UseExpressionBody", + "id": "ProtectedField", "shortDescription": { - "text": "Expression body syntax is preferable here" + "text": "Protected field" }, "fullDescription": { - "text": "Reports 'return' expressions (one-liners or 'when') that can be replaced with expression body syntax. Expression body syntax is recommended by the style guide. Convert to expression body quick-fix can be used to amend the code automatically. Example: 'fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }' After the quick-fix is applied: 'fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }'", - "markdown": "Reports `return` expressions (one-liners or `when`) that can be replaced with expression body syntax.\n\nExpression body syntax is recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#functions).\n\n**Convert to expression body** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n" + "text": "Reports 'protected' fields. Constants (that is, variables marked 'static' or 'final') are not reported. Example: 'public class A {\n protected Object object; // warning\n protected final static int MODE = 0; // constant, no warning\n }'", + "markdown": "Reports `protected` fields.\n\nConstants (that is, variables marked `static` or `final`) are not reported.\n\n**Example:**\n\n\n public class A {\n protected Object object; // warning\n protected final static int MODE = 0; // constant, no warning\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "UseExpressionBody", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "ProtectedField", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -39333,28 +39313,28 @@ ] }, { - "id": "MapGetWithNotNullAssertionOperator", + "id": "AssignmentUsedAsCondition", "shortDescription": { - "text": "'map.get()' with not-null assertion operator (!!)" + "text": "Assignment used as condition" }, "fullDescription": { - "text": "Reports 'map.get()!!' that can be replaced with 'map.getValue()', 'map.getOrElse()', and so on. Example: 'fun test(map: Map): String = map.get(0)!!' After the quick-fix is applied: 'fun test(map: Map): String = map.getValue(0)'", - "markdown": "Reports `map.get()!!` that can be replaced with `map.getValue()`, `map.getOrElse()`, and so on.\n\n**Example:**\n\n\n fun test(map: Map): String = map.get(0)!!\n\nAfter the quick-fix is applied:\n\n\n fun test(map: Map): String = map.getValue(0)\n" + "text": "Reports assignments that are used as a condition of an 'if', 'while', 'for', or 'do' statement, or a conditional expression. Although occasionally intended, this usage is confusing and may indicate a typo, for example, '=' instead of '=='. The quick-fix replaces '=' with '=='. Example: 'void update(String str, boolean empty) {\n // Warning: 'empty' is reassigned,\n // not compared to str.isEmpty()\n if (empty = str.isEmpty()) {\n ...\n }\n }' After the quick-fix is applied: 'void update(String str, boolean empty) {\n if (empty == str.isEmpty()) {\n ...\n }\n }'", + "markdown": "Reports assignments that are used as a condition of an `if`, `while`, `for`, or `do` statement, or a conditional expression.\n\nAlthough occasionally intended, this usage is confusing and may indicate a typo, for example, `=` instead of `==`.\n\nThe quick-fix replaces `=` with `==`.\n\n**Example:**\n\n\n void update(String str, boolean empty) {\n // Warning: 'empty' is reassigned,\n // not compared to str.isEmpty()\n if (empty = str.isEmpty()) {\n ...\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void update(String str, boolean empty) {\n if (empty == str.isEmpty()) {\n ...\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MapGetWithNotNullAssertionOperator", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "AssignmentUsedAsCondition", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -39366,28 +39346,28 @@ ] }, { - "id": "SortModifiers", + "id": "InstanceofThis", "shortDescription": { - "text": "Non-canonical modifier order" + "text": "'instanceof' check for 'this'" }, "fullDescription": { - "text": "Reports modifiers that do not follow the order recommended by the style guide. Sort modifiers quick-fix can be used to amend the code automatically. Examples: 'private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"'", - "markdown": "Reports modifiers that do not follow the order recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#modifiers-order).\n\n**Sort modifiers** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"\n" + "text": "Reports usages of 'instanceof' or 'getClass() == SomeClass.class' in which a 'this' expression is checked. Such expressions indicate a failure of the object-oriented design, and should be replaced by polymorphic constructions. Example: 'class Super {\n void process() {\n if (this instanceof Sub) { // warning\n doSomething();\n } else {\n doSomethingElse();\n }\n }\n}\n \nclass Sub extends Super {}' To fix the problem, use an overriding method: 'class Super {\n void process() {\n doSomethingElse();\n }\n}\n \nclass Sub extends Super {\n @Override\n void process() {\n doSomething();\n }\n}'", + "markdown": "Reports usages of `instanceof` or `getClass() == SomeClass.class` in which a `this` expression is checked.\n\nSuch expressions indicate a failure of the object-oriented design, and should be replaced by\npolymorphic constructions.\n\nExample:\n\n\n class Super {\n void process() {\n if (this instanceof Sub) { // warning\n doSomething();\n } else {\n doSomethingElse();\n }\n }\n }\n \n class Sub extends Super {}\n\nTo fix the problem, use an overriding method:\n\n\n class Super {\n void process() {\n doSomethingElse();\n }\n }\n \n class Sub extends Super {\n @Override\n void process() {\n doSomething();\n }\n } \n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SortModifiers", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "InstanceofThis", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -39399,28 +39379,28 @@ ] }, { - "id": "EnumEntryName", + "id": "PackageInMultipleModules", "shortDescription": { - "text": "Enum entry naming convention" + "text": "Package with classes in multiple modules" }, "fullDescription": { - "text": "Reports enum entry names that do not follow the recommended naming conventions. Example: 'enum class Foo {\n _Foo,\n foo\n }' To fix the problem rename enum entries to match the recommended naming conventions.", - "markdown": "Reports enum entry names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n enum class Foo {\n _Foo,\n foo\n }\n\nTo fix the problem rename enum entries to match the recommended naming conventions." + "text": "Reports non-empty packages that are present in several modules. When packages are contained in several modules, it is very easy to create a class with the same name in two modules. A module which depends on these modules will see a conflict if it tries to use such a class. The Java Platform Module System disallows packages contained in more than one module (also called split packages) Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", + "markdown": "Reports non-empty packages that are present in several modules. When packages are contained in several modules, it is very easy to create a class with the same name in two modules. A module which depends on these modules will see a conflict if it tries to use such a class. The Java Platform Module System disallows packages contained in more than one module (also called *split packages* )\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": "note", + "level": "warning", "parameters": { - "suppressToolId": "EnumEntryName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "PackageInMultipleModules", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Packaging issues", + "index": 46, "toolComponent": { "name": "QDJVM" } @@ -39432,28 +39412,28 @@ ] }, { - "id": "ReplaceSubstringWithDropLast", + "id": "FloatingPointEquality", "shortDescription": { - "text": "'substring' call should be replaced with 'dropLast' call" + "text": "Floating-point equality comparison" }, "fullDescription": { - "text": "Reports calls like 's.substring(0, s.length - x)' that can be replaced with 's.dropLast(x)'. Using corresponding functions makes your code simpler. The quick-fix replaces the 'substring' call with 'dropLast'. Example: 'fun foo(s: String) {\n s.substring(0, s.length - 5)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.dropLast(5)\n }'", - "markdown": "Reports calls like `s.substring(0, s.length - x)` that can be replaced with `s.dropLast(x)`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `dropLast`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.length - 5)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.dropLast(5)\n }\n" + "text": "Reports floating-point values that are being compared using the '==' or '!=' operator. Floating-point values are inherently inaccurate, and comparing them for exact equality is seldom the desired semantics. This inspection ignores comparisons with zero and infinity literals. Example: 'void m(double d1, double d2) {\n if (d1 == d2) {}\n }'", + "markdown": "Reports floating-point values that are being compared using the `==` or `!=` operator.\n\nFloating-point values are inherently inaccurate, and comparing them for exact equality is seldom the desired semantics.\n\nThis inspection ignores comparisons with zero and infinity literals.\n\n**Example:**\n\n\n void m(double d1, double d2) {\n if (d1 == d2) {}\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceSubstringWithDropLast", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "FloatingPointEquality", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -39465,28 +39445,28 @@ ] }, { - "id": "SetterBackingFieldAssignment", + "id": "PublicField", "shortDescription": { - "text": "Existing backing field without assignment" + "text": "'public' field" }, "fullDescription": { - "text": "Reports property setters that don't update the backing field. The quick-fix adds an assignment to the backing field. Example: 'class Test {\n var foo: Int = 1\n set(value) {\n }\n }' After the quick-fix is applied: 'class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }'", - "markdown": "Reports property setters that don't update the backing field.\n\nThe quick-fix adds an assignment to the backing field.\n\n**Example:**\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }\n" + "text": "Reports 'public' fields. Constants (fields marked with 'static' and 'final') are not reported. Example: 'class Main {\n public String name;\n }' After the quick-fix is applied: 'class Main {\n private String name;\n\n public String getName() {\n return name;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n }' Configure the inspection: Use the Ignore If Annotated By list to specify annotations to ignore. The inspection will ignore fields with any of these annotations. Use the Ignore 'public final' fields of an enum option to ignore 'public final' fields of the 'enum' type.", + "markdown": "Reports `public` fields. Constants (fields marked with `static` and `final`) are not reported.\n\n**Example:**\n\n\n class Main {\n public String name;\n }\n\nAfter the quick-fix is applied:\n\n\n class Main {\n private String name;\n\n public String getName() {\n return name;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n }\n\nConfigure the inspection:\n\n* Use the **Ignore If Annotated By** list to specify annotations to ignore. The inspection will ignore fields with any of these annotations.\n* Use the **Ignore 'public final' fields of an enum** option to ignore `public final` fields of the `enum` type." }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "SetterBackingFieldAssignment", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "PublicField", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -39498,28 +39478,28 @@ ] }, { - "id": "CopyWithoutNamedArguments", + "id": "SequencedCollectionMethodCanBeUsed", "shortDescription": { - "text": "'copy' method of data class is called without named arguments" + "text": "SequencedCollection method can be used" }, "fullDescription": { - "text": "Reports calls to a data class' 'copy()' method without named arguments. As all arguments of the 'copy()' function are optional, it might be hard to understand what properties are modified. Providing parameter names explicitly makes code easy to understand without navigating to the 'data class' declaration. Example: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }' The quick-fix provides parameter names to all 'copy()' arguments: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }'", - "markdown": "Reports calls to a data class' `copy()` method without named arguments.\n\n\nAs all arguments of the `copy()` function are optional, it might be hard to understand what properties are modified.\nProviding parameter names explicitly makes code easy to understand without navigating to the `data class` declaration.\n\n**Example:**\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }\n\nThe quick-fix provides parameter names to all `copy()` arguments:\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }\n" + "text": "Reports collection API method calls that can be simplified using 'SequencedCollection' methods. The following conversions are supported: 'list.add(0, element)' → 'list.addFirst(element);' 'list.get(0)' → 'list.getFirst();' 'list.get(list.size() - 1)' → 'list.getLast();' 'list.remove(0)' → 'list.removeFirst();' 'list.remove(list.size() - 1)' → 'list.removeLast();' 'collection.iterator().next()' → 'collection.getFirst();' This inspection depends on the Java feature 'Sequenced Collections', which is available since Java 21. New in 2023.3", + "markdown": "Reports collection API method calls that can be simplified using `SequencedCollection` methods.\n\nThe following conversions are supported:\n\n* `list.add(0, element)` → `list.addFirst(element);`\n* `list.get(0)` → `list.getFirst();`\n* `list.get(list.size() - 1)` → `list.getLast();`\n* `list.remove(0)` → `list.removeFirst();`\n* `list.remove(list.size() - 1)` → `list.removeLast();`\n* `collection.iterator().next()` → `collection.getFirst();`\n\nThis inspection depends on the Java feature 'Sequenced Collections', which is available since Java 21.\n\nNew in 2023.3" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "CopyWithoutNamedArguments", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SequencedCollectionMethodCanBeUsed", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level migration aids/Java 21", + "index": 195, "toolComponent": { "name": "QDJVM" } @@ -39531,28 +39511,28 @@ ] }, { - "id": "RedundantConstructorKeyword", + "id": "SerialAnnotationUsedOnWrongMember", "shortDescription": { - "text": "Redundant 'constructor' keyword" + "text": "'@Serial' annotation used on wrong member" }, "fullDescription": { - "text": "Reports a redundant 'constructor' keyword on primary constructors. Example: 'class Foo constructor(x: Int, y: Int)' After the quick-fix is applied: 'class Foo(x: Int, y: Int)'", - "markdown": "Reports a redundant 'constructor' keyword on primary constructors.\n\n**Example:**\n\n\n class Foo constructor(x: Int, y: Int)\n\nAfter the quick-fix is applied:\n\n\n class Foo(x: Int, y: Int)\n" + "text": "Reports methods and fields in the 'Serializable' and 'Externalizable' classes that are not suitable to be annotated with the 'java.io.Serial' annotation. Examples: 'class Test implements Serializable {\n @Serial // The annotated field is not a part of serialization mechanism because it's not final\n private static long serialVersionUID = 7874493593505141603L;\n\n @Serial // The annotated method is not a part of the serialization mechanism because it's not private\n void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' 'class Test implements Externalizable {\n @Serial // The annotated method is not a part of the serialization mechanism as it's inside Externalizable class\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n}' For information about all valid cases, refer to the Javadoc of the 'java.io.Serial' class. This inspection depends on the Java feature '@Serial annotation', which is available since Java 14. New in 2020.3", + "markdown": "Reports methods and fields in the `Serializable` and `Externalizable` classes that are not suitable to be annotated with the `java.io.Serial` annotation.\n\n**Examples:**\n\n\n class Test implements Serializable {\n @Serial // The annotated field is not a part of serialization mechanism because it's not final\n private static long serialVersionUID = 7874493593505141603L;\n\n @Serial // The annotated method is not a part of the serialization mechanism because it's not private\n void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\n\n class Test implements Externalizable {\n @Serial // The annotated method is not a part of the serialization mechanism as it's inside Externalizable class\n private void writeObject(ObjectOutputStream out) throws IOException {\n }\n }\n\nFor information about all valid cases, refer to the Javadoc of the `java.io.Serial` class.\n\nThis inspection depends on the Java feature '@Serial annotation', which is available since Java 14.\n\nNew in 2020.3" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "RedundantConstructorKeyword", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "serial", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -39564,19 +39544,19 @@ ] }, { - "id": "KotlinDeprecation", + "id": "ThrowsRuntimeException", "shortDescription": { - "text": "Usage of redundant or deprecated syntax or deprecated symbols" + "text": "Unchecked exception declared in 'throws' clause" }, "fullDescription": { - "text": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (Code | Code Cleanup). The quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax. It also replaces deprecated symbols with their proposed substitutions.", - "markdown": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (**Code \\| Code Cleanup** ).\n\n\nThe quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax.\n\n\nIt also replaces deprecated symbols with their proposed substitutions." + "text": "Reports declaration of an unchecked exception ('java.lang.RuntimeException' or one of its subclasses) in the 'throws' clause of a method. Declarations of unchecked exceptions are not required and may be deleted or moved to a Javadoc '@throws' tag. Example: 'public class InvalidDataException extends RuntimeException {}\n\n class TextEditor {\n void readSettings() throws InvalidDataException {} // warning: Unchecked exception 'InvalidDataException' declared in 'throws' clause\n }'", + "markdown": "Reports declaration of an unchecked exception (`java.lang.RuntimeException` or one of its subclasses) in the `throws` clause of a method.\n\nDeclarations of unchecked exceptions are not required and may be deleted or moved to a Javadoc `@throws` tag.\n\n**Example:**\n\n\n public class InvalidDataException extends RuntimeException {}\n\n class TextEditor {\n void readSettings() throws InvalidDataException {} // warning: Unchecked exception 'InvalidDataException' declared in 'throws' clause\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KotlinDeprecation", + "suppressToolId": "ThrowsRuntimeException", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -39584,8 +39564,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Error handling", + "index": 14, "toolComponent": { "name": "QDJVM" } @@ -39597,28 +39577,28 @@ ] }, { - "id": "ReplaceSubstringWithTake", + "id": "JNDIResource", "shortDescription": { - "text": "'substring' call should be replaced with 'take' call" + "text": "JNDI resource opened but not safely closed" }, "fullDescription": { - "text": "Reports calls like 's.substring(0, x)' that can be replaced with 's.take(x)'. Using 'take()' makes your code simpler. The quick-fix replaces the 'substring' call with 'take()'. Example: 'fun foo(s: String) {\n s.substring(0, 10)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.take(10)\n }'", - "markdown": "Reports calls like `s.substring(0, x)` that can be replaced with `s.take(x)`.\n\nUsing `take()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `take()`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, 10)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.take(10)\n }\n" + "text": "Reports JNDI resources that are not safely closed. JNDI resources reported by this inspection include 'javax.naming.InitialContext', and 'javax.naming.NamingEnumeration'. By default, the inspection assumes that the resources can be closed by any method with 'close' or 'cleanup' in its name. Example: 'Object findObject(Properties properties, String name) throws NamingException {\n Context context = new InitialContext(properties); //context is not closed\n return context.lookup(name);\n }' Use the following options to configure the inspection: Whether a JNDI 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 JNDI resources that are not safely closed. JNDI resources reported by this inspection include `javax.naming.InitialContext`, and `javax.naming.NamingEnumeration`.\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 Object findObject(Properties properties, String name) throws NamingException {\n Context context = new InitialContext(properties); //context is not closed\n return context.lookup(name);\n }\n\n\nUse the following options to configure the inspection:\n\n* Whether a JNDI 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": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceSubstringWithTake", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "JNDIResourceOpenedButNotSafelyClosed", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -39630,28 +39610,31 @@ ] }, { - "id": "ReplaceRangeToWithRangeUntil", + "id": "NewObjectEquality", "shortDescription": { - "text": "'rangeTo' or the '..' call should be replaced with '..<'" + "text": "New object is compared using '=='" }, "fullDescription": { - "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to '..<'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with '..<'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0..) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }' The quick-fix wraps call chain into 'asSequence()' and 'toList()': 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()'", - "markdown": "Reports call chain on a `Collection` that should be converted into **Sequence** .\n\nEach `Collection` transforming function (such as `map()` or `filter()`) creates a new\n`Collection` (typically `List` or `Set`) under the hood.\nIn case of multiple consequent calls, and a huge number of items in `Collection`, memory traffic might be significant.\nIn such a case, using `Sequence` is preferred.\n\n**Example:**\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n\nThe quick-fix wraps call chain into `asSequence()` and `toList()`:\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()\n" + "text": "Reports identical 'catch' sections in a single 'try' statement. Collapsing such sections into one multi-catch block reduces code duplication and prevents the situations when one 'catch' section is updated, and another one is not. Example: 'try {\n doSmth();\n }\n catch (IOException e) {\n LOG.error(e);\n }\n catch (URISyntaxException e) {\n LOG.error(e);\n }' A quick-fix is available to make the code more compact: 'try {\n doSmth();\n }\n catch (IOException | URISyntaxException e) {\n LOG.error(e);\n }' This inspection depends on the Java feature 'Multi-catches', which is available since Java 7.", + "markdown": "Reports identical `catch` sections in a single `try` statement.\n\nCollapsing such sections into one *multi-catch* block reduces code duplication and prevents\nthe situations when one `catch` section is updated, and another one is not.\n\n**Example:**\n\n\n try {\n doSmth();\n }\n catch (IOException e) {\n LOG.error(e);\n }\n catch (URISyntaxException e) {\n LOG.error(e);\n }\n\nA quick-fix is available to make the code more compact:\n\n\n try {\n doSmth();\n }\n catch (IOException | URISyntaxException e) {\n LOG.error(e);\n }\n\nThis inspection depends on the Java feature 'Multi-catches', which is available since Java 7." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ConvertCallChainIntoSequence", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "TryWithIdenticalCatches", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level migration aids/Java 7", + "index": 161, "toolComponent": { "name": "QDJVM" } @@ -39696,19 +39679,19 @@ ] }, { - "id": "AddOperatorModifier", + "id": "LambdaCanBeReplacedWithAnonymous", "shortDescription": { - "text": "Function should have 'operator' modifier" + "text": "Lambda can be replaced with anonymous class" }, "fullDescription": { - "text": "Reports a function that matches one of the operator conventions but lacks the 'operator' keyword. By adding the 'operator' modifier, you might allow function consumers to write idiomatic Kotlin code. Example: 'class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }' The quick-fix adds the 'operator' modifier keyword: 'class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }'", - "markdown": "Reports a function that matches one of the operator conventions but lacks the `operator` keyword.\n\nBy adding the `operator` modifier, you might allow function consumers to write idiomatic Kotlin code.\n\n**Example:**\n\n\n class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }\n\nThe quick-fix adds the `operator` modifier keyword:\n\n\n class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }\n" + "text": "Reports lambda expressions that can be replaced with anonymous classes. Expanding lambda expressions to anonymous classes may be useful if you need to implement other methods inside an anonymous class. Example: 's -> System.out.println(s)' After the quick-fix is applied: 'new Consumer() {\n @Override\n public void accept(String s) {\n System.out.println(s);\n }\n}' This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "markdown": "Reports lambda expressions that can be replaced with anonymous classes.\n\n\nExpanding lambda expressions to anonymous classes may be useful if you need to implement other\nmethods inside an anonymous class.\n\nExample:\n\n\n s -> System.out.println(s)\n\nAfter the quick-fix is applied:\n\n new Consumer() {\n @Override\n public void accept(String s) {\n System.out.println(s);\n }\n }\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "AddOperatorModifier", + "suppressToolId": "LambdaCanBeReplacedWithAnonymous", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -39716,8 +39699,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -39729,28 +39712,28 @@ ] }, { - "id": "MayBeConstant", + "id": "RedundantCompareCall", "shortDescription": { - "text": "Might be 'const'" + "text": "Redundant 'compare()' method call" }, "fullDescription": { - "text": "Reports top-level 'val' properties in objects that might be declared as 'const' for better performance and Java interoperability. Example: 'object A {\n val foo = 1\n }' After the quick-fix is applied: 'object A {\n const val foo = 1\n }'", - "markdown": "Reports top-level `val` properties in objects that might be declared as `const` for better performance and Java interoperability.\n\n**Example:**\n\n\n object A {\n val foo = 1\n }\n\nAfter the quick-fix is applied:\n\n\n object A {\n const val foo = 1\n }\n" + "text": "Reports comparisons in which the 'compare' method is superfluous. Example: 'boolean result = Integer.compare(a, b) == 0;' After the quick-fix is applied: 'boolean result = a == b;' New in 2018.2", + "markdown": "Reports comparisons in which the `compare` method is superfluous.\n\nExample:\n\n\n boolean result = Integer.compare(a, b) == 0;\n\nAfter the quick-fix is applied:\n\n\n boolean result = a == b;\n\nNew in 2018.2" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "MayBeConstant", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "RedundantCompareCall", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -39762,28 +39745,28 @@ ] }, { - "id": "ReplaceIsEmptyWithIfEmpty", + "id": "EmptyClass", "shortDescription": { - "text": "'if' condition can be replaced with lambda call" + "text": "Empty class" }, "fullDescription": { - "text": "Reports 'isEmpty', 'isBlank', 'isNotEmpty', or 'isNotBlank' calls in an 'if' statement to assign a default value. The quick-fix replaces the 'if' condition with 'ifEmpty' or 'ifBlank' calls. Example: 'fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }' After the quick-fix is applied: 'fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }' This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.", - "markdown": "Reports `isEmpty`, `isBlank`, `isNotEmpty`, or `isNotBlank` calls in an `if` statement to assign a default value.\n\nThe quick-fix replaces the `if` condition with `ifEmpty` or `ifBlank` calls.\n\n**Example:**\n\n\n fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }\n\nThis inspection only reports if the Kotlin language version of the project or module is 1.3 or higher." + "text": "Reports empty classes and empty Java files. A class is empty if it doesn't contain any fields, methods, constructors, or initializers. Empty classes are sometimes left over after significant changes or refactorings. Example: 'class Example {\n List getList() {\n return new ArrayList<>() {\n\n };\n }\n }' After the quick-fix is applied: 'class Example {\n List getList() {\n return new ArrayList<>();\n }\n }' Configure the inspection: Use the Ignore if annotated by option to specify special annotations. The inspection will ignore the classes marked with these annotations. Use the Ignore class if it is a parametrization of a super type option to ignore classes that parameterize a superclass. For example: 'class MyList extends ArrayList {}' Use the Ignore subclasses of java.lang.Throwable to ignore classes that extend 'java.lang.Throwable'. Use the Comments count as content option to ignore classes that contain comments.", + "markdown": "Reports empty classes and empty Java files.\n\nA class is empty if it doesn't contain any fields, methods, constructors, or initializers. Empty classes are sometimes left over\nafter significant changes or refactorings.\n\n**Example:**\n\n\n class Example {\n List getList() {\n return new ArrayList<>() {\n\n };\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Example {\n List getList() {\n return new ArrayList<>();\n }\n }\n\nConfigure the inspection:\n\n* Use the **Ignore if annotated by** option to specify special annotations. The inspection will ignore the classes marked with these annotations.\n*\n Use the **Ignore class if it is a parametrization of a super type** option to ignore classes that parameterize a superclass. For example:\n\n class MyList extends ArrayList {}\n\n* Use the **Ignore subclasses of java.lang.Throwable** to ignore classes that extend `java.lang.Throwable`.\n* Use the **Comments count as content** option to ignore classes that contain comments." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceIsEmptyWithIfEmpty", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "EmptyClass", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -39795,19 +39778,19 @@ ] }, { - "id": "ReplaceWithImportAlias", + "id": "TextBlockBackwardMigration", "shortDescription": { - "text": "Fully qualified name can be replaced with existing import alias" + "text": "Text block can be replaced with regular string literal" }, "fullDescription": { - "text": "Reports fully qualified names that can be replaced with an existing import alias. Example: 'import foo.Foo as Bar\nfun main() {\n foo.Foo()\n}' After the quick-fix is applied: 'import foo.Foo as Bar\nfun main() {\n Bar()\n}'", - "markdown": "Reports fully qualified names that can be replaced with an existing import alias.\n\n**Example:**\n\n\n import foo.Foo as Bar\n fun main() {\n foo.Foo()\n }\n\nAfter the quick-fix is applied:\n\n\n import foo.Foo as Bar\n fun main() {\n Bar()\n }\n" + "text": "Reports text blocks that can be replaced with regular string literals. This may help to downgrade for backward compatibility with earlier Java versions. Example: 'Object obj = engine.eval(\"\"\"\n function hello() {\n print('\"Hello, world\"');\n }\n\n hello();\n \"\"\");' After the quick fix is applied: 'Object obj = engine.eval(\"function hello() {\\n\" +\n \" print('\\\"Hello, world\\\"');\\n\" +\n \"}\\n\" +\n \"\\n\" +\n \"hello();\\n\");' This inspection depends on the Java feature 'Text block literals', which is available since Java 15. New in 2019.3", + "markdown": "Reports text blocks that can be replaced with regular string literals. This may help to downgrade for backward compatibility with earlier Java versions.\n\n**Example:**\n\n\n Object obj = engine.eval(\"\"\"\n function hello() {\n print('\"Hello, world\"');\n }\n\n hello();\n \"\"\");\n\nAfter the quick fix is applied:\n\n\n Object obj = engine.eval(\"function hello() {\\n\" +\n \" print('\\\"Hello, world\\\"');\\n\" +\n \"}\\n\" +\n \"\\n\" +\n \"hello();\\n\");\n\nThis inspection depends on the Java feature 'Text block literals', which is available since Java 15.\n\nNew in 2019.3" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceWithImportAlias", + "suppressToolId": "TextBlockBackwardMigration", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -39815,8 +39798,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level migration aids/Java 15", + "index": 132, "toolComponent": { "name": "QDJVM" } @@ -39828,28 +39811,28 @@ ] }, { - "id": "SimplifyBooleanWithConstants", + "id": "ConditionalCanBeOptional", "shortDescription": { - "text": "Boolean expression can be simplified" + "text": "Conditional can be replaced with Optional" }, "fullDescription": { - "text": "Reports boolean expression parts that can be reduced to constants. The quick-fix simplifies the condition. Example: 'fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }' After the quick-fix is applied: 'fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }'", - "markdown": "Reports boolean expression parts that can be reduced to constants.\n\nThe quick-fix simplifies the condition.\n\n**Example:**\n\n\n fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }\n" + "text": "Reports null-check conditions and suggests replacing them with 'Optional' chains. Example: 'return str == null ? \"\" : str.trim();' After applying the quick-fix: 'return Optional.ofNullable(str).map(String::trim).orElse(\"\");' While the replacement is not always shorter, it could be helpful for further refactoring (for example, for changing the method return value to 'Optional'). Note that when a not-null branch of the condition returns null, the corresponding mapping step will produce an empty 'Optional' possibly changing the semantics. If it cannot be statically proven that semantics will be preserved, the quick-fix action name will contain the \"(may change semantics)\" notice, and the inspection highlighting will be turned off. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2018.1", + "markdown": "Reports null-check conditions and suggests replacing them with `Optional` chains.\n\nExample:\n\n\n return str == null ? \"\" : str.trim();\n\nAfter applying the quick-fix:\n\n\n return Optional.ofNullable(str).map(String::trim).orElse(\"\");\n\nWhile the replacement is not always shorter, it could be helpful for further refactoring\n(for example, for changing the method return value to `Optional`).\n\nNote that when a not-null branch of the condition returns null, the corresponding mapping step will\nproduce an empty `Optional` possibly changing the semantics. If it cannot be statically\nproven that semantics will be preserved, the quick-fix action name will contain the \"(may change semantics)\"\nnotice, and the inspection highlighting will be turned off.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2018.1" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "SimplifyBooleanWithConstants", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConditionalCanBeOptional", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -39861,28 +39844,28 @@ ] }, { - "id": "OverrideDeprecatedMigration", + "id": "AssignmentToLambdaParameter", "shortDescription": { - "text": "Do not propagate method deprecation through overrides since 1.9" + "text": "Assignment to lambda parameter" }, "fullDescription": { - "text": "Reports a declarations that are propagated by '@Deprecated' annotation that will lead to compilation error since 1.9. Motivation types: Implementation changes are required for implementation design/architectural reasons Inconsistency in the design (things are done differently in different contexts) More details: KT-47902: Do not propagate method deprecation through overrides The quick-fix copies '@Deprecated' annotation from the parent declaration. Example: 'open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n override fun foo() {}\n }' After the quick-fix is applied: 'open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n @Deprecated(\"Don't use\")\n override fun foo() {}\n }' This inspection only reports if the Kotlin language level of the project or module is 1.6 or higher.", - "markdown": "Reports a declarations that are propagated by `@Deprecated` annotation that will lead to compilation error since 1.9.\n\nMotivation types:\n\n* Implementation changes are required for implementation design/architectural reasons\n* Inconsistency in the design (things are done differently in different contexts)\n\n**More details:** [KT-47902: Do not propagate method deprecation through overrides](https://youtrack.jetbrains.com/issue/KT-47902)\n\nThe quick-fix copies `@Deprecated` annotation from the parent declaration.\n\n**Example:**\n\n\n open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n override fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n open class Base {\n @Deprecated(\"Don't use\")\n open fun foo() {}\n }\n\n class Derived : Base() {\n @Deprecated(\"Don't use\")\n override fun foo() {}\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.6 or higher." + "text": "Reports assignment to, or modification of lambda parameters. Although occasionally intended, this construct may be confusing and is often caused by a typo or use of a wrong variable. The quick-fix adds a declaration of a new variable. Example: 'list.forEach(s -> {\n s = s.trim();\n System.out.println(\"String: \" + s);\n });' After the quick-fix is applied: 'list.forEach(s -> {\n String trimmed = s.trim();\n System.out.println(\"String: \" + trimmed);\n });' Use the Ignore if assignment is a transformation of the original parameter option to ignore assignments that modify the parameter value based on its previous value. This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.", + "markdown": "Reports assignment to, or modification of lambda parameters. Although occasionally intended, this construct may be confusing and is often caused by a typo or use of a wrong variable.\n\nThe quick-fix adds a declaration of a new variable.\n\n**Example:**\n\n\n list.forEach(s -> {\n s = s.trim();\n System.out.println(\"String: \" + s);\n });\n\nAfter the quick-fix is applied:\n\n\n list.forEach(s -> {\n String trimmed = s.trim();\n System.out.println(\"String: \" + trimmed);\n });\n\nUse the **Ignore if assignment is a transformation of the original parameter** option to ignore assignments that modify the parameter\nvalue based on its previous value.\n\nThis inspection depends on the Java feature 'Lambda expressions', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, - "level": "error", - "parameters": { - "suppressToolId": "OverrideDeprecatedMigration", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "level": "warning", + "parameters": { + "suppressToolId": "AssignmentToLambdaParameter", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Assignment issues", + "index": 86, "toolComponent": { "name": "QDJVM" } @@ -39894,19 +39877,19 @@ ] }, { - "id": "RedundantModalityModifier", + "id": "SystemGetenv", "shortDescription": { - "text": "Redundant modality modifier" + "text": "Call to 'System.getenv()'" }, "fullDescription": { - "text": "Reports the modality modifiers that match the default modality of an element ('final' for most elements, 'open' for members with an 'override'). Example: 'final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }' After the quick-fix is applied: 'class Foo\n\n open class Bar : Comparable {\n override fun compareTo(other: Bar): Int = 0\n }'", - "markdown": "Reports the modality modifiers that match the default modality of an element (`final` for most elements, `open` for members with an `override`).\n\n**Example:**\n\n\n final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo\n\n open class Bar : Comparable {\n override fun compareTo(other: Bar): Int = 0\n }\n" + "text": "Reports calls to 'System.getenv()'. Calls to 'System.getenv()' are inherently unportable.", + "markdown": "Reports calls to `System.getenv()`. Calls to `System.getenv()` are inherently unportable." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantModalityModifier", + "suppressToolId": "CallToSystemGetenv", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -39914,8 +39897,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Portability", + "index": 94, "toolComponent": { "name": "QDJVM" } @@ -39927,19 +39910,19 @@ ] }, { - "id": "SimplifyAssertNotNull", + "id": "ConstantExpression", "shortDescription": { - "text": "'assert' call can be replaced with '!!' or '?:'" + "text": "Constant expression can be evaluated" }, "fullDescription": { - "text": "Reports 'assert' calls that check a not null value of the declared variable. Using '!!' or '?:' makes your code simpler. The quick-fix replaces 'assert' with '!!' or '?:' operator in the variable initializer. Example: 'fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }' After the quick-fix is applied: 'fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }'", - "markdown": "Reports `assert` calls that check a not null value of the declared variable.\n\nUsing `!!` or `?:` makes your code simpler.\n\nThe quick-fix replaces `assert` with `!!` or `?:` operator in the variable initializer.\n\n**Example:**\n\n\n fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }\n" + "text": "Reports constant expressions, whose value can be evaluated statically, and suggests replacing them with their actual values. For example, you will be prompted to replace '2 + 2' with '4', or 'Math.sqrt(9.0)' with '3.0'. New in 2018.1", + "markdown": "Reports constant expressions, whose value can be evaluated statically, and suggests replacing them with their actual values. For example, you will be prompted to replace `2 + 2` with `4`, or `Math.sqrt(9.0)` with `3.0`.\n\nNew in 2018.1" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "SimplifyAssertNotNull", + "suppressToolId": "ConstantExpression", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -39947,8 +39930,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -39960,19 +39943,19 @@ ] }, { - "id": "ConvertNaNEquality", + "id": "PackageDotHtmlMayBePackageInfo", "shortDescription": { - "text": "Convert equality check with 'NaN' to 'isNaN' call" + "text": "'package.html' may be converted to 'package-info.java'" }, "fullDescription": { - "text": "Reports an equality check with 'Float.NaN' or 'Double.NaN' that should be replaced with an 'isNaN()' check. According to IEEE 754, equality check against NaN always returns 'false', even for 'NaN == NaN'. Therefore, such a check is likely to be a mistake. The quick-fix replaces comparison with 'isNaN()' check that uses a different comparison technique and handles 'NaN' values correctly. Example: 'fun check(value: Double): Boolean {\n return Double.NaN == value\n }' After the fix is applied: 'fun check(value: Double): Boolean {\n return value.isNaN()\n }'", - "markdown": "Reports an equality check with `Float.NaN` or `Double.NaN` that should be replaced with an `isNaN()` check.\n\n\nAccording to IEEE 754, equality check against NaN always returns `false`, even for `NaN == NaN`.\nTherefore, such a check is likely to be a mistake.\n\nThe quick-fix replaces comparison with `isNaN()` check that uses a different comparison technique and handles `NaN` values correctly.\n\n**Example:**\n\n\n fun check(value: Double): Boolean {\n return Double.NaN == value\n }\n\nAfter the fix is applied:\n\n\n fun check(value: Double): Boolean {\n return value.isNaN()\n }\n" + "text": "Reports any 'package.html' files which are used for documenting packages. Since JDK 1.5, it is recommended that you use 'package-info.java' files instead, as such files can also contain package annotations. This way, package-info.java becomes a sole repository for package level annotations and documentation. Example: 'package.html' '\n \n Documentation example.\n \n' After the quick-fix is applied: 'package-info.java' '/**\n * Documentation example.\n */\npackage com.sample;'", + "markdown": "Reports any `package.html` files which are used for documenting packages.\n\nSince JDK 1.5, it is recommended that you use `package-info.java` files instead, as such\nfiles can also contain package annotations. This way, package-info.java becomes a\nsole repository for package level annotations and documentation.\n\nExample: `package.html`\n\n\n \n \n Documentation example.\n \n \n\nAfter the quick-fix is applied: `package-info.java`\n\n\n /**\n * Documentation example.\n */\n package com.sample;\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConvertNaNEquality", + "suppressToolId": "PackageDotHtmlMayBePackageInfo", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -39980,8 +39963,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -39993,28 +39976,28 @@ ] }, { - "id": "ReplaceManualRangeWithIndicesCalls", + "id": "LongLiteralsEndingWithLowercaseL", "shortDescription": { - "text": "Range can be converted to indices or iteration" + "text": "'long' literal ending with 'l' instead of 'L'" }, "fullDescription": { - "text": "Reports 'until' and 'rangeTo' operators that can be replaced with 'Collection.indices' or iteration over collection inside 'for' loop. Using syntactic sugar makes your code simpler. The quick-fix replaces the manual range with the corresponding construction. Example: 'fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }'", - "markdown": "Reports `until` and `rangeTo` operators that can be replaced with `Collection.indices` or iteration over collection inside `for` loop.\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces the manual range with the corresponding construction.\n\n**Example:**\n\n\n fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }\n" + "text": "Reports 'long' literals ending with lowercase 'l'. These literals may be confusing, as the lowercase 'l' looks very similar to a literal '1' (one). Example: 'long nights = 100l;' After the quick-fix is applied: 'long nights = 100L;'", + "markdown": "Reports `long` literals ending with lowercase 'l'. These literals may be confusing, as the lowercase 'l' looks very similar to a literal '1' (one).\n\n**Example:**\n\n\n long nights = 100l;\n\nAfter the quick-fix is applied:\n\n\n long nights = 100L;\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ReplaceManualRangeWithIndicesCalls", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "LongLiteralEndingWithLowercaseL", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -40026,19 +40009,19 @@ ] }, { - "id": "KotlinLoggerInitializedWithForeignClass", + "id": "RedundantArrayCreation", "shortDescription": { - "text": "Logger initialized with foreign class" + "text": "Redundant array creation" }, "fullDescription": { - "text": "Reports 'Logger' instances initialized with a class literal other than the class the 'Logger' resides in. This can happen when copy-pasting from another class. It may result in logging events under an unexpected category and incorrect filtering. Use the inspection options to specify the logger factory classes and methods recognized by this inspection. Example: 'class AnotherService\nclass MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n}' After the quick-fix is applied: 'class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n}'", - "markdown": "Reports `Logger` instances initialized with a class literal other than the class the `Logger` resides in.\n\n\nThis can happen when copy-pasting from another class.\nIt may result in logging events under an unexpected category and incorrect filtering.\n\n\nUse the inspection options to specify the logger factory classes and methods recognized by this inspection.\n\n**Example:**\n\n\n class AnotherService\n class MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n }\n" + "text": "Reports arrays that are created specifically to be passed as a varargs parameter. Example: 'Arrays.asList(new String[]{\"Hello\", \"world\"})' The quick-fix replaces the array initializer with individual arguments: 'Arrays.asList(\"Hello\", \"world\")'", + "markdown": "Reports arrays that are created specifically to be passed as a varargs parameter.\n\nExample:\n\n`Arrays.asList(new String[]{\"Hello\", \"world\"})`\n\nThe quick-fix replaces the array initializer with individual arguments:\n\n`Arrays.asList(\"Hello\", \"world\")`" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KotlinLoggerInitializedWithForeignClass", + "suppressToolId": "RedundantArrayCreation", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40046,8 +40029,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Logging", - "index": 203, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -40059,28 +40042,32 @@ ] }, { - "id": "RedundantAsSequence", + "id": "NonShortCircuitBoolean", "shortDescription": { - "text": "Redundant 'asSequence' call" + "text": "Non-short-circuit boolean expression" }, "fullDescription": { - "text": "Reports redundant 'asSequence()' call that can never have a positive performance effect. 'asSequence()' speeds up collection processing that includes multiple operations because it performs operations lazily and doesn't create intermediate collections. However, if a terminal operation (such as 'toList()') is used right after 'asSequence()', this doesn't give you any positive performance effect. Example: 'fun test(list: List) {\n list.asSequence().last()\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.last()\n }'", - "markdown": "Reports redundant `asSequence()` call that can never have a positive performance effect.\n\n\n`asSequence()` speeds up collection processing that includes multiple operations because it performs operations lazily\nand doesn't create intermediate collections.\n\n\nHowever, if a terminal operation (such as `toList()`) is used right after `asSequence()`, this doesn't give\nyou any positive performance effect.\n\n**Example:**\n\n\n fun test(list: List) {\n list.asSequence().last()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.last()\n }\n" + "text": "Reports usages of the non-short-circuit forms of boolean 'and' and 'or' ('&', '|', '&=' and '|='). Although the non-short-circuit versions are occasionally useful, in most cases the short-circuit forms ('&&' and '||') are intended and such unintentional usages may lead to subtle bugs. A quick-fix is suggested to use the short-circuit versions. Example: 'void foo(boolean x, boolean y, boolean z) {\n if (x | y) { x |= z; }\n }' After the quick-fix is applied: 'void foo(boolean x, boolean y) {\n if (x || y) { x = x || z; }\n }'", + "markdown": "Reports usages of the non-short-circuit forms of boolean 'and' and 'or' (`&`, `|`, `&=` and `|=`). Although the non-short-circuit versions are occasionally useful, in most cases the short-circuit forms (`&&` and `||`) are intended and such unintentional usages may lead to subtle bugs.\n\n\nA quick-fix is suggested to use the short-circuit versions.\n\n**Example:**\n\n\n void foo(boolean x, boolean y, boolean z) {\n if (x | y) { x |= z; }\n }\n\nAfter the quick-fix is applied:\n\n\n void foo(boolean x, boolean y) {\n if (x || y) { x = x || z; }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantAsSequence", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NonShortCircuitBooleanExpression", + "cweIds": [ + 480, + 691 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -40092,28 +40079,28 @@ ] }, { - "id": "RemoveToStringInStringTemplate", + "id": "ThrowablePrintedToSystemOut", "shortDescription": { - "text": "Redundant call to 'toString()' in string template" + "text": "'Throwable' printed to 'System.out'" }, "fullDescription": { - "text": "Reports calls to 'toString()' in string templates that can be safely removed. Example: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }'", - "markdown": "Reports calls to `toString()` in string templates that can be safely removed.\n\n**Example:**\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }\n\nAfter the quick-fix is applied:\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }\n" + "text": "Reports calls to 'System.out.println()' with an exception as an argument. Using print statements for logging exceptions hides the stack trace from you, which can complicate the investigation of the problem. It is recommended that you use logger instead. Calls to 'System.out.print()', 'System.err.println()', and 'System.err.print()' with an exception argument are also reported. It is better to use a logger to log exceptions instead. The provided quick-fix supports SLF4J and Log4j 2. It replaces 'System.out.println()' call with log calls Example: 'try {\n foo();\n } catch (Exception e) {\n System.out.println(e);\n }' After the quick-fix is applied: 'try {\n foo();\n } catch (Exception e) {\n log.error(\"e: \", e);\n }' Use the Log method for fix option to specify a method which it is used to log a message.", + "markdown": "Reports calls to `System.out.println()` with an exception as an argument.\n\nUsing print statements for logging exceptions hides the stack trace from you, which can complicate the investigation of the problem.\nIt is recommended that you use logger instead.\n\nCalls to `System.out.print()`, `System.err.println()`, and `System.err.print()` with an exception argument are also\nreported. It is better to use a logger to log exceptions instead.\n\nThe provided quick-fix supports **SLF4J** and **Log4j 2** .\nIt replaces `System.out.println()` call with log calls\n\n**Example:**\n\n\n try {\n foo();\n } catch (Exception e) {\n System.out.println(e);\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n foo();\n } catch (Exception e) {\n log.error(\"e: \", e);\n }\n\n\nUse the **Log method for fix** option to specify a method which it is used to log a message." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RemoveToStringInStringTemplate", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ThrowablePrintedToSystemOut", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -40125,19 +40112,19 @@ ] }, { - "id": "KotlinUnusedImport", + "id": "RedundantRecordConstructor", "shortDescription": { - "text": "Unused import directive" + "text": "Redundant record constructor" }, "fullDescription": { - "text": "Reports redundant 'import' statements. Default and unused imports can be safely removed. Example: 'import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }'", - "markdown": "Reports redundant `import` statements.\n\nDefault and unused imports can be safely removed.\n\n**Example:**\n\n\n import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }\n" + "text": "Reports redundant constructors declared inside Java records. Example 1: 'record Point(int x, int y) {\n public Point {} // could be removed\n }\n \n record Point(int x, int y) {\n public Point(int x, int y) { // could be removed\n this.x = x;\n this.y = y;\n }\n }' The quick-fix removes the redundant constructors. Example 2: '// could be converted to compact constructor\n record Range(int from, int to) {\n public Range(int from, int to) {\n if (from > to) throw new IllegalArgumentException();\n this.from = from;\n this.to = to;\n }\n }' The quick-fix converts this code into a compact constructor. This inspection depends on the Java feature 'Records', which is available since Java 16. New in 2020.1", + "markdown": "Reports redundant constructors declared inside Java records.\n\n**Example 1:**\n\n\n record Point(int x, int y) {\n public Point {} // could be removed\n }\n \n record Point(int x, int y) {\n public Point(int x, int y) { // could be removed\n this.x = x;\n this.y = y;\n }\n }\n\nThe quick-fix removes the redundant constructors.\n\n**Example 2:**\n\n\n // could be converted to compact constructor\n record Range(int from, int to) {\n public Range(int from, int to) {\n if (from > to) throw new IllegalArgumentException();\n this.from = from;\n this.to = to;\n }\n }\n\nThe quick-fix converts this code into a compact constructor.\n\nThis inspection depends on the Java feature 'Records', which is available since Java 16.\n\nNew in 2020.1" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnusedImport", + "suppressToolId": "RedundantRecordConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40145,8 +40132,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -40158,19 +40145,19 @@ ] }, { - "id": "CanBePrimaryConstructorProperty", + "id": "AmbiguousMethodCall", "shortDescription": { - "text": "Property is explicitly assigned to constructor parameter" + "text": "Call to inherited method looks like call to local method" }, "fullDescription": { - "text": "Reports properties that are explicitly assigned to primary constructor parameters. Properties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability. Example: 'class User(name: String) {\n val name = name\n }' The quick-fix joins the parameter and property declaration into a primary constructor parameter: 'class User(val name: String) {\n }'", - "markdown": "Reports properties that are explicitly assigned to primary constructor parameters.\n\nProperties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability.\n\n**Example:**\n\n\n class User(name: String) {\n val name = name\n }\n\nThe quick-fix joins the parameter and property declaration into a primary constructor parameter:\n\n\n class User(val name: String) {\n }\n" + "text": "Reports calls to a superclass method from an anonymous, inner or local class, if a method with the same signature exists in the code surrounding the class. In this case it may seem that a method from the surrounding code is called, when in fact it is a call to a method from the superclass. To clarify the intent of the code, it is recommended to add an explicit 'super' qualifier to the method call. Example: 'class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n ambiguous(); //warning\n }\n }\n }' After the quick-fix is applied: 'class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n super.ambiguous();\n }\n }\n }'", + "markdown": "Reports calls to a superclass method from an anonymous, inner or local class, if a method with the same signature exists in the code surrounding the class. In this case it may seem that a method from the surrounding code is called, when in fact it is a call to a method from the superclass.\n\n\nTo clarify the intent of the code, it is recommended to add an explicit\n`super` qualifier to the method call.\n\n**Example:**\n\n\n class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n ambiguous(); //warning\n }\n }\n }\n \nAfter the quick-fix is applied:\n\n\n class Parent {\n void ambiguous(){}\n }\n\n class Example {\n void ambiguous(){}\n\n class Inner extends Parent {\n void example(){\n super.ambiguous();\n }\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "CanBePrimaryConstructorProperty", + "suppressToolId": "AmbiguousMethodCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40178,8 +40165,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Visibility", + "index": 98, "toolComponent": { "name": "QDJVM" } @@ -40191,28 +40178,28 @@ ] }, { - "id": "JavaMapForEach", + "id": "StaticInheritance", "shortDescription": { - "text": "Java Map.forEach method call should be replaced with Kotlin's forEach" + "text": "Static inheritance" }, "fullDescription": { - "text": "Reports a Java Map.'forEach' method call that can be replaced with Kotlin's forEach. Example: 'fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}' The quick-fix adds parentheses: 'fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}'", - "markdown": "Reports a Java Map.`forEach` method call that can be replaced with Kotlin's **forEach** .\n\n**Example:**\n\n\n fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n\nThe quick-fix adds parentheses:\n\n\n fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n" + "text": "Reports interfaces that are implemented only to provide access to constants. This kind of inheritance is often confusing and may hide important dependency information.", + "markdown": "Reports interfaces that are implemented only to provide access to constants. This kind of inheritance is often confusing and may hide important dependency information." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "JavaMapForEach", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "StaticInheritance", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Inheritance issues", + "index": 151, "toolComponent": { "name": "QDJVM" } @@ -40224,28 +40211,28 @@ ] }, { - "id": "RedundantObjectTypeCheck", + "id": "RedundantUnmodifiable", "shortDescription": { - "text": "Non-idiomatic 'is' type check for an object" + "text": "Redundant usage of unmodifiable collection wrappers" }, "fullDescription": { - "text": "Reports non-idiomatic 'is' type checks for an object. It's recommended to replace such checks with reference comparison. Example: 'object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }' After the quick-fix is applied: 'object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }'", - "markdown": "Reports non-idiomatic `is` type checks for an object.\n\nIt's recommended to replace such checks with reference comparison.\n\n**Example:**\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }\n\nAfter the quick-fix is applied:\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }\n" + "text": "Reports redundant calls to unmodifiable collection wrappers from the 'Collections' class. If the argument that is passed to an unmodifiable collection wrapper is already immutable, such a wrapping becomes redundant. Example: 'List x = Collections.unmodifiableList(Collections.singletonList(\"abc\"));' After the quick-fix is applied: 'List x = Collections.singletonList(\"abc\");' In order to detect the methods that return unmodifiable collections, the inspection uses the 'org.jetbrains.annotations.Unmodifiable' and 'org.jetbrains.annotations.UnmodifiableView' annotations. Use them to extend the inspection to your own unmodifiable collection wrappers. New in 2020.3", + "markdown": "Reports redundant calls to unmodifiable collection wrappers from the `Collections` class.\n\nIf the argument that is passed to an unmodifiable\ncollection wrapper is already immutable, such a wrapping becomes redundant.\n\nExample:\n\n\n List x = Collections.unmodifiableList(Collections.singletonList(\"abc\"));\n\nAfter the quick-fix is applied:\n\n\n List x = Collections.singletonList(\"abc\");\n\nIn order to detect the methods that return unmodifiable collections, the\ninspection uses the `org.jetbrains.annotations.Unmodifiable`\nand `org.jetbrains.annotations.UnmodifiableView` annotations.\nUse them to extend the inspection to your own unmodifiable collection\nwrappers.\n\nNew in 2020.3" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantObjectTypeCheck", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "RedundantUnmodifiable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -40257,19 +40244,23 @@ ] }, { - "id": "SuspendFunctionOnCoroutineScope", + "id": "ConstantValue", "shortDescription": { - "text": "Ambiguous coroutineContext due to CoroutineScope receiver of suspend function" + "text": "Constant values" }, "fullDescription": { - "text": "Reports calls and accesses of 'CoroutineScope' extensions or members inside suspend functions with 'CoroutineScope' receiver. When a function is 'suspend' and has 'CoroutineScope' receiver, it has ambiguous access to 'CoroutineContext' via 'kotlin.coroutines.coroutineContext' and via 'CoroutineScope.coroutineContext', and two these contexts are different in general. To improve this situation, one can wrap suspicious call inside 'coroutineScope { ... }' or get rid of 'CoroutineScope' function receiver.", - "markdown": "Reports calls and accesses of `CoroutineScope` extensions or members inside suspend functions with `CoroutineScope` receiver.\n\nWhen a function is `suspend` and has `CoroutineScope` receiver,\nit has ambiguous access to `CoroutineContext` via `kotlin.coroutines.coroutineContext` and via `CoroutineScope.coroutineContext`,\nand two these contexts are different in general.\n\n\nTo improve this situation, one can wrap suspicious call inside `coroutineScope { ... }` or\nget rid of `CoroutineScope` function receiver." + "text": "Reports expressions and conditions that always produce the same result, like true, false, null, or zero. Such expressions could be replaced with the corresponding constant value. Very often though they signal about a bug in the code. Examples: '// always true\n // root cause: || is used instead of &&\n if (x > 0 || x < 10) {}\n\n System.out.println(str.trim());\n // always false\n // root cause: variable was dereferenced before null-check\n if (str == null) {}' The inspection behavior may be controlled by a number of annotations, such as nullability annotations, '@Contract' annotation, '@Range' annotation and so on. Configure the inspection: Use the Don't report assertions with condition statically proven to be always true option to avoid reporting assertions that were statically proven to be always true. This also includes conditions like 'if (alwaysFalseCondition) throw new IllegalArgumentException();'. Use the Ignore assert statements option to control how the inspection treats 'assert' statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode). Use the Warn when constant is stored in variable option to display warnings when variable is used, whose value is known to be a constant. Before IntelliJ IDEA 2022.3, this inspection was part of \"Constant Conditions & Exceptions\" inspection. Now, it split into two inspections: \"Constant Values\" and \"Nullability and data flow problems\".", + "markdown": "Reports expressions and conditions that always produce the same result, like true, false, null, or zero. Such expressions could be replaced with the corresponding constant value. Very often though they signal about a bug in the code.\n\nExamples:\n\n // always true\n // root cause: || is used instead of &&\n if (x > 0 || x < 10) {}\n\n System.out.println(str.trim());\n // always false\n // root cause: variable was dereferenced before null-check\n if (str == null) {}\n\n\nThe inspection behavior may be controlled by a number of annotations, such as\n[nullability](https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html) annotations,\n[@Contract](https://www.jetbrains.com/help/idea/contract-annotations.html) annotation,\n`@Range` annotation and so on.\n\nConfigure the inspection:\n\n* Use the **Don't report assertions with condition statically proven to be always true** option to avoid reporting assertions that were statically proven to be always true. This also includes conditions like `if (alwaysFalseCondition) throw new IllegalArgumentException();`.\n* Use the **Ignore assert statements** option to control how the inspection treats `assert` statements. By default, the option is disabled, which means that the assertions are assumed to be executed (-ea mode). If the option is enabled, the assertions will be completely ignored (-da mode).\n* Use the **Warn when constant is stored in variable** option to display warnings when variable is used, whose value is known to be a constant.\n\n\nBefore IntelliJ IDEA 2022.3, this inspection was part of \"Constant Conditions \\& Exceptions\" inspection. Now, it split into two inspections:\n\"Constant Values\" and \"Nullability and data flow problems\"." }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "SuspendFunctionOnCoroutineScope", + "suppressToolId": "ConstantValue", + "cweIds": [ + 570, + 571 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40277,8 +40268,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -40290,28 +40281,28 @@ ] }, { - "id": "DifferentMavenStdlibVersion", + "id": "CastCanBeReplacedWithVariable", "shortDescription": { - "text": "Library and maven plugin versions are different" + "text": "Cast can be replaced with variable" }, "fullDescription": { - "text": "Reports different Kotlin stdlib and compiler versions. Using different versions of the Kotlin compiler and the standard library can lead to unpredictable runtime problems and should be avoided.", - "markdown": "Reports different Kotlin stdlib and compiler versions.\n\nUsing different versions of the Kotlin compiler and the standard library can lead to unpredictable\nruntime problems and should be avoided." + "text": "Reports type cast operations that can be replaced with existing local or pattern variables with the same value. Example: 'void foo(Object obj) {\n String s = (String) obj;\n System.out.println(((String) obj).trim());\n }' After the quick-fix is applied: 'void foo(Object obj) {\n String s = (String) obj;\n System.out.println(s.trim());\n }' New in 2022.3", + "markdown": "Reports type cast operations that can be replaced with existing local or pattern variables with the same value.\n\nExample:\n\n\n void foo(Object obj) {\n String s = (String) obj;\n System.out.println(((String) obj).trim());\n }\n\nAfter the quick-fix is applied:\n\n\n void foo(Object obj) {\n String s = (String) obj;\n System.out.println(s.trim());\n }\n\nNew in 2022.3" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "DifferentMavenStdlibVersion", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "CastCanBeReplacedWithVariable", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin", - "index": 2, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -40323,28 +40314,28 @@ ] }, { - "id": "ImplicitNullableNothingType", + "id": "Convert2Diamond", "shortDescription": { - "text": "Implicit 'Nothing?' type" + "text": "Explicit type can be replaced with '<>'" }, "fullDescription": { - "text": "Reports variables and functions with the implicit Nothing? type. Example: 'fun foo() = null' The quick fix specifies the return type explicitly: 'fun foo(): Nothing? = null'", - "markdown": "Reports variables and functions with the implicit **Nothing?** type.\n\n**Example:**\n\n\n fun foo() = null\n\nThe quick fix specifies the return type explicitly:\n\n\n fun foo(): Nothing? = null\n" + "text": "Reports 'new' expressions with type arguments that can be replaced a with diamond type '<>'. Example: 'List list = new ArrayList(); // reports array list type argument' After the quick-fix is applied: 'List list = new ArrayList<>();' This inspection depends on the Java feature 'Diamond types', which is available since Java 7.", + "markdown": "Reports `new` expressions with type arguments that can be replaced a with diamond type `<>`.\n\nExample:\n\n\n List list = new ArrayList(); // reports array list type argument\n\nAfter the quick-fix is applied:\n\n\n List list = new ArrayList<>();\n\nThis inspection depends on the Java feature 'Diamond types', which is available since Java 7." }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "ImplicitNullableNothingType", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "Convert2Diamond", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Java language level migration aids/Java 7", + "index": 161, "toolComponent": { "name": "QDJVM" } @@ -40356,28 +40347,28 @@ ] }, { - "id": "ReplaceAssociateFunction", + "id": "VarargParameter", "shortDescription": { - "text": "'associate' can be replaced with 'associateBy' or 'associateWith'" + "text": "Varargs method" }, "fullDescription": { - "text": "Reports calls to 'associate()' and 'associateTo()' that can be replaced with 'associateBy()' or 'associateWith()'. Both functions accept a transformer function applied to elements of a given sequence or collection (as a receiver). The pairs are then used to build the resulting 'Map'. Given the transformer refers to 'it', the 'associate[To]()' call can be replaced with more performant 'associateBy()' or 'associateWith()'. Examples: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }' After the quick-fix is applied: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }'", - "markdown": "Reports calls to `associate()` and `associateTo()` that can be replaced with `associateBy()` or `associateWith()`.\n\n\nBoth functions accept a transformer function applied to elements of a given sequence or collection (as a receiver).\nThe pairs are then used to build the resulting `Map`.\n\n\nGiven the transformer refers to `it`, the `associate[To]()` call can be replaced with more performant `associateBy()`\nor `associateWith()`.\n\n**Examples:**\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }\n\nAfter the quick-fix is applied:\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }\n" + "text": "Reports methods that accept an arbitrary number of parameters (also known as varargs methods). Example: 'enum EnumConstants {\n A(null), B, C;\n\n EnumConstants(String... ss) {}\n}' A quick-fix is available to replace a variable argument parameter with an equivalent array parameter. Relevant arguments in method calls are wrapped in an array initializer expression. After the quick-fix is applied: 'enum EnumConstants {\n A(null), B(new String[]{}), C(new String[]{});\n\n EnumConstants(String[] ss) {}\n}' Varargs method appeared in Java 5. This inspection can help to downgrade for backward compatibility with earlier Java versions.", + "markdown": "Reports methods that accept an arbitrary number of parameters (also known as varargs methods).\n\n**Example:**\n\n\n enum EnumConstants {\n A(null), B, C;\n\n EnumConstants(String... ss) {}\n }\n\nA quick-fix is available to replace a variable argument\nparameter with an equivalent array parameter. Relevant arguments in method calls are wrapped in an array initializer expression.\nAfter the quick-fix is applied:\n\n\n enum EnumConstants {\n A(null), B(new String[]{}), C(new String[]{});\n\n EnumConstants(String[] ss) {}\n }\n\n\n*Varargs method* appeared in Java 5.\nThis inspection can help to downgrade for backward compatibility with earlier Java versions." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceAssociateFunction", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "VariableArgumentMethod", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level issues", + "index": 147, "toolComponent": { "name": "QDJVM" } @@ -40389,28 +40380,28 @@ ] }, { - "id": "ObsoleteExperimentalCoroutines", + "id": "ArrayLengthInLoopCondition", "shortDescription": { - "text": "Experimental coroutines usages are deprecated since 1.3" + "text": "Array.length in loop condition" }, "fullDescription": { - "text": "Reports code that uses experimental coroutines. Such usages are incompatible with Kotlin 1.3+ and should be updated.", - "markdown": "Reports code that uses experimental coroutines.\n\nSuch usages are incompatible with Kotlin 1.3+ and should be updated." + "text": "Reports accesses to the '.length' property of an array in the condition part of a loop statement. In highly resource constrained environments, such calls may have adverse performance implications. 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 foo(Object[] x) {\n for (int i = 0; i < x.length; i++) { /**/ }\n }'", + "markdown": "Reports accesses to the `.length` property of an array in the condition part of a loop statement. In highly resource constrained environments, such calls may have adverse performance implications.\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 foo(Object[] x) {\n for (int i = 0; i < x.length; i++) { /**/ }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "ObsoleteExperimentalCoroutines", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "ArrayLengthInLoopCondition", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -40422,28 +40413,28 @@ ] }, { - "id": "LiftReturnOrAssignment", + "id": "CheckForOutOfMemoryOnLargeArrayAllocation", "shortDescription": { - "text": "Return or assignment can be lifted out" + "text": "Large array allocation with no OutOfMemoryError check" }, "fullDescription": { - "text": "Reports 'if', 'when', and 'try' statements that can be converted to expressions by lifting the 'return' statement or an assignment out. Example: 'fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }' After the quick-fix is applied: 'fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }' If you would like this inspection to highlight more complex code with multi-statement branches, uncheck the option \"Report only if each branch is a single statement\".", - "markdown": "Reports `if`, `when`, and `try` statements that can be converted to expressions by lifting the `return` statement or an assignment out.\n\n**Example:**\n\n\n fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }\n\nIf you would like this inspection to highlight more complex code with multi-statement branches, uncheck the option \"Report only if each branch is a single statement\"." + "text": "Reports large array allocations which do not check for 'java.lang.OutOfMemoryError'. In memory constrained environments, allocations of large data objects should probably be checked for memory depletion. 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. Use the option to specify the maximum number of elements to allow in unchecked array allocations.", + "markdown": "Reports large array allocations which do not check for `java.lang.OutOfMemoryError`. In memory constrained environments, allocations of large data objects should probably be checked for memory depletion.\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\nUse the option to specify the maximum number of elements to allow in unchecked array allocations." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "LiftReturnOrAssignment", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "CheckForOutOfMemoryOnLargeArrayAllocation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Performance/Embedded", + "index": 171, "toolComponent": { "name": "QDJVM" } @@ -40455,28 +40446,28 @@ ] }, { - "id": "SimplifyWhenWithBooleanConstantCondition", + "id": "ClassWithoutConstructor", "shortDescription": { - "text": "Simplifiable 'when'" + "text": "Class without constructor" }, "fullDescription": { - "text": "Reports 'when' expressions with the constant 'true' or 'false' branches. Simplify \"when\" quick-fix can be used to amend the code automatically. Examples: 'fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }'", - "markdown": "Reports `when` expressions with the constant `true` or `false` branches.\n\n**Simplify \"when\"** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }\n" + "text": "Reports classes without constructors. Some coding standards prohibit such classes.", + "markdown": "Reports classes without constructors.\n\nSome coding standards prohibit such classes." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SimplifyWhenWithBooleanConstantCondition", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ClassWithoutConstructor", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/JavaBeans issues", + "index": 141, "toolComponent": { "name": "QDJVM" } @@ -40488,19 +40479,19 @@ ] }, { - "id": "KotlinConstantConditions", + "id": "PackageInfoWithoutPackage", "shortDescription": { - "text": "Constant conditions" + "text": "'package-info.java' without 'package' statement" }, "fullDescription": { - "text": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable 'when' branches and some expressions that are statically known to fail always. Examples: 'fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n}\nfun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n}' Uncheck the \"Warn when constant is stored in variable\" option to avoid reporting of variables having constant values not in conditions. New in 2021.3", - "markdown": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable `when` branches and some expressions that are statically known to fail always.\n\nExamples:\n\n\n fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n }\n fun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n }\n\n\nUncheck the \"Warn when constant is stored in variable\" option to avoid reporting of variables having constant values not in conditions.\n\nNew in 2021.3" + "text": "Reports 'package-info.java' files without a 'package' statement. The Javadoc tool considers such files documentation for the default package even when the file is located somewhere else.", + "markdown": "Reports `package-info.java` files without a `package` statement.\n\n\nThe Javadoc tool considers such files documentation for the default package even when the file is located somewhere else." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KotlinConstantConditions", + "suppressToolId": "PackageInfoWithoutPackage", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40508,8 +40499,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Javadoc", + "index": 77, "toolComponent": { "name": "QDJVM" } @@ -40521,28 +40512,28 @@ ] }, { - "id": "ForEachParameterNotUsed", + "id": "NonSerializableWithSerializationMethods", "shortDescription": { - "text": "Iterated elements are not used in forEach" + "text": "Non-serializable class with 'readObject()' or 'writeObject()'" }, "fullDescription": { - "text": "Reports 'forEach' loops that do not use iterable values. Example: 'listOf(1, 2, 3).forEach { }' The quick fix introduces anonymous parameter in the 'forEach' section: 'listOf(1, 2, 3).forEach { _ -> }'", - "markdown": "Reports `forEach` loops that do not use iterable values.\n\n**Example:**\n\n\n listOf(1, 2, 3).forEach { }\n\nThe quick fix introduces anonymous parameter in the `forEach` section:\n\n\n listOf(1, 2, 3).forEach { _ -> }\n" + "text": "Reports non-'Serializable' classes that define 'readObject()' or 'writeObject()' methods. Such methods in that context normally indicate an error. Example: 'public class SampleClass {\n private void readObject(ObjectInputStream str) {}\n private void writeObject(ObjectOutputStream str) {}\n }'", + "markdown": "Reports non-`Serializable` classes that define `readObject()` or `writeObject()` methods. Such methods in that context normally indicate an error.\n\n**Example:**\n\n\n public class SampleClass {\n private void readObject(ObjectInputStream str) {}\n private void writeObject(ObjectOutputStream str) {}\n }\n" }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "ForEachParameterNotUsed", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NonSerializableClassWithSerializationMethods", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -40554,19 +40545,19 @@ ] }, { - "id": "LeakingThis", + "id": "CloneReturnsClassType", "shortDescription": { - "text": "Leaking 'this' in constructor" + "text": "'clone()' should have return type equal to the class it contains" }, "fullDescription": { - "text": "Reports unsafe operations with 'this' during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using 'this' as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out. Example: 'abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }'", - "markdown": "Reports unsafe operations with `this` during object construction including:\n\n* Accessing a non-final property during class initialization: from a constructor or property initialization\n* Calling a non-final function during class initialization\n* Using `this` as a function argument in a constructor of a non-final class\n\n\nIf other classes inherit from the given class,\nthey may not be fully initialized at the moment when an unsafe operation is carried out.\n\n**Example:**\n\n\n abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }\n" + "text": "Reports 'clone()' methods with return types different from the class they're located in. Often a 'clone()' method will have a return type of 'java.lang.Object', which makes it harder to use by its clients. Effective Java (the second and third editions) recommends making the return type of the 'clone()' method the same as the class type of the object it returns. Example: 'class Foo implements Cloneable {\n public Object clone() {\n try {\n return super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }' After the quick-fix is applied: 'class Foo implements Cloneable {\n public Foo clone() {\n try {\n return (Foo)super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }'", + "markdown": "Reports `clone()` methods with return types different from the class they're located in.\n\nOften a `clone()` method will have a return type of `java.lang.Object`, which makes it harder to use by its clients.\n*Effective Java* (the second and third editions) recommends making the return type of the `clone()` method the same as the\nclass type of the object it returns.\n\n**Example:**\n\n\n class Foo implements Cloneable {\n public Object clone() {\n try {\n return super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo implements Cloneable {\n public Foo clone() {\n try {\n return (Foo)super.clone();\n } catch (CloneNotSupportedException e) {\n throw new AssertionError();\n }\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "LeakingThis", + "suppressToolId": "CloneReturnsClassType", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40574,8 +40565,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Cloning issues", + "index": 116, "toolComponent": { "name": "QDJVM" } @@ -40587,19 +40578,19 @@ ] }, { - "id": "AddVarianceModifier", + "id": "OptionalToIf", "shortDescription": { - "text": "Type parameter can have 'in' or 'out' variance" + "text": "'Optional' can be replaced with sequence of 'if' statements" }, "fullDescription": { - "text": "Reports type parameters that can have 'in' or 'out' variance. Using 'in' and 'out' variance provides more precise type inference in Kotlin and clearer code semantics. Example: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }' The quick-fix adds the matching variance modifier: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }'", - "markdown": "Reports type parameters that can have `in` or `out` variance.\n\nUsing `in` and `out` variance provides more precise type inference in Kotlin and clearer code semantics.\n\n**Example:**\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }\n\nThe quick-fix adds the matching variance modifier:\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }\n" + "text": "Reports 'Optional' call chains that can be replaced with a sequence of 'if' statements. Example: 'return Optional.ofNullable(name)\n .map(this::extractInitials)\n .map(initials -> initials.toUpperCase(Locale.ENGLISH))\n .orElseGet(this::getDefault);' After the quick-fix is applied: 'if (name != null) {\n String initials = extractInitials(name);\n if (initials != null) return initials.toUpperCase(Locale.ENGLISH);\n }\n return getDefault();' This inspection can help to downgrade for backward compatibility with earlier Java versions. This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8. New in 2020.2", + "markdown": "Reports `Optional` call chains that can be replaced with a sequence of `if` statements.\n\nExample:\n\n\n return Optional.ofNullable(name)\n .map(this::extractInitials)\n .map(initials -> initials.toUpperCase(Locale.ENGLISH))\n .orElseGet(this::getDefault);\n\nAfter the quick-fix is applied:\n\n\n if (name != null) {\n String initials = extractInitials(name);\n if (initials != null) return initials.toUpperCase(Locale.ENGLISH);\n }\n return getDefault();\n\n\nThis inspection can help to downgrade for backward compatibility with earlier Java versions.\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.\n\nNew in 2020.2" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "AddVarianceModifier", + "suppressToolId": "OptionalToIf", "ideaSeverity": "INFORMATION", "qodanaSeverity": "Info" } @@ -40607,8 +40598,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -40620,28 +40611,28 @@ ] }, { - "id": "RemoveForLoopIndices", + "id": "IllegalDependencyOnInternalPackage", "shortDescription": { - "text": "Unused loop index" + "text": "Illegal dependency on internal package" }, "fullDescription": { - "text": "Reports 'for' loops iterating over a collection using the 'withIndex()' function and not using the index variable. Use the \"Remove indices in 'for' loop\" quick-fix to clean up the code. Examples: 'fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }' After the quick-fix is applied: 'fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }'", - "markdown": "Reports `for` loops iterating over a collection using the `withIndex()` function and not using the index variable.\n\nUse the \"Remove indices in 'for' loop\" quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }\n" + "text": "Reports references in modules without 'module-info.java' on packages which are not exported from named modules. Such configuration may occur when some modules in the project are already migrated to Java modules but others are still non-modular. By analogy to the JDK, such non-modular code should not get access to the code in named modules which is not explicitly exported.", + "markdown": "Reports references in modules without `module-info.java` on packages which are not exported from named modules.\n\nSuch configuration may occur when some modules in the project are already migrated to Java modules but others are still non-modular.\nBy analogy to the JDK, such non-modular code should not get access to the code in named modules which is not explicitly exported." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "error", "parameters": { - "suppressToolId": "RemoveForLoopIndices", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "IllegalDependencyOnInternalPackage", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -40653,19 +40644,19 @@ ] }, { - "id": "RedundantSuspendModifier", + "id": "BigDecimalMethodWithoutRoundingCalled", "shortDescription": { - "text": "Redundant 'suspend' modifier" + "text": "Call to 'BigDecimal' method without a rounding mode argument" }, "fullDescription": { - "text": "Reports 'suspend' modifier as redundant if no other suspending functions are called inside.", - "markdown": "Reports `suspend` modifier as redundant if no other suspending functions are called inside." + "text": "Reports calls to 'divide()' or 'setScale()' without a rounding mode argument. Such calls can lead to an 'ArithmeticException' when the exact value cannot be represented in the result (for example, because it has a non-terminating decimal expansion). Specifying a rounding mode prevents the 'ArithmeticException'. Example: 'BigDecimal.valueOf(1).divide(BigDecimal.valueOf(3));'", + "markdown": "Reports calls to `divide()` or `setScale()` without a rounding mode argument.\n\nSuch calls can lead to an `ArithmeticException` when the exact value cannot be represented in the result\n(for example, because it has a non-terminating decimal expansion).\n\nSpecifying a rounding mode prevents the `ArithmeticException`.\n\n**Example:**\n\n\n BigDecimal.valueOf(1).divide(BigDecimal.valueOf(3));\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantSuspendModifier", + "suppressToolId": "BigDecimalMethodWithoutRoundingCalled", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40673,8 +40664,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -40686,28 +40677,28 @@ ] }, { - "id": "SuspiciousAsDynamic", + "id": "OverlyComplexArithmeticExpression", "shortDescription": { - "text": "Suspicious 'asDynamic' member invocation" + "text": "Overly complex arithmetic expression" }, "fullDescription": { - "text": "Reports usages of 'asDynamic' function on a receiver of dynamic type. 'asDynamic' function has no effect for expressions of dynamic type. 'asDynamic' function on a receiver of dynamic type can lead to runtime problems because 'asDynamic' will be executed in JavaScript environment, and such function may not be present at runtime. The intended way is to use this function on usual Kotlin type. Remove \"asDynamic\" invocation quick-fix can be used to amend the code automatically. Example: 'fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }'", - "markdown": "Reports usages of `asDynamic` function on a receiver of dynamic type.\n\n`asDynamic` function has no effect for expressions of dynamic type.\n\n`asDynamic` function on a receiver of dynamic type can lead to runtime problems because `asDynamic`\nwill be executed in JavaScript environment, and such function may not be present at runtime.\nThe intended way is to use this function on usual Kotlin type.\n\n**Remove \"asDynamic\" invocation** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }\n" + "text": "Reports arithmetic expressions with the excessive number of terms. Such expressions might be hard to understand and might contain errors. Parameters, field references, and other primary expressions are counted as a term. Example: 'int calc(int a, int b) {\n return a + a + a + b + b + b + b; // The line contains 7 terms and will be reported.\n }' Use the field below to specify a number of terms allowed in arithmetic expressions.", + "markdown": "Reports arithmetic expressions with the excessive number of terms. Such expressions might be hard to understand and might contain errors.\n\nParameters, field references, and other primary expressions are counted as a term.\n\n**Example:**\n\n int calc(int a, int b) {\n return a + a + a + b + b + b + b; // The line contains 7 terms and will be reported.\n }\n\nUse the field below to specify a number of terms allowed in arithmetic expressions." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SuspiciousAsDynamic", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "OverlyComplexArithmeticExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Numeric issues", + "index": 30, "toolComponent": { "name": "QDJVM" } @@ -40719,28 +40710,28 @@ ] }, { - "id": "FilterIsInstanceCallWithClassLiteralArgument", + "id": "DriverManagerGetConnection", "shortDescription": { - "text": "'filterIsInstance' call with a class literal argument" + "text": "Use of 'DriverManager' to get JDBC connection" }, "fullDescription": { - "text": "Reports calls of the Kotlin standard library function 'filterIsInstance' with a class literal argument. It is more idiomatic to use a version of this function with a reified type parameter, to avoid the '::class.java' syntax. Note: inspection is not reported for generic class literals because the 'Class<*, *>' syntax in the type argument list may be undesirable. Example: 'fun foo(list: List<*>) {\n list.filterIsInstance(Int::class.java)\n }' After the quick-fix is applied: 'fun foo(list: List<*>) {\n list.filterIsInstance()\n }'", - "markdown": "Reports calls of the Kotlin standard library function `filterIsInstance` with a class literal argument. It is more idiomatic to use a version of this function with a reified type parameter, to avoid the `::class.java` syntax.\n\nNote: inspection is not reported for generic class literals because the `Class<*, *>` syntax in the type argument list may be undesirable.\n\nExample:\n\n\n fun foo(list: List<*>) {\n list.filterIsInstance(Int::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List<*>) {\n list.filterIsInstance()\n }\n" + "text": "Reports any uses of 'java.sql.DriverManager' to acquire a JDBC connection. 'java.sql.DriverManager' has been superseded by 'javax.sql.Datasource', which allows for connection pooling and other optimizations. Example: 'Connection conn = DriverManager.getConnection(url, username, password);'", + "markdown": "Reports any uses of `java.sql.DriverManager` to acquire a JDBC connection.\n\n\n`java.sql.DriverManager`\nhas been superseded by `javax.sql.Datasource`, which\nallows for connection pooling and other optimizations.\n\n**Example:**\n\n Connection conn = DriverManager.getConnection(url, username, password);\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "FilterIsInstanceCallWithClassLiteralArgument", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "CallToDriverManagerGetConnection", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Resource management", + "index": 136, "toolComponent": { "name": "QDJVM" } @@ -40752,28 +40743,28 @@ ] }, { - "id": "FromClosedRangeMigration", + "id": "ThreadDumpStack", "shortDescription": { - "text": "MIN_VALUE step in fromClosedRange() since 1.3" + "text": "Call to 'Thread.dumpStack()'" }, "fullDescription": { - "text": "Reports 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. It is prohibited to call 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. All such calls should be checked during migration to Kotlin 1.3+. Example: 'IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)' To fix the problem change the step of the progression.", - "markdown": "Reports `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with `MIN_VALUE` step.\n\n\nIt is prohibited to call `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with\n`MIN_VALUE` step. All such calls should be checked during migration to Kotlin 1.3+.\n\n**Example:**\n\n\n IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)\n\nTo fix the problem change the step of the progression." + "text": "Reports usages of 'Thread.dumpStack()'. Such statements are often used for temporary debugging and should be either removed from the production code or replaced with a more robust logging facility.", + "markdown": "Reports usages of `Thread.dumpStack()`.\n\nSuch statements are often used for temporary debugging and should be either removed from the production code\nor replaced with a more robust logging facility." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "FromClosedRangeMigration", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "CallToThreadDumpStack", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -40785,19 +40776,19 @@ ] }, { - "id": "RemoveRedundantBackticks", + "id": "FinalMethodInFinalClass", "shortDescription": { - "text": "Redundant backticks" + "text": "'final' method in 'final' class" }, "fullDescription": { - "text": "Reports redundant backticks in references. Some of the Kotlin keywords are valid identifiers in Java, for example: 'in', 'object', 'is'. If a Java library uses a Kotlin keyword for a method, you can still call the method escaping it with the backtick character ('`'), for example, 'foo.`is`(bar)'. Sometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is paired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code. Examples: 'fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks'", - "markdown": "Reports redundant backticks in references.\n\n\nSome of the Kotlin keywords are valid identifiers in Java, for example: `in`, `object`, `is`.\nIf a Java library uses a Kotlin keyword for a method, you can still call the method escaping it\nwith the backtick character (`````), for example, ``foo.`is`(bar)``.\nSometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is\npaired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code.\n\n**Examples:**\n\n\n fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks\n" + "text": "Reports 'final' methods in 'final' classes. Since 'final' classes cannot be inherited, marking a method as 'final' may be unnecessary and confusing. Example: 'record Bar(int a, int b) {\n public final int sum() { \n return a + b;\n }\n}'\n After the quick-fix is applied: 'record Bar(int a, int b) {\n public int sum() { \n return a + b;\n }\n}' As shown in the example, a class can be marked as 'final' explicitly or implicitly.", + "markdown": "Reports `final` methods in `final` classes.\n\nSince `final` classes cannot be inherited, marking a method as `final`\nmay be unnecessary and confusing.\n\n**Example:**\n\n record Bar(int a, int b) {\n public final int sum() { \n return a + b;\n }\n }\n\nAfter the quick-fix is applied:\n\n record Bar(int a, int b) {\n public int sum() { \n return a + b;\n }\n }\n\nAs shown in the example, a class can be marked as `final` explicitly or implicitly." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RemoveRedundantBackticks", + "suppressToolId": "FinalMethodInFinalClass", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40805,8 +40796,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -40818,28 +40809,28 @@ ] }, { - "id": "ReplaceReadLineWithReadln", + "id": "UnnecessaryBlockStatement", "shortDescription": { - "text": "'readLine' can be replaced with 'readln' or 'readlnOrNull'" + "text": "Unnecessary code block" }, "fullDescription": { - "text": "Reports calls to 'readLine()' that can be replaced with 'readln()' or 'readlnOrNull()'. Using corresponding functions makes your code simpler. The quick-fix replaces 'readLine()!!' with 'readln()' and 'readLine()' with 'readlnOrNull()'. Examples: 'val x = readLine()!!\n val y = readLine()?.length' After the quick-fix is applied: 'val x = readln()\n val y = readlnOrNull()?.length'", - "markdown": "Reports calls to `readLine()` that can be replaced with `readln()` or `readlnOrNull()`.\n\n\nUsing corresponding functions makes your code simpler.\n\n\nThe quick-fix replaces `readLine()!!` with `readln()` and `readLine()` with `readlnOrNull()`.\n\n**Examples:**\n\n\n val x = readLine()!!\n val y = readLine()?.length\n\nAfter the quick-fix is applied:\n\n\n val x = readln()\n val y = readlnOrNull()?.length\n" + "text": "Reports code blocks that are redundant to the semantics of the program and can be replaced with their contents. The code blocks that are the bodies of 'if', 'do', 'while', or 'for' statements will not be reported by this inspection. Example: 'void foo() {\n { // unnecessary\n int result = call();\n analyze(result);\n } // unnecessary\n }' Configure the inspection: Use the Ignore branches of 'switch' statements option to ignore the code blocks that are used as branches of switch statements.", + "markdown": "Reports code blocks that are redundant to the semantics of the program and can be replaced with their contents.\n\nThe code blocks that are the bodies of `if`, `do`,\n`while`, or `for` statements will not be reported by this\ninspection.\n\nExample:\n\n\n void foo() {\n { // unnecessary\n int result = call();\n analyze(result);\n } // unnecessary\n }\n\nConfigure the inspection:\n\n\nUse the **Ignore branches of 'switch' statements** option to ignore the code blocks that are used as branches of switch statements." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "ReplaceReadLineWithReadln", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnnecessaryCodeBlock", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -40851,28 +40842,28 @@ ] }, { - "id": "SimplifyNestedEachInScopeFunction", + "id": "FinalPrivateMethod", "shortDescription": { - "text": "Scope function with nested forEach can be simplified" + "text": "'private' method declared 'final'" }, "fullDescription": { - "text": "Reports 'forEach' functions in the scope functions such as 'also' or 'apply' that can be simplified. Convert forEach call to onEach quick-fix can be used to amend the code automatically. Examples: 'fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }' After the quick-fix is applied: 'fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }'", - "markdown": "Reports `forEach` functions in the scope functions such as `also` or `apply` that can be simplified.\n\n**Convert forEach call to onEach** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }\n" + "text": "Reports methods that are marked with both 'final' and 'private' keywords. Since 'private' methods cannot be meaningfully overridden because of their visibility, declaring them 'final' is redundant.", + "markdown": "Reports methods that are marked with both `final` and `private` keywords.\n\nSince `private` methods cannot be meaningfully overridden because of their visibility, declaring them\n`final` is redundant." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SimplifyNestedEachInScopeFunction", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "FinalPrivateMethod", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -40884,28 +40875,28 @@ ] }, { - "id": "UnsafeCastFromDynamic", + "id": "UnnecessaryUnboxing", "shortDescription": { - "text": "Implicit (unsafe) cast from dynamic type" + "text": "Unnecessary unboxing" }, "fullDescription": { - "text": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.", - "markdown": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type." + "text": "Reports unboxing, that is explicit unwrapping of wrapped primitive values. Unboxing is unnecessary as of Java 5 and later, and can safely be removed. Examples: 'Integer i = Integer.valueOf(42).intValue();' → 'Integer i = Integer.valueOf(42);' 'int k = Integer.valueOf(42).intValue();' → 'int k = Integer.valueOf(42);' (reports only when the Only report truly superfluously unboxed expressions option is not checked) Use the Only report truly superfluously unboxed expressions option to only report truly superfluous unboxing, where an unboxed value is immediately boxed either implicitly or explicitly. In this case, the entire unboxing-boxing step can be removed. The inspection doesn't report simple explicit unboxing. This inspection only reports if the language level of the project or module is 5 or higher.", + "markdown": "Reports unboxing, that is explicit unwrapping of wrapped primitive values.\n\nUnboxing is unnecessary as of Java 5 and later, and can safely be removed.\n\n**Examples:**\n\n* `Integer i = Integer.valueOf(42).intValue();` → `Integer i = Integer.valueOf(42);`\n* `int k = Integer.valueOf(42).intValue();` → `int k = Integer.valueOf(42);`\n\n (reports only when the **Only report truly superfluously unboxed expressions** option is not checked)\n\n\nUse the **Only report truly superfluously unboxed expressions** option to only report truly superfluous unboxing,\nwhere an unboxed value is immediately boxed either implicitly or explicitly.\nIn this case, the entire unboxing-boxing step can be removed. The inspection doesn't report simple explicit unboxing.\n\nThis inspection only reports if the language level of the project or module is 5 or higher." }, "defaultConfiguration": { - "enabled": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "UnsafeCastFromDynamic", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "UnnecessaryUnboxing", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Java language level migration aids/Java 5", + "index": 121, "toolComponent": { "name": "QDJVM" } @@ -40917,28 +40908,28 @@ ] }, { - "id": "PublicApiImplicitType", + "id": "AssignmentOrReturnOfFieldWithMutableType", "shortDescription": { - "text": "Public API declaration with implicit return type" + "text": "Assignment or return of field with mutable type" }, "fullDescription": { - "text": "Reports 'public' and 'protected' functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly. Example: 'fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()' After the quick-fix is applied: 'fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()'", - "markdown": "Reports `public` and `protected` functions and properties that have an implicit return type.\nFor API stability reasons, it's recommended to specify such types explicitly.\n\n**Example:**\n\n\n fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n\nAfter the quick-fix is applied:\n\n\n fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n" + "text": "Reports return of, or assignment from a method parameter to an array or a mutable type like 'Collection', 'Date', 'Map', 'Calendar', etc. Because such types are mutable, this construct may result in unexpected modifications of an object's state from outside the owning class. Although this construct may be useful for performance reasons, it is inherently prone to bugs. The following mutable types are reported: 'java.util.Date' 'java.util.Calendar' 'java.util.Collection' 'java.util.Map' 'com.google.common.collect.Multimap' 'com.google.common.collect.Table' The quick-fix adds a call to the field's '.clone()' method. Example: 'class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages; // warning: Return of String[] field 'messages'\n }\n }' After the quick-fix is applied: 'class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages.clone();\n }\n }' Use the Ignore assignments in and returns from private methods option to ignore assignments and returns in 'private' methods.", + "markdown": "Reports return of, or assignment from a method parameter to an array or a mutable type like `Collection`, `Date`, `Map`, `Calendar`, etc.\n\nBecause such types are mutable, this construct may\nresult in unexpected modifications of an object's state from outside the owning class. Although this construct may be useful for\nperformance reasons, it is inherently prone to bugs.\n\nThe following mutable types are reported:\n\n* `java.util.Date`\n* `java.util.Calendar`\n* `java.util.Collection`\n* `java.util.Map`\n* `com.google.common.collect.Multimap`\n* `com.google.common.collect.Table`\n\nThe quick-fix adds a call to the field's `.clone()` method.\n\n**Example:**\n\n\n class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages; // warning: Return of String[] field 'messages'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Log {\n String[] messages;\n ...\n\n String[] getMessages() {\n return messages.clone();\n }\n }\n\nUse the **Ignore assignments in and returns from private methods** option to ignore assignments and returns in `private` methods." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "PublicApiImplicitType", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AssignmentOrReturnOfFieldWithMutableType", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Encapsulation", + "index": 128, "toolComponent": { "name": "QDJVM" } @@ -40950,19 +40941,19 @@ ] }, { - "id": "DeclaringClassMigration", + "id": "OptionalAssignedToNull", "shortDescription": { - "text": "Deprecated 'Enum.declaringClass' property" + "text": "Null value for Optional type" }, "fullDescription": { - "text": "Reports 'declaringClass' property calls on Enum that will lead to compilation error since 1.9. 'Enum.getDeclaringClass' is among \"hidden\" Java functions which aren't normally visible by resolve. However, it's visible via synthetic property that is a front-end bug. More details: KT-49653 Deprecate and remove Enum.declaringClass synthetic property The quick-fix replaces a call with 'declaringJavaClass'. Example: 'fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringClass)\n }' After the quick-fix is applied: 'fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringJavaClass)\n }' This inspection only reports if the Kotlin language level of the project or module is 1.7 or higher.", - "markdown": "Reports 'declaringClass' property calls on Enum that will lead to compilation error since 1.9.\n\n'Enum.getDeclaringClass' is among \"hidden\" Java functions which aren't normally visible by resolve. However, it's visible via synthetic\nproperty that is a front-end bug.\n\n**More details:** [KT-49653 Deprecate and remove Enum.declaringClass synthetic\nproperty](https://youtrack.jetbrains.com/issue/KT-49653)\n\nThe quick-fix replaces a call with 'declaringJavaClass'.\n\n**Example:**\n\n\n fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringClass)\n }\n\nAfter the quick-fix is applied:\n\n\n fun > foo(values: Array) {\n EnumSet.noneOf(values.first().declaringJavaClass)\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.7 or higher." + "text": "Reports 'null' assigned to an 'Optional' variable or returned from a method returning 'Optional'. It's recommended that you use 'Optional.empty()' (or 'Optional.absent()' for Guava) to denote an empty value. Example: 'Optional foo(boolean flag) {\n return flag ? Optional.of(42) : null;\n }' After the quick-fix is applied: 'Optional foo(boolean flag) {\n return flag ? Optional.of(42) : Optional.empty();\n }' Configure the inspection: Use the Report comparison of Optional with null option to also report comparisons like 'optional == null'. While in rare cases (e.g. lazily initialized optional field) this might be correct, optional variable is usually never null, and probably 'optional.isPresent()' was intended. New in 2017.2 This inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8.", + "markdown": "Reports `null` assigned to an `Optional` variable or returned from a method returning `Optional`.\n\nIt's recommended that you use `Optional.empty()` (or `Optional.absent()` for Guava) to denote an empty value.\n\nExample:\n\n\n Optional foo(boolean flag) {\n return flag ? Optional.of(42) : null;\n }\n\nAfter the quick-fix is applied:\n\n\n Optional foo(boolean flag) {\n return flag ? Optional.of(42) : Optional.empty();\n }\n\nConfigure the inspection:\n\n\nUse the **Report comparison of Optional with null** option to also report comparisons like `optional == null`. While in rare cases (e.g. lazily initialized\noptional field) this might be correct, optional variable is usually never null, and probably `optional.isPresent()` was\nintended.\n\nNew in 2017.2\n\nThis inspection depends on the Java feature 'Stream and Optional API', which is available since Java 8." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DeclaringClassMigration", + "suppressToolId": "OptionalAssignedToNull", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -40970,8 +40961,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -40983,28 +40974,28 @@ ] }, { - "id": "ReplaceMapIndexedWithListGenerator", + "id": "PointlessIndexOfComparison", "shortDescription": { - "text": "Replace 'mapIndexed' with List generator" + "text": "Pointless 'indexOf()' comparison" }, "fullDescription": { - "text": "Reports a 'mapIndexed' call that can be replaced by 'List' generator. Example: 'val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }' After the quick-fix is applied: 'val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }'", - "markdown": "Reports a `mapIndexed` call that can be replaced by `List` generator.\n\n**Example:**\n\n\n val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }\n\nAfter the quick-fix is applied:\n\n\n val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }\n" + "text": "Reports unnecessary comparisons with '.indexOf()' expressions. An example of such an expression is comparing the result of '.indexOf()' with numbers smaller than -1.", + "markdown": "Reports unnecessary comparisons with `.indexOf()` expressions. An example of such an expression is comparing the result of `.indexOf()` with numbers smaller than -1." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceMapIndexedWithListGenerator", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "PointlessIndexOfComparison", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -41016,19 +41007,19 @@ ] }, { - "id": "ControlFlowWithEmptyBody", + "id": "EqualsAndHashcode", "shortDescription": { - "text": "Control flow with empty body" + "text": "'equals()' and 'hashCode()' not paired" }, "fullDescription": { - "text": "Reports 'if', 'while', 'do' or 'for' statements with empty bodies. While occasionally intended, this construction is confusing and often the result of a typo. The quick-fix removes a statement. Example: 'if (a > b) {}'", - "markdown": "Reports `if`, `while`, `do` or `for` statements with empty bodies.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo.\n\nThe quick-fix removes a statement.\n\n**Example:**\n\n\n if (a > b) {}\n" + "text": "Reports classes that override the 'equals()' method but do not override the 'hashCode()' method or vice versa, which can potentially lead to problems when the class is added to a 'Collection' or a 'HashMap'. The quick-fix generates the default implementation for an absent method. Example: 'class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n}' After the quick-fix is applied: 'class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (!(o instanceof StringHolder)) return false;\n\n StringHolder holder = (StringHolder)o;\n\n if (s != null ? !s.equals(holder.s) : holder.s != null) return false;\n\n return true;\n }\n}'", + "markdown": "Reports classes that override the `equals()` method but do not override the `hashCode()` method or vice versa, which can potentially lead to problems when the class is added to a `Collection` or a `HashMap`.\n\nThe quick-fix generates the default implementation for an absent method.\n\nExample:\n\n\n class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class StringHolder {\n String s;\n\n @Override public int hashCode() {\n return s != null ? s.hashCode() : 0;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (!(o instanceof StringHolder)) return false;\n\n StringHolder holder = (StringHolder)o;\n\n if (s != null ? !s.equals(holder.s) : holder.s != null) return false;\n\n return true;\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ControlFlowWithEmptyBody", + "suppressToolId": "EqualsAndHashcode", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41036,8 +41027,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -41049,28 +41040,28 @@ ] }, { - "id": "LoopToCallChain", + "id": "IteratorHasNextCallsIteratorNext", "shortDescription": { - "text": "Loop can be replaced with stdlib operations" + "text": "'Iterator.hasNext()' which calls 'next()'" }, "fullDescription": { - "text": "Reports 'for' loops that can be replaced with a sequence of stdlib operations (like 'map', 'filter', and so on). Example: 'fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n}' After the quick-fix is applied: 'fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n}'", - "markdown": "Reports `for` loops that can be replaced with a sequence of stdlib operations (like `map`, `filter`, and so on).\n\n**Example:**\n\n\n fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n }\n" + "text": "Reports implementations of 'Iterator.hasNext()' or 'ListIterator.hasPrevious()' that call 'Iterator.next()' or 'ListIterator.previous()' on the iterator instance. Such calls are almost certainly an error, as methods like 'hasNext()' should not modify the iterators state, while 'next()' should. Example: 'class MyIterator implements Iterator {\n public boolean hasNext() {\n return next() != null;\n }\n }'", + "markdown": "Reports implementations of `Iterator.hasNext()` or `ListIterator.hasPrevious()` that call `Iterator.next()` or `ListIterator.previous()` on the iterator instance. Such calls are almost certainly an error, as methods like `hasNext()` should not modify the iterators state, while `next()` should.\n\n**Example:**\n\n\n class MyIterator implements Iterator {\n public boolean hasNext() {\n return next() != null;\n }\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "LoopToCallChain", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "IteratorHasNextCallsIteratorNext", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -41082,28 +41073,28 @@ ] }, { - "id": "RemoveEmptyClassBody", + "id": "StringRepeatCanBeUsed", "shortDescription": { - "text": "Replace empty class body" + "text": "String.repeat() can be used" }, "fullDescription": { - "text": "Reports declarations of classes and objects with an empty body. Use the 'Remove redundant empty class body' quick-fix to clean up the code. Examples: 'class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }' After the quick fix is applied: 'class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }'", - "markdown": "Reports declarations of classes and objects with an empty body.\n\nUse the 'Remove redundant empty class body' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }\n\nAfter the quick fix is applied:\n\n\n class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }\n" + "text": "Reports loops that can be replaced with a single 'String.repeat()' method (available since Java 11). Example: 'void append(StringBuilder sb, int count, Object obj) {\n for (int i = 0; i < count; i++) {\n sb.append(obj);\n }\n }' After the quick-fix is applied: 'void append(StringBuilder sb, int count, Object obj) {\n sb.append(String.valueOf(obj).repeat(Math.max(0, count)));\n }' By default, the inspection may wrap 'count' with 'Math.max(0, count)' if it cannot prove statically that 'count' is not negative. This is done to prevent possible semantics change, as 'String.repeat()' rejects negative numbers. Use the Add Math.max(0,count) to avoid possible semantics change option to disable this behavior if required. Similarly, a string you want to repeat can be wrapped in 'String.valueOf' to prevent possible 'NullPointerException' if it's unknown whether it can be 'null'. This inspection only reports if the language level of the project or module is 11 or higher. New in 2019.1", + "markdown": "Reports loops that can be replaced with a single `String.repeat()` method (available since Java 11).\n\n**Example:**\n\n\n void append(StringBuilder sb, int count, Object obj) {\n for (int i = 0; i < count; i++) {\n sb.append(obj);\n }\n }\n\nAfter the quick-fix is applied:\n\n\n void append(StringBuilder sb, int count, Object obj) {\n sb.append(String.valueOf(obj).repeat(Math.max(0, count)));\n }\n\n\nBy default, the inspection may wrap `count` with `Math.max(0, count)` if it cannot prove statically that `count` is\nnot negative. This is done to prevent possible semantics change, as `String.repeat()` rejects negative numbers.\nUse the **Add Math.max(0,count) to avoid possible semantics change** option to disable this behavior if required.\n\nSimilarly, a string you want to repeat can be wrapped in\n`String.valueOf` to prevent possible `NullPointerException` if it's unknown whether it can be `null`.\n\nThis inspection only reports if the language level of the project or module is 11 or higher.\n\nNew in 2019.1" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RemoveEmptyClassBody", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "StringRepeatCanBeUsed", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Java language level migration aids/Java 11", + "index": 178, "toolComponent": { "name": "QDJVM" } @@ -41115,19 +41106,22 @@ ] }, { - "id": "CanBeParameter", + "id": "MathRoundingWithIntArgument", "shortDescription": { - "text": "Constructor parameter is never used as a property" + "text": "Call math rounding with 'int' argument" }, "fullDescription": { - "text": "Reports primary constructor parameters that can have 'val' or 'var' removed. Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them. Note that the referenced object might be garbage-collected earlier. Example: 'class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }' The quick-fix removes the extra 'val' or 'var' keyword: 'class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }'", - "markdown": "Reports primary constructor parameters that can have `val` or `var` removed.\n\n\nClass properties declared in the constructor increase memory consumption.\nIf the parameter value is only used in the constructor, you can omit them.\n\nNote that the referenced object might be garbage-collected earlier.\n\n**Example:**\n\n\n class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n\nThe quick-fix removes the extra `val` or `var` keyword:\n\n\n class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n" + "text": "Reports calls to 'round()', 'ceil()', 'floor()', 'rint()' methods for 'Math' and 'StrictMath' with 'int' as the argument. These methods could be called in case the argument is expected to be 'long' or 'double', and it may have unexpected results. The inspection provides a fix that simplify such expressions (except 'round') to cast to 'double'. Example: 'int i = 2;\n double d1 = Math.floor(i);' After the quick-fix is applied: 'int i = 2;\n double d1 = i;' New in 2023.1", + "markdown": "Reports calls to `round()`, `ceil()`, `floor()`, `rint()` methods for `Math` and `StrictMath` with `int` as the argument.\n\nThese methods could be called in case the argument is expected to be `long` or `double`, and it may have unexpected results.\n\nThe inspection provides a fix that simplify such expressions (except `round`) to cast to `double`.\n\n**Example:**\n\n\n int i = 2;\n double d1 = Math.floor(i);\n\nAfter the quick-fix is applied:\n\n\n int i = 2;\n double d1 = i;\n\nNew in 2023.1" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "CanBeParameter", + "suppressToolId": "MathRoundingWithIntArgument", + "cweIds": [ + 681 + ], "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41135,8 +41129,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -41148,28 +41142,28 @@ ] }, { - "id": "RedundantReturnLabel", + "id": "SynchronizationOnStaticField", "shortDescription": { - "text": "Redundant 'return' label" + "text": "Synchronization on 'static' field" }, "fullDescription": { - "text": "Reports redundant return labels outside of lambda expressions. Example: 'fun test() {\n return@test\n }' After the quick-fix is applied: 'fun test() {\n return\n }'", - "markdown": "Reports redundant return labels outside of lambda expressions.\n\n**Example:**\n\n\n fun test() {\n return@test\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return\n }\n" + "text": "Reports synchronization on 'static' fields. While not strictly incorrect, synchronization on 'static' fields can lead to bad performance because of contention.", + "markdown": "Reports synchronization on `static` fields. While not strictly incorrect, synchronization on `static` fields can lead to bad performance because of contention." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantReturnLabel", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SynchronizationOnStaticField", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -41181,28 +41175,28 @@ ] }, { - "id": "PackageName", + "id": "SwitchStatementWithConfusingDeclaration", "shortDescription": { - "text": "Package naming convention" + "text": "Local variable used and declared in different 'switch' branches" }, "fullDescription": { - "text": "Reports package names that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: names of packages are always lowercase and should not contain underscores. Example: 'org.example.project' Using multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case Example: 'org.example.myProject'", - "markdown": "Reports package names that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): names of packages are always lowercase and should not contain underscores.\n\n**Example:**\n`org.example.project`\n\nUsing multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case\n\n**Example:**\n`org.example.myProject`" + "text": "Reports local variables declared in one branch of a 'switch' statement and used in another branch. Such declarations can be extremely confusing. Example: 'switch(i) {\n case 2:\n int x = 0;\n break;\n case 3:\n x = 3;\n System.out.println(x);\n break;\n }'", + "markdown": "Reports local variables declared in one branch of a `switch` statement and used in another branch. Such declarations can be extremely confusing.\n\nExample:\n\n\n switch(i) {\n case 2:\n int x = 0;\n break;\n case 3:\n x = 3;\n System.out.println(x);\n break;\n }\n" }, "defaultConfiguration": { - "enabled": false, - "level": "note", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "PackageName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "LocalVariableUsedAndDeclaredInDifferentSwitchBranches", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -41214,28 +41208,28 @@ ] }, { - "id": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", + "id": "FieldMayBeFinal", "shortDescription": { - "text": "Meaningless annotations targets on superclass" + "text": "Field may be 'final'" }, "fullDescription": { - "text": "Reports meaningless annotation targets on superclasses since Kotlin 1.4. Annotation targets such as '@get:' are meaningless on superclasses and are prohibited. Example: 'interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo' After the quick-fix is applied: 'interface Foo\n\n annotation class Ann\n\n class E : Foo' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", - "markdown": "Reports meaningless annotation targets on superclasses since Kotlin 1.4.\n\nAnnotation targets such as `@get:` are meaningless on superclasses and are prohibited.\n\n**Example:**\n\n\n interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo\n\nAfter the quick-fix is applied:\n\n\n interface Foo\n\n annotation class Ann\n\n class E : Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + "text": "Reports fields that can be safely made 'final'. All 'final' fields have a value and this value does not change, which can make the code easier to reason about. To avoid too expensive analysis, this inspection only reports if the field has a 'private' modifier or it is defined in a local or anonymous class. A field can be 'final' if: It is 'static' and initialized once in its declaration or in one 'static' initializer. It is non-'static' and initialized once in its declaration, in one instance initializer or in every constructor And it is not modified anywhere else. Example: 'public class Person {\n private String name; // can be final\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }' After the quick-fix is applied: 'public class Person {\n private final String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }' Use the \"Annotations\" button to modify the list of annotations that assume implicit field write.", + "markdown": "Reports fields that can be safely made `final`. All `final` fields have a value and this value does not change, which can make the code easier to reason about.\n\nTo avoid too expensive analysis, this inspection only reports if the field has a `private` modifier\nor it is defined in a local or anonymous class.\nA field can be `final` if:\n\n* It is `static` and initialized once in its declaration or in one `static` initializer.\n* It is non-`static` and initialized once in its declaration, in one instance initializer or in every constructor\n\nAnd it is not modified anywhere else.\n\n**Example:**\n\n\n public class Person {\n private String name; // can be final\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }\n\nAfter the quick-fix is applied:\n\n\n public class Person {\n private final String name;\n\n Person(String name) {\n this.name = name;\n }\n\n public String getName() {\n return name;\n }\n }\n\n\nUse the \"Annotations\" button to modify the list of annotations that assume implicit field write." }, "defaultConfiguration": { - "enabled": false, - "level": "error", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "FieldMayBeFinal", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -41247,19 +41241,19 @@ ] }, { - "id": "ReplaceWithEnumMap", + "id": "SuspiciousArrayMethodCall", "shortDescription": { - "text": "'HashMap' can be replaced with 'EnumMap'" + "text": "Suspicious 'Arrays' method call" }, "fullDescription": { - "text": "Reports 'hashMapOf' function or 'HashMap' constructor calls that can be replaced with an 'EnumMap' constructor call. Using 'EnumMap' constructor makes your code simpler. The quick-fix replaces the function call with the 'EnumMap' constructor call. Example: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()' After the quick-fix is applied: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)'", - "markdown": "Reports `hashMapOf` function or `HashMap` constructor calls that can be replaced with an `EnumMap` constructor call.\n\nUsing `EnumMap` constructor makes your code simpler.\n\nThe quick-fix replaces the function call with the `EnumMap` constructor call.\n\n**Example:**\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()\n\nAfter the quick-fix is applied:\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)\n" + "text": "Reports calls to non-generic-array manipulation methods like 'Arrays.fill()' with mismatched argument types. Such calls don't do anything useful and are likely to be mistakes. Example: 'int foo(String[] strings) {\n return Arrays.binarySearch(strings, 1);\n }' New in 2017.2", + "markdown": "Reports calls to non-generic-array manipulation methods like `Arrays.fill()` with mismatched argument types. Such calls don't do anything useful and are likely to be mistakes.\n\n**Example:**\n\n\n int foo(String[] strings) {\n return Arrays.binarySearch(strings, 1);\n }\n\nNew in 2017.2" }, "defaultConfiguration": { "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "ReplaceWithEnumMap", + "suppressToolId": "SuspiciousArrayMethodCall", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41267,8 +41261,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -41280,19 +41274,19 @@ ] }, { - "id": "EnumValuesSoftDeprecate", + "id": "ClassHasNoToStringMethod", "shortDescription": { - "text": "'Enum.values()' is recommended to be replaced by 'Enum.entries' since 1.9" + "text": "Class does not override 'toString()' method" }, "fullDescription": { - "text": "Reports calls from Kotlin to 'values()' method in enum classes that can be replaced with 'entries' property read. Use of 'Enum.entries' may improve performance of your code. The quick-fix replaces 'values()' with 'entries'. More details: KT-48872 Provide modern and performant replacement for Enum.values() Note: 'entries' property type is different from the return type of 'values()' method ('EnumEntries' which inherits from 'List' instead of 'Array'). Due to this in some cases quick fix inserts extra '.toTypedArray()' conversion to not break the code, but for most common cases replacement will be done without it (e.g. in 'for' loop). Example: 'enum class Version {\n V1, V2\n }\n\n Version.values().forEach { /* .. */ }\n val firstVersion = Version.values()[0]\n functionExpectingArray(Version.values())' After the quick-fix is applied: 'enum class Version {\n V1, V2\n }\n\n Version.entries.forEach { /* .. */ }\n val firstVersion = Version.entries[0]\n functionExpectingArray(Version.entries.toTypedArray())'", - "markdown": "Reports calls from Kotlin to `values()` method in enum classes that can be replaced with `entries` property read.\n\n\nUse of `Enum.entries` may improve performance of your code.\n\n\nThe quick-fix replaces `values()` with `entries`.\n\n\n**More details:** [KT-48872 Provide modern and performant replacement for Enum.values()](https://youtrack.jetbrains.com/issue/KT-48872)\n\n\n**Note:** `entries` property type is different from the return type of `values()` method\n(`EnumEntries` which inherits from `List` instead of `Array`).\nDue to this in some cases quick fix inserts extra `.toTypedArray()` conversion to not break the code, but\nfor most common cases replacement will be done without it (e.g. in `for` loop).\n\n**Example:**\n\n\n enum class Version {\n V1, V2\n }\n\n Version.values().forEach { /* .. */ }\n val firstVersion = Version.values()[0]\n functionExpectingArray(Version.values())\n\nAfter the quick-fix is applied:\n\n\n enum class Version {\n V1, V2\n }\n\n Version.entries.forEach { /* .. */ }\n val firstVersion = Version.entries[0]\n functionExpectingArray(Version.entries.toTypedArray())\n" + "text": "Reports classes without a 'toString()' method.", + "markdown": "Reports classes without a `toString()` method." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EnumValuesSoftDeprecate", + "suppressToolId": "ClassHasNoToStringMethod", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41300,8 +41294,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/toString() issues", + "index": 205, "toolComponent": { "name": "QDJVM" } @@ -41313,28 +41307,28 @@ ] }, { - "id": "SuspiciousCollectionReassignment", + "id": "FieldAccessNotGuarded", "shortDescription": { - "text": "Augmented assignment creates a new collection under the hood" + "text": "Unguarded field access or method call" }, "fullDescription": { - "text": "Reports augmented assignment ('+=') expressions on a read-only 'Collection'. Augmented assignment ('+=') expression on a read-only 'Collection' temporarily allocates a new collection, which may hurt performance. Change type to mutable quick-fix can be used to amend the code automatically. Example: 'fun test() {\n var list = listOf(0)\n list += 42 // A new list is allocated here, equivalent to list = list + 42\n }' After the quick-fix is applied: 'fun test() {\n val list = mutableListOf(0)\n list += 42\n }'", - "markdown": "Reports augmented assignment (`+=`) expressions on a read-only `Collection`.\n\nAugmented assignment (`+=`) expression on a read-only `Collection` temporarily allocates a new collection,\nwhich may hurt performance.\n\n**Change type to mutable** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test() {\n var list = listOf(0)\n list += 42 // A new list is allocated here, equivalent to list = list + 42\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n val list = mutableListOf(0)\n list += 42\n }\n" + "text": "Reports accesses of fields declared as '@GuardedBy' that are not guarded by an appropriate synchronization structure. Example: '@GuardedBy(\"this\")\n void x() {\n notify();\n }\n void y() {\n x(); // unguarded method call\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 accesses of fields declared as `@GuardedBy` that are not guarded by an appropriate synchronization structure.\n\nExample:\n\n\n @GuardedBy(\"this\")\n void x() {\n notify();\n }\n void y() {\n x(); // unguarded method call\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": true, - "level": "note", + "enabled": false, + "level": "warning", "parameters": { - "suppressToolId": "SuspiciousCollectionReassignment", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "FieldAccessNotGuarded", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Concurrency annotation issues", + "index": 100, "toolComponent": { "name": "QDJVM" } @@ -41346,28 +41340,28 @@ ] }, { - "id": "RedundantNotNullExtensionReceiverOfInline", + "id": "PublicStaticArrayField", "shortDescription": { - "text": "'inline fun' extension receiver can be explicitly nullable until Kotlin 1.2" + "text": "'public static' array field" }, "fullDescription": { - "text": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver. Example: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' After the quick-fix is applied: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", - "markdown": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nThus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's\nrecommended to make such functions to have nullable receiver.\n\n**Example:**\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + "text": "Reports 'public' 'static' array fields. Such fields are often used to store arrays of constant values. Still, they represent a security hazard, as their contents may be modified, even if the field is declared 'final'. Example: 'public static String[] allowedPasswords = {\"foo\", \"bar\"};'", + "markdown": "Reports `public` `static` array fields.\n\n\nSuch fields are often used to store arrays of constant values. Still, they represent a security\nhazard, as their contents may be modified, even if the field is declared `final`.\n\n**Example:**\n\n\n public static String[] allowedPasswords = {\"foo\", \"bar\"};\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantNotNullExtensionReceiverOfInline", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "PublicStaticArrayField", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Security", + "index": 38, "toolComponent": { "name": "QDJVM" } @@ -41379,19 +41373,19 @@ ] }, { - "id": "RedundantElvisReturnNull", + "id": "MagicNumber", "shortDescription": { - "text": "Redundant '?: return null'" + "text": "Magic number" }, "fullDescription": { - "text": "Reports redundant '?: return null' Example: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }' After the quick-fix is applied: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }'", - "markdown": "Reports redundant `?: return null`\n\n**Example:**\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }\n" + "text": "Reports \"magic numbers\": numeric literals that are not named by a constant declaration. Using magic numbers can lead to unclear code, as well as errors if a magic number is changed in one location but remains unchanged not another. The numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 0L, 1L, 2L, 0.0, 1.0, 0.0F and 1.0F are not reported by this inspection. Example: 'void checkFileSize(long bytes) {\n if (bytes > 1_048_576) {\n throw new IllegalArgumentException(\"too big\");\n }\n }' A quick-fix introduces a new constant: 'static final int MAX_SUPPORTED_FILE_SIZE = 1_048_576;\n\n void checkFileSize(long bytes) {\n if (bytes > MAX_SUPPORTED_FILE_SIZE) {\n throw new IllegalArgumentException(\"too big\");\n }\n }' Configure the inspection: Use the Ignore constants in 'hashCode()' methods option to disable this inspection within 'hashCode()' methods. Use the Ignore in annotations option to ignore magic numbers in annotations. Use the Ignore initial capacity for StringBuilders and Collections option to ignore magic numbers used as initial capacity when constructing 'Collection', 'Map', 'StringBuilder' or 'StringBuffer' objects.", + "markdown": "Reports \"magic numbers\": numeric literals that are not named by a constant declaration.\n\nUsing magic numbers can lead to unclear code, as well as errors if a magic\nnumber is changed in one location but remains unchanged not another. The numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 0L, 1L, 2L,\n0.0, 1.0, 0.0F and 1.0F are not reported by this inspection.\n\nExample:\n\n\n void checkFileSize(long bytes) {\n if (bytes > 1_048_576) {\n throw new IllegalArgumentException(\"too big\");\n }\n }\n\nA quick-fix introduces a new constant:\n\n\n static final int MAX_SUPPORTED_FILE_SIZE = 1_048_576;\n\n void checkFileSize(long bytes) {\n if (bytes > MAX_SUPPORTED_FILE_SIZE) {\n throw new IllegalArgumentException(\"too big\");\n }\n }\n\nConfigure the inspection:\n\n* Use the **Ignore constants in 'hashCode()' methods** option to disable this inspection within `hashCode()` methods.\n* Use the **Ignore in annotations** option to ignore magic numbers in annotations.\n* Use the **Ignore initial capacity for StringBuilders and Collections** option to ignore magic numbers used as initial capacity when constructing `Collection`, `Map`, `StringBuilder` or `StringBuffer` objects." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "RedundantElvisReturnNull", + "suppressToolId": "MagicNumber", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41399,8 +41393,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Abstraction issues", + "index": 85, "toolComponent": { "name": "QDJVM" } @@ -41412,28 +41406,28 @@ ] }, { - "id": "PrivatePropertyName", + "id": "EnumSwitchStatementWhichMissesCases", "shortDescription": { - "text": "Private property naming convention" + "text": "Enum 'switch' statement that misses case" }, "fullDescription": { - "text": "Reports private property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, private property names should start with a lowercase letter and use camel case. Optionally, underscore prefix is allowed but only for private properties. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val _My_Cool_Property = \"\"' The quick-fix renames the class according to the Kotlin naming conventions: 'val _myCoolProperty = \"\"'", - "markdown": "Reports private property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nprivate property names should start with a lowercase letter and use camel case.\nOptionally, underscore prefix is allowed but only for **private** properties.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val _My_Cool_Property = \"\"\n\nThe quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val _myCoolProperty = \"\"\n" + "text": "Reports 'switch' statements over enumerated types that are not exhaustive. Example: 'enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n\n }\n }\n }' After the quick-fix is applied: 'enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n case A -> {}\n case B -> {}\n case C -> {}\n }\n }\n }' Use the Ignore switch statements with a default branch option to ignore 'switch' statements that have a 'default' branch. This inspection depends on the Java feature 'Enums', which is available since Java 5.", + "markdown": "Reports `switch` statements over enumerated types that are not exhaustive.\n\n**Example:**\n\n\n enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n enum AlphaBetaGamma {\n A, B, C;\n\n void x(AlphaBetaGamma e) {\n switch (e) {\n case A -> {}\n case B -> {}\n case C -> {}\n }\n }\n }\n\n\nUse the **Ignore switch statements with a default branch** option to ignore `switch`\nstatements that have a `default` branch.\n\n\nThis inspection depends on the Java feature 'Enums', which is available since Java 5." }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "PrivatePropertyName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "EnumSwitchStatementWhichMissesCases", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -41445,28 +41439,31 @@ ] }, { - "id": "ObsoleteKotlinJsPackages", + "id": "SuspiciousIntegerDivAssignment", "shortDescription": { - "text": "'kotlin.browser' and 'kotlin.dom' packages are deprecated since 1.4" + "text": "Suspicious integer division assignment" }, "fullDescription": { - "text": "Reports usages of 'kotlin.dom' and 'kotlin.browser' packages. These packages were moved to 'kotlinx.dom' and 'kotlinx.browser' respectively in Kotlin 1.4+.", - "markdown": "Reports usages of `kotlin.dom` and `kotlin.browser` packages.\n\nThese packages were moved to `kotlinx.dom` and `kotlinx.browser`\nrespectively in Kotlin 1.4+." + "text": "Reports assignments whose right side is a division that shouldn't be truncated to integer. While occasionally intended, this construction is often buggy. Example: 'int x = 18;\n x *= 3/2; // doesn't change x because of the integer division result' This code should be replaced with: 'int x = 18;\n x *= 3.0/2;' In the inspection options, you can disable warnings for suspicious but possibly correct divisions, for example, when the dividend can't be calculated statically. 'void calc(int d) {\n int x = 18;\n x *= d/2;\n }' New in 2019.2", + "markdown": "Reports assignments whose right side is a division that shouldn't be truncated to integer.\n\nWhile occasionally intended, this construction is often buggy.\n\n**Example:**\n\n\n int x = 18;\n x *= 3/2; // doesn't change x because of the integer division result\n\n\nThis code should be replaced with:\n\n\n int x = 18;\n x *= 3.0/2;\n\n\nIn the inspection options, you can disable warnings for suspicious but possibly correct divisions,\nfor example, when the dividend can't be calculated statically.\n\n\n void calc(int d) {\n int x = 18;\n x *= d/2;\n }\n\n\nNew in 2019.2" }, "defaultConfiguration": { - "enabled": false, - "level": "error", + "enabled": true, + "level": "warning", "parameters": { - "suppressToolId": "ObsoleteKotlinJsPackages", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "SuspiciousIntegerDivAssignment", + "cweIds": [ + 682 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -41478,19 +41475,19 @@ ] }, { - "id": "KotlinJvmAnnotationInJava", + "id": "MethodWithMultipleLoops", "shortDescription": { - "text": "Kotlin JVM annotation in Java" + "text": "Method with multiple loops" }, "fullDescription": { - "text": "Reports useless Kotlin JVM annotations in Java code. Example: 'import kotlin.jvm.Volatile;\n\n public class Test {\n @Volatile\n public int i;\n }'", - "markdown": "Reports useless Kotlin JVM annotations in Java code.\n\n**Example:**\n\n\n import kotlin.jvm.Volatile;\n\n public class Test {\n @Volatile\n public int i;\n }\n" + "text": "Reports methods that contain more than one loop statement. Example: The method below will be reported because it contains two loops: 'void methodWithTwoLoops(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n System.out.println(i);\n }\n\n int j = 0;\n while (j < n2) {\n System.out.println(j);\n j++;\n }\n }' The following method will also be reported because it contains a nested loop: 'void methodWithNestedLoop(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n for (int j = 0; j < n2; j++) {\n System.out.println(i + j);\n }\n }\n }'", + "markdown": "Reports methods that contain more than one loop statement.\n\n**Example:**\n\nThe method below will be reported because it contains two loops:\n\n\n void methodWithTwoLoops(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n System.out.println(i);\n }\n\n int j = 0;\n while (j < n2) {\n System.out.println(j);\n j++;\n }\n }\n\nThe following method will also be reported because it contains a nested loop:\n\n\n void methodWithNestedLoop(int n1, int n2) {\n for (int i = 0; i < n1; i++) {\n for (int j = 0; j < n2; j++) {\n System.out.println(i + j);\n }\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "KotlinJvmAnnotationInJava", + "suppressToolId": "MethodWithMultipleLoops", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41498,8 +41495,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Java interop issues", - "index": 78, + "id": "Java/Method metrics", + "index": 135, "toolComponent": { "name": "QDJVM" } @@ -41511,28 +41508,28 @@ ] }, { - "id": "CascadeIf", + "id": "NegativelyNamedBooleanVariable", "shortDescription": { - "text": "Cascade 'if' can be replaced with 'when'" + "text": "Negatively named boolean variable" }, "fullDescription": { - "text": "Reports 'if' statements with three or more branches that can be replaced with the 'when' expression. Example: 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }' The quick-fix converts the 'if' expression to 'when': 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }'", - "markdown": "Reports `if` statements with three or more branches that can be replaced with the `when` expression.\n\n**Example:**\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n\nThe quick-fix converts the `if` expression to `when`:\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }\n" + "text": "Reports negatively named variables, for example: 'disabled', 'hidden', or 'isNotChanged'. Usually, inverting the 'boolean' value and removing the negation from the name makes the code easier to understand. Example: 'boolean disabled = false;'", + "markdown": "Reports negatively named variables, for example: `disabled`, `hidden`, or `isNotChanged`.\n\nUsually, inverting the `boolean` value and removing the negation from the name makes the code easier to understand.\n\nExample:\n\n\n boolean disabled = false;\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "CascadeIf", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "NegativelyNamedBooleanVariable", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Data flow", + "index": 65, "toolComponent": { "name": "QDJVM" } @@ -41544,19 +41541,19 @@ ] }, { - "id": "EmptyRange", + "id": "SleepWhileHoldingLock", "shortDescription": { - "text": "Range with start greater than endInclusive is empty" + "text": "Call to 'Thread.sleep()' while synchronized" }, "fullDescription": { - "text": "Reports ranges that are empty because the 'start' value is greater than the 'endInclusive' value. Example: 'val range = 2..1' The quick-fix changes the '..' operator to 'downTo': 'val range = 2 downTo 1'", - "markdown": "Reports ranges that are empty because the `start` value is greater than the `endInclusive` value.\n\n**Example:**\n\n\n val range = 2..1\n\nThe quick-fix changes the `..` operator to `downTo`:\n\n\n val range = 2 downTo 1\n" + "text": "Reports calls to 'java.lang.Thread.sleep()' methods that occur within a 'synchronized' block or method. 'sleep()' within a 'synchronized' block may result in decreased performance, poor scalability, and possibly even deadlocking. Consider using 'wait()' instead, as it will release the lock held. Example: 'synchronized (lock) {\n Thread.sleep(100);\n }'", + "markdown": "Reports calls to `java.lang.Thread.sleep()` methods that occur within a `synchronized` block or method.\n\n\n`sleep()` within a\n`synchronized` block may result in decreased performance, poor scalability, and possibly\neven deadlocking. Consider using `wait()` instead,\nas it will release the lock held.\n\n**Example:**\n\n\n synchronized (lock) {\n Thread.sleep(100);\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EmptyRange", + "suppressToolId": "SleepWhileHoldingLock", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41564,8 +41561,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Threading issues", + "index": 29, "toolComponent": { "name": "QDJVM" } @@ -41577,19 +41574,19 @@ ] }, { - "id": "NonExternalClassifierExtendingStateOrProps", + "id": "DeprecatedClassUsageInspection", "shortDescription": { - "text": "Non-external classifier extending State or Props" + "text": "Deprecated API usage in XML" }, "fullDescription": { - "text": "Reports non-external classifier extending State or Props. Read more in the migration guide.", - "markdown": "Reports non-external classifier extending State or Props. Read more in the [migration guide](https://kotlinlang.org/docs/js-ir-migration.html#convert-js-and-react-related-classes-and-interfaces-to-external-interfaces)." + "text": "Reports usages of deprecated classes and methods in XML files.", + "markdown": "Reports usages of deprecated classes and methods in XML files." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonExternalClassifierExtendingStateOrProps", + "suppressToolId": "DeprecatedClassUsageInspection", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41597,8 +41594,8 @@ "relationships": [ { "target": { - "id": "Kotlin/React/Probable bugs", - "index": 207, + "id": "XML", + "index": 115, "toolComponent": { "name": "QDJVM" } @@ -41610,28 +41607,28 @@ ] }, { - "id": "OptionalExpectation", + "id": "MethodReturnAlwaysConstant", "shortDescription": { - "text": "Optionally expected annotation has no actual annotation" + "text": "Method returns per-class constant" }, "fullDescription": { - "text": "Reports optionally expected annotations without actual annotation in some platform modules. Example: '// common code\n@OptionalExpectation\nexpect annotation class JvmName(val name: String)\n\n@JvmName(name = \"JvmFoo\")\nfun foo() { }\n\n// jvm code\nactual annotation class JvmName(val name: String)' The inspection also reports cases when 'actual annotation class JvmName' is omitted for non-JVM platforms (for example, Native).", - "markdown": "Reports optionally expected annotations without actual annotation in some platform modules.\n\n**Example:**\n\n // common code\n @OptionalExpectation\n expect annotation class JvmName(val name: String)\n\n @JvmName(name = \"JvmFoo\")\n fun foo() { }\n\n // jvm code\n actual annotation class JvmName(val name: String)\n\nThe inspection also reports cases when `actual annotation class JvmName` is omitted for non-JVM platforms (for example, Native)." + "text": "Reports methods that only return a constant, which may differ for various inheritors. Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.", + "markdown": "Reports methods that only return a constant, which may differ for various inheritors.\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": "note", + "level": "warning", "parameters": { - "suppressToolId": "OptionalExpectation", - "ideaSeverity": "INFORMATION", - "qodanaSeverity": "Info" + "suppressToolId": "MethodReturnAlwaysConstant", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -41643,28 +41640,28 @@ ] }, { - "id": "DestructuringWrongName", + "id": "DuplicateBranchesInSwitch", "shortDescription": { - "text": "Variable in destructuring declaration uses name of a wrong data class property" + "text": "Duplicate branches in 'switch'" }, "fullDescription": { - "text": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class. Example: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }' The quick-fix changes variable's name to match the name of the corresponding class field: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }'", - "markdown": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class.\n\n**Example:**\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }\n\nThe quick-fix changes variable's name to match the name of the corresponding class field:\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }\n" + "text": "Reports 'switch' statements or expressions that contain the same code in different branches and suggests merging the duplicate branches. Example: 'switch (n) {\n case 1:\n System.out.println(n);\n break;\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }' After the quick-fix is applied: 'switch (n) {\n case 1:\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }' New in 2019.1", + "markdown": "Reports `switch` statements or expressions that contain the same code in different branches and suggests merging the duplicate branches.\n\nExample:\n\n\n switch (n) {\n case 1:\n System.out.println(n);\n break;\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }\n\nAfter the quick-fix is applied:\n\n\n switch (n) {\n case 1:\n case 2:\n System.out.println(n);\n break;\n default:\n System.out.println(\"default\");\n }\n\nNew in 2019.1" }, "defaultConfiguration": { - "enabled": true, - "level": "warning", + "enabled": false, + "level": "note", "parameters": { - "suppressToolId": "DestructuringWrongName", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "DuplicateBranchesInSwitch", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -41676,28 +41673,28 @@ ] }, { - "id": "IfThenToSafeAccess", + "id": "SingleElementAnnotation", "shortDescription": { - "text": "If-Then foldable to '?.'" + "text": "Non-normalized annotation" }, "fullDescription": { - "text": "Reports 'if-then' expressions that can be folded into safe-access ('?.') expressions. Example: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }' The quick fix converts the 'if-then' expression into a safe-access ('?.') expression: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }'", - "markdown": "Reports `if-then` expressions that can be folded into safe-access (`?.`) expressions.\n\n**Example:**\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }\n\nThe quick fix converts the `if-then` expression into a safe-access (`?.`) expression:\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }\n" + "text": "Reports annotations in a shorthand form and suggests rewriting them in a normal form with an attribute name. Example: '@SuppressWarnings(\"foo\")' After the quick-fix is applied: '@SuppressWarnings(value = \"foo\")'", + "markdown": "Reports annotations in a shorthand form and suggests rewriting them in a normal form with an attribute name.\n\nExample:\n\n\n @SuppressWarnings(\"foo\")\n\nAfter the quick-fix is applied:\n\n\n @SuppressWarnings(value = \"foo\")\n" }, "defaultConfiguration": { "enabled": false, "level": "note", "parameters": { - "suppressToolId": "IfThenToSafeAccess", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SingleElementAnnotation", + "ideaSeverity": "INFORMATION", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -41709,28 +41706,28 @@ ] }, { - "id": "RestrictReturnStatementTargetMigration", + "id": "ManualMinMaxCalculation", "shortDescription": { - "text": "Target label does not denote a function since 1.4" + "text": "Manual min/max calculation" }, "fullDescription": { - "text": "Reports labels that don't points to a functions. It's forbidden to declare a target label that does not denote a function. The quick-fix removes the label. Example: 'fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }' After the quick-fix is applied: 'fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }' This inspection only reports if the language level of the project or module is 1.4 or higher.", - "markdown": "Reports labels that don't points to a functions.\n\nIt's forbidden to declare a target label that does not denote a function.\n\nThe quick-fix removes the label.\n\n**Example:**\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }\n\nAfter the quick-fix is applied:\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }\n\nThis inspection only reports if the language level of the project or module is 1.4 or higher." + "text": "Reports cases where the minimum or the maximum of two numbers can be calculated using a 'Math.max()' or 'Math.min()' call, instead of doing it manually. Example: 'public int min(int a, int b) {\n return b < a ? b : a;\n }' After the quick-fix is applied: 'public int min(int a, int b) {\n return Math.min(a, b);\n }' Use the Disable for float and double option to disable this inspection for 'double' and 'float' types. This is useful because the quick-fix may slightly change the semantics for 'float'/ 'double' types when handling 'NaN'. Nevertheless, in most cases this will actually fix a subtle bug where 'NaN' is not taken into account. New in 2019.2", + "markdown": "Reports cases where the minimum or the maximum of two numbers can be calculated using a `Math.max()` or `Math.min()` call, instead of doing it manually.\n\n**Example:**\n\n\n public int min(int a, int b) {\n return b < a ? b : a;\n }\n\nAfter the quick-fix is applied:\n\n\n public int min(int a, int b) {\n return Math.min(a, b);\n }\n\n\nUse the **Disable for float and double** option to disable this inspection for `double` and `float` types.\nThis is useful because the quick-fix may slightly change the semantics for `float`/\n`double` types when handling `NaN`. Nevertheless, in most cases this will actually fix\na subtle bug where `NaN` is not taken into account.\n\nNew in 2019.2" }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "RestrictReturnStatementTargetMigration", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "ManualMinMaxCalculation", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -41742,19 +41739,19 @@ ] }, { - "id": "MigrateDiagnosticSuppression", + "id": "SillyAssignment", "shortDescription": { - "text": "Diagnostic name should be replaced" + "text": "Variable is assigned to itself" }, "fullDescription": { - "text": "Reports suppressions with old diagnostic names, for example '@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")'. Some of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant. Example: '@Suppress(\"HEADER_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}' After the quick-fix is applied: '@Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}'", - "markdown": "Reports suppressions with old diagnostic names, for example `@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")`.\n\n\nSome of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant.\n\n**Example:**\n\n\n @Suppress(\"HEADER_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n\nAfter the quick-fix is applied:\n\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n" + "text": "Reports assignments of a variable to itself. Example: 'a = a;' The quick-fix removes the assigment.", + "markdown": "Reports assignments of a variable to itself.\n\n**Example:**\n\n\n a = a;\n\nThe quick-fix removes the assigment." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MigrateDiagnosticSuppression", + "suppressToolId": "SillyAssignment", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41762,8 +41759,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Other problems", - "index": 61, + "id": "Java/Declaration redundancy", + "index": 12, "toolComponent": { "name": "QDJVM" } @@ -41775,19 +41772,19 @@ ] }, { - "id": "NonNullableBooleanPropertyInExternalInterface", + "id": "BoundedWildcard", "shortDescription": { - "text": "External interface contains non-nullable boolean property" + "text": "Can use bounded wildcard" }, "fullDescription": { - "text": "Reports non-nullable boolean properties in external interface. Read more in the migration guide.", - "markdown": "Reports non-nullable boolean properties in external interface. Read more in the [migration guide](https://kotlinlang.org/docs/js-ir-migration.html#make-boolean-properties-nullable-in-external-interfaces)." + "text": "Reports generic method parameters that can make use of bounded wildcards. Example: 'void process(Consumer consumer);' should be replaced with: 'void process(Consumer consumer);' This method signature is more flexible because it accepts more types: not only 'Consumer', but also 'Consumer'. Likewise, type parameters in covariant position: 'T produce(Producer p);' should be replaced with: 'T produce(Producer p);' To quote Joshua Bloch in Effective Java third Edition: Item 31: Use bounded wildcards to increase API flexibility Using wildcard types in your APIs, while tricky, makes the APIs far more flexible. If you write a library that will be widely used, the proper use of wildcard types should be considered mandatory. Remember the basic rule: producer-extends, consumer-super (PECS). Also remember that all Comparables and Comparators are consumers. Use the inspection options to toggle the reporting for: invariant classes. An example of an invariant class is 'java.util.List' because it both accepts values (via the 'List.add(T)' method) and produces values (via the 'T List.get()' method). On the other hand, 'contravariant' classes only receive values, for example, 'java.util.function.Consumer' with the only method 'accept(T)'. Similarly, 'covariant' classes only produce values, for example, 'java.util.function.Supplier' with the only method 'T get()'. People often use bounded wildcards in covariant/contravariant classes but avoid wildcards in invariant classes, for example, 'void process(List l)'. Disable this option to ignore such invariant classes and leave them rigidly typed, for example, 'void process(List l)'. 'private' methods, which can be considered as not a part of the public API instance methods", + "markdown": "Reports generic method parameters that can make use of [bounded wildcards](https://en.wikipedia.org/wiki/Wildcard_(Java)).\n\n**Example:**\n\n\n void process(Consumer consumer);\n\nshould be replaced with:\n\n\n void process(Consumer consumer);\n\n\nThis method signature is more flexible because it accepts more types: not only\n`Consumer`, but also `Consumer`.\n\nLikewise, type parameters in covariant position:\n\n\n T produce(Producer p);\n\nshould be replaced with:\n\n\n T produce(Producer p);\n\n\nTo quote [Joshua Bloch](https://en.wikipedia.org/wiki/Joshua_Bloch#Effective_Java) in *Effective Java* third Edition:\n>\n> #### Item 31: Use bounded wildcards to increase API flexibility\n>\n> Using wildcard types in your APIs, while tricky, makes the APIs far more flexible. If you write a library that will be widely used, the proper use of wildcard types should be considered mandatory. Remember the basic rule: producer-extends, consumer-super (PECS). Also remember that all Comparables and Comparators are consumers.\n\n\nUse the inspection options to toggle the reporting for:\n\n*\n invariant classes. An example of an invariant class is `java.util.List` because it both accepts values\n (via the `List.add(T)` method)\n and produces values (via the `T List.get()` method).\n\n\n On the\n other hand, `contravariant` classes only receive values, for example, `java.util.function.Consumer`\n with the only method `accept(T)`. Similarly, `covariant` classes\n only produce values, for example, `java.util.function.Supplier`\n with the only method `T get()`.\n\n\n People often use bounded wildcards in covariant/contravariant\n classes but avoid wildcards in invariant classes, for example, `void process(List l)`.\n Disable this option to ignore such invariant classes and leave them rigidly typed, for example, `void\n process(List l)`.\n*\n `private` methods, which can be considered as not a part of the public API\n\n*\n instance methods" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonNullableBooleanPropertyInExternalInterface", + "suppressToolId": "BoundedWildcard", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41795,8 +41792,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Code style issues", + "index": 11, "toolComponent": { "name": "QDJVM" } @@ -41808,19 +41805,19 @@ ] }, { - "id": "DeferredResultUnused", + "id": "InstanceVariableInitialization", "shortDescription": { - "text": "'@Deferred' result is unused" + "text": "Instance field may not be initialized" }, "fullDescription": { - "text": "Reports function calls with the 'Deferred' result type if the return value is not used. If the 'Deferred' return value is not used, the call site would not wait to complete this function. Example: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }' The quick-fix provides a variable with the 'Deferred' initializer: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }'", - "markdown": "Reports function calls with the `Deferred` result type if the return value is not used.\n\nIf the `Deferred` return value is not used, the call site would not wait to complete this function.\n\n**Example:**\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }\n\nThe quick-fix provides a variable with the `Deferred` initializer:\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }\n" + "text": "Reports instance variables that may be uninitialized upon object initialization. Example: 'class Foo {\n public int bar;\n\n static { }\n }' Note that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance variables as uninitialized. Variables reported as initialized will always be initialized. Use the Ignore primitive fields option to ignore uninitialized primitive fields.", + "markdown": "Reports instance variables that may be uninitialized upon object initialization.\n\n**Example:**\n\n\n class Foo {\n public int bar;\n\n static { }\n }\n\nNote that this inspection uses a very conservative dataflow algorithm and may incorrectly report instance 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": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "DeferredResultUnused", + "suppressToolId": "InstanceVariableMayNotBeInitialized", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41828,8 +41825,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Initialization", + "index": 33, "toolComponent": { "name": "QDJVM" } @@ -41841,19 +41838,19 @@ ] }, { - "id": "SelfReferenceConstructorParameter", + "id": "IfStatementWithTooManyBranches", "shortDescription": { - "text": "Constructor can never be complete" + "text": "'if' statement with too many branches" }, "fullDescription": { - "text": "Reports constructors with a non-null self-reference parameter. Such constructors never instantiate a class. The quick-fix converts the parameter type to nullable. Example: 'class SelfRef(val ref: SelfRef)' After the quick-fix is applied: 'class SelfRef(val ref: SelfRef?)'", - "markdown": "Reports constructors with a non-null self-reference parameter.\n\nSuch constructors never instantiate a class.\n\nThe quick-fix converts the parameter type to nullable.\n\n**Example:**\n\n\n class SelfRef(val ref: SelfRef)\n\nAfter the quick-fix is applied:\n\n\n class SelfRef(val ref: SelfRef?)\n" + "text": "Reports 'if' statements with too many branches. Such statements may be confusing and are often a sign of inadequate levels of design abstraction. Use the Maximum number of branches field to specify the maximum number of branches an 'if' statement is allowed to have.", + "markdown": "Reports `if` statements with too many branches.\n\nSuch statements may be confusing and are often a sign of inadequate levels of design\nabstraction.\n\n\nUse the **Maximum number of branches** field to specify the maximum number of branches an `if` statement is allowed to have." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "SelfReferenceConstructorParameter", + "suppressToolId": "IfStatementWithTooManyBranches", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41861,8 +41858,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -41874,19 +41871,19 @@ ] }, { - "id": "MainFunctionReturnUnit", + "id": "NonSerializableObjectPassedToObjectStream", "shortDescription": { - "text": "Main function should return 'Unit'" + "text": "Non-serializable object passed to 'ObjectOutputStream'" }, "fullDescription": { - "text": "Reports when a main function does not have a return type of 'Unit'. Example: 'fun main() = \"Hello world!\"'", - "markdown": "Reports when a main function does not have a return type of `Unit`.\n\n**Example:**\n`fun main() = \"Hello world!\"`" + "text": "Reports non-'Serializable' objects used as arguments to 'java.io.ObjectOutputStream.write()'. Such calls will result in runtime exceptions. This inspection assumes objects of the types 'java.util.Collection' and 'java.util.Map' to be 'Serializable', unless the types they are declared in are non-'Serializable'. Example: 'public class IWantToSerializeThis {\n public static void main(String[] args) throws IOException {\n try(var stream = new ObjectOutputStream(Files.newOutputStream(Paths.get(\"output\")))) {\n // Warning -- will fail with NotSerializableException\n stream.writeObject(new IWantToSerializeThis());\n }\n }\n }'", + "markdown": "Reports non-`Serializable` objects used as arguments to `java.io.ObjectOutputStream.write()`. Such calls will result in runtime exceptions.\n\n\nThis inspection assumes objects of the types `java.util.Collection` and\n`java.util.Map` to be `Serializable`, unless the types\nthey are declared in are non-`Serializable`.\n\n**Example:**\n\n\n public class IWantToSerializeThis {\n public static void main(String[] args) throws IOException {\n try(var stream = new ObjectOutputStream(Files.newOutputStream(Paths.get(\"output\")))) {\n // Warning -- will fail with NotSerializableException\n stream.writeObject(new IWantToSerializeThis());\n }\n }\n }\n" }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "MainFunctionReturnUnit", + "suppressToolId": "NonSerializableObjectPassedToObjectStream", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41894,8 +41891,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Serialization issues", + "index": 21, "toolComponent": { "name": "QDJVM" } @@ -41907,28 +41904,31 @@ ] }, { - "id": "SuspiciousCallableReferenceInLambda", + "id": "NullArgumentToVariableArgMethod", "shortDescription": { - "text": "Suspicious callable reference used as lambda result" + "text": "Confusing argument to varargs method" }, "fullDescription": { - "text": "Reports lambda expressions with one callable reference. It is a common error to replace a lambda with a callable reference without changing curly braces to parentheses. Example: 'listOf(1,2,3).map { it::toString }' After the quick-fix is applied: 'listOf(1,2,3).map(Int::toString)'", - "markdown": "Reports lambda expressions with one callable reference.\n\nIt is a common error to replace a lambda with a callable reference without changing curly braces to parentheses.\n\n**Example:**\n\n listOf(1,2,3).map { it::toString }\n\nAfter the quick-fix is applied:\n\n listOf(1,2,3).map(Int::toString)\n" + "text": "Reports calls to variable arity methods that have a single argument in the vararg parameter position, which is either a 'null' or an array of a subtype of the vararg parameter. Such an argument may be confusing as it is unclear if a varargs or non-varargs call is desired. Example: 'String[] ss = new String[]{\"foo\", \"bar\"};\n System.out.printf(\"%s\", ss);' In this example only the first element of the array will be printed, not the entire array. This inspection depends on the Java feature 'Variable arity methods', which is available since Java 5.", + "markdown": "Reports calls to variable arity methods that have a single argument in the vararg parameter position, which is either a `null` or an array of a subtype of the vararg parameter. Such an argument may be confusing as it is unclear if a varargs or non-varargs call is desired.\n\n**Example:**\n\n\n String[] ss = new String[]{\"foo\", \"bar\"};\n System.out.printf(\"%s\", ss);\n\nIn this example only the first element of the array will be printed, not the entire array.\n\nThis inspection depends on the Java feature 'Variable arity methods', which is available since Java 5." }, "defaultConfiguration": { "enabled": true, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "SuspiciousCallableReferenceInLambda", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConfusingArgumentToVarargsMethod", + "cweIds": [ + 628 + ], + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Probable bugs", + "index": 15, "toolComponent": { "name": "QDJVM" } @@ -41940,19 +41940,19 @@ ] }, { - "id": "ConvertSecondaryConstructorToPrimary", + "id": "UseOfObsoleteDateTimeApi", "shortDescription": { - "text": "Convert to primary constructor" + "text": "Use of obsolete date-time API" }, "fullDescription": { - "text": "Reports a secondary constructor that can be replaced with a more concise primary constructor. Example: 'class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }' The quick-fix converts code automatically: 'class User(val name: String) {\n }'", - "markdown": "Reports a secondary constructor that can be replaced with a more concise primary constructor.\n\n**Example:**\n\n\n class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }\n\nThe quick-fix converts code automatically:\n\n\n class User(val name: String) {\n }\n" + "text": "Reports usages of 'java.util.Date', 'java.util.Calendar', 'java.util.GregorianCalendar', 'java.util.TimeZone', and 'java.util.SimpleTimeZone'. While still supported, these classes were made obsolete by the JDK8 Date-Time API and should probably not be used in new development.", + "markdown": "Reports usages of `java.util.Date`, `java.util.Calendar`, `java.util.GregorianCalendar`, `java.util.TimeZone`, and `java.util.SimpleTimeZone`.\n\nWhile still supported, these classes were made obsolete by the JDK8 Date-Time API and should probably\nnot be used in new development." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ConvertSecondaryConstructorToPrimary", + "suppressToolId": "UseOfObsoleteDateTimeApi", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -41960,8 +41960,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Code maturity", + "index": 56, "toolComponent": { "name": "QDJVM" } @@ -41973,28 +41973,28 @@ ] }, { - "id": "ReplaceGetOrSet", + "id": "ModuleWithTooFewClasses", "shortDescription": { - "text": "Explicit 'get' or 'set' call" + "text": "Module with too few classes" }, "fullDescription": { - "text": "Reports explicit calls to 'get' or 'set' functions which can be replaced by an indexing operator '[]'. Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the 'operator' modifier: 'operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}' The functions above correspond to the indexing operator. Example: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }' After the quick-fix is applied: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }'", - "markdown": "Reports explicit calls to `get` or `set` functions which can be replaced by an indexing operator `[]`.\n\n\nKotlin allows custom implementations for the predefined set of operators on types.\nTo overload an operator, you can mark the corresponding function with the `operator` modifier:\n\n\n operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}\n \nThe functions above correspond to the indexing operator.\n\n**Example:**\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }\n\nAfter the quick-fix is applied:\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }\n" + "text": "Reports modules that contain too few classes. Overly small modules may indicate a too fragmented design. 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 Minimum number of classes field to specify the minimum number of classes a module may have.", + "markdown": "Reports modules that contain too few classes. Overly small modules may indicate a too fragmented design. 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 **Minimum number of classes** field to specify the minimum number of classes a module may have." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceGetOrSet", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ModuleWithTooFewClasses", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Modularization issues", + "index": 76, "toolComponent": { "name": "QDJVM" } @@ -42006,28 +42006,28 @@ ] }, { - "id": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", + "id": "OverloadedVarargsMethod", "shortDescription": { - "text": "Repeated annotation which is not marked as '@Repeatable'" + "text": "Overloaded varargs method" }, "fullDescription": { - "text": "Reports the repeated use of a non-'@Repeatable' annotation on property accessors. As a result of using non-'@Repeatable' annotation multiple times, both annotation usages will appear in the bytecode leading to an ambiguity in reflection calls. Since Kotlin 1.4 it's mandatory to either mark annotation as '@Repeatable' or not repeat the annotation, otherwise it will lead to compilation error. Example: 'annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", - "markdown": "Reports the repeated use of a non-`@Repeatable` annotation on property accessors.\n\n\nAs a result of using non-`@Repeatable` annotation multiple times, both annotation usages\nwill appear in the bytecode leading to an ambiguity in reflection calls.\n\n\nSince Kotlin 1.4 it's mandatory to either mark annotation as `@Repeatable` or not\nrepeat the annotation, otherwise it will lead to compilation error.\n\n**Example:**\n\n\n annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + "text": "Reports varargs methods with the same name as other methods in the class or in a superclass. Overloaded methods that take a variable number of arguments can be very confusing because it is often unclear which overload gets called. Example: 'public void execute(Runnable... r) {} // warning\n public void execute(Runnable r1, Runnable r2) {}' Use the option to ignore overloaded methods whose parameter types are definitely incompatible.", + "markdown": "Reports varargs methods with the same name as other methods in the class or in a superclass. Overloaded methods that take a variable number of arguments can be very confusing because it is often unclear which overload gets called.\n\n**Example:**\n\n\n public void execute(Runnable... r) {} // warning\n public void execute(Runnable r1, Runnable r2) {}\n\n\nUse the option to ignore overloaded methods whose parameter types are definitely incompatible." }, "defaultConfiguration": { "enabled": false, - "level": "error", + "level": "warning", "parameters": { - "suppressToolId": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", - "ideaSeverity": "ERROR", - "qodanaSeverity": "Critical" + "suppressToolId": "OverloadedVarargsMethod", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Migration", - "index": 16, + "id": "Java/Naming conventions/Method", + "index": 108, "toolComponent": { "name": "QDJVM" } @@ -42039,28 +42039,28 @@ ] }, { - "id": "Destructure", + "id": "AnonymousInnerClassMayBeStatic", "shortDescription": { - "text": "Use destructuring declaration" + "text": "Anonymous class may be a named 'static' inner class" }, "fullDescription": { - "text": "Reports declarations that can be destructured. Example: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }' The quick-fix destructures the declaration and introduces new variables with names from the corresponding class: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }'", - "markdown": "Reports declarations that can be destructured.\n\n**Example:**\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }\n\nThe quick-fix destructures the declaration and introduces new variables with names from the corresponding class:\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }\n" + "text": "Reports anonymous classes that may be safely replaced with 'static' inner classes. An anonymous class may be a 'static' inner class if it doesn't explicitly reference its enclosing instance or local classes from its surrounding method. A 'static' inner class does not keep an implicit reference to its enclosing instance. This prevents a common cause of memory leaks and uses less memory per class instance. Since Java 18, only serializable anonymous classes keep an implicit reference to their enclosing instance, if this reference is not used. Therefore, when the module language level is Java 18 or higher, this inspection reports serializable classes only. The quick-fix extracts the anonymous class into a named 'static' inner class. Example: 'void sample() {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n }\n });\n }' After the quick-fix is applied: 'void sample() {\n Thread thread = new Thread(new Task());\n }\n\n private static class Task implements Runnable {\n @Override\n public void run() {\n }\n }'", + "markdown": "Reports anonymous classes that may be safely replaced with `static` inner classes. An anonymous class may be a `static` inner class if it doesn't explicitly reference its enclosing instance or local classes from its surrounding method.\n\n\nA `static` inner class does not keep an implicit reference to its enclosing instance.\nThis prevents a common cause of memory leaks and uses less memory per class instance.\n\n\nSince Java 18, only serializable anonymous classes keep an implicit reference to their enclosing instance,\nif this reference is not used. Therefore, when the module language level is Java 18 or higher,\nthis inspection reports serializable classes only.\n\nThe quick-fix extracts the anonymous class into a named `static` inner class.\n\n**Example:**\n\n\n void sample() {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n }\n });\n }\n\nAfter the quick-fix is applied:\n\n\n void sample() {\n Thread thread = new Thread(new Task());\n }\n\n private static class Task implements Runnable {\n @Override\n public void run() {\n }\n }\n" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "Destructure", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "AnonymousInnerClassMayBeStatic", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Memory", + "index": 166, "toolComponent": { "name": "QDJVM" } @@ -42072,19 +42072,19 @@ ] }, { - "id": "UnusedReceiverParameter", + "id": "PublicConstructor", "shortDescription": { - "text": "Unused receiver parameter" + "text": "'public' constructor can be replaced with factory method" }, "fullDescription": { - "text": "Reports receiver parameter of extension functions and properties that is not used. Remove redundant receiver parameter can be used to amend the code automatically.", - "markdown": "Reports receiver parameter of extension functions and properties that is not used.\n\n**Remove redundant receiver parameter** can be used to amend the code automatically." + "text": "Reports 'public' constructors. Some coding standards discourage the use of 'public' constructors and recommend 'static' factory methods instead. This way the implementation can be swapped out without affecting the call sites. Example: 'class Test {\n private String name;\n\n public Test(String name) {\n this.name = name;\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n new Test(\"str\").test();\n }\n }' After quick-fix is applied: 'class Test {\n private String name;\n\n private Test(String name) {\n this.name = name;\n }\n\n public static Test getInstance(String name) {\n return new Test(name);\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n getInstance(\"str\").test();\n }\n }'", + "markdown": "Reports `public` constructors.\n\nSome coding standards discourage the use of `public` constructors and recommend\n`static` factory methods instead.\nThis way the implementation can be swapped out without affecting the call sites.\n\n**Example:**\n\n\n class Test {\n private String name;\n\n public Test(String name) {\n this.name = name;\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n new Test(\"str\").test();\n }\n }\n\nAfter quick-fix is applied:\n\n\n class Test {\n private String name;\n\n private Test(String name) {\n this.name = name;\n }\n\n public static Test getInstance(String name) {\n return new Test(name);\n }\n\n public void test() {\n System.out.println(name);\n }\n\n public static void main(String[] args) {\n getInstance(\"str\").test();\n }\n }\n" }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UnusedReceiverParameter", + "suppressToolId": "PublicConstructor", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -42092,8 +42092,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -42105,28 +42105,28 @@ ] }, { - "id": "ConvertTryFinallyToUseCall", + "id": "RedundantEmbeddedExpression", "shortDescription": { - "text": "Convert try / finally to use() call" + "text": "Redundant embedded expression in string template" }, "fullDescription": { - "text": "Reports a 'try-finally' block with 'resource.close()' in 'finally' which can be converted to a 'resource.use()' call. 'use()' is easier to read and less error-prone as there is no need in explicit 'close()' call. Example: 'fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }' After the quick-fix applied: 'fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }'", - "markdown": "Reports a `try-finally` block with `resource.close()` in `finally` which can be converted to a `resource.use()` call.\n\n`use()` is easier to read and less error-prone as there is no need in explicit `close()` call.\n\n**Example:**\n\n\n fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }\n\nAfter the quick-fix applied:\n\n\n fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }\n" + "text": "Reports redundant embedded expressions in 'STR' templates, such as trivial literals or empty expressions. Example: 'System.out.println(STR.\"Hello \\{\"world\"}\");' After the quick-fix is applied: 'System.out.println(STR.\"Hello world\");' This inspection depends on the Java feature 'String templates', which is available since Java 21-preview. New in 2023.3", + "markdown": "Reports redundant embedded expressions in `STR` templates, such as trivial literals or empty expressions.\n\nExample:\n\n\n System.out.println(STR.\"Hello \\{\"world\"}\");\n\nAfter the quick-fix is applied:\n\n\n System.out.println(STR.\"Hello world\");\n\nThis inspection depends on the Java feature 'String templates', which is available since Java 21-preview.\n\nNew in 2023.3" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ConvertTryFinallyToUseCall", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "RedundantEmbeddedExpression", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Verbose or redundant code constructs", + "index": 47, "toolComponent": { "name": "QDJVM" } @@ -42138,28 +42138,28 @@ ] }, { - "id": "KotlinRedundantOverride", + "id": "SwitchStatementWithTooFewBranches", "shortDescription": { - "text": "Redundant overriding method" + "text": "Minimum 'switch' branches" }, "fullDescription": { - "text": "Reports redundant overriding declarations. An override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility. Example: 'open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }' After the quick-fix is applied: 'class Bar : Foo() {\n }'", - "markdown": "Reports redundant overriding declarations.\n\n\nAn override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility.\n\n**Example:**\n\n\n open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }\n\nAfter the quick-fix is applied:\n\n\n class Bar : Foo() {\n }\n" + "text": "Reports 'switch' statements and expressions with too few 'case' labels, and suggests rewriting them as 'if' and 'else if' statements. Example (minimum branches == 3): 'switch (expression) {\n case \"foo\" -> foo();\n case \"bar\" -> bar();\n }' After the quick-fix is applied: 'if (\"foo\".equals(expression)) {\n foo();\n } else if (\"bar\".equals(expression)) {\n bar();\n }' Exhaustive switch expressions (Java 14+) or pattern switch statements (Java 17 preview) without the 'default' branch are not reported. That's because compile-time exhaustiveness check will be lost when the 'switch' is converted to 'if' which might be undesired. Configure the inspection: Use the Minimum number of branches field to specify the minimum expected number of 'case' labels. Use the Do not report pattern switch statements option to avoid reporting switch statements and expressions that have pattern branches. E.g.: 'String result = switch(obj) {\n case String str -> str.trim();\n default -> \"none\";\n };' It might be preferred to keep the switch even with a single pattern branch, rather than using the 'instanceof' statement.", + "markdown": "Reports `switch` statements and expressions with too few `case` labels, and suggests rewriting them as `if` and `else if` statements.\n\nExample (minimum branches == 3):\n\n\n switch (expression) {\n case \"foo\" -> foo();\n case \"bar\" -> bar();\n }\n\nAfter the quick-fix is applied:\n\n\n if (\"foo\".equals(expression)) {\n foo();\n } else if (\"bar\".equals(expression)) {\n bar();\n }\n\nExhaustive switch expressions (Java 14+) or pattern switch statements (Java 17 preview) without the 'default' branch are not reported.\nThat's because compile-time exhaustiveness check will be lost when the `switch` is converted to `if`\nwhich might be undesired.\n\nConfigure the inspection:\n\nUse the **Minimum number of branches** field to specify the minimum expected number of `case` labels.\n\nUse the **Do not report pattern switch statements** option to avoid reporting switch statements and expressions that\nhave pattern branches. E.g.:\n\n\n String result = switch(obj) {\n case String str -> str.trim();\n default -> \"none\";\n };\n\nIt might be preferred to keep the switch even with a single pattern branch, rather than using the `instanceof` statement." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "RedundantOverride", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "SwitchStatementWithTooFewBranches", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -42171,28 +42171,28 @@ ] }, { - "id": "RunBlocking", + "id": "UsagesOfObsoleteApi", "shortDescription": { - "text": "RunBlocking in coroutine" + "text": "Usages of ApiStatus.@Obsolete" }, "fullDescription": { - "text": "Reports runBlocking builders that can be reached from coroutines. Coroutines share threads for execution. When a runBlocking builder is called from a coroutine it blocks the underlying thread and prevents other coroutines from using this resource. This can result in performance issues and in bad cases thread starvation. It provides a potential callstack from coroutine primitive (suspend function or builder) to runBlocking builder. Example: 'suspend fun main() {\n foo() \n }\n\n fun foo() {\n runBlocking { suspendFunction() }\n }' Potential solution: 'suspend fun main() {\n foo() \n }\n\n suspend fun foo() {\n suspendFunction()\n }' Use the explore functions with overrides option to configure analysis for virtual functions: Use the No option to skip analysis for a function with overrides. Use the Yes, excluding overrides option to only explore the function in the defined callee type. Use the Yes, including overrides option to explore the function and all overrides.", - "markdown": "Reports runBlocking builders that can be reached from coroutines.\n\nCoroutines share threads for execution. When a runBlocking builder is called from a coroutine it blocks the underlying thread and prevents other coroutines from using this resource. This can result in performance issues and in bad cases thread starvation.\n\nIt provides a potential callstack from coroutine primitive (suspend function or builder) to runBlocking builder.\n\nExample:\n\n\n suspend fun main() {\n foo() \n }\n\n fun foo() {\n runBlocking { suspendFunction() }\n }\n\nPotential solution:\n\n\n suspend fun main() {\n foo() \n }\n\n suspend fun foo() {\n suspendFunction()\n }\n\nUse the **explore functions with overrides** option to configure analysis for virtual functions:\n\n* Use the **No** option to skip analysis for a function with overrides.\n* Use the **Yes, excluding overrides** option to only explore the function in the defined callee type.\n* Use the **Yes, including overrides** option to explore the function and all overrides." + "text": "Reports declarations (classes, methods, fields) annotated as '@ApiStatus.Obsolete'. Sometimes it's impossible to delete the current API, though it might not work correctly, there is a newer, or better, or more generic API. This way, it's a weaker variant of '@Deprecated' annotation. The annotated API is not supposed to be used in the new code, but it's permitted to postpone the migration of the existing code, therefore the usage is not considered a warning.", + "markdown": "Reports declarations (classes, methods, fields) annotated as `@ApiStatus.Obsolete`.\n\n\nSometimes it's impossible to delete the current API, though it might not work correctly, there is a newer, or better, or more generic API.\nThis way, it's a weaker variant of `@Deprecated` annotation.\nThe annotated API is not supposed to be used in the new code, but it's permitted to postpone the migration of the existing code,\ntherefore the usage is not considered a warning." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "RunBlocking", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "UsagesOfObsoleteApi", + "ideaSeverity": "TEXT ATTRIBUTES", + "qodanaSeverity": "Info" } }, "relationships": [ { "target": { - "id": "Kotlin/Coroutine inspections", - "index": 209, + "id": "JVM languages", + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -42204,28 +42204,28 @@ ] }, { - "id": "ReplaceArrayOfWithLiteral", + "id": "ConstantDeclaredInInterface", "shortDescription": { - "text": "'arrayOf' call can be replaced with array literal [...]" + "text": "Constant declared in interface" }, "fullDescription": { - "text": "Reports 'arrayOf' calls that can be replaced with array literals '[...]'. Examples: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass' After the quick-fix is applied: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass'", - "markdown": "Reports `arrayOf` calls that can be replaced with array literals `[...]`.\n\n**Examples:**\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass\n\nAfter the quick-fix is applied:\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass\n" + "text": "Reports constants ('public static final' fields) declared in interfaces. Some coding standards require declaring constants in abstract classes instead.", + "markdown": "Reports constants (`public static final` fields) declared in interfaces.\n\nSome coding standards require declaring constants in abstract classes instead." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceArrayOfWithLiteral", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConstantDeclaredInInterface", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Class structure", + "index": 20, "toolComponent": { "name": "QDJVM" } @@ -42237,28 +42237,28 @@ ] }, { - "id": "ReplaceToWithInfixForm", + "id": "ReplaceNullCheck", "shortDescription": { - "text": "'to' call should be replaced with infix form" + "text": "Null check can be replaced with method call" }, "fullDescription": { - "text": "Reports 'to' function calls that can be replaced with the infix form. Using the infix form makes your code simpler. The quick-fix replaces 'to' with the infix form. Example: 'fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) {\n val pair = a to b\n }'", - "markdown": "Reports `to` function calls that can be replaced with the infix form.\n\nUsing the infix form makes your code simpler.\n\nThe quick-fix replaces `to` with the infix form.\n\n**Example:**\n\n\n fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int, b: Int) {\n val pair = a to b\n }\n" + "text": "Reports 'null' checks that can be replaced with a call to a static method from 'Objects' or 'Stream'. Example: 'if (message == null) {\n application.messageStorage().save(new EmptyMessage());\n } else {\n application.messageStorage().save(message);\n }' After the quick-fix is applied: 'application.messageStorage()\n .save(Objects.requireNonNullElseGet(message, () -> new EmptyMessage()));' Use the Don't warn if the replacement is longer than the original option to ignore the cases when the replacement is longer than the original code. New in 2017.3", + "markdown": "Reports `null` checks that can be replaced with a call to a static method from `Objects` or `Stream`.\n\n**Example:**\n\n\n if (message == null) {\n application.messageStorage().save(new EmptyMessage());\n } else {\n application.messageStorage().save(message);\n }\n\nAfter the quick-fix is applied:\n\n\n application.messageStorage()\n .save(Objects.requireNonNullElseGet(message, () -> new EmptyMessage()));\n\n\nUse the **Don't warn if the replacement is longer than the original** option to ignore the cases when the replacement is longer than the\noriginal code.\n\nNew in 2017.3" }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ReplaceToWithInfixForm", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ReplaceNullCheck", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Style issues", - "index": 3, + "id": "Java/Java language level migration aids/Java 9", + "index": 87, "toolComponent": { "name": "QDJVM" } @@ -42270,28 +42270,28 @@ ] }, { - "id": "ConstPropertyName", + "id": "StaticImport", "shortDescription": { - "text": "Const property naming convention" + "text": "Static import" }, "fullDescription": { - "text": "Reports 'const' property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, 'const' properties should use uppercase underscore-separated names. Example: 'const val Planck: Double = 6.62607015E-34' The quick-fix renames the property: 'const val PLANCK: Double = 6.62607015E-34'", - "markdown": "Reports `const` property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#property-names),\n`const` properties should use uppercase underscore-separated names.\n\n**Example:**\n\n\n const val Planck: Double = 6.62607015E-34\n\nThe quick-fix renames the property:\n\n\n const val PLANCK: Double = 6.62607015E-34\n" + "text": "Reports 'import static' statements. Such 'import' statements are not supported under Java 1.4 or earlier JVMs. Configure the inspection: Use the table below to specify the classes that will be ignored by the inspection when used in an 'import static' statement. Use the Ignore single field static imports checkbox to ignore single-field 'import static' statements. Use the Ignore single method static imports checkbox to ignore single-method 'import static' statements.", + "markdown": "Reports `import static` statements.\n\nSuch `import` statements are not supported under Java 1.4 or earlier JVMs.\n\nConfigure the inspection:\n\n* Use the table below to specify the classes that will be ignored by the inspection when used in an `import static` statement.\n* Use the **Ignore single field static imports** checkbox to ignore single-field `import static` statements.\n* Use the **Ignore single method static imports** checkbox to ignore single-method `import static` statements." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "ConstPropertyName", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "StaticImport", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "Kotlin/Naming conventions", - "index": 71, + "id": "Java/Imports", + "index": 24, "toolComponent": { "name": "QDJVM" } @@ -42303,19 +42303,19 @@ ] }, { - "id": "RedundantNullableReturnType", + "id": "NoExplicitFinalizeCalls", "shortDescription": { - "text": "Redundant nullable return type" + "text": "'finalize()' called explicitly" }, "fullDescription": { - "text": "Reports functions and variables with nullable return type which never return or become 'null'. Example: 'fun greeting(user: String): String? = \"Hello, $user!\"' After the quick-fix is applied: 'fun greeting(user: String): String = \"Hello, $user!\"'", - "markdown": "Reports functions and variables with nullable return type which never return or become `null`.\n\n**Example:**\n\n\n fun greeting(user: String): String? = \"Hello, $user!\"\n\nAfter the quick-fix is applied:\n\n\n fun greeting(user: String): String = \"Hello, $user!\"\n" + "text": "Reports calls to 'Object.finalize()'. Calling 'Object.finalize()' explicitly may result in objects being placed in an inconsistent state. The garbage collector automatically calls this method on an object when it determines that there are no references to this object. The inspection doesn't report calls to 'super.finalize()' from within implementations of 'finalize()' as they're benign. Example: 'MyObject m = new MyObject();\n m.finalize();\n System.gc()'", + "markdown": "Reports calls to `Object.finalize()`.\n\nCalling `Object.finalize()` explicitly may result in objects being placed in an\ninconsistent state.\nThe garbage collector automatically calls this method on an object when it determines that there are no references to this object.\n\nThe inspection doesn't report calls to `super.finalize()` from within implementations of `finalize()` as\nthey're benign.\n\n**Example:**\n\n\n MyObject m = new MyObject();\n m.finalize();\n System.gc()\n" }, "defaultConfiguration": { - "enabled": false, + "enabled": true, "level": "warning", "parameters": { - "suppressToolId": "RedundantNullableReturnType", + "suppressToolId": "FinalizeCalledExplicitly", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -42323,8 +42323,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Redundant constructs", - "index": 4, + "id": "Java/Finalization", + "index": 75, "toolComponent": { "name": "QDJVM" } @@ -42336,19 +42336,19 @@ ] }, { - "id": "UselessCallOnNotNull", + "id": "NegatedIfElse", "shortDescription": { - "text": "Useless call on not-null type" + "text": "'if' statement with negated condition" }, "fullDescription": { - "text": "Reports calls on not-null receiver that make sense only for nullable receiver. Several functions from the standard library such as 'orEmpty()' or 'isNullOrEmpty' have sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same. Remove redundant call and Change call to … quick-fixes can be used to amend the code automatically. Examples: 'fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }'", - "markdown": "Reports calls on not-null receiver that make sense only for nullable receiver.\n\nSeveral functions from the standard library such as `orEmpty()` or `isNullOrEmpty`\nhave sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same.\n\n**Remove redundant call** and **Change call to ...** quick-fixes can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }\n" + "text": "Reports 'if' statements that contain 'else' branches and whose conditions are negated. Flipping the order of the 'if' and 'else' branches usually increases the clarity of such statements. There is a fix that inverts the current 'if' statement. Example: 'void m(Object o1, Object o2) {\n if (o1 != o2) {\n System.out.println(1);\n }\n else {\n System.out.println(2);\n }\n }' After applying the quick-fix: 'void m(Object o1, Object o2) {\n if (o1 == o2) {\n System.out.println(2);\n } else {\n System.out.println(1);\n }\n }' Use the Ignore '!= null' comparisons option to ignore comparisons of the '!= null' form. Use the Ignore '!= 0' comparisons option to ignore comparisons of the '!= 0' form.", + "markdown": "Reports `if` statements that contain `else` branches and whose conditions are negated.\n\nFlipping the order of the `if` and `else`\nbranches usually increases the clarity of such statements.\n\nThere is a fix that inverts the current `if` statement.\n\nExample:\n\n\n void m(Object o1, Object o2) {\n if (o1 != o2) {\n System.out.println(1);\n }\n else {\n System.out.println(2);\n }\n }\n\nAfter applying the quick-fix:\n\n\n void m(Object o1, Object o2) {\n if (o1 == o2) {\n System.out.println(2);\n } else {\n System.out.println(1);\n }\n }\n\nUse the **Ignore '!= null' comparisons** option to ignore comparisons of the `!= null` form.\n\nUse the **Ignore '!= 0' comparisons** option to ignore comparisons of the `!= 0` form." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "UselessCallOnNotNull", + "suppressToolId": "IfStatementWithNegatedCondition", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -42356,8 +42356,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Control flow issues", + "index": 31, "toolComponent": { "name": "QDJVM" } @@ -42369,19 +42369,19 @@ ] }, { - "id": "EqualsOrHashCode", + "id": "FieldCount", "shortDescription": { - "text": "'equals()' and 'hashCode()' not paired" + "text": "Class with too many fields" }, "fullDescription": { - "text": "Reports classes that override 'equals()' but do not override 'hashCode()', or vice versa. It also reports object declarations that override either 'equals()' or 'hashCode()'. This can lead to undesired behavior when a class is added to a 'Collection' Example: 'class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }' The quick-fix overrides 'equals()' or 'hashCode()' for classes and deletes these methods for objects: 'class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }'", - "markdown": "Reports classes that override `equals()` but do not override `hashCode()`, or vice versa. It also reports object declarations that override either `equals()` or `hashCode()`.\n\nThis can lead to undesired behavior when a class is added to a `Collection`\n\n**Example:**\n\n\n class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }\n\nThe quick-fix overrides `equals()` or `hashCode()` for classes and deletes these methods for objects:\n\n\n class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }\n" + "text": "Reports classes whose number of fields exceeds the specified maximum. Classes with a large number of fields are often trying to do too much. Consider splitting such a class into multiple smaller classes. Configure the inspection: Use the Field count limit field to specify the maximum allowed number of fields in a class. Use the Include constant fields in count option to indicate whether constant fields should be counted. By default only immutable 'static final' objects are counted as constants. Use the 'static final' fields count as constant option to count any 'static final' field as constant. Use the Include enum constants in count option to specify whether 'enum' constants in 'enum' classes should be counted.", + "markdown": "Reports classes whose number of fields exceeds the specified maximum.\n\nClasses with a large number of fields are often trying to do too much. Consider splitting such a class into multiple smaller classes.\n\nConfigure the inspection:\n\n* Use the **Field count limit** field to specify the maximum allowed number of fields in a class.\n* Use the **Include constant fields in count** option to indicate whether constant fields should be counted.\n* By default only immutable `static final` objects are counted as constants. Use the **'static final' fields count as constant** option to count any `static final` field as constant.\n* Use the **Include enum constants in count** option to specify whether `enum` constants in `enum` classes should be counted." }, "defaultConfiguration": { - "enabled": true, + "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "EqualsOrHashCode", + "suppressToolId": "ClassWithTooManyFields", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -42389,8 +42389,8 @@ "relationships": [ { "target": { - "id": "Kotlin/Probable bugs", - "index": 28, + "id": "Java/Class metrics", + "index": 125, "toolComponent": { "name": "QDJVM" } @@ -42468,7 +42468,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -42501,7 +42501,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -42666,7 +42666,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -42864,7 +42864,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -42897,7 +42897,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -42963,7 +42963,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -42996,7 +42996,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43029,7 +43029,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43062,7 +43062,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43095,7 +43095,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43161,7 +43161,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43194,7 +43194,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43359,7 +43359,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43458,7 +43458,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43524,7 +43524,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43590,7 +43590,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43689,7 +43689,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43755,7 +43755,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -43788,7 +43788,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44019,7 +44019,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44052,7 +44052,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44085,7 +44085,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44151,7 +44151,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44184,7 +44184,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44217,7 +44217,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44283,7 +44283,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44316,7 +44316,7 @@ { "target": { "id": "Spring/Spring Core/Code", - "index": 14, + "index": 13, "toolComponent": { "name": "QDJVM" } @@ -44616,7 +44616,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -44682,7 +44682,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -44847,7 +44847,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -45519,19 +45519,19 @@ ] }, { - "id": "GrReassignedInClosureLocalVar", + "id": "GroovyMethodParameterCount", "shortDescription": { - "text": "Local variable is reassigned in closure or anonymous class" + "text": "Method with too many parameters" }, "fullDescription": { - "text": "Reports local variables assigned to expression with different type inside of closure or anonymous class. Example: 'int sum = 0\n [1, 2, 3].each { sum += 'as' }\n println(sum)' As a result, the 'integer' variable sum is reassigned to a 'String' expression.", - "markdown": "Reports local variables assigned to expression with different type inside of closure or anonymous class.\n\n**Example:**\n\n\n int sum = 0\n [1, 2, 3].each { sum += 'as' }\n println(sum)\n\nAs a result, the `integer` variable **sum** is reassigned to a `String` expression." + "text": "Reports methods with too many parameters. Method with too many parameters is a good sign that refactoring is necessary. Methods whose signatures are inherited from library classes are ignored by this inspection. Use the Maximum number of parameters: field to specify the maximum acceptable number of parameters a method might have.", + "markdown": "Reports methods with too many parameters. Method with too many parameters is a good sign that refactoring is necessary. Methods whose signatures are inherited from library classes are ignored by this inspection.\n\n\nUse the **Maximum number of parameters:** field to specify the maximum acceptable number of parameters a method might have." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "GrReassignedInClosureLocalVar", + "suppressToolId": "GroovyMethodParameterCount", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -45539,8 +45539,8 @@ "relationships": [ { "target": { - "id": "Groovy/Potentially confusing code constructs", - "index": 118, + "id": "Groovy/Method metrics", + "index": 149, "toolComponent": { "name": "QDJVM" } @@ -45552,19 +45552,19 @@ ] }, { - "id": "GroovyMethodParameterCount", + "id": "GrReassignedInClosureLocalVar", "shortDescription": { - "text": "Method with too many parameters" + "text": "Local variable is reassigned in closure or anonymous class" }, "fullDescription": { - "text": "Reports methods with too many parameters. Method with too many parameters is a good sign that refactoring is necessary. Methods whose signatures are inherited from library classes are ignored by this inspection. Use the Maximum number of parameters: field to specify the maximum acceptable number of parameters a method might have.", - "markdown": "Reports methods with too many parameters. Method with too many parameters is a good sign that refactoring is necessary. Methods whose signatures are inherited from library classes are ignored by this inspection.\n\n\nUse the **Maximum number of parameters:** field to specify the maximum acceptable number of parameters a method might have." + "text": "Reports local variables assigned to expression with different type inside of closure or anonymous class. Example: 'int sum = 0\n [1, 2, 3].each { sum += 'as' }\n println(sum)' As a result, the 'integer' variable sum is reassigned to a 'String' expression.", + "markdown": "Reports local variables assigned to expression with different type inside of closure or anonymous class.\n\n**Example:**\n\n\n int sum = 0\n [1, 2, 3].each { sum += 'as' }\n println(sum)\n\nAs a result, the `integer` variable **sum** is reassigned to a `String` expression." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "GroovyMethodParameterCount", + "suppressToolId": "GrReassignedInClosureLocalVar", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -45572,8 +45572,8 @@ "relationships": [ { "target": { - "id": "Groovy/Method metrics", - "index": 149, + "id": "Groovy/Potentially confusing code constructs", + "index": 118, "toolComponent": { "name": "QDJVM" } @@ -45672,7 +45672,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -46035,7 +46035,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -46563,7 +46563,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -47190,7 +47190,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -47234,39 +47234,6 @@ } ] }, - { - "id": "UnnecessaryQualifiedReference", - "shortDescription": { - "text": "Unnecessary qualified reference" - }, - "fullDescription": { - "text": "Reports fully qualified references, which can be replaced with import. Example: 'def swingBuilder = new groovy.swing.SwingBuilder()' After the quick-fix is applied: 'import groovy.swing.SwingBuilder\n \n def swingBuilder = new SwingBuilder()'", - "markdown": "Reports fully qualified references, which can be replaced with import.\n\n**Example:**\n\n\n def swingBuilder = new groovy.swing.SwingBuilder()\n\nAfter the quick-fix is applied:\n\n\n import groovy.swing.SwingBuilder\n \n def swingBuilder = new SwingBuilder()\n" - }, - "defaultConfiguration": { - "enabled": false, - "level": "warning", - "parameters": { - "suppressToolId": "UnnecessaryQualifiedReference", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" - } - }, - "relationships": [ - { - "target": { - "id": "Groovy/Potentially confusing code constructs", - "index": 118, - "toolComponent": { - "name": "QDJVM" - } - }, - "kinds": [ - "superset" - ] - } - ] - }, { "id": "ChangeToMethod", "shortDescription": { @@ -47300,6 +47267,39 @@ } ] }, + { + "id": "UnnecessaryQualifiedReference", + "shortDescription": { + "text": "Unnecessary qualified reference" + }, + "fullDescription": { + "text": "Reports fully qualified references, which can be replaced with import. Example: 'def swingBuilder = new groovy.swing.SwingBuilder()' After the quick-fix is applied: 'import groovy.swing.SwingBuilder\n \n def swingBuilder = new SwingBuilder()'", + "markdown": "Reports fully qualified references, which can be replaced with import.\n\n**Example:**\n\n\n def swingBuilder = new groovy.swing.SwingBuilder()\n\nAfter the quick-fix is applied:\n\n\n import groovy.swing.SwingBuilder\n \n def swingBuilder = new SwingBuilder()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "suppressToolId": "UnnecessaryQualifiedReference", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + "relationships": [ + { + "target": { + "id": "Groovy/Potentially confusing code constructs", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, { "id": "GroovyBreak", "shortDescription": { @@ -47388,7 +47388,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -47454,7 +47454,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -47487,7 +47487,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -47520,7 +47520,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -47982,7 +47982,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -48048,7 +48048,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -48378,7 +48378,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -48444,7 +48444,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -48642,7 +48642,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -48741,7 +48741,7 @@ { "target": { "id": "Groovy/Probable bugs", - "index": 60, + "index": 61, "toolComponent": { "name": "QDJVM" } @@ -49231,7 +49231,7 @@ { "target": { "id": "JVM languages", - "index": 1, + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -54307,7 +54307,7 @@ { "target": { "id": "JavaScript and TypeScript/Validity issues", - "index": 54, + "index": 55, "toolComponent": { "name": "QDJVM" } @@ -55033,7 +55033,7 @@ { "target": { "id": "JavaScript and TypeScript/Validity issues", - "index": 54, + "index": 55, "toolComponent": { "name": "QDJVM" } @@ -56419,7 +56419,7 @@ { "target": { "id": "JavaScript and TypeScript/Imports and dependencies", - "index": 172, + "index": 174, "toolComponent": { "name": "QDJVM" } @@ -57079,7 +57079,7 @@ { "target": { "id": "JavaScript and TypeScript/Validity issues", - "index": 54, + "index": 55, "toolComponent": { "name": "QDJVM" } @@ -57223,28 +57223,28 @@ ] }, { - "id": "ConstantOnLHSOfComparisonJS", + "id": "JSCheckFunctionSignatures", "shortDescription": { - "text": "Constant on left side of comparison" + "text": "Signature mismatch" }, "fullDescription": { - "text": "Reports a comparison operation with a constant value in the left-hand side. According to coding conventions, constants should be in the right-hand side of comparisons.", - "markdown": "Reports a comparison operation with a constant value in the left-hand side. According to coding conventions, constants should be in the right-hand side of comparisons." + "text": "Reports a JavaScript call expression where the arguments do not match the signature of the referenced function, including the types of arguments and their number. Also, reports if the overloading function doesn't match the overloaded one in terms of parameters and return types. TypeScript code is ignored.", + "markdown": "Reports a JavaScript call expression where the arguments do not match the signature of the referenced function, including the types of arguments and their number. Also, reports if the overloading function doesn't match the overloaded one in terms of parameters and return types.\n\nTypeScript code is ignored." }, "defaultConfiguration": { "enabled": false, - "level": "warning", + "level": "note", "parameters": { - "suppressToolId": "ConstantOnLefSideOfComparisonJS", - "ideaSeverity": "WARNING", - "qodanaSeverity": "High" + "suppressToolId": "JSCheckFunctionSignatures", + "ideaSeverity": "WEAK WARNING", + "qodanaSeverity": "Moderate" } }, "relationships": [ { "target": { - "id": "JavaScript and TypeScript/Code style issues", - "index": 145, + "id": "JavaScript and TypeScript/General", + "index": 43, "toolComponent": { "name": "QDJVM" } @@ -57256,28 +57256,28 @@ ] }, { - "id": "JSCheckFunctionSignatures", + "id": "ConstantOnLHSOfComparisonJS", "shortDescription": { - "text": "Signature mismatch" + "text": "Constant on left side of comparison" }, "fullDescription": { - "text": "Reports a JavaScript call expression where the arguments do not match the signature of the referenced function, including the types of arguments and their number. Also, reports if the overloading function doesn't match the overloaded one in terms of parameters and return types. TypeScript code is ignored.", - "markdown": "Reports a JavaScript call expression where the arguments do not match the signature of the referenced function, including the types of arguments and their number. Also, reports if the overloading function doesn't match the overloaded one in terms of parameters and return types.\n\nTypeScript code is ignored." + "text": "Reports a comparison operation with a constant value in the left-hand side. According to coding conventions, constants should be in the right-hand side of comparisons.", + "markdown": "Reports a comparison operation with a constant value in the left-hand side. According to coding conventions, constants should be in the right-hand side of comparisons." }, "defaultConfiguration": { "enabled": false, - "level": "note", + "level": "warning", "parameters": { - "suppressToolId": "JSCheckFunctionSignatures", - "ideaSeverity": "WEAK WARNING", - "qodanaSeverity": "Moderate" + "suppressToolId": "ConstantOnLefSideOfComparisonJS", + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" } }, "relationships": [ { "target": { - "id": "JavaScript and TypeScript/General", - "index": 43, + "id": "JavaScript and TypeScript/Code style issues", + "index": 145, "toolComponent": { "name": "QDJVM" } @@ -58168,7 +58168,7 @@ { "target": { "id": "JavaScript and TypeScript/Validity issues", - "index": 54, + "index": 55, "toolComponent": { "name": "QDJVM" } @@ -58234,7 +58234,7 @@ { "target": { "id": "JavaScript and TypeScript/Imports and dependencies", - "index": 172, + "index": 174, "toolComponent": { "name": "QDJVM" } @@ -58300,7 +58300,7 @@ { "target": { "id": "JavaScript and TypeScript/Validity issues", - "index": 54, + "index": 55, "toolComponent": { "name": "QDJVM" } @@ -58729,7 +58729,7 @@ { "target": { "id": "JavaScript and TypeScript/Validity issues", - "index": 54, + "index": 55, "toolComponent": { "name": "QDJVM" } @@ -58939,19 +58939,19 @@ ] }, { - "id": "ES6UnusedImports", + "id": "InnerHTMLJS", "shortDescription": { - "text": "Unused import" + "text": "Use of 'innerHTML' property" }, "fullDescription": { - "text": "Reports a redundant 'import' statement. This is usually the case if the imported symbols are not used in the source file. To avoid side-effects, consider using bare import 'import 'packageName'' instead of the regular one.", - "markdown": "Reports a redundant `import` statement. This is usually the case if the imported symbols are not used in the source file. To avoid side-effects, consider using bare import `import 'packageName'` instead of the regular one." + "text": "Reports a JavaScript access to DOM nodes as text using the 'innerHTML' property. Most usages of 'innerHTML' are performed better with explicit DOM calls, such as 'getElementByID()' and 'createElement()'. Additionally, 'innerHTML' will not work with XML DOMs, including DOMs for XHTML if viewed as XML. This can lead to difficulties in diagnosing bugs.", + "markdown": "Reports a JavaScript access to DOM nodes as text using the `innerHTML` property. Most usages of `innerHTML` are performed better with explicit DOM calls, such as `getElementByID()` and `createElement()`. Additionally, `innerHTML` will not work with XML DOMs, including DOMs for XHTML if viewed as XML. This can lead to difficulties in diagnosing bugs." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "ES6UnusedImports", + "suppressToolId": "InnerHTMLJS", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -58959,8 +58959,8 @@ "relationships": [ { "target": { - "id": "JavaScript and TypeScript/Imports and dependencies", - "index": 172, + "id": "JavaScript and TypeScript/DOM issues", + "index": 110, "toolComponent": { "name": "QDJVM" } @@ -58972,19 +58972,19 @@ ] }, { - "id": "InnerHTMLJS", + "id": "ES6UnusedImports", "shortDescription": { - "text": "Use of 'innerHTML' property" + "text": "Unused import" }, "fullDescription": { - "text": "Reports a JavaScript access to DOM nodes as text using the 'innerHTML' property. Most usages of 'innerHTML' are performed better with explicit DOM calls, such as 'getElementByID()' and 'createElement()'. Additionally, 'innerHTML' will not work with XML DOMs, including DOMs for XHTML if viewed as XML. This can lead to difficulties in diagnosing bugs.", - "markdown": "Reports a JavaScript access to DOM nodes as text using the `innerHTML` property. Most usages of `innerHTML` are performed better with explicit DOM calls, such as `getElementByID()` and `createElement()`. Additionally, `innerHTML` will not work with XML DOMs, including DOMs for XHTML if viewed as XML. This can lead to difficulties in diagnosing bugs." + "text": "Reports a redundant 'import' statement. This is usually the case if the imported symbols are not used in the source file. To avoid side-effects, consider using bare import 'import 'packageName'' instead of the regular one.", + "markdown": "Reports a redundant `import` statement. This is usually the case if the imported symbols are not used in the source file. To avoid side-effects, consider using bare import `import 'packageName'` instead of the regular one." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "InnerHTMLJS", + "suppressToolId": "ES6UnusedImports", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -58992,8 +58992,8 @@ "relationships": [ { "target": { - "id": "JavaScript and TypeScript/DOM issues", - "index": 110, + "id": "JavaScript and TypeScript/Imports and dependencies", + "index": 174, "toolComponent": { "name": "QDJVM" } @@ -59203,19 +59203,19 @@ ] }, { - "id": "NonBlockStatementBodyJS", + "id": "JSValidateJSDoc", "shortDescription": { - "text": "Statement body without braces" + "text": "Syntax errors and unresolved references in JSDoc" }, "fullDescription": { - "text": "Reports a 'if', 'while', 'for', or 'with' statements whose body is not a block statement. Using code block in statement bodies is usually safer for downstream maintenance.", - "markdown": "Reports a `if`, `while`, `for`, or `with` statements whose body is not a block statement. Using code block in statement bodies is usually safer for downstream maintenance." + "text": "Reports a syntax discrepancy in a documentation comment.", + "markdown": "Reports a syntax discrepancy in a documentation comment." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "NonBlockStatementBodyJS", + "suppressToolId": "JSValidateJSDoc", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -59223,8 +59223,8 @@ "relationships": [ { "target": { - "id": "JavaScript and TypeScript/Code style issues", - "index": 145, + "id": "JavaScript and TypeScript/General", + "index": 43, "toolComponent": { "name": "QDJVM" } @@ -59236,19 +59236,19 @@ ] }, { - "id": "JSValidateJSDoc", + "id": "NonBlockStatementBodyJS", "shortDescription": { - "text": "Syntax errors and unresolved references in JSDoc" + "text": "Statement body without braces" }, "fullDescription": { - "text": "Reports a syntax discrepancy in a documentation comment.", - "markdown": "Reports a syntax discrepancy in a documentation comment." + "text": "Reports a 'if', 'while', 'for', or 'with' statements whose body is not a block statement. Using code block in statement bodies is usually safer for downstream maintenance.", + "markdown": "Reports a `if`, `while`, `for`, or `with` statements whose body is not a block statement. Using code block in statement bodies is usually safer for downstream maintenance." }, "defaultConfiguration": { "enabled": false, "level": "warning", "parameters": { - "suppressToolId": "JSValidateJSDoc", + "suppressToolId": "NonBlockStatementBodyJS", "ideaSeverity": "WARNING", "qodanaSeverity": "High" } @@ -59256,8 +59256,8 @@ "relationships": [ { "target": { - "id": "JavaScript and TypeScript/General", - "index": 43, + "id": "JavaScript and TypeScript/Code style issues", + "index": 145, "toolComponent": { "name": "QDJVM" } @@ -59851,7 +59851,7 @@ { "target": { "id": "JavaScript and TypeScript/Imports and dependencies", - "index": 172, + "index": 174, "toolComponent": { "name": "QDJVM" } @@ -59917,7 +59917,7 @@ { "target": { "id": "JavaScript and TypeScript/Validity issues", - "index": 54, + "index": 55, "toolComponent": { "name": "QDJVM" } @@ -60280,7 +60280,7 @@ { "target": { "id": "JavaScript and TypeScript/Imports and dependencies", - "index": 172, + "index": 174, "toolComponent": { "name": "QDJVM" } @@ -60610,7 +60610,7 @@ { "target": { "id": "JavaScript and TypeScript/Imports and dependencies", - "index": 172, + "index": 174, "toolComponent": { "name": "QDJVM" } @@ -61570,7 +61570,7 @@ { "target": { "id": "Reactive Streams/Common", - "index": 46, + "index": 45, "toolComponent": { "name": "QDJVM" } @@ -61603,7 +61603,7 @@ { "target": { "id": "Reactive Streams/Common", - "index": 46, + "index": 45, "toolComponent": { "name": "QDJVM" } @@ -61636,7 +61636,7 @@ { "target": { "id": "Reactive Streams/Common", - "index": 46, + "index": 45, "toolComponent": { "name": "QDJVM" } @@ -61669,7 +61669,7 @@ { "target": { "id": "Reactive Streams/Common", - "index": 46, + "index": 45, "toolComponent": { "name": "QDJVM" } @@ -61735,7 +61735,7 @@ { "target": { "id": "Reactive Streams/Common", - "index": 46, + "index": 45, "toolComponent": { "name": "QDJVM" } @@ -61867,7 +61867,7 @@ { "target": { "id": "Reactive Streams/Common", - "index": 46, + "index": 45, "toolComponent": { "name": "QDJVM" } @@ -62011,7 +62011,7 @@ { "target": { "id": "Gradle/Validity issues", - "index": 55, + "index": 54, "toolComponent": { "name": "QDJVM" } @@ -62176,7 +62176,7 @@ { "target": { "id": "Gradle/Validity issues", - "index": 55, + "index": 54, "toolComponent": { "name": "QDJVM" } @@ -74002,7 +74002,7 @@ { "target": { "id": "JVM languages", - "index": 1, + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -74035,7 +74035,7 @@ { "target": { "id": "JVM languages", - "index": 1, + "index": 3, "toolComponent": { "name": "QDJVM" } @@ -74739,7 +74739,7 @@ }, "invocations": [ { - "startTimeUtc": "2024-10-27T20:43:51.867083999Z", + "startTimeUtc": "2024-10-30T03:32:52.572274908Z", "exitCode": 0, "executionSuccessful": true } @@ -74748,7 +74748,7 @@ "versionControlProvenance": [ { "repositoryUri": "https://github.com/1c-syntax/bsl-language-server.git", - "revisionId": "fe793156ab9bbc0f5496e4959880329d88e9f9ba", + "revisionId": "810c04ade64b5948b7509a3183a868c4126104be", "branch": "develop", "properties": { "repoUrl": "https://github.com/1c-syntax/bsl-language-server.git", @@ -80467,10 +80467,10 @@ } ], "automationDetails": { - "id": "bsl-language-server/qodana/2024-10-27", - "guid": "03a0aec3-9ceb-4b59-ba2a-ee20cecad1f1", + "id": "bsl-language-server/qodana/2024-10-30", + "guid": "2579c655-d6d0-4466-949e-51ddf0a18250", "properties": { - "jobUrl": "https://github.com/1c-syntax/bsl-language-server/actions/runs/11543657849", + "jobUrl": "https://github.com/1c-syntax/bsl-language-server/actions/runs/11586482616", "analysisKind": "regular" } }, @@ -80828,13 +80828,13 @@ { "physicalLocation": { "artifactLocation": { - "uri": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java", + "uri": "src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/DocumentLinkOptions.java", "uriBaseId": "SRCROOT" }, "region": { - "startLine": 101, - "startColumn": 23, - "charOffset": 4108, + "startLine": 34, + "startColumn": 38, + "charOffset": 1319, "charLength": 2, "snippet": { "text": "__" @@ -80842,12 +80842,12 @@ "sourceLanguage": "JAVA" }, "contextRegion": { - "startLine": 99, + "startLine": 32, "startColumn": 1, - "charOffset": 4032, - "charLength": 224, + "charOffset": 1272, + "charLength": 163, "snippet": { - "text": " private LanguageServerConfiguration configuration;\n\n @Setter(onMethod = @__({@Autowired}))\n private ObjectProvider cognitiveComplexityComputerProvider;\n @Setter(onMethod = @__({@Autowired}))" + "text": " */\n@Data\n@AllArgsConstructor(onConstructor = @__({@JsonCreator(mode = JsonCreator.Mode.DISABLED)}))\n@NoArgsConstructor\n@JsonIgnoreProperties(ignoreUnknown = true)" }, "sourceLanguage": "JAVA" } @@ -80861,8 +80861,8 @@ } ], "partialFingerprints": { - "equalIndicator/v2": "67bec290e75c9ea1", - "equalIndicator/v1": "65ee08075b816582a26dd66fc5efe287a5f3342482f705dc17354260652d8a05" + "equalIndicator/v2": "83da478433e951c5", + "equalIndicator/v1": "7ac59927d7bddc7cee15565e790adb4bbec70aa6526f96cd5917b141510ff8bd" }, "properties": { "ideaSeverity": "ERROR", @@ -80884,13 +80884,13 @@ { "physicalLocation": { "artifactLocation": { - "uri": "src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/DocumentLinkOptions.java", + "uri": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java", "uriBaseId": "SRCROOT" }, "region": { - "startLine": 34, - "startColumn": 38, - "charOffset": 1319, + "startLine": 66, + "startColumn": 23, + "charOffset": 2598, "charLength": 2, "snippet": { "text": "__" @@ -80898,12 +80898,12 @@ "sourceLanguage": "JAVA" }, "contextRegion": { - "startLine": 32, + "startLine": 64, "startColumn": 1, - "charOffset": 1272, - "charLength": 163, + "charOffset": 2526, + "charLength": 160, "snippet": { - "text": " */\n@Data\n@AllArgsConstructor(onConstructor = @__({@JsonCreator(mode = JsonCreator.Mode.DISABLED)}))\n@NoArgsConstructor\n@JsonIgnoreProperties(ignoreUnknown = true)" + "text": " private final DocumentContext documentContext;\n\n @Setter(onMethod = @__({@Autowired}), value = AccessLevel.PACKAGE)\n private StringInterner stringInterner;\n" }, "sourceLanguage": "JAVA" } @@ -80917,8 +80917,8 @@ } ], "partialFingerprints": { - "equalIndicator/v2": "83da478433e951c5", - "equalIndicator/v1": "7ac59927d7bddc7cee15565e790adb4bbec70aa6526f96cd5917b141510ff8bd" + "equalIndicator/v2": "cb668891729a654d", + "equalIndicator/v1": "7e189a2db2fc9369500827720b491be8db24c1ee75ac0b0ce962762b335e1354" }, "properties": { "ideaSeverity": "ERROR", @@ -80940,13 +80940,13 @@ { "physicalLocation": { "artifactLocation": { - "uri": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java", + "uri": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java", "uriBaseId": "SRCROOT" }, "region": { - "startLine": 66, + "startLine": 94, "startColumn": 23, - "charOffset": 2598, + "charOffset": 3852, "charLength": 2, "snippet": { "text": "__" @@ -80954,12 +80954,12 @@ "sourceLanguage": "JAVA" }, "contextRegion": { - "startLine": 64, + "startLine": 92, "startColumn": 1, - "charOffset": 2526, - "charLength": 160, + "charOffset": 3806, + "charLength": 136, "snippet": { - "text": " private final DocumentContext documentContext;\n\n @Setter(onMethod = @__({@Autowired}), value = AccessLevel.PACKAGE)\n private StringInterner stringInterner;\n" + "text": " private int version;\n\n @Setter(onMethod = @__({@Autowired}))\n private ServerContext context;\n @Setter(onMethod = @__({@Autowired}))" }, "sourceLanguage": "JAVA" } @@ -80973,8 +80973,8 @@ } ], "partialFingerprints": { - "equalIndicator/v2": "cb668891729a654d", - "equalIndicator/v1": "7e189a2db2fc9369500827720b491be8db24c1ee75ac0b0ce962762b335e1354" + "equalIndicator/v2": "75598366b4636356", + "equalIndicator/v1": "82a4c404651a24f5837feb55fdd12e3c65266d9bbaca462d6ec14271d749b658" }, "properties": { "ideaSeverity": "ERROR", @@ -81377,64 +81377,6 @@ } } ], - "qodana.promo.results": [ - { - "ruleId": "DefaultAnnotationParam", - "kind": "fail", - "level": "warning", - "message": { - "text": "Redundant default parameter value assignment", - "markdown": "Redundant default parameter value assignment" - }, - "locations": [ - { - "physicalLocation": { - "artifactLocation": { - "uri": "src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BadWordsDiagnostic.java", - "uriBaseId": "SRCROOT" - }, - "region": { - "startLine": 51, - "startColumn": 20, - "charOffset": 1989, - "charLength": 17, - "snippet": { - "text": "BAD_WORDS_DEFAULT" - }, - "sourceLanguage": "JAVA" - }, - "contextRegion": { - "startLine": 49, - "startColumn": 1, - "charOffset": 1921, - "charLength": 169, - "snippet": { - "text": " @DiagnosticParameter(\n type = String.class,\n defaultValue = BAD_WORDS_DEFAULT\n )\n private Pattern badWords = CaseInsensitivePattern.compile(BAD_WORDS_DEFAULT);" - }, - "sourceLanguage": "JAVA" - } - }, - "logicalLocations": [ - { - "fullyQualifiedName": "bsl-language-server.main", - "kind": "module" - } - ] - } - ], - "partialFingerprints": { - "equalIndicator/v2": "1a90b847a759ba38", - "equalIndicator/v1": "ca52c609965d4a073ebaadadda63e9fd15661f8c1aeb89baf1f580f7907adac4" - }, - "properties": { - "ideaSeverity": "WARNING", - "qodanaSeverity": "High", - "tags": [ - "JAVA" - ] - } - } - ], "configProfile": "starter", "deviceId": "200820300000000-b1a5-d275-f8e7-faf9fd093ee8", "qodanaNewResultSummary": { diff --git a/qodana/results/sanity.json b/qodana/results/sanity.json index 3093263d3c3..e92c6dafff1 100644 --- a/qodana/results/sanity.json +++ b/qodana/results/sanity.json @@ -204,16 +204,16 @@ "sources": [ { "type": "file", - "path": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java", + "path": "src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/DocumentLinkOptions.java", "language": "JAVA", - "line": 101, - "offset": 23, + "line": 34, + "offset": 38, "length": 2, "code": { - "startLine": 99, + "startLine": 32, "length": 2, - "offset": 76, - "surroundingCode": " private LanguageServerConfiguration configuration;\n\n @Setter(onMethod = @__({@Autowired}))\n private ObjectProvider cognitiveComplexityComputerProvider;\n @Setter(onMethod = @__({@Autowired}))" + "offset": 47, + "surroundingCode": " */\n@Data\n@AllArgsConstructor(onConstructor = @__({@JsonCreator(mode = JsonCreator.Mode.DISABLED)}))\n@NoArgsConstructor\n@JsonIgnoreProperties(ignoreUnknown = true)" } } ], @@ -221,7 +221,7 @@ "module": "bsl-language-server.main", "inspectionName": "QodanaJavaSanity" }, - "hash": "65ee08075b816582a26dd66fc5efe287a5f3342482f705dc17354260652d8a05" + "hash": "7ac59927d7bddc7cee15565e790adb4bbec70aa6526f96cd5917b141510ff8bd" },{ "tool": "Code Inspection", "category": "General", @@ -236,16 +236,16 @@ "sources": [ { "type": "file", - "path": "src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/DocumentLinkOptions.java", + "path": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java", "language": "JAVA", - "line": 34, - "offset": 38, + "line": 66, + "offset": 23, "length": 2, "code": { - "startLine": 32, + "startLine": 64, "length": 2, - "offset": 47, - "surroundingCode": " */\n@Data\n@AllArgsConstructor(onConstructor = @__({@JsonCreator(mode = JsonCreator.Mode.DISABLED)}))\n@NoArgsConstructor\n@JsonIgnoreProperties(ignoreUnknown = true)" + "offset": 72, + "surroundingCode": " private final DocumentContext documentContext;\n\n @Setter(onMethod = @__({@Autowired}), value = AccessLevel.PACKAGE)\n private StringInterner stringInterner;\n" } } ], @@ -253,7 +253,7 @@ "module": "bsl-language-server.main", "inspectionName": "QodanaJavaSanity" }, - "hash": "7ac59927d7bddc7cee15565e790adb4bbec70aa6526f96cd5917b141510ff8bd" + "hash": "7e189a2db2fc9369500827720b491be8db24c1ee75ac0b0ce962762b335e1354" },{ "tool": "Code Inspection", "category": "General", @@ -268,16 +268,16 @@ "sources": [ { "type": "file", - "path": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java", + "path": "src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java", "language": "JAVA", - "line": 66, + "line": 94, "offset": 23, "length": 2, "code": { - "startLine": 64, + "startLine": 92, "length": 2, - "offset": 72, - "surroundingCode": " private final DocumentContext documentContext;\n\n @Setter(onMethod = @__({@Autowired}), value = AccessLevel.PACKAGE)\n private StringInterner stringInterner;\n" + "offset": 46, + "surroundingCode": " private int version;\n\n @Setter(onMethod = @__({@Autowired}))\n private ServerContext context;\n @Setter(onMethod = @__({@Autowired}))" } } ], @@ -285,7 +285,7 @@ "module": "bsl-language-server.main", "inspectionName": "QodanaJavaSanity" }, - "hash": "7e189a2db2fc9369500827720b491be8db24c1ee75ac0b0ce962762b335e1354" + "hash": "82a4c404651a24f5837feb55fdd12e3c65266d9bbaca462d6ec14271d749b658" },{ "tool": "Code Inspection", "category": "General",