CFR - another java decompiler

CFR will decompile modern Java features - up to and including much of Java 9, 12 & 14, but is written entirely in Java 6, so will work anywhere! (FAQ) - It'll even make a decent go of turning class files from other JVM languages back into java!

To use, simply run the specific version jar, with the class name(s) you want to decompile (either as a path to a class file, or as a fully qualified classname on your classpath). ( --help to list arguments).

Alternately, to decompile an entire jar, simply provide the jar path, and if you want to emit files (which you probably do!) add --outputdir /tmp/putithere

Download cfr

cfr-0.150.jar (May 2020) md5: 9172018d870313e41ae94e16af83c268



cfr-0.149.jar (Feb 2020) (I suggest using latest, but if you spot a regression, it means I'm missing a test... so please shout!)

Older versions

Or get it from maven.

...or just go to github. (yup, new since 0.145).

FAQ

FAQ is here

Contact / Updates

Feel free to drop me a line (lee@benf.org) if there's anything you think is particularly broken, bear in mind it's a work in progress (but I'd say on a par with others!) - Or if you want to know when an update is out, I've finally started announcing on twitter - (@LeeAtBenf)

Observations about syntactic sugar in compilation.

All of this stuff is documented (links where I find them); these are things I found particularly interesting while messing around with this.

.... and other observations.....

To do...

It's got a lot of things missing, which I'm messing with, as and when time makes itself available ;)

Generic reverse inference (forward inference works... getting better!)

Correct generic inference for locals which don't escape scope. Without trusting localVariableTypeTable, this is hard. I may have to use it :(

More Java 9+ improvements (java's a moving target these days!)

And more....

Change history

0.150 (2020-05-20) .. left it too long... again! See github for every change!

Fix possible static shadowing ( thanks ovf )

) Use signature throws info unless provably wrong.

Fix possible infinite loop with illegal signature

Issue with empty enums ( thanks marcono1234 )

) Handle switch expressions inside enum constructors (")

Switch expressions buried inside super/this constructor calls (")

Improve switch breaks after topsort (")

Remove illegal array iterator resugaring ( thanks mrdos )

) Verify signatures more aggressively

Fix possible stack overflow delegating clash-resolved type ( thanks rmrfchik )

) Reduce application of Kotlin switch pattern

Applying obfuscation remapping file can cause NPE ( thanks rybozymer )

) Remove dangling CMPS in unusual bytecode ( thanks graxcode )

) Handle exit-monitor is casted entry monitor (")

Don't break after terminal in unstructured loop (")

Improve SSA analysis performance (thanks edclarke)

Allow (explicit only) disabling of method scoped/anonymous classes. (thanks andrewleech)

0.149 (2020-02-20) .. left it too long, see github for every change!

Lots of annotation fixes (perfect recovery of annotations is a whole new dimension of pain). ( Thanks Marcono1234 (contrib))

of annotation fixes (perfect recovery of annotations is a whole new dimension of pain). ( (contrib)) Support for Java 14 record types

Support for Java 14 instanceof pattern matching

Update switch expressions to use final 'yield' syntax instead of 'break'.

Fix for issue with immediately accessed array.

Several fixes around cast ambiguity ( Thanks Marcono1234 )

) Handle unverifiable jumps (example)

Tweak class names when O/S can't handle them

Several fixes for ECJ generated code ( Thanks Marcono1234 )

) Improve literal formatting ( Thanks SimonWanner (contrib))

(contrib)) Explicitly display receiver parameters if required by annotations. ( Thanks Marcono1234 )

) Token stream dumper for API usage (Thanks Cubixity (contrib))

0.148 (2019-10-31)

Adapt to changes in ecj's output of switch-on-enum ( Thanks Marcono1234 )

) Many small fixes for handling obfuscation mapping files ( --obfuscationpath file.txt )( Thanks Marcono1234 )

)( ) Work on (unfinished) token output stream ( Thanks cubixity )

) Fix for regression on pretty printing of inner classes

0.147 (2019-10-18)

Support for deobfuscation mapping files with --obfuscationpath file.txt ( Thanks samuel )

( ) Fix extraneous array creation ( Thanks caagr98 )

) Handle duplicate target shared between disconnected switches ( Thanks evelynsubarrow )

) Reduce over-aggressive eclipse pass ( Thanks caagr98 )

) Allow try resources to be collapsed

Fail gracefully if a lambda body is recursive (what, scala?!) ( Thanks kolanich )

) Handle module definition classes ( Thanks metatech )

) Fix for effectively empty try requiring topsort

Allow filter on imports, to force FQN.

Fix overuse of boxed constant names.

0.146 (2019-07-19)

Tweak to improve hex usage

Fix bound on unicode ( Thanks lab13ru )

) Less paranoia with regards to operation exceptions. ( Thanks itzsomebody )

) Add recovery phase which tweaks heuristics for topsort

Fix issue with member lifting ( Thanks grahamedgecombe )

) Handle odd kotlin explicit generic return type from constructor

Introduce explicitly ignored variables if we need to preserve a calculation ( Thanks lab13ru )

) Handle a form of string switch in java more like kotlin's (don't know origin!) ( Thanks totemo )

) Fix incorrect use of explicit super type what calling indirect super methods. (Thanks jredman)

0.145 (2019-05-30)

Improve support for JVM9+'s multi version jar.

