Community
Participate
Working Groups
Build Identifier: 20100617-1415 When an annotation parameter is on a separate line than the annotation itself, and the closing parenthesis is on the same line as the parameter, the next line is indented at the same level as the parameter, which is incorrect. This issue is similar to Bug 237081 Reproducible: Always Steps to Reproduce: 1. Copy the code below in a new java editor 2. Select all, and ctrl+I (Correct Indentation) 3. The class declaration is indented at the same level as the value parameter. This is the same when the next line is also an annotation, or with array annotations (like when using @javax.persistence.NamedQueries). However this does not occur when "value=" is omitted (but it is not always possible) or when the annotation's closing parenthesis is on a separate line. @MyAnnotation( value="hello") public class ArrayAnnotationBug { } @interface MyAnnotation { String value(); }
Rajesh, please check if this is still the case with your recent patches.
(In reply to comment #1) > Rajesh, please check if this is still the case with your recent patches. Yes, this is still an issue even with latest patch and needs to be addressed separately.
Created attachment 188661 [details] Patch with test.
Deepak, please do the first review.
- Patch does not work if fully qualified name of the annotation is used (see JavaIndenter.looksLikeAnonymousTypeDecl() on how to handle fully qualified names) ------------------------------------------------------------------- package org.eclipse.annotation; public @interface MyAnnotation { String value(); } package org.eclipse.test; @org.eclipse.annotation.MyAnnotation( value="hello") public class ArrayAnnotationBug { } ------------------------------------------------------------------ - Rename looksLikeAnnotationDecl to looksLikeAnnotation. "@interface MyAnnotation {...}" is the annotation declaration. - Add "(i.e. an annotation name (potentially qualified) and an at-sign)" to the javadoc of looksLikeAnnotation.
Created attachment 188768 [details] Patch with test. Now handles qualified name.
The fix is good, but.. (In reply to comment #6) > Now handles qualified name. Please add a test for this.
Created attachment 188903 [details] Patch with test.
Committed to HEAD. Rajesh, thanks for the patch.