mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] FieldCanBeLocalInspection: do not warn on volatile fields
Somewhat helps IDEA-100902 False warning Field can be converted to a local variable GitOrigin-RevId: cb6a4c06d8939ef35fbbfbc1a98baabc977fee26
This commit is contained in:
committed by
intellij-monorepo-bot
parent
42dc156132
commit
56d1fb8fb1
+5
@@ -52,6 +52,11 @@ public class FieldCanBeLocalInspection extends AbstractBaseJavaLocalInspectionTo
|
||||
if (!field.isPhysical() || AnnotationUtil.isAnnotated(field, excludeAnnos, 0)) {
|
||||
continue;
|
||||
}
|
||||
if (field.hasModifierProperty(PsiModifier.VOLATILE)) {
|
||||
// Assume that fields marked as volatile can be modified concurrently
|
||||
// (e.g. if the only method where they are changed is called from several threads)
|
||||
continue;
|
||||
}
|
||||
if (field.hasModifierProperty(PsiModifier.PRIVATE) && !(field.hasModifierProperty(PsiModifier.STATIC) && field.hasModifierProperty(PsiModifier.FINAL))) {
|
||||
candidates.add(field);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user