2013-10-15 4 views
6

Java 파일을 컴파일 할 때 IntelliJ 프로젝트에서이 오류가 발생합니다. 특정 소스 파일은 나열되어 있지 않지만이 오류로 인해 실패합니다. 이 문제를 일으키는 일부 특정 코드 (어쩌면 try/catch 블록)이 있는가컴파일 오류 : computeFrames 옵션에서 JSR/RET가 지원되지 않습니다.

-source 1.5 -target 1.5 

그러나, 이러한 우리가 자바 5. 목표로로있을 필요가 다음 컴파일러 플래그를 제거

오류를 해결 오류?

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) 
+0

사람이 오류에 대한 해결책 (JSR/RET computeFrames 옵션으로 지원되지 않습니다)이 있습니까? –

+0

'JSRInlinerAdapter'가 나를 위해 일했습니다 : http://mail-archive.ow2.org/asm/2008-11/msg00008.html – mschonaker

답변

1

try/finally 블록이 소스에 나타날 때 JSR/RET 명령어가 바이트 코드로 나타납니다. Javac 1.6+는 -target 1.5로도 그들을 방출하지 않지만 Eclipse Java 컴파일러는 그렇게합니다.

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

... 

바이트 코드

// 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 
+1

그래서 어떻게 고쳐 졌습니까? – stealthjong

+0

@stealthjong 'javac'로 전환하면 도움이 될 것 같네요. –