|
|
@ -74,7 +74,7 @@ public class ClassWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void classLambdaToJava(ClassNode node, TextBuffer buffer, Exprent method_object, int indent) { |
|
|
|
public void classLambdaToJava(ClassNode node, TextBuffer buffer, Exprent method_object, int indent, BytecodeMappingTracer origTracer) { |
|
|
|
ClassWrapper wrapper = node.getWrapper(); |
|
|
|
ClassWrapper wrapper = node.getWrapper(); |
|
|
|
if (wrapper == null) { |
|
|
|
if (wrapper == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -85,7 +85,7 @@ public class ClassWriter { |
|
|
|
ClassNode outerNode = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE); |
|
|
|
ClassNode outerNode = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE); |
|
|
|
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node); |
|
|
|
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node); |
|
|
|
|
|
|
|
|
|
|
|
BytecodeMappingTracer tracer = new BytecodeMappingTracer(); |
|
|
|
BytecodeMappingTracer tracer = new BytecodeMappingTracer(origTracer.getCurrentSourceLine()); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
StructClass cl = wrapper.getClassStruct(); |
|
|
|
StructClass cl = wrapper.getClassStruct(); |
|
|
@ -138,10 +138,13 @@ public class ClassWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
buffer.append(" {").appendLineSeparator(); |
|
|
|
buffer.append(" {").appendLineSeparator(); |
|
|
|
|
|
|
|
tracer.incrementCurrentSourceLine(); |
|
|
|
|
|
|
|
|
|
|
|
methodLambdaToJava(node, wrapper, mt, buffer, indent + 1, !lambdaToAnonymous, tracer); |
|
|
|
methodLambdaToJava(node, wrapper, mt, buffer, indent + 1, !lambdaToAnonymous, tracer); |
|
|
|
|
|
|
|
|
|
|
|
buffer.appendIndent(indent).append("}"); |
|
|
|
buffer.appendIndent(indent).append("}"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addTracer(cl, mt, tracer); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
finally { |
|
|
|
finally { |
|
|
@ -151,6 +154,15 @@ public class ClassWriter { |
|
|
|
DecompilerContext.getLogger().endWriteClass(); |
|
|
|
DecompilerContext.getLogger().endWriteClass(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void addTracer(StructClass cls, StructMethod method, BytecodeMappingTracer tracer) { |
|
|
|
|
|
|
|
StructLineNumberTableAttribute lineNumberTable = |
|
|
|
|
|
|
|
(StructLineNumberTableAttribute)method.getAttributes().getWithKey(StructGeneralAttribute.ATTRIBUTE_LINE_NUMBER_TABLE); |
|
|
|
|
|
|
|
tracer.setLineNumberTable(lineNumberTable); |
|
|
|
|
|
|
|
DecompilerContext.getBytecodeSourceMapper().addTracer(cls.qualifiedName, |
|
|
|
|
|
|
|
InterpreterUtil.makeUniqueKey(method.getName(), method.getDescriptor()), |
|
|
|
|
|
|
|
tracer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void classToJava(ClassNode node, TextBuffer buffer, int indent, BytecodeMappingTracer tracer) { |
|
|
|
public void classToJava(ClassNode node, TextBuffer buffer, int indent, BytecodeMappingTracer tracer) { |
|
|
|
ClassNode outerNode = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE); |
|
|
|
ClassNode outerNode = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE); |
|
|
|
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node); |
|
|
|
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node); |
|
|
@ -232,8 +244,7 @@ public class ClassWriter { |
|
|
|
boolean methodSkipped = !methodToJava(node, mt, buffer, indent + 1, method_tracer); |
|
|
|
boolean methodSkipped = !methodToJava(node, mt, buffer, indent + 1, method_tracer); |
|
|
|
if (!methodSkipped) { |
|
|
|
if (!methodSkipped) { |
|
|
|
hasContent = true; |
|
|
|
hasContent = true; |
|
|
|
DecompilerContext.getBytecodeSourceMapper().addTracer(cl.qualifiedName, |
|
|
|
addTracer(cl, mt, method_tracer); |
|
|
|
InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor()), method_tracer); |
|
|
|
|
|
|
|
startLine = method_tracer.getCurrentSourceLine(); |
|
|
|
startLine = method_tracer.getCurrentSourceLine(); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
@ -573,10 +584,6 @@ public class ClassWriter { |
|
|
|
boolean isDeprecated = mt.getAttributes().containsKey("Deprecated"); |
|
|
|
boolean isDeprecated = mt.getAttributes().containsKey("Deprecated"); |
|
|
|
boolean clinit = false, init = false, dinit = false; |
|
|
|
boolean clinit = false, init = false, dinit = false; |
|
|
|
|
|
|
|
|
|
|
|
StructLineNumberTableAttribute lineNumberTable = |
|
|
|
|
|
|
|
(StructLineNumberTableAttribute)mt.getAttributes().getWithKey(StructGeneralAttribute.ATTRIBUTE_LINE_NUMBER_TABLE); |
|
|
|
|
|
|
|
tracer.setLineNumberTable(lineNumberTable); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MethodDescriptor md = MethodDescriptor.parseDescriptor(mt.getDescriptor()); |
|
|
|
MethodDescriptor md = MethodDescriptor.parseDescriptor(mt.getDescriptor()); |
|
|
|
|
|
|
|
|
|
|
|
int flags = mt.getAccessFlags(); |
|
|
|
int flags = mt.getAccessFlags(); |
|
|
@ -805,6 +812,8 @@ public class ClassWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// We do not have line information for method start, lets have it here for now
|
|
|
|
// We do not have line information for method start, lets have it here for now
|
|
|
|
|
|
|
|
StructLineNumberTableAttribute lineNumberTable = |
|
|
|
|
|
|
|
(StructLineNumberTableAttribute)mt.getAttributes().getWithKey(StructGeneralAttribute.ATTRIBUTE_LINE_NUMBER_TABLE); |
|
|
|
if (lineNumberTable != null && DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_LINE_NUMBERS)) { |
|
|
|
if (lineNumberTable != null && DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_LINE_NUMBERS)) { |
|
|
|
buffer.setCurrentLine(lineNumberTable.getFirstLine() - 1); |
|
|
|
buffer.setCurrentLine(lineNumberTable.getFirstLine() - 1); |
|
|
|
} |
|
|
|
} |
|
|
|