This is to port http://java.net/jira/browse/MACOSX_PORT-780 from Jira to bugtraq. Environment: Mac OS X 10.7.2 JDK 7 b222 (problem does not happen in previous build like b221) Description: Unzip the attached zip file in one directory. [jdkhome]/bin/javac *.java [jdkhome]/bin/java captureOnScreen The expected behaivor is that a windows will display. When jdk is b222, the program is stuck there and never ends. The Java frame can not be displayed. If using previous build like b221, the Java frame can be displayed correctly and everything works fine. The attached source files are extracted from Java i18n testing framework (Global Suite Media Server) and they are simplified by me as much as possible. captureOnScreen.java is an AWT Frame with flowlayout. It initializes an instance of class LWRenderTest which implements interface MediaServerTestCase and GUITestCase. The LWRenderTest object initializes an instance of class FontEffectTest which is a subclass of JPanel with some swing components on it. At captureOnScreen.java, there is the cast between interfaces: MediaServerTestCase tc = ((MediaServerTestCase)cl.newInstance()); LightWeightGUITestCase test = (LightWeightGUITestCase)tc; If we do not use the refernce cast (conversion), the problem will disapear. The Java Frame can be displayed and the program runs fine in b222. The program without the cast between two interfaces: //MediaServerTestCase tc = ((MediaServerTestCase)cl.newInstance()); LightWeightGUITestCase test = (LightWeightGUITestCase)cl.newInstance(); Since cast between interfaces is supported in Java and the program with interface cast works fine in previous build like b221, I'd like to file it as a JDK bug. The interface cast seems to be meaningless in the attached source file, but it's necessary in the real testing framework of media server.
|