diff --git a/java/java-impl/src/inspectionDescriptions/AccessStaticViaInstance.html b/java/java-impl/src/inspectionDescriptions/AccessStaticViaInstance.html index b904e91adbbf..d5ab6a10faa3 100644 --- a/java/java-impl/src/inspectionDescriptions/AccessStaticViaInstance.html +++ b/java/java-impl/src/inspectionDescriptions/AccessStaticViaInstance.html @@ -1,16 +1,19 @@
-Shows references to static methods and fields -via a class instance rather than a class itself.String s = String.valueOf(0); // correct: static method qualified with class nameString s1 = s.valueOf(0); // wrong: static method qualified with class instanceShows references to static methods and fields via a class instance rather than a class itself. While + allowed by Java Language Specification, referring to static members via instance variables makes the + code confusing as the reader may think that the result of the method depends on the instance.
+Quick-fix replaces the instance variable with the class name.
+Example:
++ String s1 = s.valueOf(0); ++
After the quick-fix is applied the result looks like:
++ String s = String.valueOf(0); ++ +
+ \ No newline at end of file diff --git a/java/java-impl/src/inspectionDescriptions/JavaReflectionInvocation.html b/java/java-impl/src/inspectionDescriptions/JavaReflectionInvocation.html index 1a720645362e..d7a4a43b6531 100644 --- a/java/java-impl/src/inspectionDescriptions/JavaReflectionInvocation.html +++ b/java/java-impl/src/inspectionDescriptions/JavaReflectionInvocation.html @@ -1,15 +1,14 @@
-The inspection checks that the arguments provided to Method.invoke() and Constructor.newInstance() -match the signature specified in Class.getMethod() and Class.getConstructor() - +Checks that the arguments provided toMethod.invoke() and Constructor.newInstance()
+match the signature specified in Class.getMethod() and Class.getConstructor()
Example:
-
+
Method m = myObj.getClass().getMethod("myMethod", int.class);
// the argument should be an int value
m.invoke(myObj, "abc");
-
-
+
+
New in 2017.2
\ No newline at end of file diff --git a/java/java-impl/src/inspectionDescriptions/ManualMinMaxCalculation.html b/java/java-impl/src/inspectionDescriptions/ManualMinMaxCalculation.html index 027f28b3eb28..d96c4c65f8a9 100644 --- a/java/java-impl/src/inspectionDescriptions/ManualMinMaxCalculation.html +++ b/java/java-impl/src/inspectionDescriptions/ManualMinMaxCalculation.html @@ -4,17 +4,23 @@ Reports cases where the minimum or the maximum of two numbers can be calculatedMath.max() or Math.min() instead of doing it manually.
Example:
- public int getMinWeight(int typeDiffWeight, int rawTypeDiffWeight) {
- return (rawTypeDiffWeight < typeDiffWeight ? rawTypeDiffWeight : typeDiffWeight);
+ public int min(int a, int b) {
+ return b < a ? b : a;
}
-Will be replaced with:
+After the fix is applied, the result will be like this:
- public int getMinWeight(int typeDiffWeight, int rawTypeDiffWeight) {
- return Math.min(rawTypeDiffWeight, typeDiffWeight);
+ public int min(int a, int b) {
+ return Math.min(a, b);
}
+
+ Use the checkbox below to disable this inspection for double and float
+ This might be useful because quick-fix may slightly break semantics for float/
+ double when handling NaN. Thought in most cases it will actually fix
+ the subtle bug when users did not care about NaN.
+
New in 2019.2