Migrated from Google Code (issue 287)
👤 francois.marot 🕗 Oct 13, 2011 at 08:21 UTC
What steps will reproduce the problem?
What is the expected output? What do you see instead?
everything should be fine
What version of the product are you using? On what operating system?
Eclipse indigo up to date
Please provide any additional information below.
Lombok 0.10.0 does not have this error so it was introduced in Lombok 0.10.1
I imagine that Lombok expects all @ NotNull annotations to be its own and that a more precise check on the whole @ NotNull annotation class+package would solve the problem but I may be wrong as I didn't look at the sources.
👤 steven.dick.1972 🕗 Oct 14, 2011 at 07:59 UTC
I'm using the javax validation API (with hibernate validator 4.2.0 final) and Eclipse is fine, but javac running from ANT complains about the @ NotNull when using Lombok 0.10.1 - downgrading to Lombok 0.10.0 resolves the problem.
👤 graham.berks 🕗 Oct 17, 2011 at 09:40 UTC
Any update to the use of javax validation API ? Bit of a stopper from us to upgrade this.
👤 r.spilker 🕗 Oct 17, 2011 at 09:57 UTC
We will discuss this tonight during our weekly Lombok development meeting
👤 reinierz 🕗 Oct 17, 2011 at 17:20 UTC
We've looked at version 0.8 of spring modules, here:
And as you can see, there's no 'annotation' package. We have no idea where its from, in fact; googling around doesn't give us much.
As far as we know, for years and years now, the right annotation for this stuff is javax.validation.constraints.NotNull and not spring's own variant.
Spring's own variant seems to only be legal on fields, whereas a recent version of javax.validation.constraints.NotNull is valid on fields, methods, and parameters - everything we need it to be legal on.
We suggest you switch versions. Otherwise, can you point us at the sources of this NotNull annotation so we can learn a little more about it? We could try to hardcode an exception for that annotation, but without any trace of that annotation other than this bugreport we're a bit hesitant to do so.
When we look at the javadoc for javax.validation.constraints.NotNull here:
It looks like there should be no problem; it's legal everywhere we need it to be legal. When I check the javaEE 5 docs, there is no javax.validation at all, so it seems to be new in javaEE 6.
What error message are you getting? What version are you on? The same caveat applies: We can hardcode an exception but before we do so we need to know what's going on.
👤 graham.berks 🕗 Oct 18, 2011 at 07:33 UTC
Attached a small example, error can be seen with
Test.java:[8,1] annotation type not applicable to this kind of declaration
Appears to me that Lombok should not be getting involved but some error in processing is causing @ NotNull to be processed.
👤 graham.berks 🕗 Oct 19, 2011 at 07:11 UTC
As i'm not including Lombok's @ NotNull via an import statement I would assume it shoouldn't be processing the @ NotNull.
That assumption correct ?
👤 pe.fips 🕗 Oct 19, 2011 at 20:55 UTC
Any annotation that matches the pattern ^(?:notnull|nonnull)$ will be processed by @ Data.
👤 pe.fips 🕗 Oct 19, 2011 at 21:22 UTC
Issue #364 has been merged into this issue.
👤 pe.fips 🕗 Oct 19, 2011 at 21:29 UTC
Only affects javac and works if the @ NotNull annotation is applicable to local variable declarations(so ElementType.LOCAL_VARIABLE), which I find particular strange.
👤 pe.fips 🕗 Oct 19, 2011 at 21:47 UTC
As for the Spring @ NotNull annotation, it is only allowed on fields and methods(so ElementType.METHOD, ElementType.FIELD). This means it shouldn't qualify for an annotation @ Data should process.
The question is how should we handle these cases?
👤 graham.berks 🕗 Oct 20, 2011 at 07:45 UTC
To me it would seem dangerous to process annotations without an explicit call to use it. ie. an import statement.
👤 graham.berks 🕗 Oct 21, 2011 at 07:35 UTC
Perhaps the change should be backed out until a solution is available. We are having numerous issues with eclipse and would like to narrow down any issues and get the change to remove the memory leak with @ Delegate. Though I don't really know if this is causing us any real impact.
👤 dsuepke 🕗 Oct 24, 2011 at 08:22 UTC
Getting the same problem with javax.validation.constraints.NotNull, making it necessary to fall back to the previous version of Lombok. A quick fix would be greatly appreciated.
👤 reinierz 🕗 Oct 25, 2011 at 13:02 UTC
We've stumbled on this issue before, and at that time I 'fixed' it by just not treating @ NotNull (Any kind of @ NotNull, from any package) special. I forgot to update the documentation and I also didn't document the code. Philipp recently noticed the discrepancy in the docs, and added it back in.
Seems like this is still the best option as we've never actually heard any complaints about not having @ NotNull trigger lombok's usually non-null processing.
We'll push a new version out the door with the fix soon. That would be version 0.10.2
Fixed in commit 782daa4 (and this time I did update the docs and add a comment explaining why NotNull isn't in the list).
👤 dsuepke 🕗 Oct 25, 2011 at 17:32 UTC
Great, many thanks :)
👤 graham.berks 🕗 Oct 25, 2011 at 17:59 UTC
👤 pe.fips 🕗 Oct 26, 2011 at 06:48 UTC
Issue #365 has been merged into this issue.
End of migration