Fix bug in nested string resugaring. ( Thanks dmitryg )

) Improve sugaring around some bad bool casts.

Some tidying to improve decompilation of hand written classfiles. (See SootOptimisationTests).

Where possible, collapse multiple JSRs.

Fix bad preincrement in some java6 code.

Fix typo in java 12+ switch expressions. ( Thanks timothyp )

) Improve iter loops where we can unbox immediately.

Remove more pointless super()s

0.144 (2019-05-09)

Fix leakage of internal class names in accesses of enclosing anonymous classes. ( Thanks dmitryg )

) Pseudocode support for JVM11+'s dynamic constants. (Thanks JavierM)

0.143 (2019-04-13)

Fix regression from 142 which can duplicate declarations inside a case, sad face. ( Thanks anyay )

) Don't allow variable declarations to be hoisted before super. ( Thanks anyay )

) Small improvement to conditional extraction, Just Another Edge Case...

0.142 (2019-04-09)

More improvements to Switch expressions - Kotlin comes back as switch expressions!

Improve handling (and commenting) of experimental jdk features.

Handle naughty ofbuscators illegally marking a method varargs. ( Thanks taile )

) Improvement to variable scoping inside case statements ( Thanks anyay )

) Improvement to SSA analysis in copy propagation (Thanks harrand)

0.141 (2019-03-24)

Switch expressions in Java 13 (and with --switchexpression true for earlier)!

for earlier)! Improved reconstruction of Jdk 13 try-resource blocks. (bytecode style has changed...)

Fix regresssion with splitting exception handler. ( Thanks scoleman )

) Nop isolated stack variables to avoid reordering under a nasty obfuscation. ( Thanks yanwentao )

) Fix non determinism in resolving type clash in multi-exception handler. ( Thanks borisk

Warn if type clash resolution leads to void variables.

Fix truncation issue with naming under huge bytecode.

Improve type clash behaviour. ( Thanks anyay )

) Improve type clashes in iterated arrays.

Reduce aggressive lifting of field init from constructor.

Remove varargs spam.

0.140 (2019-03-05)

Remove truncation which can break *HUGE* exception handlers. ( Thanks Janosz )

) Loosen lambda capture restriction (improves lambda resugaring for deeply nested lambdas).

Handle possible NPE in local expression rewriter.

Infer a little more information about unavailable-but-caught types. ( Thanks zbzzn )

) Tidied help. (Thanks dearappauthors)

0.139 (2019-01-09)

Double comparison inversion is not always safe wrt NaN - (a < b) is NOT !(a >= b). ( Thanks abec )

) Handle (with warning) some code that (naughtily, but obviously) splits exceptions across unsafe operations.

More aggressive inlining of switch code for cases that would fail to decompile. (Thanks brandonr)

0.138 (2018-12-14)

Handle corrupt class signatures ( Thanks itzsomebody )

) Be more lenient with mismatching bootstrap arguments ( " )

Fix precedence issue with unary minus. ( Thanks littlestar )

) If we've failed to split lifetimes, leaving too narrow a type, force explicit casts. ( Thanks hostalp )

) Fix for failure when validating casts against missing class.

Fix for NPE when explicitly decompiling an inner class with missing outer. ( Thanks abec )

) Improve displayed class name for anonymous classes (normally won't appear, but could be forced) ( " )

0.137 (2018-12-01)

0.136 (2018-11-24)

Fix for ordering of inlined lvalue mutations ( Thanks abec, karls )

) Improvement to lifetime auditing allows inlining of anonymous arrays with mutators.

Improve generated code for prechange assignments. (check out IncrTest5!!)

Reconsider JSRs if they've been expanded.

Relabel private static accessors if they're lifted to an outer class.

Improve lambda desugaring when we don't have target class available (improves reconstruction of java8+ code using jre6!)

Improve lifetime auditing on ternary roll-up.

0.135 (2018-11-17)

Now being released to maven central repos. Hence the naming style change - it's time to be a little more consistent with the rest of the world!

Finally improved and documented an API!

Fixed incorrect complaints of case insensitive fs ( Thanks nathanf )

) Fixed a possible incorrect generic binding.

Improve scoping of some method-scoped classes.

0_134 (2018-11-04)

External references to methods / fields of anonymous classes, if you're in J10+ - use var where appropriate. ( Thanks abec )

) Improvements to explicit type access to members (Force slicing to correct type).

Handle marker interfaces in lambdametafactory.

Other fixes for intersection types. ( Thanks abec ) ... (eg this)

) ... (eg this) --jarfilter allows negative filter when prefixed with ! ( Thanks gar )

) ... a whole bunch of tidying ...

0_133 (2018-09-21)

Resugar java9 indified strings - either indy or indyWithConstants.

Improve handling of anonymous class constructors.

Ensure intermediate goto after finally is tagged in correct block ( Thanks kalhauge )

) Improve assert resugaring.

Handle assert detail messages. ( Thanks abec )

) Fix issue with method scoped classes in lambdas

Fix spurious NOP after invokedynamic. (Improves lambda resugaring, yay!)

Improve error on read of uninitialized local. (Thanks qwm)

0_132 (2018-07-06)

Fix issue with batch processing on windows.

No-op changes to allow CFR to run fully under Apache Harmony's Java 6 implementation (I did say it will run on any old Java!) ( Thanks abec )

) Improvement to Java9+ loading from modules. (Thanks stefanr)

