I have the following Java code:
public class Something { static { new Something(); } public static final int[] EMPTY_INT_ARRAY = new int[0]; }
I use FindBugs to find code errors, but the following error never occurs:
SI: The static initializer instantiates before all static destination fields are assigned (SI_INSTANCE_BEFORE_FINALS_ASSIGNED)The static class initializer instantiates the class until all static leaf fields are assigned.
SI: The static initializer instantiates before all static destination fields are assigned (SI_INSTANCE_BEFORE_FINALS_ASSIGNED)
The static class initializer instantiates the class until all static leaf fields are assigned.
Is this the right case that should demonstrate this problem? why doesn't he raise this problem with code?
Not tried, but I think the example would be:
public class Something { static { new Something(); } public static final int CONST = 42; }
, FindBugs (16). , .