Skip to content

Commit

Permalink
Record pattern matching (#368)
Browse files Browse the repository at this point in the history
Co-authored-by: coehlrich <[email protected]>
  • Loading branch information
jaskarth and coehlrich authored Aug 20, 2024
1 parent 7092900 commit 49106c1
Show file tree
Hide file tree
Showing 37 changed files with 3,006 additions and 960 deletions.
4 changes: 4 additions & 0 deletions src/org/jetbrains/java/decompiler/code/BytecodeVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public boolean hasSwitchPatternMatch() {
return previewReleased(MAJOR_17, MAJOR_21);
}

public boolean hasRecordPatternMatching() {
return major >= MAJOR_21;
}

public boolean hasSealedClasses() {
return previewReleased(MAJOR_15, MAJOR_17);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public interface IFernflowerPreferences {
@Type(DecompilerOption.Type.BOOLEAN)
String VERIFY_VARIABLE_MERGES = "verify-merges";

@Name("[Experimental] Use old try deduplication")
@Description("Use the old try deduplication algorithm for methods with obfuscated exceptions, which inserts dummy exception handlers instead of duplicating blocks")
@Type(DecompilerOption.Type.BOOLEAN)
String OLD_TRY_DEDUP = "old-try-dedup";

@Name("Include Entire Classpath")
@Description("Give the decompiler information about every jar on the classpath.")
@ShortName("iec")
Expand Down Expand Up @@ -432,6 +437,7 @@ static Map<String, Object> getDefaults() {
defaults.put(SHOW_HIDDEN_STATEMENTS, "0"); // Extra debugging that isn't useful in most cases
defaults.put(SIMPLIFY_STACK_SECOND_PASS, "1"); // Generally produces better bytecode, useful to debug if it does something strange
defaults.put(VERIFY_VARIABLE_MERGES, "0"); // Produces more correct code in rare cases, but hurts code cleanliness in the majority of cases. Default off until a better fix is created.
defaults.put(OLD_TRY_DEDUP, "0");
defaults.put(DECOMPILE_PREVIEW, "1"); // Preview features are useful to decompile in almost all cases

defaults.put(INCLUDE_ENTIRE_CLASSPATH, "0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public static RootStatement codeToJava(StructClass cl, StructMethod mt, MethodDe
DecompilerContext.getCounterContainer().setCounter(CounterContainer.VAR_COUNTER, mt.getLocalVariables());

if (ExceptionDeobfuscator.hasObfuscatedExceptions(graph)) {
DecompilerContext.getLogger().writeMessage("Heavily obfuscated exception ranges found!", IFernflowerLogger.Severity.WARN);
DotExporter.toDotFile(graph, mt, "cfgExceptionsPre", true);

if (!ExceptionDeobfuscator.handleMultipleEntryExceptionRanges(graph)) {
Expand Down
Loading

0 comments on commit 49106c1

Please sign in to comment.