Community
Participate
Working Groups
NullPointerException when trying to compile the following program using the eclipse bath compiler. Program public class A { @NotNull final B.C<D> field; void x(@NotNull B.C<D> parameter) { field = parameter; } } Steps to reproduce Execute the following command: java -jar org.eclipse.jdt.core-3.13.0-SNAPSHOT-batch-compiler.jar -1.8 A.java Current result ERROR in A.java (at line 0) public class A { ^ Internal compiler error: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.lookup.FieldBinding.constant(FieldBinding.java:218) Expected result No internal compiler errors. Configuration Software O.S.: Linux Ubuntu 14.04 64bits ECJ: org.eclipse.jdt.core-3.13.0-SNAPSHOT-batch-compiler.jar (Eclipse Neon 4.6) Hardware: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
Seems to be a result of unresolved B.C, in combination with the annotation (not necessarily a nonnull annotation). The fact that also NotNull and D are unresolved is irrelevant. Same exception is thrown from compiling //--- @interface Ann {} class D {} public class A { @Ann final B.C<D> field; void x(B.C<D> parameter) { field = parameter; } } //--- Removing the B. from B.C avoids the bug, as does ensuring that B.C can be resolved. Also removing "final" from the field avoids the bug. BTW: assigning a final field in a regular method is bogus to begin with - but then changing x() to a constructor does not avoid the NPE.
bulk move out of 4.8
Bulk move out of 4.9
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
still happens