diff options
author | Jerome Lanneluc | 2005-01-31 11:32:05 +0000 |
---|---|---|
committer | Jerome Lanneluc | 2005-01-31 11:32:05 +0000 |
commit | e52412a19ba1061c6a031d4c174edbb0cda4f3f7 (patch) | |
tree | b9ac818f7cb20c82074910b023930207595c6416 | |
parent | 9f9b8273e28871e2f99c2b354d52a1c627bfc245 (diff) | |
download | eclipse.jdt.core-e52412a19ba1061c6a031d4c174edbb0cda4f3f7.tar.gz eclipse.jdt.core-e52412a19ba1061c6a031d4c174edbb0cda4f3f7.tar.xz eclipse.jdt.core-e52412a19ba1061c6a031d4c174edbb0cda4f3f7.zip |
R3_0_maintenance: Merge THAW_452_R30x back into maintenance streamv_453b_R30x
114 files changed, 712 insertions, 326 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java index 7cf6f15141..26b2d80f29 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java @@ -1077,7 +1077,7 @@ public class JavadocTestForInterface extends JavadocTest { + " * Invalid javadoc tags with valid deprecation\n" + " *\n" + " * @param\n" - + " * @return\n" + + " * @return String\n" + " * @throws Unknown\n" + " * @see \"Invalid\n" + " * @see Unknown\n" diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java index de09cae88e..2c2716c8ad 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java @@ -180,7 +180,7 @@ public class JavadocTestForMethod extends JavadocTest { + " * Invalid javadoc tags with valid deprecation at end\n" + " *\n" + " * @param\n" - + " * @return\n" + + " * @return String\n" + " * @throws Unknown\n" + " * @see \"Invalid\n" + " * @see Unknown\n" @@ -285,7 +285,7 @@ public class JavadocTestForMethod extends JavadocTest { + " *\n" + " * @deprecated\n" + " * @param\n" - + " * @return\n" + + " * @return String\n" + " * @throws Unknown\n" + " * @exception IllegalArgumentException Valid throws tag\n" + " * @see \"Invalid\n" @@ -389,7 +389,7 @@ public class JavadocTestForMethod extends JavadocTest { + " * Invalid javadoc tags with valid deprecation in the middle\n" + " *\n" + " * @param\n" - + " * @return\n" + + " * @return String\n" + " * @throws Unknown\n" + " * @exception IllegalArgumentException Valid throws tag\n" + " * @see \"Invalid\n" @@ -1658,7 +1658,7 @@ public class JavadocTestForMethod extends JavadocTest { + " /**\n" + " * Invalid return declaration\n" + " *\n" - + " * @return\n" + + " * @return String\n" + " * @return Dimension\n" + " */\n" + " public double s_foo() {\n" diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestMixed.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestMixed.java index 548bc450d9..acda1062ea 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestMixed.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestMixed.java @@ -36,7 +36,7 @@ public class JavadocTestMixed extends JavadocTest { static { // Names of tests to run: can be "testBugXXXX" or "BugXXXX") // testsNames = new String[] { -// "Bug68726conform1", "Bug68726conform2", "Bug68726negative1", "Bug68726negative2" +// "Bug73995" // }; // Numbers of tests to run: "test<number>" will be run for each number of this array // testsNumbers = new int[] { 3, 7, 10, 21 }; @@ -1771,7 +1771,7 @@ public class JavadocTestMixed extends JavadocTest { " * IllegalAccessException\n" + " * @throws\n" + " * NullPointerException tag description not empty\n" + - " * @return\n" + + " * @return int\n" + " * an integer\n" + " * @see\n" + " * String\n" + @@ -3071,17 +3071,17 @@ public class JavadocTestMixed extends JavadocTest { "----------\n" + "1. ERROR in X.java (at line 2)\n" + " /**@return*/\n" + - " ^^^^^^^\n" + + " ^^^^^^\n" + "Javadoc: Invalid tag\n" + "----------\n" + "2. ERROR in X.java (at line 4)\n" + " /**@return */\n" + - " ^^^^^^^^^^^^^^^\n" + + " ^^^^^^\n" + "Javadoc: Invalid tag\n" + "----------\n" + "3. ERROR in X.java (at line 6)\n" + " /**@return****/\n" + - " ^^^^^^^^^^\n" + + " ^^^^^^\n" + "Javadoc: Invalid tag\n" + "----------\n" + "4. ERROR in X.java (at line 9)\n" + @@ -3109,12 +3109,12 @@ public class JavadocTestMixed extends JavadocTest { "----------\n" + "1. ERROR in X.java (at line 3)\n" + " * @return* */\n" + - " ^^^^^^^\n" + + " ^^^^^^\n" + "Javadoc: Invalid tag\n" + "----------\n" + "2. ERROR in X.java (at line 5)\n" + " /**@return** **/\n" + - " ^^^^^^^^\n" + + " ^^^^^^\n" + "Javadoc: Invalid tag\n" + "----------\n" ); @@ -3135,7 +3135,7 @@ public class JavadocTestMixed extends JavadocTest { "----------\n" + "1. ERROR in X.java (at line 3)\n" + " * @return#\n" + - " ^^^^^^^\n" + + " ^^^^^^\n" + "Javadoc: Invalid tag\n" + "----------\n" ); @@ -3723,4 +3723,89 @@ public class JavadocTestMixed extends JavadocTest { "----------\n" ); } + + /** + * Test fix for bug 73348: [Javadoc] Missing description for return tag is not always warned + * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73348">73348</a> + */ + public void testBug73348conform() { + reportMissingJavadocTags = CompilerOptions.IGNORE; + reportMissingJavadocComments = CompilerOptions.IGNORE; + runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @return \n" + + " * int\n" + + " */\n" + + " public int foo1() {return 0; }\n" + + " /**\n" + + " * @return \n" + + " * int\n" + + " * @see Object\n" + + " */\n" + + " public int foo2() {return 0; }\n" + + "}\n", + } + ); + } + public void testBug73348negative() { + reportMissingJavadocComments = CompilerOptions.IGNORE; + runNegativeTest( + new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @return\n" + + " * @see Object\n" + + " */\n" + + " public int foo1() {return 0; }\n" + + " /**\n" + + " * @return \n" + + " * @see Object\n" + + " */\n" + + " public int foo2() {return 0; }\n" + + "}\n", + }, + "----------\n" + + "1. ERROR in X.java (at line 3)\n" + + " * @return\n" + + " ^^^^^^\n" + + "Javadoc: Invalid tag\n" + + "----------\n" + + "2. ERROR in X.java (at line 8)\n" + + " * @return \n" + + " ^^^^^^\n" + + "Javadoc: Invalid tag\n" + + "----------\n" + ); + } + + /** + * Test fix for bug 73995: [Javadoc] Wrong warning for missing return type description for @return {@inheritDoc} + * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73995">73995</a> + */ + public void testBug73995() { + reportMissingJavadocTags = CompilerOptions.IGNORE; + reportMissingJavadocComments = CompilerOptions.IGNORE; + runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " /**\n" + + " * @return {@link Object} \n" + + " */\n" + + " public int foo1() {return 0; }\n" + + " /** @return {@inheritedDoc} */\n" + + " public int foo2() {return 0; }\n" + + " /**\n" + + " * @return\n" + + " * {@unknown_tag}\n" + + " */\n" + + " public int foo3() {return 0; }\n" + + "}\n", + } + ); + } } 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 02c54c3fad..84c8b7f970 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 @@ -2133,4 +2133,12 @@ public class ASTConverterJavadocTest extends ConverterTestSetup { public void testBug68726() throws JavaModelException { verifyComments("testBug68726"); } + + /** + * Test fix for bug 73348: [Javadoc] Missing description for return tag is not always warned + * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73348">73348</a> + */ + public void testBug73348() throws JavaModelException { + verifyComments("testBug73348"); + } } 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 02c6bad594..63b3b5d302 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 @@ -910,9 +910,7 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases { // resource in the workspace root = project.getPackageFragmentRoot(resource); } - if (root.exists()) { - return root; - } + return root; } else { IPackageFragmentRoot[] roots = project.getPackageFragmentRoots(); if (roots == null || roots.length == 0) { diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java index e9079f085c..d49d65de89 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AttachSourceTests.java @@ -670,4 +670,24 @@ public void testRootPath11() throws JavaModelException { root.close(); } +/** + * Attach a jar with a source attachement that is itself. The jar contains 2 root paths for the same class file. + * (regression test for bug 74014 prefix path for source attachements - automatic detection does not seem to work) + */ +public void testRootPath12() throws JavaModelException { + IJavaProject project = this.getJavaProject("/AttachSourceTests"); + IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test5.jar")); + attachSource(root, "/AttachSourceTests/test5.jar", null); + + IClassFile cf = root.getPackageFragment("p1.p2").getClassFile("X.class"); + assertSourceEquals( + "Unexpected source for class file", + "package p1.p2;\n" + + "public class X {\n" + + "}\n", + cf.getSource()); + attachSource(root, null, null); // detach source + root.close(); +} + } 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 91dc0da18a..1751f29326 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 @@ -88,6 +88,8 @@ public class JavaSearchJavadocTests extends JavaSearchTests { System.err.println("WARNING: only subset of tests will be executed!!!"); suite.addTest(new JavaSearchJavadocTests("testBug54962")); suite.addTest(new JavaSearchJavadocTests("testBug54962qualified")); + suite.addTest(new JavaSearchJavadocTests("testBug71267")); + suite.addTest(new JavaSearchJavadocTests("testBug71267qualified")); return suite; } @@ -153,6 +155,8 @@ public class JavaSearchJavadocTests extends JavaSearchTests { suite.addTest(new JavaSearchJavadocTests("testBug49994constructor", support)); suite.addTest(new JavaSearchJavadocTests("testBug54962", support)); suite.addTest(new JavaSearchJavadocTests("testBug54962qualified", support)); + suite.addTest(new JavaSearchJavadocTests("testBug71267", support)); + suite.addTest(new JavaSearchJavadocTests("testBug71267qualified", support)); } /* (non-Javadoc) @@ -1005,10 +1009,10 @@ public class JavaSearchJavadocTests extends JavaSearchTests { IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j6", "Bug54962.java").getPackageDeclaration("j6"); search(packDecl, REFERENCES, getJavaSearchScope(), result); assertSearchResults( - "src/j6/Bug54962.java [j6] EXACT_MATCH INSIDE_JAVADOC\n" + - "src/j6/Bug54962.java j6.Bug54962 [j6] POTENTIAL_MATCH INSIDE_JAVADOC\n" + - "src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" + - "src/j7/qua/li/fied/Bug54962a.java [j6] EXACT_MATCH OUTSIDE_JAVADOC", + "src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/j6/Bug54962.java j6.Bug54962 [j6] POTENTIAL_MATCH INSIDE_JAVADOC\n" + + "src/j6/Bug54962.java j6.Bug54962 [j6] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/j7/qua/li/fied/Bug54962a.java [j6] EXACT_MATCH OUTSIDE_JAVADOC", result); } public void testBug54962qualified() throws CoreException { @@ -1019,9 +1023,44 @@ public class JavaSearchJavadocTests extends JavaSearchTests { IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "j7.qua.li.fied", "Bug54962a.java").getPackageDeclaration("j7.qua.li.fied"); search(packDecl, REFERENCES, getJavaSearchScope(), result); assertSearchResults( - "src/j7/qua/li/fied/Bug54962a.java [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC\n" + - "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] POTENTIAL_MATCH INSIDE_JAVADOC\n" + - "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC", + "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] POTENTIAL_MATCH INSIDE_JAVADOC\n" + + "src/j7/qua/li/fied/Bug54962a.java j7.qua.li.fied.Bug54962a [j7.qua.li.fied] EXACT_MATCH INSIDE_JAVADOC", + result); + } + + /** + * Test fix for bug 71267: [Search][Javadoc] SearchMatch in class javadoc reported with element of type IImportDeclaration + * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=71267">71267</a> + * @throws CoreException + */ + public void testBug71267() throws CoreException { + setJavadocOptions(); + JavaSearchResultCollector result = new JavaSearchResultCollector(); + result.showAccuracy = true; + result.showInsideDoc = true; + IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "p71267", "Test.java").getPackageDeclaration("p71267"); + search(packDecl, REFERENCES, getJavaSearchScope(), result); + assertSearchResults( + "src/p71267/Test.java p71267.Test [p71267] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/p71267/Test.java p71267.Test [p71267] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/p71267/q71267/Test.java p71267.q71267.Test [p71267] EXACT_MATCH INSIDE_JAVADOC", + result); + } + public void testBug71267qualified() throws CoreException { + setJavadocOptions(); + JavaSearchResultCollector result = new JavaSearchResultCollector(); + result.showAccuracy = true; + result.showInsideDoc = true; + IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "p71267.q71267", "Test.java").getPackageDeclaration("p71267.q71267"); + search(packDecl, REFERENCES, getJavaSearchScope(), result); + assertSearchResults( + "src/p71267/q71267/Test.java p71267.q71267.Test [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/p71267/q71267/Test.java p71267.q71267.Test [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/p71267/q71267/Test.java p71267.q71267.Test.field [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/p71267/q71267/Test.java p71267.q71267.Test.field [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/p71267/q71267/Test.java void p71267.q71267.Test.method() [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC\n" + + "src/p71267/q71267/Test.java void p71267.q71267.Test.method() [p71267.q71267] EXACT_MATCH INSIDE_JAVADOC", result); } } diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java index bddb113f7d..032ce2b503 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java @@ -302,6 +302,7 @@ public static Test suite() { suite.addTest(new JavaSearchTests("testSimplePackageDeclaration")); suite.addTest(new JavaSearchTests("testVariousPackageDeclarations")); suite.addTest(new JavaSearchTests("testPackageDeclaration")); + suite.addTest(new JavaSearchTests("testPackageDeclarationBug73551")); // package reference suite.addTest(new JavaSearchTests("testSimplePackageReference")); @@ -435,6 +436,8 @@ public static Test suite() { suite.addTest(new JavaSearchTests("testFieldReference5")); suite.addTest(new JavaSearchTests("testFieldReference6")); suite.addTest(new JavaSearchTests("testFieldReference7")); + suite.addTest(new JavaSearchTests("testFieldReferenceBug73112a")); + suite.addTest(new JavaSearchTests("testFieldReferenceBug73112b")); suite.addTest(new JavaSearchTests("testFieldReferenceInInnerClass")); suite.addTest(new JavaSearchTests("testFieldReferenceInAnonymousClass")); suite.addTest(new JavaSearchTests("testFieldReferenceThroughSubclass")); @@ -1186,6 +1189,47 @@ public void testFieldReference7() throws CoreException { resultCollector); } /** + * Field reference test. + * (regression test for bug 73112: [Search] SearchEngine doesn't find all fields multiple field declarations + */ +public void testFieldReferenceBug73112a() throws CoreException { + JavaSearchResultCollector resultCollector = new JavaSearchResultCollector(); + search( + "fieldA73112*", + FIELD, + ALL_OCCURRENCES, + getJavaSearchScope(), + resultCollector); + assertSearchResults( + "src/bug73112/A.java bug73112.A.fieldA73112a [fieldA73112a]\n" + + "src/bug73112/A.java bug73112.A.fieldA73112b [fieldA73112b]\n" + + "src/bug73112/A.java bug73112.A.fieldA73112c [fieldA73112c]\n" + + "src/bug73112/A.java bug73112.A.fieldA73112c [fieldA73112a]\n" + + "src/bug73112/A.java bug73112.A.fieldA73112c [fieldA73112b]\n" + + "src/bug73112/A.java bug73112.A.fieldA73112d [fieldA73112d]", + resultCollector); +} +public void testFieldReferenceBug73112b() throws CoreException { + JavaSearchResultCollector resultCollector = new JavaSearchResultCollector(); + search( + "fieldB73112*", + FIELD, + ALL_OCCURRENCES, + getJavaSearchScope(), + resultCollector); + assertSearchResults( + "src/bug73112/B.java bug73112.B.fieldB73112a [fieldB73112a]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112b [fieldB73112b]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112c [fieldB73112c]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112c [fieldB73112a]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112c [fieldB73112b]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112d [fieldB73112d]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112d [fieldB73112c]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112d [fieldB73112a]\n" + + "src/bug73112/B.java bug73112.B.fieldB73112e [fieldB73112e]", + resultCollector); +} +/** * Field reference in anonymous class test. * (regression test for PR 1GL12XE: ITPJCORE:WIN2000 - search: missing field references in inner class) */ @@ -2121,6 +2165,21 @@ public void testPackageDeclaration() throws CoreException { getExternalJCLPath() + " java.lang", resultCollector); } + +/** + * Test fix for bug 73551: NPE while searching package declaration + * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73551">73551</a> + * @throws CoreException + */ +public void testPackageDeclarationBug73551() throws CoreException { + JavaSearchResultCollector result = new JavaSearchResultCollector(); + result.showAccuracy = true; + IPackageDeclaration packDecl = getCompilationUnit("JavaSearch", "src", "p71267", "Test.java").getPackageDeclaration("p71267"); + search(packDecl, DECLARATIONS, getJavaSearchScope(), result); + assertSearchResults( + "src/p71267/Test.java [No source] EXACT_MATCH", + result); +} /** * Package reference test. * (regression test for PR 1GK90H4: ITPJCORE:WIN2000 - search: missing package reference) diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java index a46f4e45ef..4c9c1db032 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.model; +import java.io.File; + import org.eclipse.core.resources.*; import org.eclipse.core.resources.IFolder; import org.eclipse.core.runtime.CoreException; @@ -258,6 +260,17 @@ public void testExternalJarBinaryTypeMemento() throws JavaModelException { type); } /** + * Tests that a class file in an external jar at the root of the file system can be persisted and restored using its memento. + */ +public void testExternalJarClassFileMemento() throws JavaModelException { + char separator = File.separatorChar; + String device = separator == '/' ? "" : "C:"; + IClassFile classFile = getClassFile("P", device + separator + "lib.jar", "p", "X.class"); + assertMemento( + "=P/" + device + "\\/lib.jar<p(X.class", + classFile); +} +/** * Tests that an import declaration can be persisted and restored using its memento. */ public void testImportContainerMemento() { @@ -436,6 +449,20 @@ public void testPackageFragmentMemento() { pkg); } /** + * Tests that a package fragment in the default root can be persisted and restored using its memento. + */ +public void testPackageFragmentMemento2() throws CoreException { + try { + createJavaProject("P1", new String[] {""}, ""); + IPackageFragment pkg = getPackage("/P1/p"); + assertMemento( + "=P1/<p", + pkg); + } finally { + deleteProject("P1"); + } +} +/** * Tests that a source folder package fragment root can be persisted and restored using its memento. */ public void testPackageFragmentRootMemento1() { diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath index 9990816db7..643bef8a9c 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath +++ b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/.classpath @@ -7,6 +7,7 @@ <classpathentry kind="lib" path="full.jar"/> <classpathentry kind="lib" path="test2.jar"/> <classpathentry kind="lib" path="test4.jar"/> + <classpathentry kind="lib" path="test5.jar"/> <classpathentry kind="lib" path="lib"/> <classpathentry kind="src" path="src" output="src"/> <classpathentry kind="var" path="JCL_LIB"/> diff --git a/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test5.jar b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test5.jar Binary files differnew file mode 100644 index 0000000000..62fc165e30 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/AttachSourceTests/test5.jar diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestInvalid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestInvalid.java new file mode 100644 index 0000000000..d924b1d0e2 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestInvalid.java @@ -0,0 +1,14 @@ +package javadoc.testBug73348; + +public class TestInvalid { + /** + * @return + * @see Object + */ + public int foo1(int x) {return 0; } + /** + * @return + * @see Object + */ + public int foo2(int x) {return 0; } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestValid.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestValid.java new file mode 100644 index 0000000000..ed049103fe --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestValid.java @@ -0,0 +1,14 @@ +package javadoc.testBug73348; +public class TestValid { + /** + * @return + * int + */ + public int foo1() {return 0; } + /** + * @return + * int + * @see Object + */ + public int foo2() {return 0; } +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test002/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test002/A_out.java index 634e8b1788..2ff3210d34 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test002/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test002/A_out.java @@ -13,4 +13,4 @@ public abstract/* */class A extends java.lang.Object Runnable, Cloneable, Serializable { -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test003/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test003/A_out.java index d3191965f3..b49d95814a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test003/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test003/A_out.java @@ -7,4 +7,4 @@ public abstract class A extends java.lang.Object Runnable, Cloneable, Serializable { -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test004/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test004/A_out.java index cddea024f5..034116a022 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test004/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test004/A_out.java @@ -3,4 +3,4 @@ package p1.p2.test; import java.io.Serializable; import java.io.IOException; public abstract class A implements Runnable { -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test007/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test007/A_out.java index 38350c1eed..fef70e4b4b 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test007/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test007/A_out.java @@ -13,4 +13,4 @@ public abstract/* */class A extends java.lang.Object Runnable, Cloneable, Serializable { -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test008/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test008/A_out.java index b4a6bf628b..8d997a585c 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test008/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test008/A_out.java @@ -12,4 +12,4 @@ public abstract/* */class A Toto, Titi, Tata { -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test009/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test009/A_out.java index 13859a336a..8b3a3c37aa 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test009/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test009/A_out.java @@ -13,4 +13,4 @@ public abstract/* */class A extends p1.p2.fpfpfpfppffp.A public final static int CONST = 12; // CONST comment public final int value = CONST; // value comment protected long s = a; // s comment -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test010/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test010/A_out.java index 9d3cc7bd98..d56b0c9869 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test010/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test010/A_out.java @@ -6,4 +6,4 @@ public abstract class A implements Runnable { int i; int j; double d; -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test011/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test011/A_out.java index 070b925da0..a6a0f5d482 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test011/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test011/A_out.java @@ -13,4 +13,4 @@ public abstract/* */class A extends p1.p2.fpfpfpfppffp.A int CONST; int value; long s; -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test012/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test012/A_in.java index d7b4daebcd..014a71ae73 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test012/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test012/A_in.java @@ -4,4 +4,4 @@ import java.io.Serializable; import java.io.IOException; public abstract /* */ class A extends p1.p2.fpfpfpfppffp.A implements Runnable, Cloneable, Serializable, Toto, Titi, Tata { int CONST;int value;transient long s;protected synchronized void foo() throws IOException,Exception{}public A() throws IOException,Exception{} -} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test013/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test013/A_out.java index 90888f3fb8..d459f7bf1b 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test013/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test013/A_out.java @@ -14,4 +14,4 @@ public abstract/* */class A implements Serializable, Toto, Titi, Tata { i = 2; ;; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test014/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test014/A_out.java index 76148f8c79..92511752a5 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test014/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test014/A_out.java @@ -15,4 +15,4 @@ public abstract/* */class A implements Serializable, Toto, Titi, Tata { } public int value = 0; // blabla final X x; // test -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test015/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test015/A_out.java index f56dda5b83..847e41ffee 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test015/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test015/A_out.java @@ -5,4 +5,4 @@ import java.io.IOException; public abstract/* */class A implements Serializable, Toto, Titi, Tata { Object s = null; // test A a; // test -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test017/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test017/A_in.java index 5dc02073db..1b11056ec7 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test017/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test017/A_in.java @@ -4,4 +4,4 @@ String s2; Object oooooooooooooooooooooooooooooooo = null, sssssssssssssssssssssssssssssssssssss; // toto int iiiiiiiiiiiiiiiiiiiii = 1, jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj = 2, kkkkkkkkkkkkk; // test String s; -} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test018/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test018/A_in.java index 9a9c0708f4..b0956e5fba 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test018/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test018/A_in.java @@ -2,4 +2,4 @@ public class A { int oooooooooooo00000000000000000000000000000000000000000000000oooooooooooooooooooo = "125665332563256522ddddddddddddddd"; // toto String s; -} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_1_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_1_in.java index ebafad0bf1..5a3c08f59f 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_1_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_1_in.java @@ -2,4 +2,4 @@ public class A { protected synchronized void foo(final java.lang.String s1, long l) throws IOException,Exception{ foo("Helloddddddddddddddddddddddddddddddddddddd", 121212121221212121212121);f("Helloddddddddddddddddddddddddddddddddddddd", 121212121221212121212121);fooooooobaaaaaaar("Helloddddddddddddddddddddddddddddddddddddd", 121212121221212121212121); -}} +}}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_2_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_2_out.java index e283bc3eca..a78ecba7b5 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_2_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test019/A_2_out.java @@ -9,4 +9,4 @@ public class A { fooooooobaaaaaaar("Helloddddddddddddddddddddddddddddddddddddd", 121212121221212121212121); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test020/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test020/A_in.java index 9bd5c1b3b5..0e4f33fc62 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test020/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test020/A_in.java @@ -2,4 +2,4 @@ public class A { protected synchronized String foo(final java.lang.String s1) throws IOException,Exception{ foo(foo(foo(foo(foo(foo("Helloddddddddddddddddddddddddddddddddddddd")))))); -}} +}}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test021/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test021/A_in.java index e3e35658d1..ec1f86d659 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test021/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test021/A_in.java @@ -1,4 +1,4 @@ // test021 public class A { protected synchronized String foo(final java.lang.String s1) throws IOException,Exception{ -}} +}}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test022/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test022/A_out.java index 2d3ee38059..673005be43 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test022/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test022/A_out.java @@ -3,4 +3,4 @@ public class A { public int i = 2; // end of line comment public String s = "Hello"; private String tab[] = {"Hello", "World"}; // this is an array -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test023/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test023/A_out.java index 358af18e4f..bd70fc6c33 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test023/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test023/A_out.java @@ -11,4 +11,4 @@ public class A { return 3; } // end of baz() comment private String tab[] = {"Hello", "World"}; // this is an array -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test024/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test024/A_out.java index 4e74139e8b..5d37eb6540 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test024/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test024/A_out.java @@ -8,4 +8,4 @@ public class A { if (should - split - second) if (remainCompact) if (remainCompact) whatever(); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test025/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test025/A_out.java index 65ae17331c..7d2fe12d69 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test025/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test025/A_out.java @@ -3,4 +3,4 @@ public class A { public void foo() { } public int field1; -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java index fb27b04443..f27495c32f 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test026/A_out.java @@ -14,4 +14,4 @@ public class A { Alignment.M_COMPACT_SPLIT), expressionsLength - 1, this.scribe.scanner.currentPosition); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test027/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test027/A_out.java index 7f17342d12..1b7c94bb2b 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test027/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test027/A_out.java @@ -6,4 +6,4 @@ public class A { int i = 0, k = 3; i = 2; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test028/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test028/A_out.java index 1d4c704d47..0361d5abd9 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test028/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test028/A_out.java @@ -3,4 +3,4 @@ public class A { public void foo(boolean b) { ;; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test029/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test029/A_out.java index af99edf2e5..c92970dbbb 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test029/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test029/A_out.java @@ -17,4 +17,4 @@ public class Test { } public long l; // long field public String s = null; -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test030/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test030/A_out.java index 1c764259e6..e21582bde0 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test030/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test030/A_out.java @@ -17,4 +17,4 @@ public class Test { } public String s = null; public long l; // long field -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test031/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test031/A_out.java index 79635134ef..e84f3045e3 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test031/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test031/A_out.java @@ -18,4 +18,4 @@ public abstract/* */class A extends p1.p2.fpfpfpfppffp.A } public A() throws IOException, Exception { } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_in.java index 774c50b1d7..b6e380a62b 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_in.java @@ -1,3 +1,3 @@ // test032 public class A { -protected synchronized Object foo() throws IOException,Exception{return new String("this is a very long long long long string") != null ? new Object() : null;}}
\ No newline at end of file +protected synchronized Object foo() throws IOException,Exception{return new String("this is a very long long long long string") != null ? new Object() : null;}} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_out.java index 0fce2a7a80..04ac651c83 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test032/A_out.java @@ -5,4 +5,4 @@ public class A { ? new Object() : null; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test033/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test033/A_out.java index 892042ce86..17e75cb289 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test033/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test033/A_out.java @@ -3,4 +3,4 @@ public class A { protected synchronized Object foo() throws IOException, Exception { return new String("") != null ? null : null; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test034/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test034/A_out.java index c4be48b20e..6d7023f81b 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test034/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test034/A_out.java @@ -6,4 +6,4 @@ public class A { doSomething(); } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test035/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test035/A_out.java index 5c5835da5a..757fbbc361 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test035/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test035/A_out.java @@ -5,4 +5,4 @@ public class A { doSomething(); } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test036/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test036/A_out.java index 726352657a..ee105e3739 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test036/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test036/A_out.java @@ -5,4 +5,4 @@ public class A { doSomething(); } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test037/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test037/A_out.java index 5159efe7b5..cdfe7f570a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test037/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test037/A_out.java @@ -7,4 +7,4 @@ class F { } }; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test038/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test038/A_out.java index 6cdf3a9b44..b5f391d24a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test038/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test038/A_out.java @@ -6,4 +6,4 @@ class F { } }; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test039/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test039/A_out.java index 3fcf9f987c..de355641aa 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test039/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test039/A_out.java @@ -6,4 +6,4 @@ class F { } public void bar2() {//todo } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test040/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test040/A_out.java index 9041253176..73aee4645b 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test040/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test040/A_out.java @@ -3,4 +3,4 @@ class F { return new Runnable() { }; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test042/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test042/A_out.java index 9d531aaea6..3813519a8a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test042/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test042/A_out.java @@ -11,4 +11,4 @@ class F { --size; } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test045/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test045/A_out.java index 0a9793c55b..de652b3a91 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test045/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test045/A_out.java @@ -5,4 +5,4 @@ class F { && ((local.declaration.bits & AstNode.IsLocalDeclarationReachableMASK) != 0)) { // declaration is reachable } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test052/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test052/A_out.java index d3191965f3..b49d95814a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test052/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test052/A_out.java @@ -7,4 +7,4 @@ public abstract class A extends java.lang.Object Runnable, Cloneable, Serializable { -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test053/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test053/A_out.java index 741327fa1f..5efa7b963a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test053/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test053/A_out.java @@ -14,4 +14,4 @@ public abstract class A extends java.lang.Object * test4 * 004 */ -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test054/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test054/A_out.java index 741327fa1f..5efa7b963a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test054/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test054/A_out.java @@ -14,4 +14,4 @@ public abstract class A extends java.lang.Object * test4 * 004 */ -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test063/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test063/A_out.java index 96804bc8bc..b0f85a6012 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test063/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test063/A_out.java @@ -4,4 +4,4 @@ public class E { goo(); System.out.println(); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test064/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test064/A_out.java index 55997badb9..14136c8c6d 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test064/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test064/A_out.java @@ -8,4 +8,4 @@ public class E { } public int foo1(int i) { } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test065/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test065/A_out.java index 916b516bd0..5c0d3f807b 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test065/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test065/A_out.java @@ -13,4 +13,4 @@ public class E { public int foo1(int i) { return 0; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test066/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test066/A_in.java index db0d0eab64..1c7dd99057 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test066/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test066/A_in.java @@ -11,4 +11,4 @@ public class E { public int foo1(int i) { return 0; } -} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test067/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test067/A_out.java index 7675551bd3..2df95dd8b1 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test067/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test067/A_out.java @@ -12,4 +12,4 @@ public class E { public int foo1(int i) { return 0; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test073/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test073/A_out.java index f8781175f7..a09933d99a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test073/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test073/A_out.java @@ -28,4 +28,4 @@ public class FormatterProblem { if (!d.readAndDispatch()) d.sleep(); } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test113/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test113/A_out.java index 0ead9425f2..a6cb2320ed 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test113/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test113/A_out.java @@ -9,4 +9,4 @@ public class A { fooooooobaaaaaaar( "Helloddddddddddddddddddddddddddddddddddddd", 121212121221212121212121); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test117/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test117/A_out.java index 3907ec3038..af8170f0ba 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test117/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test117/A_out.java @@ -5,4 +5,4 @@ public class A { foo(); } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test118/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test118/A_out.java index b9d82cf085..254ca03b47 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test118/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test118/A_out.java @@ -5,4 +5,4 @@ public class A { hoo(11); } while (true); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test123/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test123/A_out.java index 3907ec3038..af8170f0ba 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test123/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test123/A_out.java @@ -5,4 +5,4 @@ public class A { foo(); } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test126/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test126/A_out.java index 3907ec3038..af8170f0ba 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test126/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test126/A_out.java @@ -5,4 +5,4 @@ public class A { foo(); } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test133/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test133/A_out.java index b0f21b70fb..8fc5ef2016 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test133/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test133/A_out.java @@ -141,4 +141,4 @@ public class AssistOptions { } } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test140/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test140/A_out.java index 9e8c3d87e7..a2f1af131d 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test140/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test140/A_out.java @@ -7,4 +7,4 @@ public class A { default : } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test141/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test141/A_out.java index d8b17d86b2..6ccb9a8aa1 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test141/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test141/A_out.java @@ -7,4 +7,4 @@ public class A { default : } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test153/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test153/A_out.java index faf948eb22..9dde19ed18 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test153/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test153/A_out.java @@ -3,4 +3,4 @@ public class Parser { protected int[] astLengthStack; public CompilationUnitDeclaration compilationUnit; /*the result from parse()*/ AstNode[] noAstNodes = new AstNode[AstStackIncrement]; -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test154/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test154/A_out.java index d99eeb55d6..f07376a52a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test154/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test154/A_out.java @@ -16,4 +16,4 @@ public class E { } public int foo1(int i) { } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test159/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test159/A_out.java index aa40ab8ba4..4fdc43c3cc 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test159/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test159/A_out.java @@ -41,4 +41,4 @@ public class Example extends Object { } return size; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test165/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test165/A_out.java index 71c8ae7c29..14aac98dee 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test165/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test165/A_out.java @@ -7,4 +7,4 @@ public class A { } }; } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test181/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test181/A_out.java index 56a04fbabb..498e31c662 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test181/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test181/A_out.java @@ -3,4 +3,4 @@ public class X { str4 = "xxxxxxxxxx", str5 = "xxxxxxxxxx", str6 = "xxxxxxxxxx", str7 = "xxxxxxxxxx", str8 = "xxxxxxxxxx", str9 = "xxxxxxxxxx", str10 = "xxxxxxxxxx"; -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test215/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test215/A_out.java index e604ad54c4..f9c26aea70 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test215/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test215/A_out.java @@ -11,4 +11,4 @@ public class TestFormatCode { synchronized (this) { } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test216/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test216/A_out.java index ba0b63a55f..dd79d2019a 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test216/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test216/A_out.java @@ -18,4 +18,4 @@ public class TestFormatCode { } } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test432/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test432/A_out.java index a97a37a2c6..82c1719ea7 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test432/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test432/A_out.java @@ -836,4 +836,4 @@ public class ReflectionToStringBuilder extends ToStringBuilder { void unregisterObject() { unregister(this.getObject()); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test446/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test446/A_out.java index 3f8d2416a0..faa4a09854 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test446/A_out.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test446/A_out.java @@ -5,4 +5,4 @@ class Foo { public Foo blowup() { return (Foo.KABOOM); } -}
\ No newline at end of file +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test448/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test448/A_in.java index 3da0cee168..0fedc8fb72 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test448/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test448/A_in.java @@ -3,4 +3,4 @@ public class Format { public void temp() { int[] tab = new int[3]; } -} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test449/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test449/A_in.java index 3da0cee168..0fedc8fb72 100644 --- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test449/A_in.java +++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test449/A_in.java @@ -3,4 +3,4 @@ public class Format { public void temp() { int[] tab = new int[3]; } -} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/bug73112/A.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/bug73112/A.java new file mode 100644 index 0000000000..9c51f251b0 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/bug73112/A.java @@ -0,0 +1,6 @@ +public class A { + int fieldA73112a = 1, fieldA73112b = new Integer(2).intValue(), fieldA73112c = fieldA73112a + fieldA73112b; + int fieldA73112d; + + public void method(){} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/bug73112/B.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/bug73112/B.java new file mode 100644 index 0000000000..d0751f5566 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/bug73112/B.java @@ -0,0 +1,6 @@ +public class B { + int fieldB73112a, fieldB73112b = 10; + int fieldB73112c = fieldB73112a + fieldB73112b, fieldB73112d = fieldB73112c + fieldB73112a, fieldB73112e; + + public void method(){} +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p71267/Test.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p71267/Test.java new file mode 100644 index 0000000000..c039bc4826 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p71267/Test.java @@ -0,0 +1,8 @@ +package p71267; + +/** + * @see p71267 + * @see p71267.Test + */ +public class Test { +} diff --git a/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p71267/q71267/Test.java b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p71267/q71267/Test.java new file mode 100644 index 0000000000..3d5335c753 --- /dev/null +++ b/org.eclipse.jdt.core.tests.model/workspace/JavaSearch/src/p71267/q71267/Test.java @@ -0,0 +1,19 @@ +package p71267.q71267; + +/** + * @see p71267 + * @see p71267.q71267 + * @see p71267.q71267.Test + */ +public class Test { + /** + * @see p71267.q71267 + * @see p71267.q71267.Test#field + */ + int field; + /** + * @see p71267.q71267 + * @see p71267.q71267.Test#method() + */ + void method() {} +} diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java index a38edc9e4e..7bc82be539 100644 --- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java +++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java @@ -101,8 +101,8 @@ public class Main implements ProblemSeverities, SuffixConstants { /** * Lookup the message with the given ID in this catalog - * @param id - * @return + * @param id String + * @return String */ public static String bind(String id) { return bind(id, (String[]) null); @@ -111,9 +111,9 @@ public class Main implements ProblemSeverities, SuffixConstants { /** * Lookup the message with the given ID in this catalog and bind its * substitution locations with the given string. - * @param id - * @param binding - * @return + * @param id String + * @param binding String + * @return String */ public static String bind(String id, String binding) { return bind(id, new String[] { binding }); @@ -122,10 +122,10 @@ public class Main implements ProblemSeverities, SuffixConstants { /** * Lookup the message with the given ID in this catalog and bind its * substitution locations with the given strings. - * @param id - * @param binding1 - * @param binding2 - * @return + * @param id String + * @param binding1 String + * @param binding2 String + * @return String */ public static String bind(String id, String binding1, String binding2) { return bind(id, new String[] { binding1, binding2 }); @@ -134,9 +134,9 @@ public class Main implements ProblemSeverities, SuffixConstants { /** * Lookup the message with the given ID in this catalog and bind its * substitution locations with the given string values. - * @param id - * @param bindings - * @return + * @param id String + * @param bindings String[] + * @return String */ public static String bind(String id, String[] bindings) { if (id == null) diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html index 306b55a790..a91ee735a0 100644 --- a/org.eclipse.jdt.core/buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html @@ -49,7 +49,37 @@ What's new in this drop</h2> </ul> <h3>Problem Reports Fixed</h3> -<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=75842">75842</a> +<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68506">68506</a> +Java code formatter strips newline, leaving final line unterminated! +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=78358">78358</a> +[1.5] Disassembling a .class file can fail +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73497">73497</a> +Problem methods don't point to the right position in source +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=78128">78128</a> +Error deleting project with jar file referenced by other project +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=75814">75814</a> +Inconsistent results when adding a breakpoint to class file with src attached +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=75784">75784</a> +java.lang.ArrayIndexOutOfBoundsException in compilation +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=75090">75090</a> +source positions calculated wrongly +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73497">73497</a> +Problem methods don't point to the right position in source +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=74014">74014</a> +prefix path for source attachements - automatic detection does not seem to work +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73330">73330</a> +NullPointerException in search +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73995">73995</a> +[Javadoc] Wrong warning for missing return type description for @return {@inheritDoc} +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73551">73551</a> +[Search] NPE while searching package declaration +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=71267">71267</a> +[Search][Javadoc] SearchMatch in class javadoc reported with element of type IImportDeclaration +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73112">73112</a> +[Search] SearchEngine doesn't find all fields multiple field declarations +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=73348">73348</a> +[Javadoc] Missing description for return tag is not always warned +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=75842">75842</a> Performance Regression in NameLookup.seekPackageFragments <a name="v_452_R30x"></a> diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java index e575af546b..274b4946ad 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java @@ -67,7 +67,6 @@ public class ClassFile public boolean ownSharedArrays = false; // flag set when header/contents are set to shared arrays public static final int INNER_CLASSES_SIZE = 5; public CodeStream codeStream; - protected int problemLine; // used to create line number attributes for problem methods public long targetJDK; /** @@ -559,6 +558,7 @@ public class ClassFile generateCodeAttributeHeader(); codeStream.resetForProblemClinit(this); String problemString = "" ; //$NON-NLS-1$ + int problemLine = 0; if (problems != null) { int max = problems.length; StringBuffer buffer = new StringBuffer(25); @@ -591,7 +591,8 @@ public class ClassFile .scope .referenceCompilationUnit() .compilationResult - .lineSeparatorPositions); + .lineSeparatorPositions, + problemLine); contents[attributeOffset++] = (byte) (attributeNumber >> 8); contents[attributeOffset] = (byte) attributeNumber; } @@ -620,6 +621,7 @@ public class ClassFile generateCodeAttributeHeader(); codeStream.reset(method, this); String problemString = "" ; //$NON-NLS-1$ + int problemLine = 0; if (problems != null) { int max = problems.length; StringBuffer buffer = new StringBuffer(25); @@ -652,7 +654,8 @@ public class ClassFile .scope .referenceCompilationUnit() .compilationResult - .lineSeparatorPositions); + .lineSeparatorPositions, + problemLine); completeMethodInfo(methodAttributeOffset, attributeNumber); } @@ -704,6 +707,7 @@ public class ClassFile generateCodeAttributeHeader(); codeStream.reset(method, this); String problemString = "" ; //$NON-NLS-1$ + int problemLine = 0; if (problems != null) { int max = problems.length; StringBuffer buffer = new StringBuffer(25); @@ -740,7 +744,8 @@ public class ClassFile .scope .referenceCompilationUnit() .compilationResult - .lineSeparatorPositions); + .lineSeparatorPositions, + problemLine); completeMethodInfo(methodAttributeOffset, attributeNumber); } @@ -858,7 +863,7 @@ public class ClassFile buffer.append("\t" + problem.getMessage() + "\n" ); //$NON-NLS-1$ //$NON-NLS-2$ buffer.insert(0, Util.bind("compilation.unresolvedProblem" )); //$NON-NLS-1$ String problemString = buffer.toString(); - this.problemLine = problem.getSourceLineNumber(); + int problemLine = problem.getSourceLineNumber(); codeStream.init(this); codeStream.preserveUnusedLocals = true; @@ -870,7 +875,8 @@ public class ClassFile completeCodeAttributeForMissingAbstractProblemMethod( methodBinding, codeAttributeOffset, - compilationResult.lineSeparatorPositions); + compilationResult.lineSeparatorPositions, + problemLine); completeMethodInfo(methodAttributeOffset, attributeNumber); } @@ -881,7 +887,8 @@ public class ClassFile public void completeCodeAttributeForMissingAbstractProblemMethod( MethodBinding binding, int codeAttributeOffset, - int[] startLineIndexes) { + int[] startLineIndexes, + int problemLine) { // reinitialize the localContents with the byte modified by the code stream this.contents = codeStream.bCodeStream; int localContentsOffset = codeStream.classFileOffset; @@ -1612,7 +1619,8 @@ public class ClassFile */ public void completeCodeAttributeForClinit( int codeAttributeOffset, - int[] startLineIndexes) { + int[] startLineIndexes, + int problemLine) { // reinitialize the contents with the byte modified by the code stream this.contents = codeStream.bCodeStream; int localContentsOffset = codeStream.classFileOffset; @@ -1726,7 +1734,8 @@ public class ClassFile AbstractMethodDeclaration method, MethodBinding binding, int codeAttributeOffset, - int[] startLineIndexes) { + int[] startLineIndexes, + int problemLine) { // reinitialize the localContents with the byte modified by the code stream this.contents = codeStream.bCodeStream; int localContentsOffset = codeStream.classFileOffset; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java index 7170bbf40d..40503c6c29 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java @@ -326,8 +326,8 @@ public class ConstructorDeclaration extends AbstractMethodDeclaration { * Given most constructors aren't, we only allocate the visited list * lazily. * - * @param visited - * @return + * @param visited ArrayList + * @return String */ public boolean isRecursive(ArrayList visited) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java index 8a53e1bac7..4633195db6 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java @@ -16,6 +16,7 @@ import org.eclipse.jdt.internal.compiler.lookup.*; public class JavadocReturnStatement extends ReturnStatement { public char[] description; + public boolean empty = true; public JavadocReturnStatement(int s, int e, char[] descr) { super(null, s, e); @@ -34,6 +35,8 @@ public class JavadocReturnStatement extends ReturnStatement { : VoidBinding; if (methodType == null || methodType == VoidBinding) { scope.problemReporter().javadocUnexpectedTag(this.sourceStart, this.sourceEnd); + } else if (this.empty) { + scope.problemReporter().javadocInvalidTag(this.sourceStart, this.sourceEnd); } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java index 6d83943540..12057f396e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java @@ -111,7 +111,7 @@ public class ClassScope extends Scope { } // remove duplicate fields if (duplicate) { - FieldBinding[] newFieldBindings = new FieldBinding[knownFieldNames.size() - 1]; + FieldBinding[] newFieldBindings = new FieldBinding[fieldBindings.length]; // we know we'll be removing at least 1 duplicate name size = count; count = 0; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java index ca99505046..ba54dd0819 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java @@ -15,6 +15,7 @@ import java.util.List; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.InvalidInputException; +import org.eclipse.jdt.internal.compiler.ast.JavadocReturnStatement; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; /** @@ -60,6 +61,9 @@ public abstract class AbstractCommentParser { protected boolean lineStarted = false, inlineTagStarted = false; protected int kind; protected int[] lineEnds; + + // Store when return tag is parsed + protected int returnTagPtr= -2; // Private fields private int currentTokenType = -1; @@ -109,7 +113,7 @@ public abstract class AbstractCommentParser { readChar(); // first '*' char nextCharacter= readChar(); // second '*' - // Init local variables + // Init variables this.astLengthPtr = -1; this.astPtr = -1; this.currentTokenType = -1; @@ -119,6 +123,7 @@ public abstract class AbstractCommentParser { this.returnStatement = null; this.inherited = false; this.deprecated = false; + this.returnTagPtr = -2; this.linePtr = getLineNumber(javadocStart); this.lastLinePtr = getLineNumber(javadocEnd); this.lineEnd = (this.linePtr == this.lastLinePtr) ? this.endComment : this.scanner.getLineEnd(this.linePtr); @@ -191,6 +196,14 @@ public abstract class AbstractCommentParser { this.scanner.resetTo(this.index, this.endComment); this.currentTokenType = -1; // flush token cache at line begin try { + // In case of previous return tag, set it to not empty if parsing an inline tag + if (this.kind == COMPIL_PARSER && this.returnTagPtr != -2 && this.returnStatement != null) { + this.returnTagPtr = -2; + JavadocReturnStatement javadocReturn = (JavadocReturnStatement) this.returnStatement; + javadocReturn.empty = javadocReturn.empty && !this.inlineTagStarted; + } + + // Read tag name int token = readTokenAndConsume(); this.tagSourceStart = this.scanner.getCurrentTokenStartPosition(); this.tagSourceEnd = this.scanner.getCurrentTokenEndPosition(); @@ -289,13 +302,14 @@ public abstract class AbstractCommentParser { break; case TerminalTokens.TokenNamereturn : valid = parseReturn(); - // verify characters after return tag (we're expecting text description) + /* verify characters after return tag (we're expecting text description) if(!verifyCharsAfterReturnTag(this.index)) { if (this.sourceParser != null) { int end = this.starPosition == -1 || this.lineEnd<this.starPosition ? this.lineEnd : this.starPosition; this.sourceParser.problemReporter().javadocInvalidTag(this.tagSourceStart, end); } } + */ break; case TerminalTokens.TokenNamethrows : valid = parseThrows(true); @@ -1318,40 +1332,28 @@ public abstract class AbstractCommentParser { /* * Verify that some text exists after a @return tag. Text must be different than * end of comment which may be preceeding by several '*' chars. - */ + * private boolean verifyCharsAfterReturnTag(int startPosition) { // Whitespace or inline tag closing brace int previousPosition = this.index; char ch = readChar(); - boolean malformed = true; - while (Character.isWhitespace(ch)) { - malformed = false; + this.starPosition = -1; + while (Character.isWhitespace(ch) || ch == '*') { previousPosition = this.index; + if (ch == '*') { + // valid whatever the number of star before last '/' + this.starPosition = previousPosition; + } ch = readChar(); } - // End of comment - this.starPosition = -1; - nextChar: while (this.index<this.source.length) { - switch (ch) { - case '*': - // valid whatever the number of star before last '/' - this.starPosition = previousPosition; - break; - case '/': - if (this.starPosition >= startPosition) { // valid only if a star was previous character - return false; - } - default : - // valid if any other character is encountered, even white spaces - this.index = startPosition; - return !malformed; - - } - previousPosition = this.index; - ch = readChar(); + // Look at possible end of comment + if (this.starPosition >= startPosition) { // valid only if a star was previous character + return ch == '/'; } + + // valid if next encountered is not, even white spaces this.index = startPosition; - return false; + return ch != '@'; } /* diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java index 7786636fff..58727cbf1d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java @@ -271,6 +271,7 @@ public class JavadocParser extends AbstractCommentParser { protected boolean parseReturn() { if (this.returnStatement == null) { this.returnStatement = createReturnStatement(); + this.returnTagPtr = this.astPtr; return true; } if (this.sourceParser != null) this.sourceParser.problemReporter().javadocDuplicatedReturnTag( @@ -370,7 +371,34 @@ public class JavadocParser extends AbstractCommentParser { * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#pushText(int, int) */ protected void pushText(int start, int end) { - // compiler does not matter of text + // In case of previous return tag, verify that text make it not empty + if (this.returnTagPtr != -2 && this.returnStatement != null) { + int position = this.index; + this.index = start; + boolean empty = true; + boolean star = false; + char ch = readChar(); + // Look for first character other than white or '*' + if (Character.isWhitespace(ch) || start>(this.tagSourceEnd+1)) { + while (this.index <= end && empty) { + if (!star) { + empty = Character.isWhitespace(ch) || ch == '*'; + star = ch == '*'; + } else if (ch != '*') { + empty = false; + break; + } + ch = readChar(); + } + } + // Store result in previous return tag + ((JavadocReturnStatement)this.returnStatement).empty = empty; + // Reset position and current ast ptr if we are on a different tag than previous return one + this.index = position; + if (this.returnTagPtr != this.astPtr) { + this.returnTagPtr = -2; + } + } } /* diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java index c642c18f20..2a2fe4a09b 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java @@ -689,10 +689,10 @@ public class ASTParser { } /** - * @param monitor - * @param compilationUnitDeclaration - * @param source - * @return + * @param monitor IProgressMonitor + * @param compilationUnitDeclaration CompilationUnitDeclaration + * @param source char[] + * @return ASTNode */ private ASTNode convert(IProgressMonitor monitor, CompilationUnitDeclaration compilationUnitDeclaration, char[] source, boolean needToResolveBindings) { BindingResolver resolver = null; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java index b1476ee7d8..2a5ed8f465 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java @@ -209,8 +209,8 @@ import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; /** * Creates a string that represents the given number of indents (can be spaces or tabs..) - * @param indent - * @return + * @param indent int + * @return String */ public String createIndentString(int indent) { StringBuffer buf= new StringBuffer(indent * this.singleIndentString.length()); diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/Indents.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/Indents.java index 540481b561..046c4ee998 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/Indents.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/Indents.java @@ -32,8 +32,8 @@ public class Indents { /** * Indent char is a space char but not a line delimiters. * <code>== Character.isWhitespace(ch) && ch != '\n' && ch != '\r'</code> - * @param ch - * @return + * @param ch char + * @return boolean */ public static boolean isIndentChar(char ch) { return Character.isWhitespace(ch) && !isLineDelimiterChar(ch); @@ -78,13 +78,13 @@ public class Indents { } /** - * Removes the given number of idents from the line. Asserts that the given line + * Removes the given number of indents from the line. Asserts that the given line * has the requested number of indents. If <code>indentsToRemove <= 0</code> * the line is returned. * @param line The line to trim the indent * @param indentsToRemove The indent level to remove * @param tabWidth The current tab width - * @return + * @return String The trimmed string */ public static String trimIndent(String line, int indentsToRemove, int tabWidth) { if (line == null || indentsToRemove <= 0) @@ -197,8 +197,8 @@ public class Indents { * @param codeIndentLevel The indent level of the code * @param tabWidth The current tab width setting * @param newIndent The new Indent string - * @param lineDelim THe current line delimiter - * @return + * @param lineDelim The current line delimiter + * @return String The changed string */ public static String changeIndent(String code, int codeIndentLevel, int tabWidth, String newIndent, String lineDelim) { try { diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java index 584b46a202..3cdda7bdea 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java @@ -374,9 +374,9 @@ public final class RewriteEventStore { /** * Kind is either ORIGINAL, NEW, or BOTH - * @param value - * @param kind - * @return + * @param value Object + * @param kind int + * @return RewriteEvent */ public RewriteEvent findEvent(Object value, int kind) { for (int i= 0; i < this.events.size(); i++) { diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java index d0dbf1ef23..666971870b 100644 --- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java +++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java @@ -255,7 +255,7 @@ protected void consumeMethodDeclaration(boolean isNotAbstract) { } int start = methodDecl.bodyStart-1, end = start; - long position = (start << 32) + end; + long position = ((long) start << 32) + end; long[] positions = new long[]{position}; if (this.evaluationContext.localVariableNames != null) { diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java index abd4b26a7d..71aadccdba 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java @@ -2487,9 +2487,8 @@ public class CodeFormatterVisitor extends ASTVisitor { } format(types[typesLength - 1]); } - this.scribe.printComment(); - formatEmptyTypeDeclaration(false); - return false; + this.scribe.printEndOfCompilationUnit(); + return false; } /** diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java index b951deba3b..dd5fcff62f 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java @@ -952,6 +952,122 @@ public class Scribe { addInsertEdit(insertPosition, buffer.toString()); } + public void printEndOfCompilationUnit() { + try { + // if we have a space between two tokens we ensure it will be dumped in the formatted string + int currentTokenStartPosition = this.scanner.currentPosition; + boolean hasComment = false; + boolean hasLineComment = false; + boolean hasWhitespace = false; + int count = 0; + while (true) { + this.currentToken = this.scanner.getNextToken(); + switch(this.currentToken) { + case TerminalTokens.TokenNameWHITESPACE : + char[] whiteSpaces = this.scanner.getCurrentTokenSource(); + count = 0; + for (int i = 0, max = whiteSpaces.length; i < max; i++) { + switch(whiteSpaces[i]) { + case '\r' : + if ((i + 1) < max) { + if (whiteSpaces[i + 1] == '\n') { + i++; + } + } + count++; + break; + case '\n' : + count++; + } + } + if (count == 0) { + hasWhitespace = true; + addDeleteEdit(this.scanner.getCurrentTokenStartPosition(), this.scanner.getCurrentTokenEndPosition()); + } else if (hasComment) { + if (count == 1) { + this.printNewLine(this.scanner.getCurrentTokenStartPosition()); + } else { + preserveEmptyLines(count - 1, this.scanner.getCurrentTokenStartPosition()); + } + addDeleteEdit(this.scanner.getCurrentTokenStartPosition(), this.scanner.getCurrentTokenEndPosition()); + } else if (hasLineComment) { + this.preserveEmptyLines(count, this.scanner.getCurrentTokenStartPosition()); + addDeleteEdit(this.scanner.getCurrentTokenStartPosition(), this.scanner.getCurrentTokenEndPosition()); + } else { + addDeleteEdit(this.scanner.getCurrentTokenStartPosition(), this.scanner.getCurrentTokenEndPosition()); + } + currentTokenStartPosition = this.scanner.currentPosition; + break; + case TerminalTokens.TokenNameCOMMENT_LINE : + if (count >= 1) { + if (count > 1) { + preserveEmptyLines(count - 1, this.scanner.getCurrentTokenStartPosition()); + } else if (count == 1) { + printNewLine(this.scanner.getCurrentTokenStartPosition()); + } + } else if (hasWhitespace) { + space(); + } + hasWhitespace = false; + this.printCommentLine(this.scanner.getRawTokenSource()); + currentTokenStartPosition = this.scanner.currentPosition; + hasLineComment = true; + count = 0; + break; + case TerminalTokens.TokenNameCOMMENT_BLOCK : + if (count >= 1) { + if (count > 1) { + preserveEmptyLines(count - 1, this.scanner.getCurrentTokenStartPosition()); + } else if (count == 1) { + printNewLine(this.scanner.getCurrentTokenStartPosition()); + } + } else if (hasWhitespace) { + space(); + } + hasWhitespace = false; + this.printBlockComment(this.scanner.getRawTokenSource(), false); + currentTokenStartPosition = this.scanner.currentPosition; + hasLineComment = false; + hasComment = true; + count = 0; + break; + case TerminalTokens.TokenNameCOMMENT_JAVADOC : + if (count >= 1) { + if (count > 1) { + preserveEmptyLines(count - 1, this.scanner.getCurrentTokenStartPosition()); + } else if (count == 1) { + printNewLine(this.scanner.getCurrentTokenStartPosition()); + } + } else if (hasWhitespace) { + space(); + } + hasWhitespace = false; + this.printBlockComment(this.scanner.getRawTokenSource(), true); + currentTokenStartPosition = this.scanner.currentPosition; + hasLineComment = false; + hasComment = true; + count = 0; + break; + case TerminalTokens.TokenNameSEMICOLON : + char[] currentTokenSource = this.scanner.getRawTokenSource(); + this.print(currentTokenSource, this.formatter.preferences.insert_space_before_semicolon); + break; + case TerminalTokens.TokenNameEOF : + if (count >= 1) { + this.printNewLine(this.scannerEndPosition); + } + return; + default : + // step back one token + this.scanner.resetTo(currentTokenStartPosition, this.scannerEndPosition - 1); + return; + } + } + } catch (InvalidInputException e) { + throw new AbortFormatting(e); + } + } + private void printIndentationIfNecessary() { int indentationColumn = (this.useTab ? this.indentationLevel * this.tabSize : this.indentationLevel)+1; if (this.column < indentationColumn) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java index 80c5fea06f..5c090fae7c 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java @@ -185,7 +185,14 @@ public class ToolFactory { try { if (root instanceof JarPackageFragmentRoot) { - String archiveName = ((JarPackageFragmentRoot)root).getJar().getName(); + String archiveName = null; + ZipFile jar = null; + try { + jar = ((JarPackageFragmentRoot)root).getJar(); + archiveName = jar.getName(); + } finally { + JavaModelManager.getJavaModelManager().closeZipFile(jar); + } String entryName = classfile.getParent().getElementName(); entryName = entryName.replace('.', '/'); if (entryName.equals("")) { //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java index 90b43ef64d..c6ad71e316 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java @@ -218,7 +218,7 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor { } /** - * @see ISourceElementRequestor#exitField(int) + * @see ISourceElementRequestor#exitField(int, int, int) */ public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) { // default implementation: do nothing diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java index c3ccb87db5..a031c96f5e 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java @@ -195,7 +195,7 @@ public class SourceTypeConverter implements CompilerModifiers { char[][] argumentTypeNames = sourceMethod.getArgumentTypeNames(); char[][] argumentNames = sourceMethod.getArgumentNames(); int argumentCount = argumentTypeNames == null ? 0 : argumentTypeNames.length; - long position = (long) start << 32 + end; + long position = ((long) start << 32) + end; method.arguments = new Argument[argumentCount]; for (int i = 0; i < argumentCount; i++) { method.arguments[i] = @@ -328,7 +328,7 @@ public class SourceTypeConverter implements CompilerModifiers { char[][] qImportName = CharOperation.splitOn('.', importName); long[] positions = new long[qImportName.length]; - long position = (long) start << 32 + end; + long position = ((long) start << 32) + end; for (int i = 0; i < qImportName.length; i++) { positions[i] = position; // dummy positions } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java index 6c4f4c21bc..930ab28bc4 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java @@ -1490,8 +1490,10 @@ public class JavaProject case 0: return null; case 1: - // default root - return getPackageFragmentRoot(this.project); + if (path.equals(getPath())) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=75814 + // default root + return getPackageFragmentRoot(this.project); + } default: // a path ending with .jar/.zip is still ambiguous and could still resolve to a source/lib folder // thus will try to guess based on existing resource diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java index d969ade44d..8e4b2c7372 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java @@ -387,14 +387,15 @@ public class SourceMapper zip = manager.getZipFile(this.sourcePath); for (Enumeration entries = zip.entries(); entries.hasMoreElements(); ) { ZipEntry entry = (ZipEntry) entries.nextElement(); - if (!entry.isDirectory()) { - IPath path = new Path(entry.getName()); + String entryName; + if (!entry.isDirectory() && Util.isJavaFileName(entryName = entry.getName())) { + IPath path = new Path(entryName); int segmentCount = path.segmentCount(); if (segmentCount > 1) { loop: for (int i = 0, max = path.segmentCount() - 1; i < max; i++) { if (firstLevelPackageNames.contains(path.segment(i))) { this.rootPaths.add(path.uptoSegment(i).toString()); - break loop; + // don't break here as this path could contain other first level package names (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=74014) } if (i == max - 1 && containsADefaultPackage) { this.rootPaths.add(path.uptoSegment(max).toString()); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java index 33e7a622aa..53ed3aefab 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java @@ -744,8 +744,8 @@ private void setEnvironment(LookupEnvironment lookupEnvironment, HierarchyBuilde /** * Set the focus type (ie. the type that this resolver is computing the hierarch for. * Returns the binding of this focus type or null if it could not be found. - * @param compoundName - * @return + * @param compoundName char[] + * @return ReferenceBinding */ public ReferenceBinding setFocusType(char[][] compoundName) { if (compoundName == null || this.lookupEnvironment == null) return null; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java index aab682b02f..97b2cdebf8 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java @@ -159,7 +159,7 @@ void normalize(ILineStartFinder finder) { initalizeHeader(); } /** - * @see IDOMCompilationUnit@setHeader(String) + * @see IDOMCompilationUnit#setHeader(String) */ public void setHeader(String comment) { fHeader= comment; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java index 27e104b816..bf312aca21 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java @@ -248,8 +248,6 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader } else if (equals(attributeName, IAttributeNamesConstants.SOURCE)) { this.sourceFileAttribute = new SourceFileAttribute(classFileBytes, this.constantPool, readOffset); this.attributes[attributesIndex++] = this.sourceFileAttribute; - } else if (equals(attributeName, IAttributeNamesConstants.SYNTHETIC)) { - this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset); } else { this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset); } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java index a571781ece..0f2fea9327 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java @@ -13,8 +13,9 @@ package org.eclipse.jdt.internal.core.util; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.core.util.*; +import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; import org.eclipse.jdt.core.util.ClassFormatException; +import org.eclipse.jdt.core.util.IAttributeNamesConstants; import org.eclipse.jdt.core.util.IClassFileAttribute; import org.eclipse.jdt.core.util.IClassFileReader; import org.eclipse.jdt.core.util.ICodeAttribute; @@ -430,8 +431,6 @@ public class Disassembler extends ClassFileBytesDisassembler { StringBuffer buffer = new StringBuffer(); ISourceAttribute sourceAttribute = classFileReader.getSourceFileAttribute(); - IClassFileAttribute classFileAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.SIGNATURE); - ISignatureAttribute signatureAttribute = (ISignatureAttribute) classFileAttribute; final int accesssFlags = classFileReader.getAccessFlags(); if (mode == ClassFileBytesDisassembler.DETAILED) { int minorVersion = classFileReader.getMinorVersion(); @@ -465,13 +464,6 @@ public class Disassembler extends ClassFileBytesDisassembler { + (isDeprecated(classFileReader) ? ", deprecated" : EMPTY_OUTPUT)//$NON-NLS-1$ })); writeNewLine(buffer, lineSeparator, 0); - if (signatureAttribute != null) { - buffer - .append(Util.bind("disassembler.begincommentline")) //$NON-NLS-1$ - .append(Util.bind("disassembler.signatureattributeheader")) //$NON-NLS-1$ - .append(signatureAttribute.getSignature()); - writeNewLine(buffer, lineSeparator, 0); - } } char[] className = classFileReader.getClassName(); if (className == null) { @@ -537,36 +529,24 @@ public class Disassembler extends ClassFileBytesDisassembler { if (mode == ClassFileBytesDisassembler.DETAILED) { IClassFileAttribute[] attributes = classFileReader.getAttributes(); length = attributes.length; - IEnclosingMethodAttribute enclosingMethodAttribute = getEnclosingMethodAttribute(classFileReader); int remainingAttributesLength = length; if (innerClassesAttribute != null) { remainingAttributesLength--; } - if (enclosingMethodAttribute != null) { - remainingAttributesLength--; - } if (sourceAttribute != null) { remainingAttributesLength--; } - if (signatureAttribute != null) { - remainingAttributesLength--; - } - if (innerClassesAttribute != null || enclosingMethodAttribute != null || remainingAttributesLength != 0) { + if (innerClassesAttribute != null || remainingAttributesLength != 0) { writeNewLine(buffer, lineSeparator, 0); } if (innerClassesAttribute != null) { disassemble(innerClassesAttribute, buffer, lineSeparator, 1); } - if (enclosingMethodAttribute != null) { - disassemble(enclosingMethodAttribute, buffer, lineSeparator, 0); - } if (length != 0) { for (int i = 0; i < length; i++) { IClassFileAttribute attribute = attributes[i]; if (attribute != innerClassesAttribute && attribute != sourceAttribute - && attribute != signatureAttribute - && attribute != enclosingMethodAttribute && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) { disassemble(attribute, buffer, lineSeparator, 0); @@ -693,8 +673,6 @@ public class Disassembler extends ClassFileBytesDisassembler { private void disassemble(IFieldInfo fieldInfo, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { writeNewLine(buffer, lineSeparator, tabNumber); char[] fieldDescriptor = fieldInfo.getDescriptor(); - IClassFileAttribute classFileAttribute = Util.getAttribute(fieldInfo, IAttributeNamesConstants.SIGNATURE); - ISignatureAttribute signatureAttribute = (ISignatureAttribute) classFileAttribute; if (mode == DETAILED) { buffer .append(Util.bind("disassembler.begincommentline")) //$NON-NLS-1$ @@ -707,13 +685,6 @@ public class Disassembler extends ClassFileBytesDisassembler { buffer.append(Util.bind("disassembler.deprecated"));//$NON-NLS-1$ } writeNewLine(buffer, lineSeparator, tabNumber); - if (signatureAttribute != null) { - buffer - .append(Util.bind("disassembler.begincommentline")) //$NON-NLS-1$ - .append(Util.bind("disassembler.signatureattributeheader")) //$NON-NLS-1$ - .append(signatureAttribute.getSignature()); - writeNewLine(buffer, lineSeparator, tabNumber); - } } decodeModifiersForField(buffer, fieldInfo.getAccessFlags()); if (fieldInfo.isSynthetic()) { @@ -767,7 +738,6 @@ public class Disassembler extends ClassFileBytesDisassembler { for (int i = 0; i < length; i++) { IClassFileAttribute attribute = attributes[i]; if (attribute != constantValueAttribute - && attribute != signatureAttribute && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) { disassemble(attribute, buffer, lineSeparator, tabNumber); @@ -784,8 +754,6 @@ public class Disassembler extends ClassFileBytesDisassembler { writeNewLine(buffer, lineSeparator, tabNumber); ICodeAttribute codeAttribute = methodInfo.getCodeAttribute(); char[] methodDescriptor = methodInfo.getDescriptor(); - IClassFileAttribute classFileAttribute = Util.getAttribute(methodInfo, IAttributeNamesConstants.SIGNATURE); - ISignatureAttribute signatureAttribute = (ISignatureAttribute) classFileAttribute; if (mode == DETAILED) { buffer .append(Util.bind("disassembler.begincommentline")) //$NON-NLS-1$ @@ -798,13 +766,6 @@ public class Disassembler extends ClassFileBytesDisassembler { buffer.append(Util.bind("disassembler.deprecated"));//$NON-NLS-1$ } writeNewLine(buffer, lineSeparator, tabNumber); - if (signatureAttribute != null) { - buffer - .append(Util.bind("disassembler.begincommentline")) //$NON-NLS-1$ - .append(Util.bind("disassembler.signatureattributeheader")) //$NON-NLS-1$ - .append(signatureAttribute.getSignature()); - writeNewLine(buffer, lineSeparator, tabNumber); - } if (codeAttribute != null) { buffer .append(Util.bind("disassembler.begincommentline")) //$NON-NLS-1$ @@ -861,7 +822,6 @@ public class Disassembler extends ClassFileBytesDisassembler { IClassFileAttribute attribute = attributes[i]; if (attribute != codeAttribute && attribute != exceptionAttribute - && attribute != signatureAttribute && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED) && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) { disassemble(attribute, buffer, lineSeparator, tabNumber); @@ -1005,66 +965,8 @@ public class Disassembler extends ClassFileBytesDisassembler { .append(Util.bind("classfileformat.localvariabletablelocaltype")); //$NON-NLS-1$ buffer.append(localVariableTableEntry.getDescriptor()); } - ILocalVariableTypeTableAttribute localVariableTypeAttribute= getLocalVariableTypeAttribute(codeAttribute); - int localVariableTypeTableLength = localVariableTypeAttribute == null ? 0 : localVariableTypeAttribute.getLocalVariableTypeTableLength(); - if (localVariableTypeTableLength != 0) { - int tabNumberForLocalVariableAttribute = tabNumber + 2; - writeNewLine(buffer, lineSeparator, tabNumberForLocalVariableAttribute); - buffer.append(Util.bind("disassembler.localvariabletypetableattributeheader")); //$NON-NLS-1$ - writeNewLine(buffer, lineSeparator, tabNumberForLocalVariableAttribute + 1); - ILocalVariableTypeTableEntry[] localVariableTypeTableEntries = localVariableTypeAttribute.getLocalVariableTypeTable(); - for (int i = 0; i < localVariableTypeTableLength - 1; i++) { - ILocalVariableTypeTableEntry localVariableTypeTableEntry = localVariableTypeTableEntries[i]; - int index= localVariableTypeTableEntry.getIndex(); - int startPC = localVariableTypeTableEntry.getStartPC(); - int length = localVariableTypeTableEntry.getLength(); - buffer - .append(Util.bind("classfileformat.localvariabletablefrom")) //$NON-NLS-1$ - .append(startPC) - .append(Util.bind("classfileformat.localvariabletableto")) //$NON-NLS-1$ - .append(startPC + length) - .append(Util.bind("classfileformat.localvariabletablelocalname")) //$NON-NLS-1$ - .append(localVariableTypeTableEntry.getName()) - .append(Util.bind("classfileformat.localvariabletablelocalindex")) //$NON-NLS-1$ - .append(index) - .append(Util.bind("classfileformat.localvariabletablelocaltype")); //$NON-NLS-1$ - buffer.append(localVariableTypeTableEntry.getSignature()); - writeNewLine(buffer, lineSeparator, tabNumberForLocalVariableAttribute + 1); - } - ILocalVariableTypeTableEntry localVariableTypeTableEntry = localVariableTypeTableEntries[localVariableTypeTableLength - 1]; - int index= localVariableTypeTableEntry.getIndex(); - int startPC = localVariableTypeTableEntry.getStartPC(); - int length = localVariableTypeTableEntry.getLength(); - buffer - .append(Util.bind("classfileformat.localvariabletablefrom")) //$NON-NLS-1$ - .append(startPC) - .append(Util.bind("classfileformat.localvariabletableto")) //$NON-NLS-1$ - .append(startPC + length) - .append(Util.bind("classfileformat.localvariabletablelocalname")) //$NON-NLS-1$ - .append(localVariableTypeTableEntry.getName()) - .append(Util.bind("classfileformat.localvariabletablelocalindex")) //$NON-NLS-1$ - .append(index) - .append(Util.bind("classfileformat.localvariabletablelocaltype")) //$NON-NLS-1$ - .append(localVariableTypeTableEntry.getSignature()); - } } - private void disassemble(IEnclosingMethodAttribute enclosingMethodAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) { - writeNewLine(buffer, lineSeparator, tabNumber + 1); - buffer.append(Util.bind("disassembler.enclosingmethodheader")); //$NON-NLS-1$ - buffer - .append(Util.bind("disassembler.constantpoolindex")) //$NON-NLS-1$ - .append(enclosingMethodAttribute.getEnclosingClassIndex()) - .append(" ")//$NON-NLS-1$ - .append(Util.bind("disassembler.constantpoolindex")) //$NON-NLS-1$ - .append(enclosingMethodAttribute.getMethodNameAndTypeIndex()) - .append(" ")//$NON-NLS-1$ - .append(enclosingMethodAttribute.getEnclosingClass()) //$NON-NLS-1$ - .append(".")//$NON-NLS-1$ - .append(enclosingMethodAttribute.getMethodName()) //$NON-NLS-1$ - .append(enclosingMethodAttribute.getMethodDescriptor()); //$NON-NLS-1$ - } - private void disassembleTypeMembers(IClassFileReader classFileReader, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { IFieldInfo[] fields = classFileReader.getFieldInfos(); for (int i = 0, max = fields.length; i < max; i++) { @@ -1091,15 +993,6 @@ public class Disassembler extends ClassFileBytesDisassembler { return Util.bind("disassembler.description"); //$NON-NLS-1$ } - private IEnclosingMethodAttribute getEnclosingMethodAttribute(IClassFileReader classFileReader) { - IClassFileAttribute[] attributes = classFileReader.getAttributes(); - for (int i = 0, max = attributes.length; i < max; i++) { - if (CharOperation.equals(attributes[i].getAttributeName(), IAttributeNamesConstants.ENCLOSING_METHOD)) { - return (IEnclosingMethodAttribute) attributes[i]; - } - } - return null; - } /** * Method getEntryFor. * @param localIndex @@ -1118,15 +1011,6 @@ public class Disassembler extends ClassFileBytesDisassembler { } return null; } - private ILocalVariableTypeTableAttribute getLocalVariableTypeAttribute(ICodeAttribute codeAttribute) { - IClassFileAttribute[] attributes = codeAttribute.getAttributes(); - for (int i = 0, max = attributes.length; i < max; i++) { - if (CharOperation.equals(attributes[i].getAttributeName(), IAttributeNamesConstants.LOCAL_VARIABLE_TYPE_TABLE)) { - return (ILocalVariableTypeTableAttribute) attributes[i]; - } - } - return null; - } private char[] getSignatureForField(char[] fieldDescriptor) { final int length = fieldDescriptor.length; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java index 4578f6318c..e436a4b50b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java @@ -201,7 +201,7 @@ public class ElementInfoConverter implements CompilerModifiers { char[][] argumentTypeNames = sourceMethod.getArgumentTypeNames(); char[][] argumentNames = sourceMethod.getArgumentNames(); int argumentCount = argumentTypeNames == null ? 0 : argumentTypeNames.length; - long position = (long) start << 32 + end; + long position = ((long) start << 32) + end; method.arguments = new Argument[argumentCount]; for (int i = 0; i < argumentCount; i++) { method.arguments[i] = @@ -419,7 +419,7 @@ public class ElementInfoConverter implements CompilerModifiers { char[][] qImportName = CharOperation.splitOn('.', importName); long[] positions = new long[qImportName.length]; - long position = (long) start << 32 + end; + long position = ((long) start << 32) + end; for (int i = 0; i < qImportName.length; i++) { positions[i] = position; // dummy positions } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java index 84186c0dc3..2517c72c64 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java @@ -98,7 +98,9 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo { } else if (equals(attributeName, IAttributeNamesConstants.EXCEPTIONS)) { this.exceptionAttribute = new ExceptionAttribute(classFileBytes, constantPool, offset + readOffset); this.attributes[attributesIndex++] = this.exceptionAttribute; - } else { + } else if (equals(attributeName, IAttributeNamesConstants.SIGNATURE)) { + this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset); + } else { this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset); } readOffset += (6 + u4At(classFileBytes, readOffset + 2, offset)); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java index e263d9e611..2878e2b381 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java @@ -158,6 +158,12 @@ class AddJarFileToIndex extends IndexRequest { // index already existed: recreate it so that we forget about previous entries SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); index = manager.recreateIndex(this.containerPath); + if (index == null) { + // failed to recreate index, see 73330 + manager.removeIndex(this.containerPath); + return false; + } + for (Enumeration e = zip.entries(); e.hasMoreElements();) { if (this.isCancelled) { if (JobManager.VERBOSE) diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java index 99427d8661..7d6be42cb1 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java @@ -1027,6 +1027,8 @@ public SearchMatch newDeclarationMatch( return new MethodDeclarationMatch(element, accuracy, offset, length, participant, resource); case IJavaElement.LOCAL_VARIABLE: return new LocalVariableDeclarationMatch(element, accuracy, offset, length, participant, resource); + case IJavaElement.PACKAGE_DECLARATION: + return new PackageDeclarationMatch(element, accuracy, offset, length, participant, resource); default: return null; } @@ -1407,32 +1409,6 @@ protected void reportMatching(CompilationUnitDeclaration unit, boolean mustResol ? unit.scope.getTypeOrPackage(CharOperation.subarray(importRef.tokens, 0, importRef.tokens.length)) : unit.scope.getTypeOrPackage(importRef.tokens); this.patternLocator.matchLevelAndReportImportRef(importRef, binding, this); - } else { - if (node instanceof JavadocSingleTypeReference) { - // special case for javadoc single type reference - JavadocSingleTypeReference singleRef = (JavadocSingleTypeReference) node; - if (singleRef.packageBinding != null) { - char[][] tokens = new char[][] { singleRef.token }; - long[] positions = new long[] { (((long) singleRef.sourceStart) << 32) + singleRef.sourceEnd }; - int tagStart = singleRef.tagSourceStart; - int tagEnd = singleRef.tagSourceEnd; - JavadocImportReference importRef = new JavadocImportReference(tokens, positions, tagStart, tagEnd); - this.patternLocator.matchLevelAndReportImportRef(importRef, singleRef.packageBinding, this); - continue; - } - } else if (node instanceof JavadocQualifiedTypeReference) { - // special case for javadoc qualified type reference - JavadocQualifiedTypeReference qualifRef = (JavadocQualifiedTypeReference) node; - if (qualifRef.packageBinding != null) { - char[][] tokens = qualifRef.tokens; - long[] positions = qualifRef.sourcePositions; - int tagStart = qualifRef.tagSourceStart; - int tagEnd = qualifRef.tagSourceEnd; - JavadocImportReference importRef = new JavadocImportReference(tokens, positions, tagStart, tagEnd); - this.patternLocator.matchLevelAndReportImportRef(importRef, qualifRef.packageBinding, this); - continue; - } - } } nodeSet.addMatch(node, this.patternLocator.resolveLevel(node)); } @@ -1498,7 +1474,9 @@ protected void reportMatching(FieldDeclaration field, TypeDeclaration type, IJav } if (typeInHierarchy) { - ASTNode[] nodes = nodeSet.matchingNodes(field.declarationSourceStart, field.declarationSourceEnd); + // limit scan to end part position for multiple fields declaration (see bug 73112) + int end = field.endPart2Position==0 ? field.declarationSourceEnd : field.endPart2Position; + ASTNode[] nodes = nodeSet.matchingNodes(field.declarationSourceStart, end); if (nodes != null) { if ((this.matchContainer & PatternLocator.FIELD_CONTAINER) == 0) { for (int i = 0, l = nodes.length; i < l; i++) diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java index 77d76a99f4..d6f4015018 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java @@ -179,6 +179,11 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, int QualifiedTypeReference qTypeRef = (QualifiedTypeReference) reference; positions = qTypeRef.sourcePositions; typeBinding = qTypeRef.resolvedType; + } else if (reference instanceof JavadocSingleTypeReference) { + JavadocSingleTypeReference jsTypeRef = (JavadocSingleTypeReference) reference; + positions = new long[1]; + positions[0] = (((long)jsTypeRef.sourceStart) << 32) + jsTypeRef.sourceEnd; + typeBinding = jsTypeRef.resolvedType; } if (typeBinding instanceof ArrayBinding) typeBinding = ((ArrayBinding) typeBinding).leafComponentType; @@ -204,6 +209,18 @@ protected int referenceType() { return IJavaElement.PACKAGE_FRAGMENT; } public int resolveLevel(ASTNode node) { + if (node instanceof JavadocQualifiedTypeReference) { + JavadocQualifiedTypeReference qualifRef = (JavadocQualifiedTypeReference) node; + if (qualifRef.packageBinding != null) + return resolveLevel(qualifRef.packageBinding); + return resolveLevel(qualifRef.resolvedType); + } + if (node instanceof JavadocSingleTypeReference) { + JavadocSingleTypeReference singleRef = (JavadocSingleTypeReference) node; + if (singleRef.packageBinding != null) + return resolveLevel(singleRef.packageBinding); + return IMPOSSIBLE_MATCH; + } if (node instanceof QualifiedTypeReference) return resolveLevel(((QualifiedTypeReference) node).resolvedType); if (node instanceof QualifiedNameReference) |