0_131 (2018-06-27)

Improvements to method scoped classes. ( Thanks abec )

) Prefer classes from explicitly searched jars. ( " )

0_130 (2018-06-04)

Fix missing cast in immediately evaluated functional interface method. ( Thanks abec )

) Fix over eager redundant code removal. ( " )

Remove incorrect stripping of anonymous array around varargs call. ( " )

Fix lambda resugaring bug around new Object[0]::clone ( " )

Improve ternary casting. ( " )

Handle a particularly painful ternary style.

Fix missing cast when array type requires de-clashing.

Improve iterated loop resugaring when loop variable is updated.

Improve type inference.

Collapse try resources.

Accept multiple class/jars on command line.

0_129 (2018-05-15)

Remove horrid reflection to allow java6 to read java9 code. ( Thanks comatrices )

) Fix a few grotty inference bugs. ( Thanks jstokes )

) Handle when-string - kotlin's switch on string - nicely.

0_128 (2018-04-30)

Tidy jdk9 requireNotNull artifacts.

Tidy lambda whitespace.

Fix issue lifting members out of constructors in function-scoped classes.

Fix scope issue with variable incorrectly captured in loop (Thanks jstokes)

0_127 (2018-04-26)

...somehow, I manged to release an ancient version as 0_126! 0_127 is the real thing!

Thanks jstokes for pointing out that bit of idiocy!

0_126 (2018-04-25)

Fix possible NPE rebuilding string constant references.

Add a very silly option to allow you to completely --ignoreexceptions. This is useful when the exception table is so confusing that nothing sensible can be retrieved.

option to allow you to completely --ignoreexceptions. This is useful when the exception table is so confusing that nothing sensible can be retrieved. Remove pointless assignments when dealing with very large bytecode to clean output.

Allow jimage files to be used when running under JRE9 to read base classes.

Fix issue with an inner class constructor not having synthetic argument removed.

Fix anonymous inner not being collapsed across constructors and extracted into field ( Thanks jstokes )

) Better handle lack of static marker on anonymous classes with JDK9.

Handle mutating synthetic friend accessors in JDK9.

Handle try-with-resources in both JDK<9 and JDK9.

0_125 (2018-01-26)

Change visibility of static bridge methods (impossible in java, used for defaults in Kotlin!)

Fix accidental signed short usage ... oops.... causes index exception on huge tables. ( Thanks Bchong )

) Where unambiguous (though you can never be sure!), replace string constants with guessed source static finals. (disable with -relinkconststring false) (Thanks Matti)

0_124 (2018-01-04) - A flurry of mails!

Improvements to boxing around Bytes, missing explicit up and down casts. ( Thanks AbeC )

) Handle empty enum switches ( Thanks AbeC )

) Removed slightly misguided pretty print of long constants without L where possible

Ensure method scoped classes are displayed if they're only referred to via teir type constants. (Thanks AbeC)

0_123 (2017-10-11)

Improvement to assert rewriter ( Thanks abec - lots of tests! )

) Fix for boolean constant in attribute being treated as int (")

Don't display defensive cast to anonymous type (")

More aggressive anonymous block jumps (")

Fix for monadic op on bool casting to int (")

Fix classpath issue ( Thanks ken )

) Avoid collapsing compound assignment operators where rhs involves further mutation (thanks michaln)

0_122 (2017-06-12)

Don't detect class as anonymous inner class of object in scala ( Thanks sarahg )

) Basic support for varargs bootstrap factories (only seen thus far in scala) ( Thanks sarahg )

) Fix for boolean default elementvalue - use hint from returntype ( Thanks caoli5288 )

) Fix for OuterClass.this() when OuterClass.super() specifically invoked. (Thanks littlestar)

0_121 (2017-04-05)

Don't mark static methods with implementations in interfaces (yeuch!) as default ( Thanks caoli )

) Fix for missed dropped jump in finally analysis. ( Thanks lee_zhou )

) Reduce emission of uneccessary break/continue statements.

Fix an issue where obfuscated code with an odd unreachable jump structure can cause failure. ( Thanks testsubject )

) Fix spurious 'default' on static interface method. (Thanks caoli)

0_120 (2017-03-07)

Fix for loop in copy propagation (Thanks dequis)

0_119 (2016-11-03)

Improvements in scope handling ( Thanks pokechu22 )

) Minor tweak to plugin runner interface (which I really should document)

Fix for NPE processing bad classpath directories. (Thanks mkraus)

0_118 (2016-08-26)

Optionally, (warn if applicable and you're unlucky enough to be using a case insensitive fs) rename classes to avoid MixED case clash (wuth --caseinsensitivefs true) ( Thanks testsubject, chases )

) Tidy up help. ( Thanks michaelf )

) Correctly specify explicit super calls to default interface methods (Thanks dmitryp)

0_117 (2016-07-27)

--elidescala helper option to make reading decompiled scala easier by removing serialVersionUID and ScalaSignature (may help in other languages). (Thanks sarahg)

0_116 (2016-07-11)

Fix for nested lambdas ( Thanks abec )

) Fix bracketing for lambda precedence, improvement to use of method references.

Basic support for runtime visible type annotations (currently on local variables, not on pure expressions) ( Thanks abec )

) Fix for NPE handling bad annotations.

Tweak to finally detection.

