Compile Error: JSR/RET are not supported with computeFrames option
Asked Answered
A

2

8

Getting this error on an IntelliJ project when I compile java files. There is no specific source file listed, but it fails with this error.

Removing the following compiler flags fixes the error:

-source 1.5 -target 1.5

However, these need to be in there as we are targeting Java 5. Is there some specific code (maybe a try/catch block) that is causing this error?

2013-10-15 16:21:50,556 [26947209]   INFO - ompiler.BackendCompilerWrapper - JSR/RET are not supported with computeFrames option 
java.lang.RuntimeException: JSR/RET are not supported with computeFrames option
    at org.objectweb.asm.Frame.a(Unknown Source)
    at org.objectweb.asm.MethodWriter.visitJumpInsn(Unknown Source)
    at org.objectweb.asm.MethodAdapter.visitJumpInsn(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at com.intellij.compiler.impl.javaCompiler.BackendCompilerWrapper$ClassParsingThread.a(BackendCompilerWrapper.java:893)
    at com.intellij.compiler.impl.javaCompiler.BackendCompilerWrapper$ClassParsingThread.run(BackendCompilerWrapper.java:846)
    at com.intellij.openapi.application.impl.ApplicationImpl$7.run(ApplicationImpl.java:386)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:130)
Acquittance answered 15/10, 2013 at 12:36 Comment(2)
Does someone have a solution for this error (JSR/RET are not supported with computeFrames option)?Stator
The JSRInlinerAdapter worked for me: mail-archive.ow2.org/asm/2008-11/msg00008.htmlKalina
A
2

JSR/RET instructions appear in the byte code when try/finally blocks appear in the source. Javac 1.6+ doesn't seem to emit them even with -target 1.5, but Eclipse java compiler does.

Example

public class JSRDemo {
    public static void main(String[] args) {
        try {
            bodyOfTry();
        }
        finally {
            bodyOfFinally();
        }
    }

...

Byte codes

  // access flags 0x9
  public static main([Ljava/lang/String;)V
    TRYCATCHBLOCK L0 L1 L1 null
    TRYCATCHBLOCK L2 L3 L1 null
   L0
    LINENUMBER 4 L0
    INVOKESTATIC JSRDemo.bodyOfTry ()V
   L4
    LINENUMBER 5 L4
    GOTO L2
   L1
    LINENUMBER 6 L1
    ASTORE 2
    JSR L5               // JSR jumps to the finally block
   L6
    LINENUMBER 8 L6
    ALOAD 2
    ATHROW
   L5
    LINENUMBER 6 L5
    ASTORE 1
   L7
    LINENUMBER 7 L7
    INVOKESTATIC JSRDemo.bodyOfFinally ()V
   L8
    LINENUMBER 8 L8
    RET 1                 // RET returns from the finally block
   L2
    JSR L5                // Jump to the same finally block from another execution path
   L3
    LINENUMBER 9 L3
    RETURN
   L9
    LOCALVARIABLE args [Ljava/lang/String; L0 L9 0
    MAXSTACK = 1
    MAXLOCALS = 3
Asperse answered 25/1, 2014 at 4:36 Comment(1)
@stealthjong I guess, switching to javac might helpAsperse
B
1

I received the same error today: JSR/RET are not supported with computeFrames option

I found out that, I was using commons-io dependency for my project.

implementation 'commons-io:commons-io:2.11.0'

And I updated this dependency to the latest version as per the Gradle Suggestion.

implementation 'commons-io:commons-io:20030203.000550'

This updated version was causing the Error!

I put back the earlier version and the Error was gone and build was Successful!

Baro answered 5/1, 2022 at 13:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.