gpt4 book ai didi

java - 使用 JAD 反编译 java - 限制

转载 作者:搜寻专家 更新时间:2023-11-01 01:18:29 25 4
gpt4 key购买 nike

我正在尝试使用 Java 中的 JAD 反编译几个 jar 文件(我也尝试了 JD-GUI,但运气更差),但我遇到了很多错误。一种(易于修复)似乎与内部类有关,但我也发现了这段代码:

static int[] $SWITCH_TABLE$atp$com$OrderType()
{
$SWITCH_TABLE$atp$com$OrderType;
if($SWITCH_TABLE$atp$com$OrderType == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai[] = new int[OrderType.values().length];
try
{
ai[OrderType.LIMIT.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
try
{
ai[OrderType.MARKET.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
try
{
ai[OrderType.STOP.ordinal()] = 3;
}
catch(NoSuchFieldError _ex) { }
try
{
ai[OrderType.TAKE.ordinal()] = 4;
}
catch(NoSuchFieldError _ex) { }
return $SWITCH_TABLE$atp$com$OrderType = ai;
}

使用方法如下:

switch($SWITCH_TABLE$atp$com$OrderType()[co.getOrderType().ordinal()])
{
case 1: // '\001'
order = new Order(userID, null, co.getOrderType(), co.getOrderSide(), co.getOrderID(), co.getOrderSecurity(), co.getOrderQuantity(), broker);
break;

case 2: // '\002'
order = new Order(userID, null, co.getOrderType(), co.getOrderSide(), co.getOrderPrice(), co.getOrderID(), co.getOrderSecurity(), co.getOrderQuantity(), broker);
break;

case 3: // '\003'
order = new Order(userID, null, co.getOrderType(), co.getOrderSide(), co.getOrderPrice(), co.getOrderID(), co.getOrderSecurity(), co.getOrderQuantity(), broker);
break;
}

知道这个构造最初可能是什么吗?

最佳答案

我认为是 tableswitch枚举。它将任意枚举序数值转换为数字 0..n,它可以提高 switch 语句的性能。

更新才明白过来!问题是——使用枚举的代码可以与枚举本身分开编译。所以它在编译时不知道序数值,所以它不能构造一个合适的 tableswitch 操作。所以,这就是它引入惰性 SWITCH_TABLE 结构以将当前可用的序数值映射到本地 tableswitch int 数字的原因。

关于java - 使用 JAD 反编译 java - 限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7873725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com