Don't remove nested anonymous array qualifiers when assignment target is of incorrect arity. (Thanks abec)

0_115 (2016-03-08)

Bugfix to finally analyser ( thanks thelaser )

) Improvement to JSR analysis to untangle some simple deliberate obfuscations ( thanks sun )

) Diagnostic comment when we lose an exception.

Support '--clobber' to avoid overwriting files. (defaults to true). (thanks dloyall)

0_114 (2016-02-26)

Fix an NPE. ( thanks sun )

) Fix for a stack overflow in copy propagation on a handwritten edge case. (thanks sun)

0_113 (2016-02-17)

Fixed issue with incorrectly parsing a Stack map attribute. (thanks sun)

0_112 (2016-02-16)

Fix for variable clash resolution which could lead to parse error. (Thanks knotovna)

0_111 (2016-02-11)

Improvement in array type collision resolution ( thanks abec )

) Improvement to plugin runner ( thanks sun )

) Handle illegal identifiers in obfuscated enums. ( thanks krisa )

) Allow recovery of obfuscated enum identifiers (where name text and field don't match)

0_110 (2015-11-18)

Tweak to finally detection for case blocks.

0_109 (2015-11-17)

Improvement to ident naming clashes.

Fix issue where iterator reconstruction would be applied uneccesarily.

Tweak to check if aggressive exception aggregation improves things (fallback pass).

Improve type detection (note - I'm still avoiding using type tables etc. This is a conscious choice - they can be faked with possible obfuscation).

Fix for an illegal forward reordering in some for loop detection.

Check raw (stack type int) type is implicitly castable on return (Thanks thedmitriyk).

0_108 (2015-10-15)

Fix to dead node removal (led to exception analysing some classes of finally statement)

Tweaks to finally analysis ( thanks abec )

) If reconstructed string switch is on a literal null, force explicit cast (")

Tidy imports ( thanks rillig )

) Fix issue with assert detection. (")

Improve names on certain FP constants (")

Force RHS of shift ops to int, if type is indeterminate from elsewhere. (")

0_107 (2015-10-10)

Split lifetimes if final type misdetected as reference due to clash.

Fix bug allowing primitive arrays in constructor to be lifted erroneously. ( thanks rillig )

) Tidy arguments/errors.

0_106 (2015-10-02)

Allow reference placeholders to be treated as arrays. (Strange, but allows some otherwise failing Kotlin code to decompile)

Option to allow code to be aggressively pulled into case statements. Not enabled by default/recovery yet (useful for Kotlin)

Improve assertion normalisation. ( thanks abec )

) Make push through goto slightly more aggressive.

Allow unstructured gotos to be nopped if they fall into successor in same block (pass 4).

Move if body to after else, if else has no exits, and if has foreign entrants which would cause issues.

0_105 (2015-09-20)

Fix for incorrect target on jsr_w (thanks esnow)

0_104 (2015-09-17)

Small improvement to conditional aggregation. ( thanks thelaser )

) Poison hidden iterators when rebuilding for (x:...)

Tweak to demorgan conditional simplifier to take precedence into account when working out best representation.

Fix asymmetry in some cases of basic block collapse.

0_103 (2015-09-11)

Improve bad cast chains (if a crazy cast via 'Object' is required') ( thanks abec )

) Don't discard necessary extra casts with lambda methods ("")

Fix for some cases where switch literals weren't detected from bool->int ("")

Fix for bad names with literals not in the identifier set ("")

Add --extraclasspath to allow helper jars to be searched for analysis (thanks jozko)

0_102 (2015-08-03)

Handle unknown bootstrap metafactories more gracefully

Take lambda variables into account when assigning names ( thanks wbeuchner )

) Fix for preop >>= being displayed incorrectly in some circumstances. ( thanks jhadrava )

) Attempt to remove spurious returns from clinit, as it leads to illegal java. (thanks rbalerdi)

0_101 (2015-05-18)

Fix for wildcards in some inappropriate places ( thanks (again!) abec )

) Bad catch name in some cases

Fix some NPEs (edge case with missing dependency, edge anonymous array rewrite) ( thanks choonster )

) Fix some missing WIDE opcode handling (you need a LOT of locals to trigger that!) (thanks alexnguyen)

0_100 (2015-04-15)

Fix for explicit constpool literals (not initialised by code) being displayed as int when they could be narrowed to bool. (thanks abec, malter)

Helpful little tweak to cause CFR to emit more descriptive local names, by optionally triggering the illegal name rewriter when variable names are less than a certain size (see --renamesmallmembers). ( idea from xryl )

) Fix for regression in which cast -> ConstantPoolEntryMethodRef exception is thrown. ( thanks adamp )

) Fix for --renamedupmembers failing when some base classes don't exist

0_99 (2015-03-25)

Handle enormous code blocks better, by aggressively applying semantically safe but destructive transforms, such as removing ignored stores, to simplify static assignment analysis. (Controlled with --aggressivesizethreshold, defaults to 15000 instructions.) ( thanks vbabenko )

code blocks better, by aggressively applying semantically safe but destructive transforms, such as removing ignored stores, to simplify static assignment analysis. (Controlled with --aggressivesizethreshold, defaults to 15000 instructions.) ( ) Better error reporting for illegal bytecode. ( thanks dpetrashko )

) Improvements to missing disambiguation casts when using explicit nulls (thanks abec)

