Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-05-17 17:03:42 -0400
committerStephan Herrmann2010-05-17 17:03:42 -0400
commit1a29123644da078e6135054cf9d77189a57c3110 (patch)
treeafcfede7a4e24d8066e1a93e514c9d98a2c52f9b /org.eclipse.jdt.core.tests.model
parentd8d223e22f9ff543a04481535e28a5f98b512838 (diff)
downloadorg.eclipse.objectteams-1a29123644da078e6135054cf9d77189a57c3110.tar.gz
org.eclipse.objectteams-1a29123644da078e6135054cf9d77189a57c3110.tar.xz
org.eclipse.objectteams-1a29123644da078e6135054cf9d77189a57c3110.zip
update jdt.core tests to v_A53
Diffstat (limited to 'org.eclipse.jdt.core.tests.model')
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java91
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java50
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java161
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java45
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/CommentTestCase.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java2
23 files changed, 318 insertions, 69 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java
index 71e527171..4653c1fe4 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java
index e3e82c993..88f5c10c7 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -2133,5 +2133,94 @@ public class ASTModelBridgeTests extends AbstractASTTests {
element
);
}
+ /**
+ * Test behavior when the binding key denotes a non existent type.
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847"
+ */
+ public void test157847a() throws CoreException {
+ String filePath = "/P/src/Bug157847A.java";
+ try {
+ String contents =
+ "public class Bug157847A<T> {\n" +
+ " void add(Y<? extends T> l) {}\n" +
+ "}\n"+
+ "interface Y<T> {}\n";
+ createFile(filePath, contents);
+
+ BindingRequestor requestor = new BindingRequestor();
+ String[] bindingKeys = new String[] {"LBug157847A~ThisTypeDoesNotExist;"};
+ resolveASTs(
+ new ICompilationUnit[] {},
+ bindingKeys,
+ requestor,
+ getJavaProject("P"),
+ this.workingCopy.getOwner()
+ );
+ IBinding[] bindings = requestor.getBindings(bindingKeys);
+ assertTrue("Constructed non existing type", bindings.length == 0);
+ } finally {
+ deleteFile(filePath);
+ }
+ }
+ /**
+ * Ensures that we don't create internally inconsistent wildcard
+ * bindings of the form '? extends <null>' or '? super <null>'
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847"
+ */
+ public void test157847b() throws CoreException {
+ String filePath = "/P/src/Bug157847B.java";
+ try {
+ String contents =
+ "public class Bug157847B<T> {\n" +
+ " void add(Y<? super T> l) {}\n" +
+ "}\n"+
+ "interface Y<T> {}\n";
+ createFile(filePath, contents);
+
+ BindingRequestor requestor = new BindingRequestor();
+ String[] bindingKeys = new String[] {"LBug157847B~Y<LBug157847B~Y;{0}-!LBug157847B;{0}*54;>;"};
+ resolveASTs(
+ new ICompilationUnit[] {},
+ bindingKeys,
+ requestor,
+ getJavaProject("P"),
+ this.workingCopy.getOwner()
+ );
+ IBinding[] bindings = requestor.getBindings(bindingKeys);
+ assertTrue("Constructed bogus wildcard", bindings.length == 0);
+ } finally {
+ deleteFile(filePath);
+ }
+ }
+ /**
+ * Ensures that we don't create internally inconsistent wildcard
+ * bindings of the form '? extends <null>' or '? super <null>'
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847"
+ */
+ public void test157847c() throws CoreException {
+ String filePath = "/P/src/Bug157847C.java";
+ try {
+ String contents =
+ "public class Bug157847C<T> {\n" +
+ " void add(Y<? extends T> l) {}\n" +
+ "}\n"+
+ "interface Y<T> {}\n";
+ createFile(filePath, contents);
+
+ BindingRequestor requestor = new BindingRequestor();
+ String[] bindingKeys = new String[] {"LBug157847C~Y<LBug157847C~Y;{0}+!LBug157847C;{0}*54;>;"};
+ resolveASTs(
+ new ICompilationUnit[] {},
+ bindingKeys,
+ requestor,
+ getJavaProject("P"),
+ this.workingCopy.getOwner()
+ );
+ IBinding[] bindings = requestor.getBindings(bindingKeys);
+ assertTrue("Constructed bogus wildcard", bindings.length == 0);
+ } finally {
+ deleteFile(filePath);
+ }
+ }
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java
index 7b39f3763..3aadde1b1 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,11 +32,8 @@ import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
import org.eclipse.jdt.core.tests.util.Util;
public class BatchASTCreationTests extends AbstractASTTests {
@@ -1713,49 +1710,6 @@ public class BatchASTCreationTests extends AbstractASTTests {
"LX;.m()V",
bindings[0].getDeclaringMethod());
}
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152060
- public void test072a() throws CoreException, IOException {
- try {
- IJavaProject project = createJavaProject("P072a", new String[] {"src"}, Util.getJavaClassLibs(), "bin", "1.5");
- createFile("/P072a/src/X.java",
- "public class X {\n" +
- " void m() {\n" +
- " Object o;\n" +
- " }\n" +
- "}");
- final ICompilationUnit compilationUnits[] = new ICompilationUnit[1];
- compilationUnits[0] = getCompilationUnit("P072a", "src", "", "X.java");
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setResolveBindings(true);
- parser.setProject(project);
- final String[] keys = new String[] { "LX;.m()V#o" };
- final ASTNode[] nodes = new ASTNode[1];
- BindingRequestor bindingRequestor = new BindingRequestor() {
- public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
- if (compilationUnits[0].equals(source)) {
- nodes[0] = ast;
- }
- }
- };
- parser.createASTs(
- compilationUnits,
- keys,
- bindingRequestor,
- null);
- IBinding[] bindings = bindingRequestor.getBindings(keys);
- IBinding binding = bindings[0];
- assertNotNull("Should not be null", binding);
- assertEquals("Not a type binding", IBinding.VARIABLE, binding.getKind());
- MethodDeclaration declaration = ((TypeDeclaration)((CompilationUnit) nodes[0]).types().get(0)).getMethods()[0];
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) ((VariableDeclarationStatement) declaration.getBody().statements().get(0)).fragments().get(0);
- IVariableBinding resolveBinding = fragment.resolveBinding();
- assertTrue("Not equals", binding.isEqualTo(resolveBinding));
- assertNotNull("No java element", resolveBinding.getJavaElement());
- assertNotNull("No java element", binding.getJavaElement());
- } finally {
- deleteProject("P072a");
- }
- }
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159631
public void test073() throws CoreException, IOException {
@@ -1982,7 +1936,7 @@ public void test079() throws CoreException, IOException {
" }\n" +
" public void extra() {\n" +
" }\n" +
- "}");
+ "}");
ICompilationUnit compilationUnits[] = new ICompilationUnit[1];
compilationUnits[0] = getCompilationUnit("P079", "src", "test", "Test.java");
ASTParser parser = ASTParser.newParser(AST.JLS3);
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
index c3b07c5c8..de894275d 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
@@ -101,6 +101,7 @@ public void testBug027079a() throws JavaModelException {
);
}
public void testBug027079a1() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -130,6 +131,7 @@ public void testBug027079a1() throws JavaModelException {
);
}
public void testBug027079a2() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -159,6 +161,7 @@ public void testBug027079a2() throws JavaModelException {
);
}
public void testBug027079a3() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -188,6 +191,7 @@ public void testBug027079a3() throws JavaModelException {
);
}
public void testBug027079a4() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -218,6 +222,7 @@ public void testBug027079a4() throws JavaModelException {
);
}
public void testBug027079b() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -256,6 +261,7 @@ public void testBug027079b() throws JavaModelException {
);
}
public void testBug027079c() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -305,6 +311,7 @@ public void testBug027079c() throws JavaModelException {
);
}
public void testBug027079c2() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -352,6 +359,7 @@ public void testBug027079c2() throws JavaModelException {
);
}
public void testBug027079d() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -386,6 +394,7 @@ public void testBug027079d() throws JavaModelException {
true/*repeat*/);
}
public void testBug027079d2() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -420,6 +429,7 @@ public void testBug027079d2() throws JavaModelException {
true/*repeat*/);
}
public void testBug027079d3() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -454,6 +464,7 @@ public void testBug027079d3() throws JavaModelException {
true/*repeat*/);
}
public void testBug027079d4() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
String source =
@@ -488,6 +499,7 @@ public void testBug027079d4() throws JavaModelException {
true/*repeat*/);
}
public void testBug027079e() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "format: off".toCharArray();
this.formatterPrefs.enabling_tag = "format: on".toCharArray();
String source =
@@ -517,6 +529,7 @@ public void testBug027079e() throws JavaModelException {
);
}
public void testBug027079f() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "format: off".toCharArray();
this.formatterPrefs.enabling_tag = "format: on".toCharArray();
String source =
@@ -546,6 +559,7 @@ public void testBug027079f() throws JavaModelException {
);
}
public void testBug027079f2() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "format: off".toCharArray();
this.formatterPrefs.enabling_tag = "format: on".toCharArray();
String source =
@@ -575,6 +589,7 @@ public void testBug027079f2() throws JavaModelException {
);
}
public void testBug027079f3() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = " format: off ".toCharArray();
this.formatterPrefs.enabling_tag = " format: on ".toCharArray();
String source =
@@ -604,6 +619,7 @@ public void testBug027079f3() throws JavaModelException {
);
}
public void testBug027079f4() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = " format: off ".toCharArray();
this.formatterPrefs.enabling_tag = " format: on ".toCharArray();
String source =
@@ -5657,6 +5673,44 @@ public void testBug298243() {
}
/**
+ * @bug 298844: [formatter] New lines in empty method body wrong behavior
+ * @test Verify that comment is well indented inside empty constructor and method
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=298844"
+ */
+public void testBug298844a() {
+ this.formatterPrefs.insert_new_line_in_empty_method_body = false;
+ String source =
+ "public class X01 {\n" +
+ "public X01() {\n" +
+ "// TODO Auto-generated constructor stub\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ " public X01() {\n" +
+ " // TODO Auto-generated constructor stub\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug298844b() {
+ this.formatterPrefs.insert_new_line_in_empty_method_body = false;
+ String source =
+ "public class X02 {\n" +
+ "public void foo() {\n" +
+ " // TODO Auto-generated constructor stub\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class X02 {\n" +
+ " public void foo() {\n" +
+ " // TODO Auto-generated constructor stub\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+
+/**
* @bug 302123: [formatter] AssertionFailedException occurs while formatting a source containing the specific javadoc comment...
* @test Verify that no exception occurs while formatting source including the specific comment
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=302123"
@@ -5839,6 +5893,7 @@ public void testBug302552_LW5() {
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=304529"
*/
public void testBug304529() {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = "off".toCharArray();
this.formatterPrefs.enabling_tag = null;
String source =
@@ -5851,6 +5906,7 @@ public void testBug304529() {
formatSource(source);
}
public void testBug304529b() {
+ this.formatterPrefs.use_tags = true;
this.formatterPrefs.disabling_tag = null;
this.formatterPrefs.enabling_tag = "on".toCharArray();
String source =
@@ -5871,6 +5927,7 @@ public void testBug304529b() {
}
public void testBug304529c() {
this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE);
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "off");
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "");
String source =
@@ -5884,6 +5941,7 @@ public void testBug304529c() {
}
public void testBug304529d() {
this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE);
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "");
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "on");
String source =
@@ -5904,6 +5962,7 @@ public void testBug304529d() {
}
public void testBug304529e() {
this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE);
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "off");
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "on");
String source =
@@ -5986,4 +6045,106 @@ public void testBug309706b() {
);
}
+/**
+ * @bug 311582: [formatter] Master switch to enable/disable on/off tags
+ * @test Ensure that the formatter does not take care of formatting tags by default
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582"
+ */
+public void testBug0311582a() throws JavaModelException {
+ this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
+ this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
+ String source =
+ "public class X01 {\n" +
+ "\n" +
+ "/* disable-formatter */\n" +
+ "void foo( ) { \n" +
+ " // unformatted comment\n" +
+ "}\n" +
+ "/* enable-formatter */\n" +
+ "void bar( ) { \n" +
+ " // formatted comment\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ "\n" +
+ " /* disable-formatter */\n" +
+ " void foo() {\n" +
+ " // unformatted comment\n" +
+ " }\n" +
+ "\n" +
+ " /* enable-formatter */\n" +
+ " void bar() {\n" +
+ " // formatted comment\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug0311582b() {
+ this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "off");
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "");
+ String source =
+ "/* off */\n" +
+ "public class X01 {\n" +
+ "void foo( ) { \n" +
+ " // unformatted area\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "/* off */\n" +
+ "public class X01 {\n" +
+ " void foo() {\n" +
+ " // unformatted area\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+
+/**
+ * @bug 311617: [formatter] Master switch to enable/disable on/off tags
+ * @test Ensure that the formatter does not take care of formatting tags by default
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=311617"
+ */
+public void testBug0311617() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
+ String source =
+ "public class X01 {\n" +
+ "\n" +
+ "/* @formatter:off */\n" +
+ "void foo( ) { \n" +
+ " // unformatted comment\n" +
+ "}\n" +
+ "/* @formatter:on */\n" +
+ "void bar( ) { \n" +
+ " // formatted comment\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ "\n" +
+ "/* @formatter:off */\n" +
+ "void foo( ) { \n" +
+ " // unformatted comment\n" +
+ "}\n" +
+ "/* @formatter:on */\n" +
+ " void bar() {\n" +
+ " // formatted comment\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug0311617b() {
+ this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE);
+ String source =
+ "/* @formatter:off */\n" +
+ "public class X01 {\n" +
+ "void foo( ) { \n" +
+ " // unformatted area\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source);
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java
index deb22874a..d00b92203 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java
@@ -6262,6 +6262,7 @@ public void testBug304705b() {
*/
public void testBug305281() {
this.formatterPrefs = null;
+ this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE);
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "format: OFF");
this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "format: ON");
String source =
@@ -6752,4 +6753,48 @@ public void testBug309835_wksp2_01() {
);
}
+/**
+ * @bug 311864: [formatter] NPE with empty {@code }
+ * @test Ensure that no NPE occurs while formatting an empty code inline tag.
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=311864"
+ */
+public void testBug0311864() throws JavaModelException {
+ this.formatterPrefs.use_tags = true;
+ String source =
+ "public class Test {\n" +
+ "\n" +
+ "/**\n" +
+ "* Compares two property values. For font or color the <i>description</i> of\n" +
+ "* the resource, {@link FontData} or {@link RGB}, is used for comparison.\n" +
+ "*\n" +
+ "* @param value1\n" +
+ "* first property value\n" +
+ "* @param value2\n" +
+ "* second property value\n" +
+ "* @return {@code true} if the values are equals; otherwise {@code}\n" +
+ "*/\n" +
+ "boolean foo(int value1, int value2) {\n" +
+ " return value1 > value2;\n" +
+ "}\n" +
+ "}\n";
+ formatSource(source,
+ "public class Test {\n" +
+ "\n" +
+ " /**\n" +
+ " * Compares two property values. For font or color the <i>description</i> of\n" +
+ " * the resource, {@link FontData} or {@link RGB}, is used for comparison.\n" +
+ " * \n" +
+ " * @param value1\n" +
+ " * first property value\n" +
+ " * @param value2\n" +
+ " * second property value\n" +
+ " * @return {@code true} if the values are equals; otherwise {@code}\n" +
+ " */\n" +
+ " boolean foo(int value1, int value2) {\n" +
+ " return value1 > value2;\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/CommentTestCase.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/CommentTestCase.java
index 199ebad8e..f68ddff9a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/CommentTestCase.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/CommentTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java
index da589d7a5..66c15774c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java
index 2d436d3bc..0554d0af3 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java
index 463c7e298..5a17229a4 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
index 12386640d..fe5c4dbcd 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java
index 3243cbc01..d779c06ad 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
index fb7e4fe67..d55fa60d7 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java
index b3f687015..2850760ae 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
index c3c2b1fe2..2531b96ff 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java
index 8e0c64e7c..bf063ff07 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchFineGrainTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java
index b600bc2c4..efd430de4 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchJavadocTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java
index 5a30f9240..f2cc7e4bf 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests_1_5.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
index 37d018f76..dd2cf85e7 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -666,7 +666,7 @@ public void testEfficiencyMultipleProjects() throws CoreException {
}
ProgressCounter counter = new ProgressCounter();
type.newTypeHierarchy(counter);
- assertEquals("Unexpected work count", 76, counter.count);
+ assertEquals("Unexpected work count", 85, counter.count);
} finally {
deleteProjects(new String[] {"P1", "P2", "P3"});
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
index 921405676..320f3212a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
index af152adc9..7f9a19267 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java
index 46b478a51..21a479803 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java
index 08aa7e5b7..7dee24ce6 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java
index 4a86e821d..1624839fe 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at

Back to the top