JDK-5094805 : Compiler crashes when compiling an abstract generic class
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-08-31
  • Updated: 2004-08-31
  • Resolved: 2004-08-31
Related Reports
Duplicate :  
Description

Name: gm110360			Date: 08/31/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
Compiler crashes when I try to compile the program listed below.  Note that the class was previously non-generic, and just used Window for the display attributes.  This non-generic version compiled OK.  It wasn't until I made it generic that the failure occurred.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the code below with:

   javac -source 1.5 DebugTest.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Unknown.  I don't know if the code will compile  because I can't actually compile it.
ACTUAL -
The compiler crashes with the error below.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.5.0-beta2). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.AssertionError: writePool DisplayType
	at com.sun.tools.javac.jvm.ClassWriter.writePool(ClassWriter.java:513)
	at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1332)
	at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1210)
	at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:325)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:474)
	at com.sun.tools.javac.main.Main.compile(Main.java:592)
	at com.sun.tools.javac.main.Main.compile(Main.java:544)
	at com.sun.tools.javac.Main.compile(Main.java:58)
	at com.sun.tools.javac.Main.main(Main.java:48)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class DebugTest<DisplayType extends Window>
{
    private final static String CLASS_NAME =
        DebugTest.class.getName();

    private final static Logger LOG = Logger.getLogger(CLASS_NAME);

    protected DisplayType display = null;

    protected final ActionListener closeHandler = new CloseDisplayHandler();

    private final ActionListener openHandler = new DisplaySelectionHandler();

    public ActionListener getDisplaySelectionHandler()
    {
        return openHandler;
    }

    protected abstract DisplayType createDisplay();

    private void openDisplay()
    {
        if (display == null)
        {
            display = createDisplay();
        }
        else
        {
            display.toFront();
        }
    }

    private class DisplaySelectionHandler implements ActionListener
    {
        public void actionPerformed(ActionEvent event)
        {
            openDisplay();
        }
    }

    private class CloseDisplayHandler implements ActionListener
    {
        public void actionPerformed(ActionEvent event)
        {
            display.dispose();
            display = null;
        }
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I have yet to determine a workaround.
(Incident Review ID: 301417) 
======================================================================

Comments
WORK AROUND Add a cast: ((Window)display).dispose(); In CloseDisplayHandler.actionPerformed, this will allow you to compile your programs until this issue is resolved. ###@###.### 2004-08-31
31-08-2004