0_98 (2015-03-09)

Fix for inverted condition on empty while loops with a special case structure ( thanks abec )

) Fix for explicit null callees (thanks abec)

0_97 (2015-02-25)

Fix for some missed loops. ( Thanks rossmck )

) Fix for some bad naming collisions, over aggressive imports. (Thanks malter)

0_96 (2015-02-10)

Tweak disambiguated variable names so they won't collide with methods ( Thanks abecker )

) Fix for missed detection of an anonymous array initialiser (Thanks maxl)

0_95 (2015-01-27)

Fixes for some incorrect @Overrides

Normalise some parse trees, to improve detection of some assert patterns.

Improvements to bad member name detection - see this. Examples here and here. Use --renamedupmembers true to enable. (Thanks abecker)

0_94 (2015-01-10)

Small improvement to restructuring of breaks.

Fix to daft unicode regression in 0_93 leaving trailing unicode marker on extracted jar content. (thanks abecker)

0_93 (2015-01-08)

If a goto can be transformed into a break of the tightest breakable block - do so.

Better handling of type names when renaming duplicate members. ( thanks abecker )

) Detect and offer to rename illegal identifiers (illegal idents in local variables are always dropped).

Handle pre 1.0 java class files. (But warn, as your recompilation with a modern compiler is unlikely to be compatible!)

0_92 (2014-12-18)

Improve topsort - if there's an orphan block, force it early.

Fix bad chained goto removal, where it appears to leave an uneccessary loop.

Remove references to labelled blocks if a labelled block break would end up in the same place as a natural scoped break.

Reduce goto chain condensing in the presence of break statements.

Handle (Only if explicitly selected) duplicate field names (thanks cliffh)

0_91 (2014-12-05)

Allow jar processing to take a regex of which classes to extract (--jarfilter)

Tidy errors

Push returns early when reordering to make control flow as simple as possible. Explicit support for ternaries which jump into identical returns. (improves quality of some dex2jar code).

Shrink catch block if it's over aggressive.

Improve trailing goto removal once code at structurable stage.

Handle conditionals that jump straight into a fall through (was leaving a goto)

Don't allow static initialiser to be marked as an override (oops!)

0_90 (2014-11-05)

Fix issue where aggressive conditional to return pushing was dropping a side effect, when inside a block with a finally clause.

Fix over extension of switch contained in finally affected block, leading to default block adopting code outside switch. ( thanks abec )

) Fix case where unbound generic with no typing info could suggest a variable name of '$'.

0_89 (2014-10-29)

Improvements to SSA analysis (see IncrTest5, thanks hgraf ).

). (minor) improvement to handling some obfuscated switches which caused failure. (thanks abec)

0_88 (2014-10-04)

Don't force parameter type - allow parameters to be displaced in code. ( Thanks lefevrol )

) Improve explicit generics for java 1.6 function args

Cope (but not particularly well yet) with groovy invokedynamics. ( Thanks franze )

) Fix issue where explicit classfile permissions are more generous than inner class permissions.

Explicit cast if we're returning a generic place holder.

Fix uneccessary redundant bracing

Fix a precedence issue

Check for correct overload calling POST erasure - means less explicit argument casting.

Explicit final on loop iters, when forced by inner class usage

Change placeholder binding collision policy

Fix possible illegal rewrite of ternaries when de-inlining assignments

Improve synthetic accessor rewriter.

Feed back type information from detected loops

Extract aggressive inlining of assignments, if it can no longer help simplifying code

Tidy statics so we use simple name where possible

Fix bad type on unused null argument

Attempt to resolve any outstanding type clashes at scope discovery time

0_87 (2014-08-18)

Rewrite variable definitions if anonymous inners are inadvertently causing scope hiding.

Better guess for anonymous inner types.

Don't remove unused function args from ident set, as it causes them to have ugly idents set (and causes bad behaviour with jre8's broken (still in the wild, alas) HashMap implementation.) (Thanks srborlongan).

0_86 (2014-08-15)

Fix precedence issue on instanceof.

Tidy some character quoting where I \uXXXX unicode instead of simple char literals.

Improve the way outer class this references are processed - more efficient.

Hide inner class friend helper classes (see fake friendship).

Remove some illegal wildcards when generating LValue types.

Handle empty switches better - don't always remove them, as that leaves odd code lying around in switch-on-enum case.

Better inferrence of final for anonymous class outer references.

Improvements to implicit cast checking.

0_85 (2014-08-10)

Fix bug which could cause some switch-on-enum statements not to be resugared.

Fix issue with possible unstructured break on switch.

0_84 (2014-08-08)

Fixed issue causing failure of lambda methods with > 127 captures. (Thanks srborlongan).

0_83 (2014-08-08)

Fix some false sharing scenarios.

Handle even more complex conditionals with ludicrous inline assignment. ShortCircuitAssignTest4e(!).

Fix issues with ugly code from early-detected ternaries

Allow for loops to capture multiple updates, (but only if they're involved in the predicate, for cleaner code. Override with --forloopaggcapture to capture all possible updates).

Fix bug whereby conditionals were being too aggressively merged.

Other improvements to conditional merging.

0_82 (2014-07-26)

Yet more fixes for nasty topsort edge cases (again, mostly exhibited in dex2jar).

Improve error when magic is wrong.

Allow force class/jar.

0_81 (2014-07-19)

Only enable rolling returns up to conditional if necessary in recovery pass. (or manually selected)

Another dex2jar optimisation - handle conditionals which jump into middle of later conditionals - if the latter can be rewritten as a block escape. ( Thanks MCirsta )

conditionals - if the latter can be rewritten as a block escape. ( ) Minor formatting improvements.

0_80 (2014-07-07) ... been a while!

Switch fixes

Improve top sort block emission - allow emission when not all sources satisfied, if it would cause us to save known block ordering

Several improvements for dex'd code ( thanks pcreath )

) Fix bug with overly aggressive push-through-goto

Enable tautology conditional recovery pass - will slice out comparisons which are tautologies and move the jump back as far as possible.

Fix for dup2_x2 sometimes generating weird assignments. ( thanks jmcgowan )

) Lots of code refactoring...

0_79 (2014-04-19)

Handle dex2jar style finally (where try blocks jump between each other, and non-throwing content is often outside a try regime) ( Thanks pcreath )

) Fix for bug in copy propagation (Thanks jmcgowan)

0_78 (2014-03-28)

Fix for NPE regression when displaying some missing anonymous inner classes. ( Thanks atanasn )

) For for type being displayed as null. ( Thanks jarrkos )

) Minor improvement to type inference.

Tweaks to boxing for nicer output.

0_77 (2014-03-26)

Fix missing labels on switch statements when necessary for block-break. ( Thanks nilsandre )

) Fix typing issue with some argument types. ( Thanks jarrkos )

) Misc improvements to labelled block breaks.

0_76 (2014-03-17)

Remove spurious getClass generated by instance lambda in later java 8s.

0_75 (2014-03-17)

Fix for missing annotations on fields.

0_74 (2014-03-17)

Now that java 8 correctly fills in lambda arg names, trust them a little more. ( Thanks mstrobel )

) Remaining untranslated stack vars get turned into locals.

Improve cast insertion logic around generic wildcarding, generic arrays.

0_73 (2014-03-12)

Handle trailing dead bytecode at the end of methods. ( Thanks mcirsta )

) Fix small issue where some post-operations weren't recognised, leaving annoying temporaries. (Thanks mkiersch)

0_72 (2014-03-11)

Fixed (one) issue with structured goto removal. ( Thanks jarrkos )

) Fixed regression with standalone inner class analysis. (String exception)

Fix for exception when performing some cases of try block merging.

0_71 (2014-03-10)

Fix type promotion issue. (Thanks jarrkos)

0_70 (2014-03-09)

Improvement to time complexity in boxing removal and alias removal. ( Thanks nnelous )

) Fix for uneccessary fully qualified types in enum arguments

Fix for chained enum constructors.

0_69 (2014-03-06)

Fix for precedence issue on locally casted field access.

Handle possible CannotLoadClass exception for scala style bytecode.

Change inner class name processing logic - handles scala style inner classes better. (Here's an icky test.... ) (Thanks leat)

0_68 (2014-02-21)

Another small change to exception block extension.

0_67 (2014-02-20)

Improvement to topsort heuristics, significantly improves handling of some dex2jar output. ( Thanks pcreath )

) Improvement to impossible exception block extension. (Allows statements to be brought inside an exception block if this can't affect semantics).

0_66 (2014-02-19)

Fix for precedence issue.

0_65 (2014-02-18)

Resugar java 1.4 class constants (did you know they did this?)

Change java.lang imports to hidden by default (controlled with --hidelangimports)

Honour old Synthetic attribute.

0_64 (2014-02-16)

Fix regression in 0_63, when backjump occurs to target of forward jump labelled-goto.

0_63 (2014-02-14)

Fix integral cast missing explicit promotion.

Fix for unsupported operation exception on bad inner class info.

Tidy float output.

Fix for bad type inference in some boolean ops.

Labelled blocks (to support fake-goto) I've been holding off on this because it allows output which could be improved by reordering, but I guess it's time .

. Fix incorrect preop output.

Tweak int^-1 -> ~int.

Tidy up help display.

0_62 (2014-02-13)

Remove bad backjumps to exception handlers when topsorted - shouldn't be valid, but seen in obfuscated (or dex2jar!!) code. ( Thanks pcreath )

) Fix for incorrect variable scoping in exception handlers ( Thanks jarrkos )

) Finally implemented more sensible precedence handling, eliminates lots of redundant braces, and fixes precedence bug on casting. (Thanks jarrkos)

0_61 (2014-02-05)

Fix issue with overlapping but non-nested while loops causing exception. (generally when final backjump to earlier loop is a continue, and end of earlier loop is break; while(true), meaning it appears to have a shorter scope)

0_60 (2014-01-29)

Fix for switch incorrectly marking some sources of break targets as breaks, leading to unstructured output.

Fix for missing assert pattern (some cases of assert not resugared).

Normalise try blocks to improve conditional detection.

Recover from out of order constructor parameters (warn in comment if this happens).

Tweak argument help (--help xxx)

0_59 (2014-01-16)

Improve classification of some escapes from catch blocks. ( Thanks chrixian )

) Stack discovery is no longer recursive, to avoid blowup on Humungous stack walks

stack walks Work around for file names FS can't support due to length. ( Thanks SvenB )

) Fix NPE on while-as-for detection.

Fix annotation enum values display.

Significant internal tidying of recovery passes.

Added iterative fallback passes, with more aggressive options.

Added (pretty desparate if we get here!) monitor commenting fallback. (significantly improves readability of some nastier dex2jar output).

Fix issue where unstructured code was failing to display a block.

Minor fixes to synchronized block handling.

0_58 (2013-12-19)

Interface for plugin use

Push literal manipulations when in recovery

Gracefully handle messed up Scala signatures. Multiple improvements to allow better emission of ScalaJava.

Finally decode unicode literals nicely. (or leave it as it was with - --hideutf false )

) Fix (oops!) instance of English spelling of synchroni(S|Z)ed. ( Thanks Jwalter )

) Be more lenient when removing array indirection - helps recover when we've incorrectly merged stackvars.

Fix instances of loops at top of case statements emitting Duff's device!

Rebuild switch blocks after forcing a topsort.

0_57 (2013-12-10)

Fix bug caused by agressive 'through jump' pushing (regression in 0_53). (LoopTest47 - Thanks chrixian)

0_56 (2013-12-09)

Improve switch block contiguity checking

Improve finally handling

Allow LDC through aggressive synchronised exit removal.

Avoid stack overflow on odd Scala anonymous classes

Handle dodgy Scala generic signatures (If you want ScalaJava tm ;) )

;) ) Improve aggressive exception aggregation

Display multiple cases in a more sane way.

0_55 (2013-12-05)

Default iterated loop resugaring to java 5 (!), as a lot of test classes which require it are marked as 49.

Admit in comments/summary.txt when we emit orphaned catch blocks.

Much more aggressive exception block aggregation/expansion, in cases where we can prove the adopted instructions can't change semantics.

the adopted instructions can't change semantics. Recovery enables lenient flag, to allow wierdly ordered exception handlers to get sorted.

0_54 (2013-11-29)

Fix regression - when moving blocks through a goto, update block start information - (otherwise a break out of a loop was being left as a GOTO, leading to unstructured code/fallback sorting.

Fix stack overflow where a local class returns a new instance of itself.

0_53 (2013-11-28)

Fix bug which causes while loop to be pulled out of conditional in odd circumstances

Fix bug which inverts test when a block is switched in a topsort (again, odd circumstances, but... :P )

0_52 (2013-11-28)

Handle enums implementing interfaces.

Generate @Override annotations ( if code was compiled for Java6+, and the class files for the super classes are available....) Disable with --override false (or force earlier java with --override true, if you feel odd).

code was compiled for Java6+, and the class files for the super classes are available....) Disable with --override false (or force earlier java with --override true, if you feel odd). Remove support for disabling per method failure, unused.

Tidy up errors a bit

0_51 (2013-11-27)

More minor typing issues

Local classes were being treated as anonymous - oops! Pull out local classes correctly, define in as tight a scope as possible. (interesting tests InnerClassTest28 & InnerClassTest25)

Fix possible infinite loop on confused finally detection

Remove bad brace in enum definition (!) (Thanks kkiehne)

0_50 (2013-11-26)

Several more tweaks to handle the sheer horror that is eclipse. Who needs an obfuscator? Most CFR tests are now happy with eclipse. (Some sync ones still grumpy)

Finally removed hack which stops (local) a = i[x], if (a) being rolled into the conditional if appropriate. (Was causing iterator loop rewriting to fail).

Misc control flow improvements to tidy dex2jar decompilation

Fix NPE where attempting to resolve a typeclash with incomplete information (output code will be odd but readable!)

Fix bug whereby a package-free class gets the class name as its package. (oops.) ( Thanks Adrian )

) Handle (one) case where topsorting introduces confusing ordering, and made things worse!

0_49 (2013-11-23)

Added --eclipse option to allow disabling of transforms which normalise eclipse output (enabled by default)

Fixed gnarly generic bug which failed to select (or selected non-deterministic) specific type instance for generic binding. (In rare circumstances!)

0_48 (2013-11-22)

Handle eclipse style loops. (step 1, more to go maybe!) ( Thanks nkniazev )

) --recover option stops any attempt to override with extra options in case of decompile failure. (more useful for me testing than anyone else ;)

0_47 (2013-11-22)

Fix for several NPEs with awkward dex2jar output.

Fix for orphaned block as a result of loop prettifying transform

Fix (regression from 0_42) instanceOf showing qualified name uneccesarily

Add intermediate jumps to fix topological sort losing direct relationships (fixes case where falling back to topsort causes method to fail decompilation entirely (dex2jar, again.... :P ))

Rework summary dumper, also display per method issues.

Allow non-adjacent exception ranges to aggregate where intervening instructions CANNOT throw. (fixes broken up try blocks in awkward-but-valid cases)

Weaken topsort heuristics for keeping blocks together (improves dex2jar switch output, when fall through cases are out of order)

Prefer inner class short names when shortening, otherwise we get fooled by inner classes.

0_46 (2013-11-20)

Reduce overeager assignment into conditional rolling. Much less ugly ;)

Fix small type inference errors where both sides are apparently constant, but one is later used as a variable.

When dumping a jar to file, write a summary of errors in PATH/summary.txt

0_45 (2013-11-19)

Fix over-eager assignment into conditional rolling, which caused a stack overflow with a recursive lvalue. (Rolling is still quite eager....) (Thanks pcreath)

0_44 (2013-11-15)

Fix issue with constructor arg for re-sugaring stringbuilder/stringbuffer construction. ( Thanks pcreath )

) StringBuilder/StringBuffer re-sugaring now correct for original compilation version, however can be explicitly enabled with [--stringbuilder true] and [--stringbuffer true]

0_43 (2013-11-15)

Significant refactoring of internal state, allows multiple decompilations to share work.

Jar dumping - specify a .jar, and it'll all come out! (also use --outputdir !!)

Output to director - eg --outputdir /tmp/javaherepls

Aggressive exception stripping (--forceexceptionprune) - removes pointless exception blocks for cleaner code.

Fallback analysis uses --forcetopsort, --forcexceptionprune

Significantly better JSR handling. (eg JsHurt4.class)

StringBuffer resugaring (i.e. same behaviour as StringBuilder)

Fix for bug of default value, where it's a class attribute.

0_42 (2013-10-17)

Added an aggressive topological sort when the code 'doesn't look right' (controlled with --forcetopsort, otherwise, it'll use when appropriate). There's still work to do here, but it improves dex2jar output (somewhat, still issues). If you find that significantly better code is generated by using --forcetopsort false , (which you shouldn't have to do!), please let me know! ( Thanks pcreath )

, (which you shouldn't have to do!), please let me know! ( ) Fixed silly separator issue which caused classpath issues on windows. ( Thanks mmebane )

) Output tweaks - per method comment blocks, class comments etc (still playing with this, controlled with --comments to turn off, I prefer them on!)

0_41 (2013-10-04)

Improve eclipse style switch support (not completely there yet).

Fix crash on constructor rewrite bug

Add --dumpclasspath option for (heavy) debug

Fix for (very specific) eclipse style exception rewrite which causes backjumps

0_40 (2013-10-02)

Improved break detection in loop analysis.

0_39 (2013-10-01)

Improve assert code, where assert conditionals have been flipped. (so the assert-throw ends up as fall through).

0_38 (2013-10-01)

Fix minor issues with assert in inner classes (minor issue still exists if direction of test has flipped, will leave ugly code)

Fix crash if assert sugarer hits unstructured code

0_37 (2013-10-01)

Reduce spurious class analysis

Capture anonymous inner class outer local use

0_36 (2013-09-26)

Fix multi-catch (java 7) exceptions

0_35 (2013-09-26)

Several changes to type propagation - this may result in a few more seemingly uneccessary casts (until I find them!) - but allows varargs methods to be better desugared, and improves bad overloading rewrites.

Lambda serialisation / altMetaFactories support added. (Some info here.) Thanks srborlongan again!

Format tidying

Fix bug on string constant overflowing signed short size

Fix string quoting bug

Improve type inference (esp for lambdas)

0_34 (2013-09-13)

Don't remove stack variable alias if it's needed inside comparison. (this is a sign that the decompilation hasn't quite managed to condense a complex conditional with inline assignments down to a single line).

Some flavours of empty catch blocks were causing decompiler to bail early.

0_33 (2013-09-12)

Fix to bug which nopped out self mutating replacement candidates.

0_32 (2013-09-12)

Fix bad pre-mutation

Don't needlessly up-promote types on comparison (stops chars being promoted to int)

Better use of continues in for loops

Tidy up single method dumping

Pathological loop improvements

Allow array lvalue alias replacement (fixes many Short circuit tests).

0_31 (2013-09-10)

Some improvements to flow which will allow me to match final-with-resources (c# using)

Some scope improvements

Partial failure. If only to stop Mike (Procyon) from moaning ;)

Better classpatch searching.

broke the meg jar barrier :( Time to clear out some dead code!

0_30 (2013-08-29)

Improvements to lifetime knowledge

Improvements to gnarly conditionals. Really gnarly ;)

Correct minimal type for scope sharing objects.

0_29 (2013-08-27)

Removed hardcoded String knowledge, as it stopped String resolving, breaking string lambdas!

Improvements in local variable sharing - not quite right yet as we don't correctly deduce minimal type for objects which share scope, (you see !! in output... ) ... fixed soon!

0_28 (2013-08-21)

Fix issue with finally rewriting stripping returns

Construction changes, to cope better with handwritten bytecode.

Missing annotation display on interface class fixes

Fix issue with dumping raw dynamic methods in j8 103+

Fix for unordered attributes causing output to change.

0_27 (2013-08-19)

Rewrite of the finally extraction code - there are still some edge cases where it struggles with nested finallys, but on the whole it behaves better.

Lambda detection now also handles post beta 1.0.8-103 lambdas (Where MethodType is now used instead of MethodHandle, amongst other things). Thanks srborlongan (Java behaviour change documented http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8019635 )

(Java behaviour change documented http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8019635 ) Prefer local files over classpath (doh!) - otherwise if you're decompiling a hacked version of a standard library, you get the original! Thanks matteoceccarello

0_26 (2013-08-09)

Another exception + looping improvement - this test case is pretty fun.

0_25 (2013-08-09)

Fix regression which breaks optimised sable test

When file isn't in logical location, infer class path alterations. (Will truncate directory at 'best' point in class path, and search from there for non jar files).

Be more graceful handling missing files.

Fix bad test on finally rewriter

Improvements for empty if blocks

0_24 (2013-08-07)

Fairly significant improvements to finally handling.

0_23 (2013-08-02)