not initialized problem: fix static fields checks

This commit is contained in:
anna
2013-11-04 11:06:17 +01:00
parent a1f8ef4b0e
commit 17fbe75287
2 changed files with 11 additions and 1 deletions

View File

@@ -318,7 +318,7 @@ public class HighlightControlFlowUtil {
return null;
}
final PsiField anotherField = PsiTreeUtil.getTopmostParentOfType(expression, PsiField.class);
if (anotherField != null && anotherField.getContainingClass() == aClass) {
if (anotherField != null && anotherField.getContainingClass() == aClass && !field.hasModifierProperty(PsiModifier.STATIC)) {
startOffset = 0;
}
block = null;

View File

@@ -239,4 +239,14 @@ class IDEA100237 {
final int qux = <error descr="Variable 'bar' might not have been initialized">bar</error>.hashCode() + 1;
};
}
}
class StaticInitializerUsedInAnotherStaticField {
private static final int ENUMERATION_CACHE_SIZE;
static {
ENUMERATION_CACHE_SIZE = 0;
}
private static final int ourEnumerationCacheConstant = ENUMERATION_CACHE_SIZE;
}