j使用Font End plus 反编译包含内部类的java类的问题

[复制链接]
查看11 | 回复1 | 2010-10-14 21:34:10 | 显示全部楼层 |阅读模式
//下面是源代码(代码为本人写的)
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
public class Login extends JFrame
{
private JButton exit;

public void init(){
exit = new JButton();
exit.setText("退出");
exit.setBounds(160, 60, 60, 18);
this.add(exit);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("Login");
this.setSize(300,150);
//this.setFocusable(true);
//this.getRootPane().setDefaultButton(exit); //得到焦点监听
this.setVisible(true);
this.setLocationRelativeTo(null);

//左键执行
exit.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {

System.out.println("exit");
}
});
}

/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
Login l = new Login();
l.init();
}
}
//下面是采用Font End plus 反编译后的代码
// Decompiled Using: FrontEnd Plus v2.03 and the JAD Engine
// Available From: http://www.reflections.ath.cx
// Decompiler options: packimports(3)
// Source File Name: Login.java
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.PrintStream;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Login extends JFrame
{

public Login()

{

}

public void init()

{

exit = new JButton();

exit.setText("\u9000\u51FA");

exit.setBounds(160, 60, 60, 18);

add(exit);

setDefaultCloseOperation(3);

setTitle("Login");

setSize(300, 150);

setVisible(true);

setLocationRelativeTo(null);

exit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

{

System.out.println("exit");

}

final Login this$0;

{

this$0 = Login.this;

super();

}

});

}

public static void main(String args[])

{

Login l = new Login();

l.init();

}

private JButton exit;
}
观察到在反编译后的代码中包含:

final Login this$0;

{

this$0 = Login.this;

super();

}
反编译的时候都会出现多余的上述代码,明显的去除该部分代码后,反编译后的代码与源代码是一致的。问题是:
是否所有的包含内部监听器类的class文件在反编译后都会出现上述的类型代码?
上述代码的作用又是什么?

回复

使用道具 举报

千问 | 2010-10-14 21:34:10 | 显示全部楼层
如果有内部类,就一定会出现上述代码,上述代码是java编辑器做的特殊处理,目的是让内部类能够访问外部类的私有成员变量;在google上搜“java反编译 内部类”,能够得到跟多的结果
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行