Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch翻译结果很诡异 #45

Closed
GoogleCodeExporter opened this issue Apr 7, 2015 · 5 comments
Closed

switch翻译结果很诡异 #45

GoogleCodeExporter opened this issue Apr 7, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

我对自己的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
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

使用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
Copy link
Author

出错的.class文件

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

Attachments:

@GoogleCodeExporter
Copy link
Author

我也遇到相同的问题. 

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

@GoogleCodeExporter
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant