<Swing Dev> [9] Review Request: 8073420 JFrame.EXIT_ON_CLOSE can be removed in favour of WindowConstants.EXIT_ON_CLOSE

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Feb 24 14:13:51 UTC 2015


Hello.
Please review the fix for jdk 9.
   - In JDK 1.2 javax.swing.WindowConstants interface was added.
   - But unfortunately WindowConstants didn't contain EXIT_ON_CLOSE 
constant, later in jdk 1.3 this constant was added to the JFrame class, 
which implements WindowConstants.
   - Later it was realized that it should be added to the 
WindowConstants instead, and this was fixed in jdk 1.4

EXIT_ON_CLOSE fields are static constant variables (JLS 4.12.4). When 
source code references either field,
a Java compiler is required to inline the field's value into the 
resulting class file (JLS 14.21).
This means that removing EXIT_ON_CLOSE from JFrame is binary compatible,
because no class file actually refers to the field in JFrame directly 
(JLS 13.4.9).

In addition, removing EXIT_ON_CLOSE from JFrame is source compatible,
because JFrame continues to have an EXIT_ON_CLOSE member (via
inheritance from WindowConstants) so code which refers to
JFrame.EXIT_ON_CLOSE will recompile.

CCC request will be created after review.

Bug: https://bugs.openjdk.java.net/browse/JDK-8073420
Webrevs can be found at:
http://cr.openjdk.java.net/~serb/8073420/webrev.00/jdk
http://cr.openjdk.java.net/~serb/8073420/webrev.00/pubs

-- 
Best regards, Sergey.




More information about the swing-dev mailing list