do not warn about unguarded field access in constructor (IDEA-26644)
authoranna <Anna.Kozlova@jetbrains.com>
Fri, 26 Nov 2010 15:22:21 +0000 (18:22 +0300)
committeranna <Anna.Kozlova@jetbrains.com>
Fri, 26 Nov 2010 16:34:15 +0000 (19:34 +0300)
java/java-impl/src/com/intellij/codeInspection/concurrencyAnnotations/FieldAccessNotGuardedInspection.java

index 9b7400e96b3266d02769ae2c799fef4e9913ce30..4a45e35d8f0d657554331b1b273f75c0dc0228d6 100644 (file)
@@ -68,6 +68,9 @@ public class FieldAccessNotGuardedInspection extends BaseJavaLocalInspectionTool
       if (containingMethod != null && JCiPUtil.isGuardedBy(containingMethod, guard)) {
         return;
       }
+      if (containingMethod != null && containingMethod.isConstructor()) {
+        return;
+      }
       if ("this".equals(guard)) {
         if (containingMethod != null && containingMethod.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
           return;