I've been given some ancient unsupported third party vendor code in a jar file by a customer and I'm trying to reverse engineer it so I re-implement the same protocol it used to connect to a server.
I've decompiled it and one of the classes seems to have labels and goto statements in it. My compiler is throwing a hissy-fit at this because as I understand it goto is not supported in Java.
I can't post the all the code due to IP issues but here is the gist of it (I've put the compiler errors in the comments):
private void methodName(InputType input)
throws ConfigurationException
{
// initialization code here
_L2:
String x; // The compiler is complaining that "String cannot be resolved to a variable" here
String y; // This line is fine though...
// Some Code here
x = <SOME VALUE> // Compiler complains about "x cannot be resolved to a variable"
y = <ANOTHER VALUE> // Compiler is fine with this.
// Some more code
if(true) goto _L2; else goto _L1 // Multiple issues here see following lines.
// Syntax error on token "goto", throw expected
// _L2 cannot be resolved to a variable
// Syntax error on token "goto", { expected
// Syntax error on token "goto", { expected
_L1: // Syntax error on token "goto", { expected
local; // local cannot be resolved to a variable
// Some more code
JVM INSTR ret 12; // Multiple issues here see following lines.
// JVM INSTR ret 12;
// Syntax error on token "ret", = expected
return;
}
I understand that the lines followed by a colon are Labels, but I don't understand what is going wrong here.
The line with the goto is testing for true so I could just remove the labels as they are irrelevant here, but I don't understand what this line means:
local;
Or this:
JVM INSTR ret 12;
Any assistance interpreting this would be most appreciated.
What you are seeing are artifacts of the byte-code, which your decompiler could not properly handle, as it seems. For exmaple
_L2:
String x;
String y;
...
if(true) goto _L2; else goto _L1;
_L1:
might have been something like
do {
String x;
String y;
...
} while (true);
but the decompiler was not able (or didn't event try) to piece these parts properly together. Likewise, the
JVM INSTR ret 12
seems to be a rendering for some opcode, which the decompiler did not properly understand. I have no idea, what the local
might be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With