### Eclipse Workspace Patch 1.0 #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.99 diff -u -r1.99 DefaultCodeFormatterConstants.java --- formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 18 Feb 2010 10:41:31 -0000 1.99 +++ formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 19 Feb 2010 14:19:02 -0000 @@ -87,6 +87,17 @@ public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT = JavaCore.PLUGIN_ID + ".formatter.alignment_for_arguments_in_enum_constant"; //$NON-NLS-1$ /** *
+ * FORMATTER / Option for alignment of arguments in annotation
+ * - option id: "org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation"
+ * - possible values: values returned by createAlignmentValue(boolean, int, int)
call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ *
+ * @see #createAlignmentValue(boolean, int, int)
+ * @since 3.6
+ */
+ public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_arguments_in_annotation"; //$NON-NLS-1$
+ /**
+ *
* FORMATTER / Option for alignment of arguments in explicit constructor call
* - option id: "org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
* - possible values: values returned by createAlignmentValue(boolean, int, int)
call
Index: formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java,v
retrieving revision 1.226
diff -u -r1.226 CodeFormatterVisitor.java
--- formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 18 Feb 2010 10:41:32 -0000 1.226
+++ formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java 19 Feb 2010 14:19:03 -0000
@@ -4295,14 +4295,32 @@
MemberValuePair[] memberValuePairs = annotation.memberValuePairs;
if (memberValuePairs != null) {
int length = memberValuePairs.length;
- for (int i = 0; i < length - 1; i++) {
- memberValuePairs[i].traverse(this, scope);
- this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_annotation);
- if (this.preferences.insert_space_after_comma_in_annotation) {
- this.scribe.space();
+ Alignment annotationAlignment = this.scribe.createAlignment(
+ "annotationMemberValuePairs",//$NON-NLS-1$
+ this.preferences.alignment_for_arguments_in_annotation,
+ length,
+ this.scribe.scanner.currentPosition);
+ this.scribe.enterAlignment(annotationAlignment);
+ boolean ok = false;
+ do {
+ try {
+ for (int i = 0; i < length; i++) {
+ if (i > 0) {
+ this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_annotation);
+ this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
+ }
+ this.scribe.alignFragment(annotationAlignment, i);
+ if (i > 0 && this.preferences.insert_space_after_comma_in_annotation) {
+ this.scribe.space();
+ }
+ memberValuePairs[i].traverse(this, scope);
+ }
+ ok = true;
+ } catch (AlignmentException e) {
+ this.scribe.redoAlignment(e);
}
- }
- memberValuePairs[length - 1].traverse(this, scope);
+ } while (!ok);
+ this.scribe.exitAlignment(annotationAlignment, true);
}
this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_annotation);
return false;
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.95
diff -u -r1.95 DefaultCodeFormatterOptions.java
--- formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 18 Feb 2010 10:41:32 -0000 1.95
+++ formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 19 Feb 2010 14:19:04 -0000
@@ -47,6 +47,7 @@
}
public int alignment_for_arguments_in_allocation_expression;
+ public int alignment_for_arguments_in_annotation;
public int alignment_for_arguments_in_enum_constant;
public int alignment_for_arguments_in_explicit_constructor_call;
public int alignment_for_arguments_in_method_invocation;
@@ -334,6 +335,7 @@
public Map getMap() {
Map options = new HashMap();
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_allocation_expression));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION, getAlignment(this.alignment_for_arguments_in_annotation));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT, getAlignment(this.alignment_for_arguments_in_enum_constant));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL, getAlignment(this.alignment_for_arguments_in_explicit_constructor_call));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_arguments_in_method_invocation));
@@ -616,6 +618,16 @@
this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
}
}
+ final Object alignmentForArgumentsInAnnotationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION);
+ if (alignmentForArgumentsInAnnotationOption != null) {
+ try {
+ this.alignment_for_arguments_in_annotation = Integer.parseInt((String) alignmentForArgumentsInAnnotationOption);
+ } catch (NumberFormatException e) {
+ this.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_SPLIT;
+ } catch (ClassCastException e) {
+ this.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_SPLIT;
+ }
+ }
final Object alignmentForArgumentsInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT);
if (alignmentForArgumentsInEnumConstantOption != null) {
try {
@@ -1956,6 +1968,7 @@
public void setDefaultSettings() {
this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_SPLIT;
this.alignment_for_arguments_in_enum_constant = Alignment.M_COMPACT_SPLIT;
this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
@@ -2222,6 +2235,7 @@
public void setJavaConventionsSettings() {
this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_SPLIT;
this.alignment_for_arguments_in_enum_constant = Alignment.M_COMPACT_SPLIT;
this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
#P org.eclipse.jdt.core.tests.model
Index: src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java,v
retrieving revision 1.20
diff -u -r1.20 FormatterBugsTests.java
--- src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 16 Feb 2010 14:56:46 -0000 1.20
+++ src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 19 Feb 2010 14:19:06 -0000
@@ -582,6 +582,296 @@
}
/**
+ * @bug 281655: [formatter] "Never join lines" does not work for annotations.
+ * @test Verify that "Never join lines" now works for annotations and also that
+ * element-value pairs are well wrapped using the new formatter option
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=281655"
+ */
+public void testBug281655() throws JavaModelException {
+ this.formatterPrefs.join_wrapped_lines = false;
+ String source =
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", \n" +
+ " activationConfig = { \n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ "propertyValue = \"0/10 * * * * ?\") \n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\",\n" +
+ " activationConfig = {\n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ " propertyValue = \"0/10 * * * * ?\")\n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+public void testBug281655a() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_NO_ALIGNMENT;
+ String source =
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", \n" +
+ " activationConfig = { \n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ "propertyValue = \"0/10 * * * * ?\") \n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", activationConfig = { @ActivationConfigProperty(propertyName = \"cronTrigger\", propertyValue = \"0/10 * * * * ?\") })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+public void testBug281655b() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_SPLIT;
+ String source =
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", \n" +
+ " activationConfig = { \n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ "propertyValue = \"0/10 * * * * ?\") \n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@MessageDriven(\n" +
+ " mappedName = \"filiality/SchedulerMQService\",\n" +
+ " activationConfig = { @ActivationConfigProperty(\n" +
+ " propertyName = \"cronTrigger\", propertyValue = \"0/10 * * * * ?\") })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+public void testBug281655c() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
+ String source =
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", \n" +
+ " activationConfig = { \n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ "propertyValue = \"0/10 * * * * ?\") \n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@MessageDriven(\n" +
+ " mappedName = \"filiality/SchedulerMQService\",\n" +
+ " activationConfig = { @ActivationConfigProperty(\n" +
+ " propertyName = \"cronTrigger\", propertyValue = \"0/10 * * * * ?\") })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+public void testBug281655d() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_ONE_PER_LINE_SPLIT;
+ String source =
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", \n" +
+ " activationConfig = { \n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ "propertyValue = \"0/10 * * * * ?\") \n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@MessageDriven(\n" +
+ " mappedName = \"filiality/SchedulerMQService\",\n" +
+ " activationConfig = { @ActivationConfigProperty(\n" +
+ " propertyName = \"cronTrigger\",\n" +
+ " propertyValue = \"0/10 * * * * ?\") })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+public void testBug281655e() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_NEXT_SHIFTED_SPLIT;
+ String source =
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", \n" +
+ " activationConfig = { \n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ "propertyValue = \"0/10 * * * * ?\") \n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@MessageDriven(\n" +
+ " mappedName = \"filiality/SchedulerMQService\",\n" +
+ " activationConfig = { @ActivationConfigProperty(\n" +
+ " propertyName = \"cronTrigger\",\n" +
+ " propertyValue = \"0/10 * * * * ?\") })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+public void testBug281655f() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_NEXT_PER_LINE_SPLIT;
+ String source =
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\", \n" +
+ " activationConfig = { \n" +
+ " @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ "propertyValue = \"0/10 * * * * ?\") \n" +
+ " })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@MessageDriven(mappedName = \"filiality/SchedulerMQService\",\n" +
+ " activationConfig = { @ActivationConfigProperty(propertyName = \"cronTrigger\",\n" +
+ " propertyValue = \"0/10 * * * * ?\") })\n" +
+ "@RunAs(\"admin\")\n" +
+ "@ResourceAdapter(\"quartz-ra.rar\")\n" +
+ "@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+
+/**
+ * @bug 282030: [formatter] Java annotation formatting
+ * @test Verify that element-value pairs are well wrapped using the new formatter option
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=282030"
+ */
+public void testBug282030() throws JavaModelException {
+ String source =
+ "@DeclareParents(value =\n" +
+ "\"com.apress.springrecipes.calculator.ArithmeticCalculatorImpl\", defaultImpl =\n" +
+ "MaxCalculatorImpl.class) \n" +
+ "public class X {\n" +
+ "}\n";
+ formatSource(source,
+ "@DeclareParents(\n" +
+ " value = \"com.apress.springrecipes.calculator.ArithmeticCalculatorImpl\",\n" +
+ " defaultImpl = MaxCalculatorImpl.class)\n" +
+ "public class X {\n" +
+ "}\n"
+ );
+}
+public void testBug282030a() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_NO_ALIGNMENT;
+ String source =
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\", value3 = \"with several arguments\", value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n";
+ formatSource(source,
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\", value3 = \"with several arguments\", value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n"
+ );
+}
+public void testBug282030b() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_SPLIT;
+ String source =
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\", value3 = \"with several arguments\", value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n";
+ formatSource(source,
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\",\n" +
+ " value3 = \"with several arguments\",\n" +
+ " value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n"
+ );
+}
+public void testBug282030c() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
+ String source =
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\", value3 = \"with several arguments\", value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n";
+ formatSource(source,
+ "@MyAnnot(\n" +
+ " value1 = \"this is an example\", value2 = \"of an annotation\",\n" +
+ " value3 = \"with several arguments\",\n" +
+ " value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n"
+ );
+}
+public void testBug282030d() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_ONE_PER_LINE_SPLIT;
+ String source =
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\", value3 = \"with several arguments\", value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n";
+ formatSource(source,
+ "@MyAnnot(\n" +
+ " value1 = \"this is an example\",\n" +
+ " value2 = \"of an annotation\",\n" +
+ " value3 = \"with several arguments\",\n" +
+ " value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n"
+ );
+}
+public void testBug282030e() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_NEXT_SHIFTED_SPLIT;
+ String source =
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\", value3 = \"with several arguments\", value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n";
+ formatSource(source,
+ "@MyAnnot(\n" +
+ " value1 = \"this is an example\",\n" +
+ " value2 = \"of an annotation\",\n" +
+ " value3 = \"with several arguments\",\n" +
+ " value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n"
+ );
+}
+public void testBug282030f() throws JavaModelException {
+ this.formatterPrefs.alignment_for_arguments_in_annotation = Alignment.M_NEXT_PER_LINE_SPLIT;
+ String source =
+ "@MyAnnot(value1 = \"this is an example\", value2 = \"of an annotation\", value3 = \"with several arguments\", value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n";
+ formatSource(source,
+ "@MyAnnot(value1 = \"this is an example\",\n" +
+ " value2 = \"of an annotation\",\n" +
+ " value3 = \"with several arguments\",\n" +
+ " value4 = \"which may need to be wrapped\")\n" +
+ "public class Test {\n" +
+ "}\n"
+ );
+}
+
+/**
* @bug 283467: [formatter] wrong indentation with 'Never join lines' selected
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=283467"
*/
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.255
diff -u -r1.255 FormatterRegressionTests.java
--- src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 18 Feb 2010 10:41:40 -0000 1.255
+++ src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java 19 Feb 2010 14:19:09 -0000
@@ -41,6 +41,7 @@
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions;
+import org.eclipse.jdt.internal.formatter.align.Alignment;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.text.edits.TextEdit;
@@ -7293,6 +7294,7 @@
DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
preferences.tab_char = DefaultCodeFormatterOptions.TAB;
preferences.tab_size = 4;
+ preferences.alignment_for_arguments_in_annotation = Alignment.M_NO_ALIGNMENT;
Hashtable javaCoreOptions = JavaCore.getOptions();
try {
Hashtable newJavaCoreOptions = JavaCore.getOptions();
@@ -7311,6 +7313,29 @@
JavaCore.setOptions(javaCoreOptions);
}
}
+ public void test527b() {
+ Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings();
+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
+ preferences.tab_char = DefaultCodeFormatterOptions.TAB;
+ preferences.tab_size = 4;
+ 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, "test527b", "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=79779
Index: workspace/Formatter/test527b/A_in.java
===================================================================
RCS file: workspace/Formatter/test527b/A_in.java
diff -N workspace/Formatter/test527b/A_in.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/Formatter/test527b/A_in.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,9 @@
+package test527b;
+
+@Jpf.Controller(
+ catches={
+ @Jpf.Catch(type=java.lang.Exception.class, method="handleException"),
+ @Jpf.Catch(type=PageFlowException.class, method="handlePageFlowException")
+ }
+ )
+ public class A {}
Index: workspace/Formatter/test527b/A_out.java
===================================================================
RCS file: workspace/Formatter/test527b/A_out.java
diff -N workspace/Formatter/test527b/A_out.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/Formatter/test527b/A_out.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,10 @@
+package test527b;
+
+@Jpf.Controller(
+ catches = {
+ @Jpf.Catch(type = java.lang.Exception.class,
+ method = "handleException"),
+ @Jpf.Catch(type = PageFlowException.class,
+ method = "handlePageFlowException") })
+public class A {
+}