Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Support for introduction of inner classes

Hello List,

since it is possible to introduce anonymous classes, I am asking if
there are plans to support introduction of inner classes.

My code looks like this:
private void MainUI.addPersonItem ()
{
   // ... some code
   JMenuItem item = new JMenuItem ( "Person" );
   item.addActionListener (
          new ActionListener ()
           {
               public void actionPerformed ( ActionEvent e )
               {
                   // do something ...
                }
           }
   );
   // some code ...
}

What I want to do looks like this:
private class MainUI.PersonActionListener implements ActionListener
{
   public void actionPerformed ( ActionEvent e )
   {
       // do something ...
   }
}

private void MainUI.addPersonItem ()
{
   // ... some code
   JMenuItem item = new JMenuItem ( "Person" );
   item.addActionListener ( new MainUI.PersonActionListener () );
   // some code ...
}

I must admit here that I hate anonymous classes. They are very hard to
document. Another reason is, that sometimes inner classes might get
reused, which is not possible with anonymous classes.

These are just my 0.02$ so if there already exists a feature request
in the buglist, or there has been already a similar discussion, then I
apologize my lame research.

Kind regards,
Franz Prilmeier



Back to the top