Comments (10)
π€ voidstar Β π Sep 02, 2009 at 01:35 UTC
What steps will reproduce the problem?
- Put an @ NotNull on a field and watch javac choke.
Please provide any additional information below.
In my case I'm using an older version of hibernate validator with it's
@ org.hibernate.validator.NotNull annotation. The newest version uses @ javax.validation.NotNull
which from what I can tell will have the same issue.
See this thread:
http://groups.google.com/group/project-lombok/browse_thread/thread/572eb913e1a86eea
from lombok.
π€ reinierz Β π Sep 02, 2009 at 02:04 UTC
Well, it'll only choke on that particular variant of @ NotNull (javax.validation.NotNull). But, show-stopper. We'll fix
this ASAP.
from lombok.
π€ r.spilker Β π Sep 02, 2009 at 08:27 UTC
To solve it right, we need to implement the bindings so we can tell what exact
NotNull is being used and maybe even check where it can be applied.
For now, I'm considering to NOT copy the NotNull annotation to the parameter because,
for as far as I know, the only other NotNull annotation in the wild is the one from
IDEA, and currently we don't support IntelliJ anyway. And not having the annotation
copied won't break anything.
from lombok.
π€ reinierz Β π Sep 02, 2009 at 08:31 UTC
Yup. For safety's and consistency's sake, we should probably stop copying the annotations everywhere (so, also
for the getter), and not just for the parameters of the setter and the constructor.
from lombok.
π€ jacek99 Β π Sep 02, 2009 at 08:59 UTC
Wouldn't it be better to have some generic logic that would look at how an annotation
is defined and where it can be applied and use that in a common fashion to decide if
annotations should be copied around?
The same issue may pop up on other annotations that Lombok may have to deal with in
the future.
from lombok.
π€ reinierz Β π Sep 02, 2009 at 09:18 UTC
jacek99: Well, what kind of 'generic' logic are you referring to? If you're referring to: Check the target
ElementType and copy only if its legal - well, lombok can't do that - no type info. That's what Roel meant in
comment οΉ2 with "we need to implement the bindings so we can tell". It's planned - the suggested 'let's not
copy anything' is a short-term workaround.
from lombok.
π€ reinierz Β π Sep 02, 2009 at 23:41 UTC
Fixed in c46bf85 which will be rolled out in v0.8.5.
The "fix" simply reduces the feature to scan only for annotations named 'nonnull'. All annotations named nonnull
work the way we want them to (e.g. legal on parameters). The only commonly used notnull that ISNT a variant of
javax.validation.NotNull is IDEA's, but lombok doesn't support IDEA.
This is a workaround - once lombok supports type introspection we'll fix this properly.
from lombok.
π€ matt.deboer Β π Oct 17, 2011 at 19:48 UTC
This doesn't seem to be resolved (or has regressed?); using Lombok 0.10.1 with a maven 3.0.3 build, having a simple class with a single member which has @ javax.validation.constraints.NotNull applied causes compiler plugin to bomb with the aforementioned "annotation type not applicable to this kind of declaration".. this works correctly within Eclipse environment, but fails during Maven build.
(Compiler plugin is configured to use compilerVersion,source,target all = 1.6)
from lombok.
π€ reinierz Β π Oct 25, 2011 at 13:04 UTC
It's a regression introduced in 0.10.1. See issue #360 for more up to date discussion.
from lombok.
End of migration
from lombok.
Related Issues (20)
- [FEATURE] finish the job and make generating `@lombok.Generated` default behaviour HOT 1
- Jakarta Generated support HOT 3
- Support extension method autocomplete HOT 2
- [FEATURE] Add more flexibility to declare copyable annotations
- sorry it was mistake
- [BUG] Javadoc generation fails because of @Builder
- [BUG] Delombok fails on unnamed patterns in Java 22 HOT 1
- [BUG] UtilityClass nested in an enum does not work after upgrading to Java 21
- [BUG] @Delegate does not respect --source and --target HOT 1
- [BUG] Installer Throws a Bunch of Errors
- [BUG][REG 1.18.32] A required class was missing while executing org.eclipse.tycho:tycho-compiler-plugin:4.0.7:compile: org/eclipse/jdt/internal/compiler/parser/Parser
- [FEATURE] @FieldNameConstants Easier overwrite for generated fields HOT 2
- @FieldDefaults: Keep the global setting experimental, make the annotation permanent.
- [FEATURE] Allow to easily add interfaces to Builders
- [BUG] Support for Eclipse 2024-06 (4.32) HOT 14
- [FEATURE] Super Constructor
- [FEATURE] enhance @FieldNameConstants with specific prefix string HOT 2
- [BUG] SuperBuilder does not compile then binding generics to an array HOT 5
- [BUG] SaSessionForFastjsonCustomizedη±»δΈηgetModelζ₯ι HOT 1
- [FEATURE] setX() for mutable state, fluent otherwise HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lombok.