Hi, I have the following java code fragment
while (condition1){
switch (someinteger){
case 1:
if(condition2) continue;
// other stuff here
break;
// other cases here
}
}
All is fine. When I generate a class file and then decompile it using a free tool (JD-gui), I get back the following code.
while (condition1){
switch (someinteger){
case 1:
if(!condition2);
// other stuff here
break;
// other cases here
}
}
So it changes if(condition2) continue;
to if(!condition2);
I could not find any info on the other if statement (without braces).
Can anyone explain the logic here? Thanks in advance.
EDIT: I did some more tests and the decompiler does not work correctly.
here is the code before:
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);
}
}
here is the decompiled code
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);
}
}
sorry for bothering everyone. :P I'll try to delete this question if I can.