Psava Cyber
Psava Cyber

Reputation: 13

"java decompiler" JD-Core 0.6.0 / JD-GUI 0.3.3 decompiled code meaning

 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();
      }
    };

Upvotes: 1

Views: 2474

Answers (2)

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81684

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.

Upvotes: 2

MByD
MByD

Reputation: 137282

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();
    }
};

Upvotes: 3

Related Questions