This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Formatting option: treat @Override as a modifier | ||
---|---|---|---|
Product: | java | Reporter: | Jesse Glick <jglick> |
Component: | Source | Assignee: | Dusan Balek <dbalek> |
Status: | NEW --- | ||
Severity: | blocker | CC: | pnejedly |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 211037 | ||
Bug Blocks: | |||
Attachments: | Proposed fix |
Description
Jesse Glick
2007-05-24 18:37:57 UTC
*** Issue 117934 has been marked as a duplicate of this issue. *** Worse, if you by hand write protected @Override void initialize() { super.initialize(); } and reformat, you get protected @Override void initialize() { super.initialize(); } which looks silly. @Override protected void initialize() { super.initialize(); } works a bit better; at least Reformat will not touch this (unless Wrapping on Annotations is set to Always). However code generation will create @Override protected void initialize() { super.initialize(); } and Reformat will not fix it. (In reply to comment #3) > code generation will create ImplementOverrideMethodGenerator I guess. Not sure how to fix that. > Reformat will not fix it. This part I can fix. Created attachment 109154 [details]
Proposed fix
This patch implements inline @Override unconditionally; not sure if it should rather be an option?
There are certain other annotations, such as @CheckForNull, which are used as type qualifiers on methods and fields and so ought to be formatted inline as well, since they logically belong right next to the type. Not sure how to distinguish these from annotations such as @SuppressWarnings or @Deprecated which semantically apply to the entire member; could hardcode a list of them, or check for @TypeQualifier or @TypeQualifierNickname. (Certainly if the annotation follows an access modifier then we know inline formatting is appropriate, but this will not help in the case of package-private members.) Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/4f3760d0cbb1 User: Jesse Glick <jglick@netbeans.org> Log: @Override was getting reformatted badly (see #104757). |