Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Hallo mihi,</p> <p>sorry for the late response. I'm copying my answer from <a href="http://www.reversed-java.com/fernflower/forum?threadfolder=2_DE" rel="noreferrer">http://www.reversed-java.com/fernflower/forum?threadfolder=2_DE</a></p> <p>Your problem is actually a well known one. Let's see:</p> <p>1) Pure bytecode doesn't contain any information about the type of object variables, so in the first pass s1 and s2 are declared as Object.</p> <p>2) Decompiler is trying hard to assign the best possible type to each variable (= "narrowest type principle" implemented in Fernflower). So s1 and s2 are correctly identified as instances of String.</p> <p>3) Invocation of doPrint give us a direct link to the correct method<br> private static void doPrint(Object s1)</p> <p>4) Everything OK so far, right? Now we have got a String variable s1 passed to a function, which expects an Object. Do we need to cast it? Not as such, you would think, as Object is a super-type of String. And yet we do - because there is another function within the same class with the same name and a different parameter signature. So we need to analyse the whole class to find out, whether a cast is needed or not.</p> <p>5) Generally speaking, it means we need to analyse ALL referenced classes in ALL libraries including the java runtime. A huge load of work! Indeed, this feature was implemented in some alpha version of Fernflower, but have not made it in the production yet because of performance and memory penalty. Other mentioned decompilers lack this ability by design. </p> <p>Hope I have clarified things a bit :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload