java无法重新编译反编译的类文件
我有一点Java我想编辑(这是一个Minecraft mod),我反编译了。类文件(使用JDGUI),编辑了我想要的内容,然后尝试重新编译(使用javac)
我犯了几百个错误。不过我只编辑了几行,所以我试着编译。未经编辑的java,与反编译器中的完全相同。同样的事情,成百上千的错误
对Java知之甚少,所以我肯定我犯了一些错误。为什么它不能编译未从有效工作区编辑的代码。班级档案
以下是我得到的示例:
ReiMinimap.java:451: illegal start of expression
switch (???)
^
ReiMinimap.java:451: ';' expected
switch (???)
^
ReiMinimap.java:451: illegal start of expression
switch (???)
^
ReiMinimap.java:451: illegal start of expression
switch (???)
^
ReiMinimap.java:451: illegal start of expression
switch (???)
^
ReiMinimap.java:452: illegal start of expression
{
^
ReiMinimap.java:452: : expected
{
^
ReiMinimap.java:453: ';' expected
case 49:
^
ReiMinimap.java:453: ')' expected
case 49:
^
ReiMinimap.java:454: illegal start of expression
this.allowCavemap = true;
^
ReiMinimap.java:454: ';' expected
this.allowCavemap = true;
^
ReiMinimap.java:454: illegal start of expression
this.allowCavemap = true;
^
ReiMinimap.java:454: ';' expected
this.allowCavemap = true;
^
ReiMinimap.java:456: orphaned case
case 50:
^
ReiMinimap.java:308: 'try' without 'catch' or 'finally'
try { if (paramMinecraft == null);
^
ReiMinimap.java:499: illegal start of type
else
^
ReiMinimap.java:499: ';' expected
else
^
ReiMinimap.java:501: illegal start of type
this.chatWelcomed = true;
^
ReiMinimap.java:501: <identifier> expected
this.chatWelcomed = true;
^
ReiMinimap.java:501: ';' expected
this.chatWelcomed = true;
^
ReiMinimap.java:501: illegal start of type
this.chatWelcomed = true;
^
ReiMinimap.java:501: <identifier> expected
this.chatWelcomed = true;
^
还有一些代码:
if ((!this.chatWelcomed) && (System.currentTimeMillis() < this.chatTime + 10000L))
{
Object localObject1;
for (localObject2 = this.chatLineList.iterator(); ((Iterator)localObject2).hasNext(); ) { localObject1 = (ahe)((Iterator)localObject2).next();
if ((localObject1 == null) || (this.chatLineLast == localObject1)) break;
Matcher localMatcher1 = Pattern.compile("§0§0((?:§[1-9a-d])+)§e§f").matcher(((ahe)localObject1).a);
while (localMatcher1.find())
{
this.chatWelcomed = true;
for (??? : localMatcher1.group(1).toCharArray())
{
switch (???)
{
case 49:
this.allowCavemap = true;
break;
case 50:
this.allowEntityPlayer = true;
break;
case 51:
this.allowEntityAnimal = true;
break;
case 52:
this.allowEntityMob = true;
break;
case 53:
this.allowEntitySlime = true;
break;
case 54:
this.allowEntitySquid = true;
break;
case 55:
this.allowEntityLiving = true;
}
}
}
# 1 楼答案
听起来像是原始Java编译被混淆了。模糊处理者使用了许多技巧,使代码的逆向工程变得困难。例如,在中包含方法和字段名是合法的。类文件,这些文件在Java源代码(
for
,if
,等等)中是保留字。如果混淆器使用了这些技巧,那么当您反编译。类文件,Java源代码是非法的,因为不能将这些保留字用作方法或字段名