|
|
|
@ -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(); |
|
|
|
|
if (wrapper == null) { |
|
|
|
|
return; |
|
|
|
@ -85,7 +85,7 @@ public class ClassWriter { |
|
|
|
|
ClassNode outerNode = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE); |
|
|
|
|
DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_NODE, node); |
|
|
|
|
|
|
|
|
|
BytecodeMappingTracer tracer = new BytecodeMappingTracer(); |
|
|
|
|
BytecodeMappingTracer tracer = new BytecodeMappingTracer(origTracer.getCurrentSourceLine()); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
StructClass cl = wrapper.getClassStruct(); |
|
|
|
@ -138,10 +138,13 @@ public class ClassWriter { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
buffer.append(" {").appendLineSeparator(); |
|
|
|
|
tracer.incrementCurrentSourceLine(); |
|
|
|
|
|
|
|
|
|
methodLambdaToJava(node, wrapper, mt, buffer, indent + 1, !lambdaToAnonymous, tracer); |
|
|
|
|
|
|
|
|
|
buffer.appendIndent(indent).append("}"); |
|
|
|
|
|
|
|
|
|
addTracer(cl, mt, tracer); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
finally { |
|
|
|
@ -151,6 +154,15 @@ public class ClassWriter { |
|
|
|
|
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) { |
|
|
|
|
ClassNode outerNode = (ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_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); |
|
|
|
|
if (!methodSkipped) { |
|
|
|
|
hasContent = true; |
|
|
|
|
DecompilerContext.getBytecodeSourceMapper().addTracer(cl.qualifiedName, |
|
|
|
|
InterpreterUtil.makeUniqueKey(mt.getName(), mt.getDescriptor()), method_tracer); |
|
|
|
|
addTracer(cl, mt, method_tracer); |
|
|
|
|
startLine = method_tracer.getCurrentSourceLine(); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
@ -573,10 +584,6 @@ public class ClassWriter { |
|
|
|
|
boolean isDeprecated = mt.getAttributes().containsKey("Deprecated"); |
|
|
|
|
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()); |
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
StructLineNumberTableAttribute lineNumberTable = |
|
|
|
|
(StructLineNumberTableAttribute)mt.getAttributes().getWithKey(StructGeneralAttribute.ATTRIBUTE_LINE_NUMBER_TABLE); |
|
|
|
|
if (lineNumberTable != null && DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_LINE_NUMBERS)) { |
|
|
|
|
buffer.setCurrentLine(lineNumberTable.getFirstLine() - 1); |
|
|
|
|
} |
|
|
|
|