@Builder not work with static import in Intellij 2016.2.4
See original GitHub issueI 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:
- Created 7 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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.