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.

onConstructor handling

See original GitHub issue

Lombok provides a nice trick to generate constructors with additional annotations added to them. This helps a lot with writing code that uses dependency injection, e.g. with Spring Framework.

A simple testcase looks as following:

@Component @RequiredArgsConstructor(onConstructor = @__(@Autowired)) public class SomeService {

private final SomeRepository someRepository;

private final AnotherRepository anotherRepository;

public void someLogic() {

}

}

The problem is that that Lombok Intellij plugin doesn’t seem to understand Lombok’s specific @__ syntax.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11

github_iconTop GitHub Comments

8reactions
diasdevcommented, Oct 13, 2020

This is still happening for Intellij 2020.3 and latest lombok plugin version.

@AllArgsConstructor(onConstructor = @__(@Inject) cannot find symbol symbol: class __

2reactions
ranjitparvacommented, Jun 22, 2017

It doesn’t work for me either. Using the following annotation: @AllArgsConstructor(onConstructor = @__(@Inject)

Others annotations seem to be working fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the difference between @RequiredArgsConstructor ...
Which one does Spring use to construct your bean? Enter Lombok's @RequiredArgsConstructor(onConstructor = @__(@Inject)) or the more popular @ ...
Read more >
@NoArgsConstructor, @RequiredArgsConstructor ...
@RequiredArgsConstructor generates a constructor with 1 parameter for each field that requires special handling. All non-initialized final fields get a ...
Read more >
On Constructor Over-injection by Mark Seemann - ploeh blog
Constructor Over-injection is a code smell, not an anti-pattern. Sometimes, people struggle with how to deal with the Constructor ...
Read more >
What is the @RequiredArgsConstructor annotation in Lombok?
The final fields annotated with @NonNull are the parameters of the required constructor because they need special handling. For example, final fields need...
Read more >
WriteableBitmap crashes on constructor when run from opentap UI ...
WriteableBitmap crashes on constructor when run from opentap UI test launcher ... (to then later convert to an open CV image to do...
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