Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import static on @builder generated method does not work #1326

Closed
MLabusquiere opened this issue Mar 6, 2017 · 3 comments
Closed

Import static on @builder generated method does not work #1326

MLabusquiere opened this issue Mar 6, 2017 · 3 comments

Comments

@MLabusquiere
Copy link

Given that Pojo :

@Builder
public class TotoSample {
    private String toto;
}

The following code provides compilation errors

[ERROR] ~/src/main/java/Main.java:[3,1] cannot find symbol
[ERROR] symbol: static builder
[ERROR] location: class
[ERROR] ~/src/main/java/Main.java:[10,27] cannot find symbol
[ERROR] symbol: method builder()
[ERROR] location: class Main
[ERROR] -> [Help 1]

import static pojo.TotoSample.builder;

/**
 * Created 06/03/17.
 */
public class Main {
    public static void main(String[] args) {
        TotoSample toto = builder().toto("toto").build();
    }
}

But when i expand static import, it works !! TotoSample.builder().toto("toto").build()

In the aim to reproduce the error, i used this pom configuration :

   <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.14</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
@askoning
Copy link
Collaborator

askoning commented Mar 6, 2017

Unfortunately this is a bug in javac's resolution, as described in #979 .

@askoning askoning closed this as completed Mar 6, 2017
@omega09
Copy link

omega09 commented Mar 8, 2017

@askoning #884 is also the same thing (if you want to do some cleaning).

@rzwitserloot
Copy link
Collaborator

Duplicate of #2044

@rzwitserloot rzwitserloot marked this as a duplicate of #2044 Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants