Community
Participate
Working Groups
Using 1119, we don't generate the qualifier of a static message call. This is a bug if this qualifier can send an exception. public class A { static A a = null; A a1 = null; public static void foo(int i) { System.out.print(i); } public static void main(String[] args) { try { a.a1.foo(0); } catch (NullPointerException e) { System.out.print("OK"); } } } Compiling this code, we return: 0 instead of: OK because a.a1 should have thrown an NPE. Changing foo to a non static method fixes it. The JLS http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#38359 states that if the invocation mode is static, then there is no target reference. The expression Primary is evaluated, but the result is then discarded. javac and jikes are compiling this code and get the right result.
Solved. Null check in 1.4 mode got moved from constructor to allocation, so it gets performed prior to evaluating allocation arguments (JLS 15.9.4). Fixed. In 1.3 mode, we don't want to complain for backward compatibility (see bug 25174).
Fixed
Oops modified wrong bug, these comments were for bug 27247
Deferred to M5. Changes are quite big and too close to M4. Need more testing.
Changed both field ref and qualified name ref. Added InitializationTests for these. Fixed
Verified.