Lombok: importing nested static method breaks compilation

Created on 30 Nov 2016  路  3Comments  路  Source: projectlombok/lombok

my system (latest stable builds):

IntelliJ IDEA 2016.3
Build #IU-163.7743.44, built on November 17, 2016
JRE: 1.8.0_112-release-408-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
IntelliJ Lombok plugin Version: 0.13.16

to reproduce, I use the following code:

package ch;

import static ch.LombokBug.Inner.foo;
import org.junit.Test;
import lombok.AllArgsConstructor;

public class LombokBug {

    @Test
    public void test() {
        foo();
    }

    @AllArgsConstructor
    static class Inner {
        static void foo() {}
    }
}

what I get:

  • in the editor, everything looks fine (no compilation issue marked!)
  • however, if I want to execute the test, the compiler fails with following message (and hence test is not even executed):
Error:(14, 10) java: cannot find symbol
  symbol:   class AllArgsConstructor
  location: class ch.LombokBug

what I expect:

  • same result as with following code, i.e. test passes
package ch;

//import static ch.LombokBug.Inner.foo;
import org.junit.Test;
import lombok.AllArgsConstructor;

public class LombokBug {

    @Test
    public void test() {
        //foo();
        Inner.foo();
    }

    @AllArgsConstructor
    static class Inner {
        static void foo() {}
    }
}

All 3 comments

Please see https://github.com/cowwoc/jackson-annotating-nested-classes. If you do a normal (non-static) import on the nested static class (not even its members) you will get the exact same kind of errors.

Duplicate of #884 and friends.

cannot reproduce (and is not a duplicate of 884 and friends).

Was this page helpful?
0 / 5 - 0 ratings