Community
Participate
Working Groups
Java compiler generates errors for constraint annotations like "@NotNull", "@Valid" and others. Problem text = "NotNull cannot be resolved to a type" The lib "validation-api-1.0.0.GA.jar" is part of the build path and contains the complete validation API. The statement "import javax.validation.constraints.NotNull;" is in the source file. Opening such a file with one of these problems, adding a character, removing it and saving the file leads to zero problems when Eclipse recompiled it. Activating the menu item "Project - Clean" recreates all problems. This problem already existed in Indigo. Its available in Eclipse on Win XP, Win 7 and Linux. Enabling or disabling annotation processing makes no difference.
I quickly tried what you describe but I cannot reproduce. Apparently we need some more info. Ideally you would put together a small test project exhibiting the error. Could you do that?
Very loosely speaking, parts of this problem sound like https://bugs.eclipse.org/bugs/show_bug.cgi?id=386356#c7, but comment#0 mentions Indigo which would rule out 386356 and point to something else.
I'm not yet able to reproduce this problem in a smaller environment. I could give you access to our Subversion Repository. I think the problem may be related to the interdependent projects and the index management of Eclipse. If subversion access is an option for you, please tell where I should send your credentials.
I did not really solve the issue, but I have some work-around. The problem with validation constraints vanished after: - copying all sources to a new workspace (no metadata, no classpath, ...) - create all projects as new - recreate all build paths manually The effect can be reproduced when setting up an annotation processor (self written) which creates Remote Interface classes from annotated bean methods (@GenerateRemote) and create them in another project. So the workaround is to create these files in ".apt_generated" in the same project and regularly start a job to copy newer files into the other project. Well ... not perfect but at least working
(In reply to comment #4) > I did not really solve the issue, but I have some work-around. Thanks for reporting your workaround, which means this no longer is a blocker. Still I'd like to find out if it's a bug in the tool. > The effect can be reproduced when setting up an annotation processor (self > written) which creates Remote Interface classes from annotated bean methods > (@GenerateRemote) and create them in another project. So I see three kinds of types: A) regular classes written by you B) types created by the annotation processor C) additional annotations inside the validation-api jar Is this list complete? No the compiler complains that C) cannot be found. QUESTIONS: Where is that error reported, against A) or against B)? Does the annotation processor evaluate annotations from C)?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.