From 482b5c265e9ce45c4a8f99ca04aeab2617b9b044 Mon Sep 17 00:00:00 2001
From: Bas Leijdekkers The code is highlighted only if the field initializer is located in the initializer, and
+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, the inspection provides a quick-fix without code highlighting, as the fix may change the code semantics.
Example:
class MyClass {
@@ -14,7 +15,7 @@ Suggests replacing initializations of a field via assignment with field initiali
}
}
-The quick fix moves the assigned value to the field initializer removing the class initializer section if possible:
+The quick fix moves the assigned value to the field initializer removing the class initializer if possible:
class MyClass {
static final int intConstant = 10;