Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 88022 Details for
Bug 122247
[formatter] add support to handle parameter annotations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
[patch] - proposed correction
patch_bug_122247_top_HEAD(v833)_v04.txt (text/plain), 17.62 KB, created by
Eric Jodet
on 2008-01-28 11:09:04 EST
(
hide
)
Description:
[patch] - proposed correction
Filename:
MIME Type:
Creator:
Eric Jodet
Created:
2008-01-28 11:09:04 EST
Size:
17.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java,v >retrieving revision 1.224 >diff -u -r1.224 FormatterRegressionTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 25 Jan 2008 09:38:29 -0000 1.224 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 28 Jan 2008 16:02:35 -0000 >@@ -8141,6 +8141,7 @@ > public void test575() { > Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); > DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.insert_new_line_after_annotation_on_parameter = true; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 > Hashtable javaCoreOptions = JavaCore.getOptions(); > try { > Hashtable newJavaCoreOptions = JavaCore.getOptions(); >@@ -8160,6 +8161,30 @@ > } > } > >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=77809 >+ public void test575a() { >+ Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.insert_new_line_after_annotation_on_parameter = false; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 >+ Hashtable javaCoreOptions = JavaCore.getOptions(); >+ try { >+ Hashtable newJavaCoreOptions = JavaCore.getOptions(); >+ newJavaCoreOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); >+ newJavaCoreOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); >+ newJavaCoreOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); >+ JavaCore.setOptions(newJavaCoreOptions); >+ >+ Map compilerOptions = new HashMap(); >+ compilerOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); >+ compilerOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); >+ compilerOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, compilerOptions); >+ runTest(codeFormatter, "test575a", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$ >+ } finally { >+ JavaCore.setOptions(javaCoreOptions); >+ } >+ } >+ > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=95431 > public void test576() { > Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >@@ -9831,11 +9856,64 @@ > final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); > DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); > preferences.line_separator = "\n";//$NON-NLS-1$ >- preferences.insert_new_line_after_arg_annotation = true; >+ preferences.insert_new_line_after_annotation_on_parameter = true; > DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); > IRegion[] regions = new IRegion[] { > new Region(0, 221) // nothing selected --> format all > }; > runTest(codeFormatter, "test701", "X.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$ > } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 >+ public void test702() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.line_separator = "\n";//$NON-NLS-1$ >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ IRegion[] regions = new IRegion[] { >+ new Region(0, 86) // nothing selected --> format all >+ }; >+ runTest(codeFormatter, "test702", "X.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 >+ public void test703() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.line_separator = "\n";//$NON-NLS-1$ >+ preferences.insert_new_line_after_annotation_on_parameter = true; >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ IRegion[] regions = new IRegion[] { >+ new Region(0, 86) // nothing selected --> format all >+ }; >+ runTest(codeFormatter, "test703", "X.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 >+ public void test704() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.line_separator = "\n";//$NON-NLS-1$ >+ preferences.insert_new_line_after_annotation = false; >+ preferences.insert_new_line_after_annotation_on_parameter = true; >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ IRegion[] regions = new IRegion[] { >+ new Region(0, 86) // nothing selected --> format all >+ }; >+ runTest(codeFormatter, "test704", "X.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 >+ public void test705() { >+ final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); >+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); >+ preferences.line_separator = "\n";//$NON-NLS-1$ >+ preferences.insert_new_line_after_annotation = false; >+ preferences.insert_new_line_after_annotation_on_parameter = false; >+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences); >+ IRegion[] regions = new IRegion[] { >+ new Region(0, 86) // nothing selected --> format all >+ }; >+ runTest(codeFormatter, "test705", "X.java", CodeFormatter.K_UNKNOWN, 0, false, regions, "\n");//$NON-NLS-1$ //$NON-NLS-2$ >+ } > } >Index: workspace/Formatter/test703/X_in.java >=================================================================== >RCS file: workspace/Formatter/test703/X_in.java >diff -N workspace/Formatter/test703/X_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test703/X_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+public class X { >+ @Deprecated public void bar(@SuppressWarnings("unused") int i) { >+ } >+} >Index: workspace/Formatter/test704/X_in.java >=================================================================== >RCS file: workspace/Formatter/test704/X_in.java >diff -N workspace/Formatter/test704/X_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test704/X_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+public class X { >+ @Deprecated public void bar(@SuppressWarnings("unused") int i) { >+ } >+} >Index: workspace/Formatter/test575a/A_out.java >=================================================================== >RCS file: workspace/Formatter/test575a/A_out.java >diff -N workspace/Formatter/test575a/A_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test575a/A_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+public class A { >+ public Object foo(@Ann("parameter") Object parameter) { >+ return parameter; >+ } >+} >Index: workspace/Formatter/test705/X_in.java >=================================================================== >RCS file: workspace/Formatter/test705/X_in.java >diff -N workspace/Formatter/test705/X_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test705/X_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+public class X { >+ @Deprecated public void bar(@SuppressWarnings("unused") int i) { >+ } >+} >Index: workspace/Formatter/test575a/A_in.java >=================================================================== >RCS file: workspace/Formatter/test575a/A_in.java >diff -N workspace/Formatter/test575a/A_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test575a/A_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+public class A >+{ public Object foo( @Ann("parameter") Object parameter ) { >+ return parameter; >+ } >+} >Index: workspace/Formatter/test705/X_out.java >=================================================================== >RCS file: workspace/Formatter/test705/X_out.java >diff -N workspace/Formatter/test705/X_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test705/X_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+public class X { >+ @Deprecated public void bar(@SuppressWarnings("unused") int i) { >+ } >+} >Index: workspace/Formatter/test704/X_out.java >=================================================================== >RCS file: workspace/Formatter/test704/X_out.java >diff -N workspace/Formatter/test704/X_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test704/X_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+public class X { >+ @Deprecated public void bar(@SuppressWarnings("unused") >+ int i) { >+ } >+} >Index: workspace/Formatter/test703/X_out.java >=================================================================== >RCS file: workspace/Formatter/test703/X_out.java >diff -N workspace/Formatter/test703/X_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test703/X_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+public class X { >+ @Deprecated >+ public void bar(@SuppressWarnings("unused") >+ int i) { >+ } >+} >Index: workspace/Formatter/test702/X_out.java >=================================================================== >RCS file: workspace/Formatter/test702/X_out.java >diff -N workspace/Formatter/test702/X_out.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test702/X_out.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+public class X { >+ @Deprecated >+ public void bar(@SuppressWarnings("unused") int i) { >+ } >+} >Index: workspace/Formatter/test702/X_in.java >=================================================================== >RCS file: workspace/Formatter/test702/X_in.java >diff -N workspace/Formatter/test702/X_in.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Formatter/test702/X_in.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+public class X { >+ @Deprecated public void bar(@SuppressWarnings("unused") int i) { >+ } >+} >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java,v >retrieving revision 1.86 >diff -u -r1.86 DefaultCodeFormatterConstants.java >--- formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 25 Jan 2008 12:17:18 -0000 1.86 >+++ formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 28 Jan 2008 16:02:38 -0000 >@@ -943,8 +943,8 @@ > > /** > * <pre> >- * FORMATTER / Option to insert a new line after an argument annotation >- * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_arg_annotation" >+ * FORMATTER / Option to insert a new line after an annotation in a member argument declaration >+ * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_in_member_argument_declaration" > * - possible values: { INSERT, DO_NOT_INSERT } > * - default: INSERT > * </pre> >@@ -952,7 +952,7 @@ > * @see JavaCore#DO_NOT_INSERT > * @since 3.4 > */ >- public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ARG_ANNOTATION = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_arg_annotation";//$NON-NLS-1$ >+ public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_annotation_in_member_argument_declaration";//$NON-NLS-1$ > > > /** >Index: formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java,v >retrieving revision 1.86 >diff -u -r1.86 DefaultCodeFormatterOptions.java >--- formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 25 Jan 2008 09:38:24 -0000 1.86 >+++ formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 28 Jan 2008 16:02:40 -0000 >@@ -122,8 +122,8 @@ > public boolean indent_switchstatements_compare_to_switch; > public int indentation_size; > >- public boolean insert_new_line_after_annotation; >- public boolean insert_new_line_after_arg_annotation; >+ public boolean insert_new_line_after_annotation; // annotation that are not on parameters >+ public boolean insert_new_line_after_annotation_on_parameter; > public boolean insert_new_line_after_opening_brace_in_array_initializer; > public boolean insert_new_line_at_end_of_file_if_missing; > public boolean insert_new_line_before_catch_in_try_statement; >@@ -399,7 +399,7 @@ > options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, this.indent_switchstatements_compare_to_switch ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); > options.put(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE, Integer.toString(this.indentation_size)); > options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION, this.insert_new_line_after_annotation ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); >- options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ARG_ANNOTATION, this.insert_new_line_after_arg_annotation ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); >+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER, this.insert_new_line_after_annotation_on_parameter ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); > options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_after_opening_brace_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); > options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, this.insert_new_line_at_end_of_file_if_missing ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); > options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, this.insert_new_line_before_catch_in_try_statement? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); >@@ -1134,9 +1134,9 @@ > if (insertNewLineAfterAnnotationOption != null) { > this.insert_new_line_after_annotation = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOption); > } >- final Object insertNewLineAfterArgAnnotationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ARG_ANNOTATION); >+ final Object insertNewLineAfterArgAnnotationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER); > if (insertNewLineAfterArgAnnotationOption != null) { >- this.insert_new_line_after_arg_annotation = JavaCore.INSERT.equals(insertNewLineAfterArgAnnotationOption); >+ this.insert_new_line_after_annotation_on_parameter = JavaCore.INSERT.equals(insertNewLineAfterArgAnnotationOption); > } > final Object insertNewLineAfterOpeningBraceInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER); > if (insertNewLineAfterOpeningBraceInArrayInitializerOption != null) { >@@ -2252,7 +2252,7 @@ > this.indent_switchstatements_compare_to_switch = false; > this.indentation_size = 4; > this.insert_new_line_after_annotation = true; >- this.insert_new_line_after_arg_annotation = false; >+ this.insert_new_line_after_annotation_on_parameter = false; > this.insert_new_line_after_opening_brace_in_array_initializer = false; > this.insert_new_line_at_end_of_file_if_missing = false; > this.insert_new_line_before_catch_in_try_statement = false; >Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v >retrieving revision 1.114 >diff -u -r1.114 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 25 Jan 2008 09:38:24 -0000 1.114 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 28 Jan 2008 16:02:41 -0000 >@@ -1506,18 +1506,11 @@ > } > this.scanner.resetTo(this.scanner.getCurrentTokenStartPosition(), this.scannerEndPosition - 1); > if (annotationsIndex < annotationsLength) { >- boolean hasMemberValuePairs = annotations[annotationsIndex].memberValuePairs().length > 0; > annotations[annotationsIndex++].traverse(visitor, (BlockScope) null); > if (atArg) { > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 >- if (hasMemberValuePairs) { >- if (this.formatter.preferences.insert_new_line_after_annotation) { >- this.printNewLine(); >- } >- } else { >- if (this.formatter.preferences.insert_new_line_after_arg_annotation) { >- this.printNewLine(); >- } >+ if (this.formatter.preferences.insert_new_line_after_annotation_on_parameter) { >+ this.printNewLine(); > } > } else if (this.formatter.preferences.insert_new_line_after_annotation) { > this.printNewLine();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 122247
:
75636
|
87756
|
88022
|
88283
|
88284
|
88538