From 495589a81532a9a5ee32bea8f1a2a6ac7420d3e2 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Sat, 24 May 2014 14:00:22 +0400 Subject: natural enum formatting (injected constructor parameters omitted) --- src/de/fernflower/main/ClassWriter.java | 9 ++-- src/de/fernflower/main/EnumProcessor.java | 3 +- .../modules/decompiler/exps/InvocationExprent.java | 19 +++---- .../modules/decompiler/exps/NewExprent.java | 63 +++++++++++++--------- 4 files changed, 52 insertions(+), 42 deletions(-) diff --git a/src/de/fernflower/main/ClassWriter.java b/src/de/fernflower/main/ClassWriter.java index 68b4689..54a490e 100644 --- a/src/de/fernflower/main/ClassWriter.java +++ b/src/de/fernflower/main/ClassWriter.java @@ -698,7 +698,7 @@ public class ClassWriter { boolean isInterface = (cl.access_flags & CodeConstants.ACC_INTERFACE) != 0; boolean isAnnotation = (cl.access_flags & CodeConstants.ACC_ANNOTATION) != 0; - + boolean isEnum = (cl.access_flags & CodeConstants.ACC_ENUM) != 0 && DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM); boolean isDeprecated = mt.getAttributes().containsKey("Deprecated"); String indstr = InterpreterUtil.getIndentString(indent); @@ -861,10 +861,11 @@ public class ClassWriter { lastparam_index = i; } } - + boolean firstpar = true; - int index = thisvar?1:0; - for(int i=0;i sigFields = null; + boolean isEnum = false; if(functype == TYP_INIT) { ClassNode newnode = DecompilerContext.getClassprocessor().getMapRootClasses().get(classname); @@ -328,13 +322,16 @@ public class InvocationExprent extends Exprent { sigFields.set(0, new VarVersionPaar(-1, 0)); } } + isEnum = (newnode.classStruct.access_flags & CodeConstants.ACC_ENUM) != 0 && + DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM); } } Set setAmbiguousParameters = getAmbiguousParameters(); boolean firstpar = true; - for(int i=0;i