Opened 15 years ago

#234 new defect

Wrong exception checking for anonymous inner class constructors in GJ

Reported by: hauma Owned by: moschny
Priority: normal Milestone:
Component: gjc Version: 1.00
Severity: normal Keywords:


The following code should silently compile: A new anonymous inner class is constructed as subclass of A by calling its constructor A() that declares an exception to be thrown. This exception is declared to be thrown from the surronding method.


class A {
    A() throws IOException {}

class C {
    void bar() throws IOException {
        A x = new A() {};

When compiling with GJ, the following error is reported. This indicates that the generated inner class constructor misses to declare IOException. unreported exception:; must be caught
or declared to be thrown

        A x = new A() {};

Attachments (0)

Change History (0)

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain moschny.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from moschny to the specified user. Next status will be 'new'.
The owner will be changed from moschny to anonymous. Next status will be 'assigned'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.