Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core.tests.model')
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java204
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java48
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java3
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java3
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java3
5 files changed, 258 insertions, 3 deletions
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 a2594ebd8..deb22874a 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
@@ -6548,4 +6548,208 @@ public void testBug305830c() {
);
}
+/**
+ * @bug 309835: [formatter] adds blank lines on each run
+ * @test Test that no line is added when the word exceeds the line width
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=309835"
+ */
+public void testBug309835() {
+ this.formatterPrefs.join_lines_in_comments = false;
+ this.formatterPrefs.comment_line_length = 120;
+ String source =
+ "package org.eclipse.bug.test;\n" +
+ "\n" +
+ "/**\n" +
+ " * @author Bug Reporter\n" +
+ " * ThisIsAVeryLongCommentWithoutSpaces_TheFormatterTriesToBreakTheLine_ButTheResultOfItIsThatANewLineIsAdded_____\n" +
+ " * \n" +
+ " * Try to press Ctrl+Shift+F to format the code. If the unbreakable line is exactly 121 characters long,\n" +
+ " * a blank line is inserted on each formating.\n" +
+ " * Check project preferences to see the format settings\n" +
+ " * (max. line length 80 chars, max. comment line length 120 chars)\n" +
+ " */\n" +
+ "public class FormatterBug {\n" +
+ "}\n";
+ formatSource(source);
+}
+public void testBug309835b() {
+ this.formatterPrefs.comment_line_length = 120;
+ String source =
+ "package org.eclipse.bug.test;\n" +
+ "\n" +
+ "/**\n" +
+ " * @author Bug Reporter\n" +
+ " * ThisIsAVeryLongCommentWithoutSpaces_TheFormatterTriesToBreakTheLine_ButTheResultOfItIsThatANewLineIsAdded_____\n" +
+ " * \n" +
+ " * Try to press Ctrl+Shift+F to format the code. If the unbreakable line is exactly 121 characters long,\n" +
+ " * a blank line is inserted on each formating.\n" +
+ " * Check project preferences to see the format settings\n" +
+ " * (max. line length 80 chars, max. comment line length 120 chars)\n" +
+ " */\n" +
+ "public class FormatterBug {\n" +
+ "}\n";
+ formatSource(source,
+ "package org.eclipse.bug.test;\n" +
+ "\n" +
+ "/**\n" +
+ " * @author Bug Reporter\n" +
+ " * ThisIsAVeryLongCommentWithoutSpaces_TheFormatterTriesToBreakTheLine_ButTheResultOfItIsThatANewLineIsAdded_____\n" +
+ " * \n" +
+ " * Try to press Ctrl+Shift+F to format the code. If the unbreakable line is exactly 121 characters long, a blank\n" +
+ " * line is inserted on each formating. Check project preferences to see the format settings (max. line length 80\n" +
+ " * chars, max. comment line length 120 chars)\n" +
+ " */\n" +
+ "public class FormatterBug {\n" +
+ "}\n"
+ );
+}
+public void testBug309835c() {
+ this.formatterPrefs.join_lines_in_comments = false;
+ String source =
+ "package org.eclipse.bug.test;\n" +
+ "\n" +
+ "/**\n" +
+ " * @author Bug Reporter\n" +
+ " * ThisIsAVeryLongCommentWithoutSpaces_TheFormatterTriesToBreakTheLine_ButTheResultOfItIsThatANewLineIsAdded_____\n" +
+ " * \n" +
+ " * Try to press Ctrl+Shift+F to format the code. If the unbreakable line is exactly 121 characters long,\n" +
+ " * a blank line is inserted on each formating.\n" +
+ " * Check project preferences to see the format settings\n" +
+ " * (max. line length 80 chars, max. comment line length 120 chars)\n" +
+ " */\n" +
+ "public class FormatterBug {\n" +
+ "}\n";
+ formatSource(source,
+ "package org.eclipse.bug.test;\n" +
+ "\n" +
+ "/**\n" +
+ " * @author Bug Reporter\n" +
+ " * ThisIsAVeryLongCommentWithoutSpaces_TheFormatterTriesToBreakTheLine_ButTheResultOfItIsThatANewLineIsAdded_____\n" +
+ " * \n" +
+ " * Try to press Ctrl+Shift+F to format the code. If the unbreakable line\n" +
+ " * is exactly 121 characters long,\n" +
+ " * a blank line is inserted on each formating.\n" +
+ " * Check project preferences to see the format settings\n" +
+ " * (max. line length 80 chars, max. comment line length 120 chars)\n" +
+ " */\n" +
+ "public class FormatterBug {\n" +
+ "}\n"
+ );
+}
+public void testBug309835d() {
+ String source =
+ "package org.eclipse.bug.test;\n" +
+ "\n" +
+ "/**\n" +
+ " * @author Bug Reporter\n" +
+ " * ThisIsAVeryLongCommentWithoutSpaces_TheFormatterTriesToBreakTheLine_ButTheResultOfItIsThatANewLineIsAdded_____\n" +
+ " * \n" +
+ " * Try to press Ctrl+Shift+F to format the code. If the unbreakable line is exactly 121 characters long,\n" +
+ " * a blank line is inserted on each formating.\n" +
+ " * Check project preferences to see the format settings\n" +
+ " * (max. line length 80 chars, max. comment line length 120 chars)\n" +
+ " */\n" +
+ "public class FormatterBug {\n" +
+ "}\n";
+ formatSource(source,
+ "package org.eclipse.bug.test;\n" +
+ "\n" +
+ "/**\n" +
+ " * @author Bug Reporter\n" +
+ " * ThisIsAVeryLongCommentWithoutSpaces_TheFormatterTriesToBreakTheLine_ButTheResultOfItIsThatANewLineIsAdded_____\n" +
+ " * \n" +
+ " * Try to press Ctrl+Shift+F to format the code. If the unbreakable line\n" +
+ " * is exactly 121 characters long, a blank line is inserted on each\n" +
+ " * formating. Check project preferences to see the format settings (max.\n" +
+ " * line length 80 chars, max. comment line length 120 chars)\n" +
+ " */\n" +
+ "public class FormatterBug {\n" +
+ "}\n"
+ );
+}
+public void testBug309835_wksp1_01() {
+ String source =
+ "public class X01 {\n" +
+ "\n" +
+ " /**\n" +
+ " * @param severity the severity to search for. Must be one of <code>FATAL\n" +
+ " * </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>\n" +
+ " */\n" +
+ " public void foo(int severity) {\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ "\n" +
+ " /**\n" +
+ " * @param severity\n" +
+ " * the severity to search for. Must be one of <code>FATAL\n" +
+ " * </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>\n" +
+ " */\n" +
+ " public void foo(int severity) {\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug309835_wksp1_02() {
+ String source =
+ "public class X02 {\n" +
+ "\n" +
+ " /**\n" +
+ " * INTERNAL USE-ONLY\n" +
+ " * Generate the byte for a problem method info that correspond to a boggus method.\n" +
+ " *\n" +
+ " * @param method org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration\n" +
+ " * @param methodBinding org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding\n" +
+ " */\n" +
+ " public void foo(int severity) {\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X02 {\n" +
+ "\n" +
+ " /**\n" +
+ " * INTERNAL USE-ONLY Generate the byte for a problem method info that\n" +
+ " * correspond to a boggus method.\n" +
+ " * \n" +
+ " * @param method\n" +
+ " * org.eclipse.jdt.internal.compiler.ast.\n" +
+ " * AbstractMethodDeclaration\n" +
+ " * @param methodBinding\n" +
+ " * org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding\n" +
+ " */\n" +
+ " public void foo(int severity) {\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+public void testBug309835_wksp2_01() {
+ String source =
+ "public class X01 {\n" +
+ "\n" +
+ " /**\n" +
+ " * Given a jar file, get the names of any AnnotationProcessorFactory\n" +
+ " * implementations it offers. The information is based on the Sun\n" +
+ " * <a href=\"http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider\">\n" +
+ " * Jar Service Provider spec</a>: the jar file contains a META-INF/services\n" +
+ " */\n" +
+ " public void foo() {\n" +
+ " }\n" +
+ "}\n";
+ formatSource(source,
+ "public class X01 {\n" +
+ "\n" +
+ " /**\n" +
+ " * Given a jar file, get the names of any AnnotationProcessorFactory\n" +
+ " * implementations it offers. The information is based on the Sun <a href=\n" +
+ " * \"http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider\"\n" +
+ " * > Jar Service Provider spec</a>: the jar file contains a\n" +
+ " * META-INF/services\n" +
+ " */\n" +
+ " public void foo() {\n" +
+ " }\n" +
+ "}\n"
+ );
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
index bd2a22bc3..213a081e8 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java
@@ -11793,4 +11793,52 @@ public void testBug306223g() throws CoreException {
null);
assertSearchResults("");
}
+
+/**
+ * @bug 310213: [search] Reference to package is not found in qualified annotation
+ * @test Ensure that references to package are also found in qualified annotation
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=310213"
+ */
+public void testBug310213() throws CoreException {
+ boolean autoBuild = getWorkspace().isAutoBuilding();
+ IWorkspaceDescription preferences = getWorkspace().getDescription();
+ try {
+ // ensure that the workspace auto-build is ON
+ preferences.setAutoBuilding(true);
+ getWorkspace().setDescription(preferences);
+
+ // create files
+ createFolder("/JavaSearchBugs/src/java/lang");
+ createFile("/JavaSearchBugs/src/java/lang/Throwable.java",
+ "package java.lang;\n" +
+ "public class Throwable{}\n"
+ );
+ createFolder("/JavaSearchBugs/src/b310213/test");
+ createFile("/JavaSearchBugs/src/b310213/test/Test.java",
+ "package b310213.test;\n" +
+ "public class Test extends Throwable {\n" +
+ "}"
+ );
+ waitUntilIndexesReady();
+
+ // search
+ IType type = getCompilationUnit("/JavaSearchBugs/src/java/lang/Throwable.java").getType("Throwable");
+ search(type, REFERENCES);
+ assertSearchResults(
+ "src/b310213/test/Test.java b310213.test.Test [Throwable] EXACT_MATCH\n" +
+ ""+ getExternalJCLPathString("1.5") + " java.lang.Error EXACT_MATCH\n" +
+ ""+ getExternalJCLPathString("1.5") + " java.lang.Exception EXACT_MATCH\n" +
+ ""+ getExternalJCLPathString("1.5") + " void java.lang.Object.finalize() EXACT_MATCH"
+ );
+ }
+ finally {
+ // put back initial setup
+ preferences.setAutoBuilding(autoBuild);
+ getWorkspace().setDescription(preferences);
+
+ // delete files
+ deleteFolder("/JavaSearchBugs/src/b310213");
+ deleteFolder("/JavaSearchBugs/src/java");
+ }
+}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java
index d28b97b66..0b45c28ee 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java
@@ -15,7 +15,8 @@ package test.wksp.ganymede;
* </p>
*
* @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget()
- * @model annotation="http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
+ * @model annotation=
+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
* @generated
*/
public class X03 {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java
index aca948e33..1b2bf8bf0 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java
@@ -17,7 +17,8 @@ package test.wksp.ganymede;
* </p>
*
* @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget()
- * @model annotation="http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
+ * @model annotation=
+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
* @generated
*/
public class X03 {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java
index aca948e33..deea51380 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java
@@ -17,7 +17,8 @@ package test.wksp.ganymede;
* </p>
*
* @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget()
- * @model annotation="http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
+ * @model annotation=
+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
* @generated
*/
public class X03 {

Back to the top