From a43ac282e4d6944bf3019ca22150072c9dd985fb Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Mon, 23 Jul 2018 16:11:23 +0200 Subject: [PATCH] Improve description of "Type can be weakened" inspection Bold font should be used to draw attention. Type names and method names are not the important eye catchers here, it's the names of the configuration knobs. --- .../TypeMayBeWeakened.html | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/TypeMayBeWeakened.html b/plugins/InspectionGadgets/src/inspectionDescriptions/TypeMayBeWeakened.html index e03c5cbeb690..a82ddd5f185e 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/TypeMayBeWeakened.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/TypeMayBeWeakened.html @@ -1,34 +1,38 @@ Reports any variables which may be declared with a weaker type. For instance, -a variable may be of type ArrayList, and only the method -isEmpty() is called on it. In this case the type -List would do just as well. +a variable may be of type ArrayList, and only the method +isEmpty() is called on it. In this case the type +List would do just as well.

-Enable the first checkbox below to prevent weakening the left side of assignments when the right side is not +Enable the Use righthand type checkbox below +to prevent weakening the left side of assignments when the right side is not a type cast or new expression. When storing the result of a method call in a variable, it is useful to retain the type of the method call result instead of unnecessarily weakening it.

-Enable the second checkbox below to use the parameterized type of the collection as weakest type when +Enable the Use parameterized type checkbox below +to use the parameterized type of the collection as weakest type when the object evaluated is used as an argument to a collection method with a parameter type of -java.lang.Object. Use this option to prevent weakening to -Object when passing an object to the collection methods -get(), remove(), -contains(), indexOf(), -lastIndexOf(), containsKey() -and containsValue(). +java.lang.Object. +Use this option to prevent weakening to Object when passing an object to the collection methods +get(), remove(), +contains(), indexOf(), +lastIndexOf(), containsKey() and containsValue().

-Use the third checkbox below to specify if this inspection should warn when a type can be -weakened to java.lang.Object. Weakening to -java.lang.Object is often not very useful. +Enable the Do not weaken to Object checkbox below +to specify whether a type should be weakened to java.lang.Object. +Weakening to java.lang.Object is often not very useful.

-Use the fourth checkbox below to only report when the type can be weakened to an interface type. +Enable the Only weaken to an interface checkbox below +to only report when the type can be weakened to an interface type.

-Use the fifth checkbox below to prevent reporting when return type may be weakened. So, only variables will be analysed. +Enable the Do not weaken return type checkbox below +to prevent reporting when return type may be weakened. +Only variables will be analyzed.

-Stop classes are intended to prevent weakening to classes, lower than stop classes, even if it is possible. -In some cases it may improve readability. - +Stop classes are intended to prevent weakening to classes +lower than stop classes, even if it would be possible. +In some cases this may improve readability. - \ No newline at end of file +