Question

 MohrAboutBox.1 local1 = new ActionListener() {

I decompiled a jar file with JD GUI 0.3.3 and I got this line which make no sense to me. The ".1" (dot one), what is it referencing to? I tried to recompile and I had an error from javac compiler, it says that it is not a statement that line. What should I do ? I suppose I have to remove ".1" or put "this" instead, or some variable, class or method, I have no idea why the JD cannot do that job.

class MohrAboutBox extends JDialog
{
  public MohrAboutBox(MohrControls paramMohrControls)
  {

    MohrAboutBox.1 local1 = new ActionListener() {
      public void actionPerformed(ActionEvent paramActionEvent) {
        MohrAboutBox.this.exit_dlg();
      }
    };
Was it helpful?

Solution

It refers to the fact that this is an instance of the enclosed (anonymous) class (implementing ActionListener) within MohrAboutBox, e.g. MohrAboutBox $1, change it to:

ActionListener listener = new ActionListener() {
    public void actionPerformed(ActionEvent paramActionEvent) {
        MohrAboutBox.this.exit_dlg();
    }
};

OTHER TIPS

It was an anonymous inner class in the original source; a class without a valid Java name. The Java compiler names the resulting class files ClassName$1, ClassName$2. It's unclear why the decompiler can't work this out on its own. You'll need to supply the name of the real class from which the inner class is extended -- i.e., ActionListener, in this case -- and then the code should compile fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top