我有以下java代码片段
while (condition1){
switch (someinteger){
case 1:
if(condition2) continue;
// other stuff here
break;
// other cases here
}
}
一切皆好。当我生成一个类文件,然后使用免费工具 (JD-gui) 对其进行反编译时,我得到以下代码。
while (condition1){
switch (someinteger){
case 1:
if(!condition2);
// other stuff here
break;
// other cases here
}
}
所以它变成if(condition2) continue;
了if(!condition2);
我在另一个 if 语句(没有大括号)上找不到任何信息。谁能解释这里的逻辑?提前致谢。
编辑:我做了更多测试,反编译器无法正常工作。
这是之前的代码:
public void strip(InputStreamReader f1, OutputStreamWriter f2) throws IOException{
int commentON=0, quoteON=0;
int b1;
while ((b1 = f1.read()) != -1){
switch ((char) b1){
case '\\':
if (commentON==0){
quoteON = 1;
break;
}
continue;
case '\n':
if (commentON>0){ commentON=0; continue; }
break;
case '%':
if (commentON>0) continue;
if (quoteON>0) { quoteON=0; break; }
commentON=2;
continue;
default:
if (commentON>0) continue;
if (quoteON>0) quoteON=0;
break;
}
f2.write(b1);
}
}
这是反编译的代码
public void strip(InputStreamReader f1, OutputStreamWriter f2) throws IOException
{
int commentON = 0; int quoteON = 0;
while ((b1 = f1.read()) != -1)
{
int b1;
switch ((char)b1)
{
case '\\':
if (commentON == 0);
quoteON = 1;
break;
case '\n':
if (commentON <= 0) break label109; commentON = 0; break;
case '%':
if (commentON <= 0);
if (quoteON > 0) { quoteON = 0; break label109: }
commentON = 2;
break;
}
if (commentON <= 0);
if (quoteON > 0) quoteON = 0;
label109: f2.write(b1);
}
}
很抱歉打扰大家。:P 如果可以的话,我会尝试删除这个问题。