haco20292 / dex2jar

Automatically exported from code.google.com/p/dex2jar
0 stars 0 forks source link

switch翻译结果很诡异 #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
我对自己的apk进行了测试,发现了下面的问题:
我的源代码是:
protected Dialog onCreateDialog(int id)
    {
        switch(id)
        {
        case DIALOG_ABOUT:
            return new AlertDialog.Builder(this)
            .setTitle("关于")
            .setIcon(android.R.drawable.ic_dialog_info)
            .setMessage("TinyPlayer\n关于")
            .setPositiveButton("确定", null)
            .create();
        default:return null;
        }
编译成APK再反编译后变成了:
protected Dialog onCreateDialog(int paramInt)
  {
    switch (paramInt)
    {
    default:
    case 1:
    }
    for (AlertDialog localAlertDialog = null; ; localAlertDialog = new AlertDialog.Builder(this).setTitle("关于").setIcon(17301659).setMessage("TinyPlayer\n关于").setPositiveButton("确定", null).create())
      return localAlertDialog;
  }
    }

Original issue reported on code.google.com by lipub...@gmail.com on 28 Feb 2011 at 3:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
使用jad后,反编译时提示:
can not fully decompile method onCreateDialog
can not fully decompile method onOptionItemSelected
编译后的结果为:

    protected Dialog onCreateDialog(int i)
    {
        i;
        JVM INSTR tableswitch 1 1: default 20
    //                   1 24;
           goto _L1 _L2
_L1:
        Object obj = null;
_L4:
        return ((Dialog) (obj));
_L2:
        obj = (new android.app.AlertDialog.Builder(this)).setTitle("\u5173\u4E8E").setIcon(0x108009b).setMessage("TinyPlayer\n\u5173\u4E8E").setPositiveButton("\u786E\u5B9A", null).create();
        if(true) goto _L4; else goto _L3
_L3:
    }

    public boolean onOptionsItemSelected(MenuItem menuitem)
    {
        boolean flag = super.onOptionsItemSelected(menuitem);
        menuitem.getItemId();
        JVM INSTR tableswitch 1 1: default 32
    //                   1 34;
           goto _L1 _L2
_L1:
        return true;
_L2:
        showDialog(1);
        if(true) goto _L1; else goto _L3
_L3:
    }

Original comment by lipub...@gmail.com on 28 Feb 2011 at 7:50

GoogleCodeExporter commented 9 years ago
出错的.class文件

Original comment by lipub...@gmail.com on 28 Feb 2011 at 7:53

Attachments:

GoogleCodeExporter commented 9 years ago
我也遇到相同的问题. 

Original comment by yangtong...@gmail.com on 19 Apr 2011 at 6:00

GoogleCodeExporter commented 9 years ago
0.0.7.11,switch的bug依然在。
PS:用JD-GUI以及DJ Java 
decompiler测试。具体表现在于没判断好每个分支的结束部分。

Original comment by coolspac...@gmail.com on 8 Oct 2011 at 10:30