rzwitserloot/lombok.ast

lombok hangs forever on Java 7 multicatch

Closed this issue · 4 comments

I've seen lombok hit an apparent infinite loop when parsing stuff like

catch (IOException|SomeOtherExceptionType|SomeThirdExceptionType e) {

}

Is Java 7 not supported?

No, that should be fine. Can you send me a specific complete source file which hangs if you compile it with javac -cp lombok.jar TheFile.java, and/or hangs if you create a fresh new eclipse project, add lombok.jar as a library dependency, and put this file in the project?

Oh, and, our issue tracker is over at googlecode; just click 'report an issue' on projectlombok.org.

Thanks for the quick response. This happened for us when using Android lint on some Java 7 code. I tried reproing using lombok-ast-0.2.1.jar and something like:

Source source = new Source(                                                                                                          
    Joiner.on("\n").join(                                                                                                            
        "class Blah { ",                                                                                                             
        "  public void meh() {",                                                                                                     
        "    try {",                                                                                                                 
        "      // nothing",                                                                                                          
        "    } catch (IOException",                                                                                                  
        "             |IllegalStateException",                                                                                       
        "             |SomeOtherException e) {",                                                                                     
        "      // do nothing",                                                                                                       
        "    }",                                                                                                                     
        "}"),                                                                                                                        
    "name");                                                                                                                         
source.parseCompilationUnit();

But it seems to work fine. I'll dig a little deeper; first guess is that Android Lint includes a different version of Lombok. Second guess is that the problem was caused by something else.

I'll reopen on googlecode if/when I manage an actual repro.

I have this same problem. It has taken me several days of plowing around through Lombok AST and parboiled code to narrow it down to multicatch. I am having trouble isolating a single source file that will go into the infinite loop when it is in a project by itself, but in the larger project context I can confirm that Android lint will loop for what seems forever on files containing multicatch expressions (I let it run overnight once and it didn't finish).

Converting the multicatch to separate catch blocks for each exception type and making no other changes allows lint to breeze through the entire codebase.