question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Builder not work with static import in Intellij 2016.2.4

See original GitHub issue

I have an issue with static import mode with @Builder

import com.raimtec.milkyway.orch.mktfeed.EventType;
import java.util.ArrayList;
import java.util.Collection;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder(builderMethodName = "ibMarketFeedRequestBuilder")
@NoArgsConstructor
@AllArgsConstructor
public class IBMarketFeedRequest {

  private String contextId;

  private Collection<EventType> eventTypes = new ArrayList<>();

}

When I use static import like this :

import static com.raimtec.milkyway.orch.mktfeed.ib.IBMarketFeedRequest.ibMarketFeedRequestBuilder;

public class MyService  {
  public void serve() {
    IBMarketFeedRequest request = ibMarketFeedRequestBuilder().contextId(marketFeed.getId()).eventTypes(eventTypes).build();
  }
}

I get error below :

Error:(23, 1) java: cannot find symbol
  symbol:   static ibMarketFeedRequestBuilder
  location: class

If I use normal mode:

import com.raimtec.milkyway.orch.mktfeed.ib.IBMarketFeedRequest;

public class MyService  {
  public void serve() {
    IBMarketFeedRequest request = IBMarketFeedRequest.ibMarketFeedRequestBuilder().contextId(marketFeed.getId()).eventTypes(eventTypes).build();
  }
}

It works perfectly.

If I build the project in commandline without Intellij, it works too.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
mplushnikovcommented, Feb 28, 2019

This error comes from javac, not IntelliJ. Unfortunatly static import for BuilderClass is not possible with lombok: https://github.com/rzwitserloot/lombok/issues/2044

I can only think about adding some Inspection and generate IntelliJ-Warning in this situation.

6reactions
Mahtarancommented, Aug 26, 2019

Just letting you know that this is a feature I would very much like, would have saved me a few hours of debugging and head-scratching.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
Builder not work with static import in Intellij 2016.2.4.
Read more >
static import not working in lombok builder in intelliJ
This is a known bug, and not something that's easy to fix. Static imports are resolved before the annotation processors are run.
Read more >
Intellij IDEA cannot resolve any import statement
Hi there,. I am struggling recently with very strange issue. Suddenly, my intellij IDEA stopped resolving all java import statements.
Read more >
PyCharm 181.4203.547 Release Notes | Knowledge Base
Feature PY‑20770 Support Python 3.6 asynchronous generators and comprehensions Feature PY‑21768 Semantic highlighting for Python Bug PY‑19573 Python console ‑ no output under OS X Bug...
Read more >
Untitled
Fixed the Run Git hooks checkbox in the Before Commit section of the Commit ... specified more than once" error does not appear...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found