Project
IntelliJ IDEA
Priority
Major
Type
Bug
Fix versions
No Fix versions
State
Open
Assignee
Maxim Shafirov
Subsystem
Code Analysis. Inspection
Affected versions
No Affected versions
Fixed in build
No Fixed in build
  • Created by   Jonas Kvarnstrom
    6 years ago (02 Nov 2005 14:26)
  • Updated by   root
    2 years ago (17 Jan 2010 20:24)
  • Jira: IDEADEV-3683
    (history, comments)
 
IDEA-30498 Nullability not checked in initializer for static field
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
Nullability is apparently not checked in initializers for static fields. See the two occurrences of "new TestConstantConditions(null)" below – only one of them generates a warning.

package test;

import org.jetbrains.annotations.NotNull;

public class TestConstantConditions
{
static Object obj =    new TestConstantConditions(null); // No warning
TestConstantConditions(@NotNull Object obj) { }
void test() { new TestConstantConditions(null); } // Warning
}
Comments (1)
 
History
 
Linked Issues (?)
 
Jonas Kvarnstrom
  Jonas Kvarnstrom
16 Oct 2006 13:38
5 years ago
Still present in 6041. Though I obviously don't know the internals of the code it seems to me that this should be reasonably easy to fix (but please correct me if I'm wrong), and it would be nice to close this hole in the nullability checker.