Cleanup (formatting)

master
Roman Shevchenko 10 years ago
parent 9bd8af2b43
commit d96104bdec
  1. 28
      src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
  2. 12
      src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java
  3. 3
      src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java
  4. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java

@ -48,10 +48,8 @@ public class ClassesProcessor {
public ClassesProcessor(StructContext context) { public ClassesProcessor(StructContext context) {
HashMap<String, Object[]> mapInnerClasses = new HashMap<String, Object[]>(); HashMap<String, Object[]> mapInnerClasses = new HashMap<String, Object[]>();
HashMap<String, HashSet<String>> mapNestedClassReferences = new HashMap<String, HashSet<String>>(); HashMap<String, HashSet<String>> mapNestedClassReferences = new HashMap<String, HashSet<String>>();
HashMap<String, HashSet<String>> mapEnclosingClassReferences = new HashMap<String, HashSet<String>>(); HashMap<String, HashSet<String>> mapEnclosingClassReferences = new HashMap<String, HashSet<String>>();
HashMap<String, String> mapNewSimpleNames = new HashMap<String, String>(); HashMap<String, String> mapNewSimpleNames = new HashMap<String, String>();
boolean bDecompileInner = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_INNER); boolean bDecompileInner = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_INNER);
@ -113,11 +111,9 @@ public class ClassesProcessor {
if (arrold == null) { if (arrold == null) {
mapInnerClasses.put(innername, arr); mapInnerClasses.put(innername, arr);
} }
else { else if (!InterpreterUtil.equalObjectArrays(arrold, arr)) {
if (!InterpreterUtil.equalObjectArrays(arrold, arr)) { String message = "Inconsistent inner class entries for " + innername + "!";
DecompilerContext.getLogger() DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN);
.writeMessage("Inconsistent inner class entries for " + innername + "!", IFernflowerLogger.Severity.WARN);
}
} }
// reference to the nested class // reference to the nested class
@ -174,15 +170,13 @@ public class ClassesProcessor {
continue; continue;
} }
if (setVisited.contains(nestedClass)) { if (!setVisited.add(nestedClass)) {
continue; continue;
} }
setVisited.add(nestedClass);
ClassNode nestednode = mapRootClasses.get(nestedClass); ClassNode nestednode = mapRootClasses.get(nestedClass);
if (nestednode == null) { if (nestednode == null) {
DecompilerContext.getLogger().writeMessage("Nested class " + nestedClass + " missing!", DecompilerContext.getLogger().writeMessage("Nested class " + nestedClass + " missing!", IFernflowerLogger.Severity.WARN);
IFernflowerLogger.Severity.WARN);
continue; continue;
} }
@ -207,13 +201,13 @@ public class ClassesProcessor {
if (interfaces.length > 0) { if (interfaces.length > 0) {
if (interfaces.length > 1) { if (interfaces.length > 1) {
DecompilerContext.getLogger() String message = "Inconsistent anonymous class definition: " + cl.qualifiedName;
.writeMessage("Inconsistent anonymous class definition: " + cl.qualifiedName, IFernflowerLogger.Severity.WARN); DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN);
} }
nestednode.anonimousClassType = new VarType(cl.getInterface(0), true); nestednode.anonymousClassType = new VarType(cl.getInterface(0), true);
} }
else { else {
nestednode.anonimousClassType = new VarType(cl.superClass.getString(), true); nestednode.anonymousClassType = new VarType(cl.superClass.getString(), true);
} }
} }
else if (nestednode.type == ClassNode.CLASS_LOCAL) { else if (nestednode.type == ClassNode.CLASS_LOCAL) {
@ -366,7 +360,7 @@ public class ClassesProcessor {
public HashMap<String, VarVersionPaar> mapFieldsToVars = new HashMap<String, VarVersionPaar>(); public HashMap<String, VarVersionPaar> mapFieldsToVars = new HashMap<String, VarVersionPaar>();
public VarType anonimousClassType; public VarType anonymousClassType;
public List<ClassNode> nested = new ArrayList<ClassNode>(); public List<ClassNode> nested = new ArrayList<ClassNode>();
@ -401,7 +395,7 @@ public class ClassesProcessor {
lambda_information.content_method_key = lambda_information.content_method_key =
InterpreterUtil.makeUniqueKey(lambda_information.content_method_name, lambda_information.content_method_descriptor); InterpreterUtil.makeUniqueKey(lambda_information.content_method_name, lambda_information.content_method_descriptor);
anonimousClassType = new VarType(lambda_class_name, true); anonymousClassType = new VarType(lambda_class_name, true);
boolean is_method_reference = (content_class_name != classStruct.qualifiedName); boolean is_method_reference = (content_class_name != classStruct.qualifiedName);
if (!is_method_reference) { // content method in the same class, check synthetic flag if (!is_method_reference) { // content method in the same class, check synthetic flag

@ -221,12 +221,12 @@ public class NestedClassProcessor {
if (!hasEnclosing) { if (!hasEnclosing) {
if (child.type == ClassNode.CLASS_ANONYMOUS) { if (child.type == ClassNode.CLASS_ANONYMOUS) {
DecompilerContext.getLogger() String message = "Unreferenced anonymous class " + child.classStruct.qualifiedName + "!";
.writeMessage("Unreferenced anonymous class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.Severity.WARN); DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN);
} }
else if (child.type == ClassNode.CLASS_LOCAL) { else if (child.type == ClassNode.CLASS_LOCAL) {
DecompilerContext.getLogger() String message = "Unreferenced local class " + child.classStruct.qualifiedName + "!";
.writeMessage("Unreferenced local class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.Severity.WARN); DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN);
} }
} }
} }
@ -275,8 +275,8 @@ public class NestedClassProcessor {
HashMap<String, List<VarFieldPair>> mask = getMaskLocalVars(nd.wrapper); HashMap<String, List<VarFieldPair>> mask = getMaskLocalVars(nd.wrapper);
if (mask.isEmpty()) { if (mask.isEmpty()) {
DecompilerContext.getLogger() String message = "Nested class " + nd.classStruct.qualifiedName + " has no constructor!";
.writeMessage("Nested class " + nd.classStruct.qualifiedName + " has no constructor!", IFernflowerLogger.Severity.WARN); DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN);
} }
else { else {
mapVarMasks.put(nd.classStruct.qualifiedName, mask); mapVarMasks.put(nd.classStruct.qualifiedName, mask);

@ -347,8 +347,7 @@ public class DomHelper {
} }
else { else {
if (mapstage == 2 || mapRefreshed) { // last chance lost if (mapstage == 2 || mapRefreshed) { // last chance lost
DecompilerContext.getLogger().writeMessage("Statement cannot be decomposed although reducible!", DecompilerContext.getLogger().writeMessage("Statement cannot be decomposed although reducible!", IFernflowerLogger.Severity.ERROR);
IFernflowerLogger.Severity.ERROR);
} }
break; break;
} }

@ -95,7 +95,7 @@ public class NewExprent extends Exprent {
if (anonymous) { if (anonymous) {
ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(newtype.value); ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(newtype.value);
return node.anonimousClassType; return node.anonymousClassType;
} }
else { else {
return newtype; return newtype;
@ -233,13 +233,13 @@ public class NewExprent extends Exprent {
if (!enumconst) { if (!enumconst) {
String enclosing = null; String enclosing = null;
if (!lambda && constructor != null) { if (!lambda && constructor != null) {
enclosing = getQualifiedNewInstance(child.anonimousClassType.value, constructor.getLstParameters(), indent, tracer); enclosing = getQualifiedNewInstance(child.anonymousClassType.value, constructor.getLstParameters(), indent, tracer);
} }
String typename = ExprProcessor.getCastTypeName(child.anonimousClassType); String typename = ExprProcessor.getCastTypeName(child.anonymousClassType);
if (enclosing != null) { if (enclosing != null) {
ClassNode anonimousNode = DecompilerContext.getClassProcessor().getMapRootClasses().get(child.anonimousClassType.value); ClassNode anonimousNode = DecompilerContext.getClassProcessor().getMapRootClasses().get(child.anonymousClassType.value);
if (anonimousNode != null) { if (anonimousNode != null) {
typename = anonimousNode.simpleName; typename = anonimousNode.simpleName;
} }

Loading…
Cancel
Save