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.

Add possibility to add custom annotations to Builder

See original GitHub issue

In particular edu.umd.cs.findbugs.annotations.SuppressFBWarnings, otherweise SpotBugs detects violations which normally would be ignored in generated code.

It’s not possible to make SpotBugs process @Generated annotation since SpotBugs process byte-code and @Generated has source retention type.

P.S. Nice library and nice work! I use Immutables a lot so it’s really nice to have similar funtionality for java records.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Randgaltcommented, Jun 4, 2021

Thanks for the feedback everyone. So, at minimum copy the annotations (respecting Target, etc.). We can decide later if we can/should do more.

1reaction
aowsscommented, Jun 3, 2021

in my opinion, you could just keep things simple and copy all annotations as you mentioned earlier.

I don’t think you should act on them: that’s not really the job of this library. This library’s goal is to add a builder pattern to the Java record construct, IMHO.

Regarding the annotations, if the original record was acting on them, then this will still happen. if not, then how are you going to handle those annotations. for JSR-303 for example, are you going to throw an exception ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementing a Custom Lombok Annotation - Baeldung
Learn how to implement a custom annotation using Lombok handlers.
Read more >
How To Create And Use Your Own Custom Annotations
Create your own custom annotations in Java!Thanks to Mailgun for sponsoring this video! Head to https://mailgun.com/john to try Mailgun ...
Read more >
java - How to create custom annotation with code behind
Annotation is a metadata to a class that says based on the supplied data, do something.Had this metadata not present in the MyMessage...
Read more >
Using Custom Annotation Processors - Apache NetBeans
Defining an Annotation and Creating an Annotation Processor · In this exercise you will create a class library project. · When you click...
Read more >
Your Own Custom Annotations - More than Just Comments!
The second argument to this method represents the namespace of the Annotation class to be used. And for all the annotations we find,...
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