4 ms·
I just scrolled to the bottom and all I see is } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } What the fuck
by warent 9y ago
I just scrolled to the bottom and all I see is
} } } } } } } } } } } } } } } } } } } } } } } } } } } } } }
What the fuck
- mikeash 9y agoThis is decompiled code, not the original source, so much/most/all of the craziness probably comes from that.
- danbruc 9y agoDecompiling .NET or Java binaries usually yields code very close if not identical to the original source code, at least unless an obfuscator was used but that seems not to be the case here. Chances are very good the original source code looks almost exactly like that code, maybe with some additional comments.
- amyjess 9y agoMind you, a lot of Java 5 and later features like generics, switch on Strings, Iterable-based for, etc., are syntactic sugar implemented in the compiler, not part of Java bytecode, so those features don't decompile well.
- thefifthsetpin 9y agoIn this case, it's just that the decompiler didn't think of "else if" as a single control flow construct/keyword in the way that the original programmers did. What was no doubt written like this: if(a < 1){ }else if(a < 2){ }else if(a < 3){ }else{ } Decompiled into this: if(a < 1){ }else{ if(a < 2){ }else{ if(a < 3){ }else{ } } }
- danbruc 9y agoI will try this tomorrow, I am pretty sure dotPeek can recognize and output else if. Might be a coding style option though.
- mikeash 9y agoWouldn’t “else if {“ and “else { if” compile to identical bytecode?
- ufo 9y agoSure, but the decompiler can choose to always decompile to "else if {", which is more readable and more likely to match the original source code.
- mikeash 9y agoThat's my point. The compiler's choice of "else if {" or "else { if" is unrelated to the programmer's choice.
- danbruc 9y agoIt does and at least the current dotPeek 2017.2.2 decompiles it to else if and does, other than I thought, not allow to customize it.
- mikeash 9y agoObviously whatever decompiler was used here decided to do it the other way.