Recaf icon indicating copy to clipboard operation
Recaf copied to clipboard

Handle frame-generation with Java 7- classes with JSR/RET

Open Col-E opened this issue 4 years ago • 5 comments

Describe the bug

You can edit a class with JSR/RET but unless you disable verify in the config assembling/exporting these modified classes will complain.

Exception

java.lang.IllegalArgumentException: JSR/RET are not supported with computeFrames option
	at org.objectweb.asm.Frame.execute(Frame.java:1017)
	at org.objectweb.asm.MethodWriter.visitJumpInsn(MethodWriter.java:1145)
	at org.objectweb.asm.tree.JumpInsnNode.accept(JumpInsnNode.java:79)
	at org.objectweb.asm.tree.InsnList.accept(InsnList.java:144)
	at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:751)
	at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:649)
	at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:452)
	at me.coley.recaf.ui.controls.text.BytecodeEditorPane.assemble(BytecodeEditorPane.java:230)
	at me.coley.recaf.ui.controls.view.BytecodeViewport.save(BytecodeViewport.java:85)

Potential Fix

When loading older classes, pass them through JSRInlinerAdapter or disable frame generation.

Col-E avatar Feb 23 '21 04:02 Col-E

If somebody can find a class/jar that demonstrates this behavior I can toss up a fix. I don't have one laying around at the moment.

Col-E avatar Apr 10 '21 07:04 Col-E

afaik frames and jsr/ret are mutually exclusive, and jsr/ret was already deprecated by the time frames were introduced

GiantNuker avatar Jan 14 '22 03:01 GiantNuker