JDK_1_5-Merge with HEAD: v_434
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java
index aad29f7..a44bc0b 100644
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java
+++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java
@@ -65,9 +65,8 @@
IPath packagePath = addPackage(packageFragmentRootPath, packageName);
return addBinaryClass(packagePath, className, contents);
- } else {
- return addBinaryClass(packageFragmentRootPath, className, contents);
}
+ return addBinaryClass(packageFragmentRootPath, className, contents);
}
@@ -103,9 +102,8 @@
IPath packagePath = addPackage(packageFragmentRootPath, packageName);
return addClass(packagePath, className, contents);
- } else {
- return addClass(packageFragmentRootPath, className, contents);
}
+ return addClass(packageFragmentRootPath, className, contents);
}
/** Adds a package to the given package fragment root
@@ -467,10 +465,10 @@
*/
public IPath getPackagePath(IPath root, String packageName) {
checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- if (packageName.length() == 0)
+ if (packageName.length() == 0) {
return root;
- else
- return root.append(packageName.replace('.', IPath.SEPARATOR));
+ }
+ return root.append(packageName.replace('.', IPath.SEPARATOR));
}
/** Return the path of the package fragment root
@@ -479,10 +477,10 @@
*/
public IPath getPackageFragmentRootPath(IPath projectPath, String name) {
checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$
- if (name.length() == 0)
+ if (name.length() == 0) {
return projectPath;
- else
- return projectPath.append(name);
+ }
+ return projectPath.append(name);
}
/**
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java
index 0357239..53f5db6 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java
@@ -205,9 +205,8 @@
if (field instanceof Initializer) {
parser.parseBlockStatements((Initializer)field, type, unit);
break;
- } else {
- assertTrue("TBD", false); // field initializer
}
+ assertTrue("TBD", false); // field initializer
}
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java
index bd4802a..9fe44a1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java
@@ -112,11 +112,10 @@
* @see junit.framework.TestCase#getName()
*/
public String getName() {
- if (this.docCommentSupport == null) {
- return super.getName();
- } else {
+ if (this.docCommentSupport != null) {
return getNamePrefix()+super.getName();
}
+ return super.getName();
}
/* (non-Javadoc)
@@ -142,9 +141,8 @@
System.arraycopy(classLibs, 0, newClassPaths, 0, length);
newClassPaths[length] = getClass().getResource(zipFile).getPath();
return newClassPaths;
- } else {
- return super.getDefaultClassPaths();
}
+ return super.getDefaultClassPaths();
}
static String[] referencedClasses = null;
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 3355b8b..5fa7b33 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
@@ -35,7 +35,7 @@
// All specified tests which does not belong to the class are skipped...
static {
// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
-// testsNames = new String[] { "Bug53290" };
+// testsNames = new String[] { "Bug51606", "Bug51606a", "Bug51606b", "Bug51606c" };
// Numbers of tests to run: "test<number>" will be run for each number of this array
// testsNumbers = new int[] { 3, 7, 10, 21 };
// Range numbers of tests to run: all tests between "test<first>" and "test<last>" will be run for { first, last }
@@ -2408,4 +2408,190 @@
"----------\n"
);
}
+
+ /**
+ * Test fix for bug 62812: Some malformed javadoc tags are not reported as malformed
+ * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62812">62812</a>
+ */
+ public void testBug62812() {
+ reportMissingJavadocComments = CompilerOptions.IGNORE;
+ runNegativeTest(
+ new String[] {
+ "Test.java",
+ "/**\n" +
+ " * @see Object#clone())\n" +
+ " * @see Object#equals(Object)}\n" +
+ " * @see Object#equals(Object))\n" +
+ " * @see Object#equals(Object)xx\n" +
+ " */\n" +
+ "public class Test {\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in Test.java (at line 2)\n" +
+ " * @see Object#clone())\n" +
+ " ^^^\n" +
+ "Javadoc: Malformed reference (missing separator after method reference closing brace)\n" +
+ "----------\n" +
+ "2. ERROR in Test.java (at line 3)\n" +
+ " * @see Object#equals(Object)}\n" +
+ " ^^^^^^^^^\n" +
+ "Javadoc: Malformed reference (missing separator after method reference closing brace)\n" +
+ "----------\n" +
+ "3. ERROR in Test.java (at line 4)\n" +
+ " * @see Object#equals(Object))\n" +
+ " ^^^^^^^^^\n" +
+ "Javadoc: Malformed reference (missing separator after method reference closing brace)\n" +
+ "----------\n" +
+ "4. ERROR in Test.java (at line 5)\n" +
+ " * @see Object#equals(Object)xx\n" +
+ " ^^^^^^^^^^\n" +
+ "Javadoc: Malformed reference (missing separator after method reference closing brace)\n" +
+ "----------\n"
+ );
+ }
+ public void testBug62812a() {
+ reportMissingJavadocComments = CompilerOptions.IGNORE;
+ runNegativeTest(
+ new String[] {
+ "Test.java",
+ "/**\n" +
+ " * {@link Object#clone())}\n" +
+ " * {@link Object#equals(Object)}\n" +
+ " * {@link Object#equals(Object))}\n" +
+ " * {@link Object#equals(Object)xx}\n" +
+ " */\n" +
+ "public class Test {\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in Test.java (at line 2)\n" +
+ " * {@link Object#clone())}\n" +
+ " ^^^^\n" +
+ "Javadoc: Malformed reference (missing separator after method reference closing brace)\n" +
+ "----------\n" +
+ "2. ERROR in Test.java (at line 4)\n" +
+ " * {@link Object#equals(Object))}\n" +
+ " ^^^^^^^^^^\n" +
+ "Javadoc: Malformed reference (missing separator after method reference closing brace)\n" +
+ "----------\n" +
+ "3. ERROR in Test.java (at line 5)\n" +
+ " * {@link Object#equals(Object)xx}\n" +
+ " ^^^^^^^^^^^\n" +
+ "Javadoc: Malformed reference (missing separator after method reference closing brace)\n" +
+ "----------\n"
+ );
+ }
+
+ /**
+ * Test fix for bug 51606: [Javadoc] Compiler should complain when tag name is not correct
+ * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51606">51606</a>
+ */
+ public void testBug51606() {
+ reportMissingJavadocComments = CompilerOptions.IGNORE;
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " /**\n" +
+ " * @param a aaa\n" +
+ " * @param b bbb\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n",
+ "Y.java",
+ "public class Y extends X {\n" +
+ " /**\n" +
+ " * @param a {@inheritDoc}\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in Y.java (at line 5)\n" +
+ " public void foo(int a, int b) {\n" +
+ " ^\n" +
+ "Javadoc: Missing tag for parameter b\n" +
+ "----------\n"
+ );
+ }
+ public void testBug51606a() {
+ reportMissingJavadocComments = CompilerOptions.IGNORE;
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " /**\n" +
+ " * @param a aaa\n" +
+ " * @param b bbb\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n",
+ "Y.java",
+ "public class Y extends X {\n" +
+ " /**\n" +
+ " * {@inheritDoc}\n" +
+ " * @param a aaaaa\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n"
+ },
+ ""
+ );
+ }
+ public void testBug51606b() {
+ reportMissingJavadocComments = CompilerOptions.IGNORE;
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " /**\n" +
+ " * @param a aaa\n" +
+ " * @param b bbb\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n",
+ "Y.java",
+ "public class Y extends X {\n" +
+ " /**\n" +
+ " * Text before inherit tag\n" +
+ " * {@inheritDoc}\n" +
+ " * @param a aaaaa\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n"
+ }
+ );
+ }
+ public void testBug51606c() {
+ reportMissingJavadocComments = CompilerOptions.IGNORE;
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " /**\n" +
+ " * @param a aaa\n" +
+ " * @param b bbb\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n",
+ "Y.java",
+ "public class Y extends X {\n" +
+ " /**\n" +
+ " * Text before inherit tag {@inheritDoc}\n" +
+ " * @param a aaaaa\n" +
+ " */\n" +
+ " public void foo(int a, int b) {\n" +
+ " }\n" +
+ "}\n"
+ }
+ );
+ }
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
index 8045352..f2f7daa 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
+import java.io.File;
import java.util.Hashtable;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -1496,7 +1497,78 @@
},
"SUCCESS");
}
+/*
+ * 62639 - check that missing member type is not noticed if no direct connection with compiled type
+ */
public void test044() {
+ this.runConformTest(
+ new String[] {
+ "p/Dumbo.java",
+ "package p;\n" +
+ "public class Dumbo {\n" +
+ " public class Clyde { }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"SUCCESS\");\n" +
+ " }\n" +
+ "}\n",
+ },
+ "SUCCESS");
+ // delete binary file Dumbo$Clyde (i.e. simulate removing it from classpath for subsequent compile)
+ new File(OUTPUT_DIR, "p" + File.separator + "Dumbo$Clyde.class").delete();
+
+ this.runConformTest(
+ new String[] {
+ "q/Main.java",
+ "package q;\n" +
+ "public class Main extends p.Dumbo {\n" +
+ " public static void main(String[] args) {\n" +
+ " p.Dumbo d;\n" +
+ " System.out.println(\"SUCCESS\");\n" +
+ " }\n" +
+ "}\n",
+ },
+ "SUCCESS",
+ null,
+ false,
+ null);
+}
+/*
+ * ensure that can still found binary member types at depth >=2 (enclosing name Dumbo$Clyde $ Fred)
+ */
+public void test045() {
+ this.runConformTest(
+ new String[] {
+ "p/Dumbo.java",
+ "package p;\n" +
+ "public class Dumbo {\n" +
+ " public class Clyde {\n" +
+ " public class Fred {\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"SUCCESS\");\n" +
+ " }\n" +
+ "}\n",
+ },
+ "SUCCESS");
+
+ this.runConformTest(
+ new String[] {
+ "q/Main.java",
+ "package q;\n" +
+ "public class Main extends p.Dumbo {\n" +
+ " public static void main(String[] args) {\n" +
+ " p.Dumbo.Clyde.Fred f;\n" +
+ " System.out.println(\"SUCCESS\");\n" +
+ " }\n" +
+ "}\n",
+ },
+ "SUCCESS",
+ null,
+ false,
+ null);
+}
+public void test046() {
this.runNegativeTest(
new String[] {
"X.java", //================================
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java
index 8d48f7f..7f90814 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java
@@ -35,26 +35,24 @@
public boolean acceptClassFiles(org.eclipse.jdt.internal.compiler.ClassFile[] classFiles, char[] codeSnippetClassName) {
if (jdiStackFrame == null) {
return super.acceptClassFiles(classFiles, codeSnippetClassName);
- } else {
- // Send but don't run
- super.acceptClassFiles(classFiles, null);
-
- // Run if needed
- if (codeSnippetClassName != null) {
- boolean success = jdiStackFrame.run(new String(codeSnippetClassName));
- if (success) {
- TargetInterface.Result result = target.getResult();
- if (result.displayString == null) {
- this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, null, null));
- } else {
- this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, result.displayString, result.typeName));
- }
- }
- return success;
- } else {
- return true;
- }
}
+ // Send but don't run
+ super.acceptClassFiles(classFiles, null);
+
+ // Run if needed
+ if (codeSnippetClassName != null) {
+ boolean success = jdiStackFrame.run(new String(codeSnippetClassName));
+ if (success) {
+ TargetInterface.Result result = target.getResult();
+ if (result.displayString == null) {
+ this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, null, null));
+ } else {
+ this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, result.displayString, result.typeName));
+ }
+ }
+ return success;
+ }
+ return true;
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java
index bceeb53..a24276d 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java
@@ -185,9 +185,8 @@
try {
if (this.breakpointLine == Integer.MAX_VALUE) {
return this.jdiThread.frame(1);
- } else {
- return this.jdiThread.frame(0);
}
+ return this.jdiThread.frame(0);
} catch (IncompatibleThreadStateException e) {
e.printStackTrace();
return null;
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java
index 3f7b7aa..9e5bd58 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java
@@ -35,9 +35,8 @@
testClasses.add(DebugEvaluationTest.class);
return AbstractCompilerTest.suite(TestAll.class.getName(), DebugEvaluationSetup.class, testClasses);
- } else {
- // Disable evaluation tests on Linux
- return new TestSuite(TestAll.class.getName());
}
+ // Disable evaluation tests on Linux
+ return new TestSuite(TestAll.class.getName());
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java
index 7b504fe..dba3483 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java
@@ -32,9 +32,8 @@
ClassLoader myLoader = getClass().getClassLoader();
if (myLoader == null) {
return Class.forName(name);
- } else {
- return myLoader.loadClass(name);
}
+ return myLoader.loadClass(name);
}
/**
* Loads the given class. If the class is known to this runner, returns it.
@@ -49,18 +48,15 @@
Class clazz = makeClass(name, resolve);
if (clazz == null) {
throw e;
- } else {
- return clazz;
}
- }
- } else {
- Class clazz = makeClass(name, resolve);
- if (clazz == null) {
- return delegateLoadClass(name);
- } else {
return clazz;
}
}
+ Class clazz = makeClass(name, resolve);
+ if (clazz == null) {
+ return delegateLoadClass(name);
+ }
+ return clazz;
}
/**
* Loads the given class either from the stored class definition or from the system.
@@ -92,19 +88,17 @@
Object o = this.loadedClasses.get(name);
if (o == null) {
return null;
- } else {
- if (o instanceof Class) {
- return (Class) o;
- } else {
- byte[] classDefinition = (byte[]) o;
- Class clazz = defineClass(null, classDefinition, 0, classDefinition.length);
- if (resolve) {
- resolveClass(clazz);
- }
- this.loadedClasses.put(name, clazz);
- return clazz;
- }
}
+ if (o instanceof Class) {
+ return (Class) o;
+ }
+ byte[] classDefinition = (byte[]) o;
+ Class clazz = defineClass(null, classDefinition, 0, classDefinition.length);
+ if (resolve) {
+ resolveClass(clazz);
+ }
+ this.loadedClasses.put(name, clazz);
+ return clazz;
}
/**
* Stores the given class definition for the given class.
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
index e684f0a..14cfe3b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java
@@ -182,63 +182,62 @@
if (length < 2 || !args[0].toLowerCase().equals("-evalport")) {
printUsage();
return;
- } else {
- int evalPort = Integer.parseInt(args[1]);
- String classPath = null;
- String bootPath = null;
- int mainClass = -1;
- for (int i = 2; i < length; i++) {
- String arg = args[i];
- if (arg.startsWith("-")) {
- if (arg.toLowerCase().equals("-cscp")) {
- if (++i < length) {
- classPath = args[i];
- } else {
- printUsage();
- return;
- }
- } else if (arg.toLowerCase().equals("-csbp")) {
- if (++i < length) {
- bootPath = args[i];
- } else {
- printUsage();
- return;
- }
+ }
+ int evalPort = Integer.parseInt(args[1]);
+ String classPath = null;
+ String bootPath = null;
+ int mainClass = -1;
+ for (int i = 2; i < length; i++) {
+ String arg = args[i];
+ if (arg.startsWith("-")) {
+ if (arg.toLowerCase().equals("-cscp")) {
+ if (++i < length) {
+ classPath = args[i];
+ } else {
+ printUsage();
+ return;
}
- } else {
- mainClass = i;
- break;
+ } else if (arg.toLowerCase().equals("-csbp")) {
+ if (++i < length) {
+ bootPath = args[i];
+ } else {
+ printUsage();
+ return;
+ }
}
- }
- theRunner = new CodeSnippetRunner(evalPort, classPath, bootPath);
- if (mainClass == -1) {
- theRunner.start();
} else {
- Thread server = new Thread() {
- public void run() {
- theRunner.start();
- }
- };
- server.setDaemon(true);
- server.start();
- int mainArgsLength = length-mainClass-1;
- String[] mainArgs = new String[mainArgsLength];
- System.arraycopy(args, mainClass+1, mainArgs, 0, mainArgsLength);
- try {
- Class clazz = Class.forName(args[mainClass]);
- Method mainMethod = clazz.getMethod("main", new Class[] {String[].class});
- mainMethod.invoke(null, new String[][] {mainArgs});
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- }
+ mainClass = i;
+ break;
}
- }
+ }
+ theRunner = new CodeSnippetRunner(evalPort, classPath, bootPath);
+ if (mainClass == -1) {
+ theRunner.start();
+ } else {
+ Thread server = new Thread() {
+ public void run() {
+ theRunner.start();
+ }
+ };
+ server.setDaemon(true);
+ server.start();
+ int mainArgsLength = length-mainClass-1;
+ String[] mainArgs = new String[mainArgsLength];
+ System.arraycopy(args, mainClass+1, mainArgs, 0, mainArgsLength);
+ try {
+ Class clazz = Class.forName(args[mainClass]);
+ Method mainMethod = clazz.getMethod("main", new Class[] {String[].class});
+ mainMethod.invoke(null, new String[][] {mainArgs});
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
}
private static void printUsage() {
System.out.println("Usage: java org.eclipse.jdt.tests.eval.target.CodeSnippetRunner -evalport <portNumber> [-options] [<mainClassName>] [<arguments>]");
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
index 5151fa2..017eede 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
@@ -47,18 +47,17 @@
}
private boolean isProxyRunning() {
- if (this.proxyProcess == null)
+ if (this.proxyProcess == null) {
return false;
- else {
- boolean hasExited;
- try {
- this.proxyProcess.exitValue();
- hasExited = true;
- } catch (IllegalThreadStateException e) {
- hasExited = false;
- }
- return !hasExited;
}
+ boolean hasExited;
+ try {
+ this.proxyProcess.exitValue();
+ hasExited = true;
+ } catch (IllegalThreadStateException e) {
+ hasExited = false;
+ }
+ return !hasExited;
}
/**
* @see LocalVirtualMachine#shutDown
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java
index e807b15..f8db749 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java
@@ -54,18 +54,15 @@
final String vmName = System.getProperty("java.vm.name");
if ("J9".equals(vmName)) {
return new J9VMLauncher();
- } else {
- File file = new File(Util.getJREDirectory() + "/lib/rt.jar");
- if (file.exists()) {
- return new StandardVMLauncher();
- } else {
- if ("IBM J9SE VM".equals(vmName)) {
- return new SideCarJ9VMLauncher();
- } else {
- return new SideCarVMLauncher();
- }
- }
}
+ File file = new File(Util.getJREDirectory() + "/lib/rt.jar");
+ if (file.exists()) {
+ return new StandardVMLauncher();
+ }
+ if ("IBM J9SE VM".equals(vmName)) {
+ return new SideCarJ9VMLauncher();
+ }
+ return new SideCarVMLauncher();
}
/**
* Builds the actual class path that is going to be passed to the VM.
@@ -187,9 +184,8 @@
public String[] getProgramArguments() {
if (this.evalPort != -1) {
return null;
- } else {
- return this.programArguments;
}
+ return this.programArguments;
}
/**
* Returns the dot-separated, fully qualified name of the class to run.
@@ -199,9 +195,8 @@
public String getProgramClass() {
if (this.evalPort != -1) {
return null;
- } else {
- return this.programClass;
}
+ return this.programClass;
}
/**
* Returns all the target VMs that are running at this launcher's target
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java
index 70df221..7fab571 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java
@@ -88,11 +88,10 @@
for (int i = 0; i < count; i++) {
if (file.delete()) {
break;
- } else {
- try {
- Thread.sleep(count * 100);
- } catch (InterruptedException e) {
- }
+ }
+ try {
+ Thread.sleep(count * 100);
+ } catch (InterruptedException e) {
}
}
if (file.exists()) {
@@ -129,8 +128,7 @@
public InputStream getErrorStream() throws TargetException {
if (this.process == null)
throw new TargetException("The VM is not running");
- else
- return this.process.getErrorStream();
+ return this.process.getErrorStream();
}
/**
* Returns an input stream that is connected to the standard output
@@ -150,9 +148,8 @@
public InputStream getInputStream() throws TargetException {
if (this.process == null)
throw new TargetException("The VM is not running");
- else
- // Workaround problem with input stream of a Process
- return new VMInputStream(this.process, this.process.getInputStream());
+ // Workaround problem with input stream of a Process
+ return new VMInputStream(this.process, this.process.getInputStream());
}
/**
* Returns an output stream that is connected to the standard input
@@ -172,8 +169,7 @@
public OutputStream getOutputStream() throws TargetException {
if (this.process == null)
throw new TargetException("The VM is not running");
- else
- return this.process.getOutputStream();
+ return this.process.getOutputStream();
}
/**
* Returns whether this target VM is still running.
@@ -182,18 +178,17 @@
* if it is still running.
*/
public boolean isRunning() {
- if (this.process == null)
+ if (this.process == null) {
return false;
- else {
- boolean hasExited;
- try {
- this.process.exitValue();
- hasExited = true;
- } catch (IllegalThreadStateException e) {
- hasExited = false;
- }
- return !hasExited;
}
+ boolean hasExited;
+ try {
+ this.process.exitValue();
+ hasExited = true;
+ } catch (IllegalThreadStateException e) {
+ hasExited = false;
+ }
+ return !hasExited;
}
/**
* Shuts down this target VM.
@@ -213,9 +208,8 @@
}
if (this.isRunning()) { // give up cleaning the target path if VM is still running
throw new TargetException("Could not shut the VM down");
- } else {
- this.cleanupTargetPath();
}
+ this.cleanupTargetPath();
}
/**
* Waits for the VM to shut down. This method returns
@@ -227,9 +221,7 @@
* interrupted.
*/
public void waitForTermination() throws InterruptedException {
- if (this.process == null)
- return;
- else
- this.process.waitFor();
+ if (this.process == null) return;
+ this.process.waitFor();
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java
index 99f9aba..42acb33 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java
@@ -30,18 +30,17 @@
this.input.close();
}
private boolean isRunning() {
- if (this.process == null)
+ if (this.process == null) {
return false;
- else {
- boolean hasExited;
- try {
- this.process.exitValue();
- hasExited = true;
- } catch (IllegalThreadStateException e) {
- hasExited = false;
- }
- return !hasExited;
}
+ boolean hasExited;
+ try {
+ this.process.exitValue();
+ hasExited = true;
+ } catch (IllegalThreadStateException e) {
+ hasExited = false;
+ }
+ return !hasExited;
}
public synchronized void mark(int readlimit) {
this.input.mark(readlimit);
@@ -55,9 +54,8 @@
} catch (IOException e) {
if (isRunning()) {
return read();
- } else {
- throw e;
}
+ throw e;
}
}
public int read(byte b[]) throws IOException {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
index 4df8110..9536b07 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
@@ -242,11 +242,10 @@
buffer.append("\"");
}
continue;
- } else {
- buffer.append("\" + \n");
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append("\"");
}
+ buffer.append("\" + \n");
+ for (int i = 0; i < indent; i++) buffer.append("\t");
+ buffer.append("\"");
} else {
continue;
}
@@ -385,25 +384,22 @@
String jreDir = getJREDirectory();
if (jreDir == null) {
return new String[] {};
- } else {
- final String vmName = System.getProperty("java.vm.name");
- if ("J9".equals(vmName)) {
- return new String[] { toNativePath(jreDir + "/lib/jclMax/classes.zip")};
- } else {
- File file = new File(jreDir + "/lib/rt.jar");
- if (file.exists()) {
- return new String[] {
- toNativePath(jreDir + "/lib/rt.jar")
- };
- } else {
- return new String[] {
- toNativePath(jreDir + "/lib/core.jar"),
- toNativePath(jreDir + "/lib/security.jar"),
- toNativePath(jreDir + "/lib/graphics.jar")
- };
- }
- }
}
+ final String vmName = System.getProperty("java.vm.name");
+ if ("J9".equals(vmName)) {
+ return new String[] { toNativePath(jreDir + "/lib/jclMax/classes.zip")};
+ }
+ File file = new File(jreDir + "/lib/rt.jar");
+ if (file.exists()) {
+ return new String[] {
+ toNativePath(jreDir + "/lib/rt.jar")
+ };
+ }
+ return new String[] {
+ toNativePath(jreDir + "/lib/core.jar"),
+ toNativePath(jreDir + "/lib/security.jar"),
+ toNativePath(jreDir + "/lib/graphics.jar")
+ };
}
public static String getJavaClassLibsAsString() {
String[] classLibs = getJavaClassLibs();
@@ -435,9 +431,8 @@
String container = System.getProperty("user.home");
if (container == null){
return null;
- } else {
- return toNativePath(container) + File.separator + OUTPUT_DIRECTORY;
}
+ return toNativePath(container) + File.separator + OUTPUT_DIRECTORY;
}
/**
* Returns the next available port number on the local host.
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 1327921..bc73521 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
@@ -60,7 +60,8 @@
// Unicode tests
protected static boolean unicode = false;
// Unix tests
- protected static boolean unix = false;
+ final boolean unix;
+ static final String UNIX_SUPPORT = System.getProperty("unix");
// Doc Comment support
static final String DOC_COMMENT_SUPPORT = System.getProperty("doc.support");
final String docCommentSupport;
@@ -91,15 +92,16 @@
* @param name
* @param support
*/
- public ASTConverterJavadocTest(String name, String support) {
+ public ASTConverterJavadocTest(String name, String support, String unix) {
super(name);
this.docCommentSupport = support;
+ this.unix = "true".equals(unix);
}
/**
* @param name
*/
public ASTConverterJavadocTest(String name) {
- this(name, JavaCore.ENABLED);
+ this(name, JavaCore.ENABLED, UNIX_SUPPORT);
}
public static Test suite() {
@@ -108,10 +110,10 @@
// if ("true".equals(param)) {
// unicode = true;
// }
- String param = System.getProperty("unix");
- if ("true".equals(param)) {
- unix = true;
- }
+// String param = System.getProperty("unix");
+// if ("true".equals(param)) {
+// unix = true;
+// }
if (true) {
if (DOC_COMMENT_SUPPORT == null) {
buildSuite(suite, JavaCore.ENABLED);
@@ -125,9 +127,7 @@
// Run test cases subset
System.err.println("WARNING: only subset of tests will be executed!!!");
- suite.addTest(new ASTConverterJavadocTest("testBug51600"));
- suite.addTest(new ASTConverterJavadocTest("testBug51617"));
- suite.addTest(new ASTConverterJavadocTest("testBug54424"));
+ suite.addTest(new ASTConverterJavadocTest("testBug51660"));
return suite;
}
@@ -136,7 +136,15 @@
Method[] methods = c.getMethods();
for (int i = 0, max = methods.length; i < max; i++) {
if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTConverterJavadocTest(methods[i].getName(), support));
+ suite.addTest(new ASTConverterJavadocTest(methods[i].getName(), support, UNIX_SUPPORT));
+ }
+ }
+ // when unix support not specified, also run using unix format
+ if (UNIX_SUPPORT == null) {
+ for (int i = 0, max = methods.length; i < max; i++) {
+ if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
+ suite.addTest(new ASTConverterJavadocTest(methods[i].getName(), support, "true"));
+ }
}
}
}
@@ -145,7 +153,8 @@
* @see junit.framework.TestCase#getName()
*/
public String getName() {
- return "Doc "+this.docCommentSupport+" - "+super.getName();
+ String strUnix = this.unix ? " - Unix" : "";
+ return "Doc "+this.docCommentSupport+strUnix+" - "+super.getName();
}
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
@@ -670,9 +679,8 @@
char[] result = new char[u];
System.arraycopy(unicodeSource, 0, result, 0, u);
return result;
- } else {
- return unicodeSource;
}
+ return unicodeSource;
}
/*
@@ -697,9 +705,8 @@
char[] result = new char[u];
System.arraycopy(unixSource, 0, result, 0, u);
return result;
- } else {
- return unixSource;
}
+ return unixSource;
}
/*
@@ -1078,8 +1085,41 @@
MethodRef methodRef = (MethodRef) fragment;
previousBinding = methodRef.resolveBinding();
if (previousBinding != null) {
- assumeNotNull(this.prefix+""+methodRef.getName()+" binding was not found!", methodRef.getName().resolveBinding());
- verifyNameBindings(methodRef.getQualifier());
+ IBinding methNameBinding = methodRef.getName().resolveBinding();
+ Name methodQualifier = methodRef.getQualifier();
+ // TODO (frederic) Replace the two following lines by commented block when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650 will be fixed
+ assumeNotNull(this.prefix+""+methodRef.getName()+" binding was not found!",methNameBinding);
+ verifyNameBindings(methodQualifier);
+ /*
+ if (methodQualifier == null) {
+ if (methNameBinding == null) {
+ char firstChar = methodRef.getName().getIdentifier().charAt(0);
+ if (Character.isUpperCase(firstChar)) {
+ // assume that selector starting with uppercase is for constructor => signal that binding is null
+ System.out.println(this.prefix+"Binding for selector of '"+methodRef+"' is null.");
+ }
+ } else {
+ if (methNameBinding.getName().equals(methodRef.getName().getIdentifier())) { // binding is not null only for constructor
+ assumeNotNull(this.prefix+""+methodRef.getName()+" binding was not found!",methNameBinding);
+ } else {
+ assumeNull(this.prefix+""+methodRef.getName()+" binding should be null!", methNameBinding);
+ }
+ }
+ } else {
+ SimpleName methodSimpleType = null;
+ if (methodQualifier.isQualifiedName()) {
+ methodSimpleType = ((QualifiedName)methodQualifier).getName();
+ } else {
+ methodSimpleType = (SimpleName) methodQualifier;
+ }
+ if (methodSimpleType.getIdentifier().equals(methodRef.getName().getIdentifier())) { // binding is not null only for constructor
+ assumeNotNull(this.prefix+""+methodRef.getName()+" binding was not found!",methNameBinding);
+ } else {
+ assumeNull(this.prefix+""+methodRef.getName()+" binding should be null!", methNameBinding);
+ }
+ verifyNameBindings(methodRef.getQualifier());
+ }
+ */
Iterator parameters = methodRef.parameters().listIterator();
while (parameters.hasNext()) {
MethodRefParameter param = (MethodRefParameter) parameters.next();
@@ -1208,7 +1248,9 @@
if (length > 0) {
problems.append(" - "+this.prefix+length+" problems:"); //$NON-NLS-1$
for (int i = 0; i < problemsList.length; i++) {
- problems.append(" + "+problemsList[i]);
+ problems.append(" + ");
+ problems.append(problemsList[i]);
+ problems.append("\n");
}
}
}
@@ -1846,6 +1888,7 @@
*/
public void testBug53075() throws JavaModelException {
ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug53075", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ boolean pb = this.packageBinding;
this.packageBinding = false;
CompilationUnit compilUnit = verifyComments(unit);
if (this.docCommentSupport.equals(JavaCore.ENABLED)) {
@@ -1857,6 +1900,7 @@
tagElement = (TagElement) docComment.tags().get(1);
assumeEquals("Wrong tag type!", TagElement.TAG_LINKPLAIN, tagElement.getTagName());
}
+ this.packageBinding = pb;
}
/**
@@ -1919,4 +1963,152 @@
}
this.stopOnFailure = true;
}
+
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=63044
+ */
+ public void testBug63044() throws JavaModelException {
+ verifyComments("testBug63044");
+ }
+
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51660
+ */
+ public void testBug51660() throws JavaModelException {
+ this.stopOnFailure = false;
+ ICompilationUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug51660", "Test.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ CompilationUnit compilUnit = verifyComments(unit);
+ if (this.docCommentSupport.equals(JavaCore.ENABLED)) {
+ String[] tagNames = {
+ "@ejb",
+ "@ejb\"bean test non-java id character '\"",
+ "@ejb",
+ "@ejb",
+ "@ejb",
+ "@ejb",
+ "@ejb(bean",
+ "@ejb)bean",
+ "@ejb*bean",
+ "@ejb+bean",
+ "@ejb,bean",
+ "@ejb",
+ "@ejb.bean",
+ "@ejb/bean",
+ "@ejb",
+ "@ejb;bean",
+ "@ejb",
+ "@ejb=bean",
+ "@ejb",
+ "@ejb?bean",
+ "@ejb@bean",
+ "@ejb[bean",
+ "@ejb\\bean",
+ "@ejb]bean",
+ "@ejb^bean",
+ "@ejb`bean",
+ "@ejb{bean",
+ "@ejb|bean",
+ "@ejb",
+ "@ejb~bean",
+ "@ejb¦bean",
+ "@ejb§bean",
+ "@ejb¨bean",
+ "@ejb©bean",
+ "@ejb«bean",
+ "@ejb¬bean",
+ "@ejbbean",
+ "@ejb®bean",
+ "@ejb¯bean",
+ "@ejb°bean",
+ "@ejb±bean",
+ "@ejb²bean",
+ "@ejb³bean",
+ "@ejb´bean",
+ "@ejb¶bean",
+ "@ejb·bean",
+ "@ejb¸bean",
+ "@ejb¹bean",
+ "@ejb»bean",
+ "@ejb¼bean",
+ "@ejb½bean",
+ "@ejb¾bean",
+ "@ejb¿bean",
+ "@ejb×bean",
+ "@ejb÷bean",
+ "@unknown"
+ };
+ String[] tagTexts = {
+ "!bean test non-java id character '!' (val=33) in tag name",
+ "' (val=34) in tag name",
+ "#bean test non-java id character '#' (val=35) in tag name",
+ "%bean test non-java id character '%' (val=37) in tag name",
+ "&bean test non-java id character '&' (val=38) in tag name",
+ "'bean test non-java id character ''' (val=39) in tag name",
+ " test non-java id character '(' (val=40) in tag name",
+ " test non-java id character ')' (val=41) in tag name",
+ " test non-java id character '*' (val=42) in tag name",
+ " test non-java id character '+' (val=43) in tag name",
+ " test non-java id character ',' (val=44) in tag name",
+ "-bean test non-java id character '-' (val=45) in tag name",
+ " test non-java id character '.' (val=46) in tag name",
+ " test non-java id character '/' (val=47) in tag name",
+ ":bean test non-java id character ':' (val=58) in tag name",
+ " test non-java id character ';' (val=59) in tag name",
+ "<bean test non-java id character '<' (val=60) in tag name",
+ " test non-java id character '=' (val=61) in tag name",
+ ">bean test non-java id character '>' (val=62) in tag name",
+ " test non-java id character '?' (val=63) in tag name",
+ " test non-java id character '@' (val=64) in tag name",
+ " test non-java id character '[' (val=91) in tag name",
+ " test non-java id character '\\' (val=92) in tag name",
+ " test non-java id character ']' (val=93) in tag name",
+ " test non-java id character '^' (val=94) in tag name",
+ " test non-java id character '`' (val=96) in tag name",
+ " test non-java id character '{' (val=123) in tag name",
+ " test non-java id character '|' (val=124) in tag name",
+ "}bean test non-java id character '}' (val=125) in tag name",
+ " test non-java id character '~' (val=126) in tag name",
+ " test non-java id character '¦' (val=166) in tag name",
+ " test non-java id character '§' (val=167) in tag name",
+ " test non-java id character '¨' (val=168) in tag name",
+ " test non-java id character '©' (val=169) in tag name",
+ " test non-java id character '«' (val=171) in tag name",
+ " test non-java id character '¬' (val=172) in tag name",
+ " test non-java id character '' (val=173) in tag name",
+ " test non-java id character '®' (val=174) in tag name",
+ " test non-java id character '¯' (val=175) in tag name",
+ " test non-java id character '°' (val=176) in tag name",
+ " test non-java id character '±' (val=177) in tag name",
+ " test non-java id character '²' (val=178) in tag name",
+ " test non-java id character '³' (val=179) in tag name",
+ " test non-java id character '´' (val=180) in tag name",
+ " test non-java id character '¶' (val=182) in tag name",
+ " test non-java id character '·' (val=183) in tag name",
+ " test non-java id character '¸' (val=184) in tag name",
+ " test non-java id character '¹' (val=185) in tag name",
+ " test non-java id character '»' (val=187) in tag name",
+ " test non-java id character '¼' (val=188) in tag name",
+ " test non-java id character '½' (val=189) in tag name",
+ " test non-java id character '¾' (val=190) in tag name",
+ " test non-java id character '¿' (val=191) in tag name",
+ " test non-java id character '×' (val=215) in tag name",
+ " test non-java id character '÷' (val=247) in tag name",
+ " test java id"
+ };
+ Comment comment = (Comment) compilUnit.getCommentList().get(0);
+ assumeTrue(this.prefix+"Comment should be a javadoc comment ", comment.isDocComment());
+ Javadoc docComment = (Javadoc) comment;
+ int size = docComment.tags().size();
+ for (int i=0; i<size; i++) {
+ TagElement tagElement = (TagElement) docComment.tags().get(i);
+ assumeEquals("Wrong tag name for:"+tagElement, tagNames[i], tagElement.getTagName());
+ assumeEquals("Wrong fragments size for :"+tagElement, 1, tagElement.fragments().size());
+ ASTNode fragment = (ASTNode) tagElement.fragments().get(0);
+ assumeEquals("Wrong fragments type for :"+tagElement, ASTNode.TEXT_ELEMENT, fragment.getNodeType());
+ TextElement textElement = (TextElement) fragment;
+ assumeEquals("Wrong text for tag!", tagTexts[i], textElement.getText());
+ }
+ }
+ this.stopOnFailure = true;
+ }
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java
index 8cca48d..a6cce59 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java
@@ -252,9 +252,8 @@
this.superMatchResult = matchResult;
if (superMatch) {
return this.superMatchResult;
- } else {
- return this.result;
}
+ return this.result;
}
public boolean match(AnnotationTypeDeclaration node, Object other) {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
index 0a1a46a..0faae6a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
@@ -61,15 +61,14 @@
if (!jclDir.mkdir()) {
//mkdir failed
throw new IOException("Could not create the directory " + jclDir); //$NON-NLS-1$
- } else {
- //copy the two files to the JCL directory
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + "converterJclMin.jar"); //$NON-NLS-1$
- copy(resourceJCLMin, jclMin);
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + "converterJclMinsrc.zip"); //$NON-NLS-1$
- copy(resourceJCLMinsrc, jclMinsrc);
}
+ //copy the two files to the JCL directory
+ java.io.File resourceJCLMin =
+ new java.io.File(resourceJCLDir + separator + "converterJclMin.jar"); //$NON-NLS-1$
+ copy(resourceJCLMin, jclMin);
+ java.io.File resourceJCLMinsrc =
+ new java.io.File(resourceJCLDir + separator + "converterJclMinsrc.zip"); //$NON-NLS-1$
+ copy(resourceJCLMinsrc, jclMinsrc);
} else {
//check that the two files, jclMin.jar and jclMinsrc.zip are present
//copy either file that is missing or less recent than the one in workspace
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
index 855b41a..e6074a3 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
@@ -55,7 +55,7 @@
return new Suite(FormatterRegressionTests.class);
}
junit.framework.TestSuite suite = new Suite(FormatterRegressionTests.class.getName());
- suite.addTest(new FormatterRegressionTests("test499")); //$NON-NLS-1$
+ suite.addTest(new FormatterRegressionTests("test500")); //$NON-NLS-1$
return suite;
}
@@ -260,9 +260,8 @@
String result = new String(CharOperation.subarray(source, astNode.getStartPosition() + 1, astNode.getStartPosition() + astNode.getLength() - 1));
if (result.endsWith("\\n")) {
return result.substring(0, result.length() - 2) + LINE_SEPARATOR;
- } else {
- return result;
}
+ return result;
}
public void test001() {
@@ -6456,4 +6455,11 @@
DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
runTest(codeFormatter, "test499", "A.java", CodeFormatter.K_COMPILATION_UNIT, true);//$NON-NLS-1$ //$NON-NLS-2$
}
+
+ public void test500() {
+ Map options = DefaultCodeFormatterConstants.getDefaultSettings();
+ DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
+ DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
+ runTest(codeFormatter, "test500", "A.java", CodeFormatter.K_COMPILATION_UNIT, false);//$NON-NLS-1$ //$NON-NLS-2$
+ }
}
\ No newline at end of file
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 1c94f05..7e04286 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
@@ -159,7 +159,7 @@
protected void assertSearchResults(String message, String expected, Object collector) {
String actual = collector.toString();
if (!expected.equals(actual)) {
- System.out.print(org.eclipse.jdt.core.tests.util.Util.displayString(actual, 2));
+ System.out.print(displayString(actual, 2));
System.out.println(",");
}
assertEquals(
@@ -196,7 +196,12 @@
StringBuffer buffer = new StringBuffer();
if (elements != null) {
for (int i = 0, length = elements.length; i < length; i++){
- buffer.append(((JavaElement)elements[i]).toStringWithAncestors());
+ JavaElement element = (JavaElement)elements[i];
+ if (element == null) {
+ buffer.append("<null>");
+ } else {
+ buffer.append(element.toStringWithAncestors());
+ }
if (i != length-1) buffer.append("\n");
}
} else {
@@ -729,9 +734,8 @@
IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
if (pkg == null) {
return null;
- } else {
- return pkg.getClassFile(className);
}
+ return pkg.getClassFile(className);
}
protected ICompilationUnit getCompilationUnit(String path) {
return (ICompilationUnit)JavaCore.create(getFile(path));
@@ -744,9 +748,8 @@
IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
if (pkg == null) {
return null;
- } else {
- return pkg.getCompilationUnit(cuName);
}
+ return pkg.getCompilationUnit(cuName);
}
/**
* Returns the specified compilation unit in the given project, root, and
@@ -756,9 +759,8 @@
IPackageFragment pkg= getPackageFragment(projectName, rootPath, packageName);
if (pkg == null) {
return null;
- } else {
- return pkg.getCompilationUnits();
}
+ return pkg.getCompilationUnits();
}
protected ICompilationUnit getCompilationUnitFor(IJavaElement element) {
@@ -797,9 +799,8 @@
if (delta != null) {
if (returnFirst) {
return delta;
- } else {
- result = delta;
}
+ result = delta;
}
}
return result;
@@ -851,9 +852,8 @@
if (elements.length == 0) return null;
if (elements[0] instanceof ILocalVariable) {
return (ILocalVariable)elements[0];
- } else {
- return null;
}
+ return null;
}
/**
* Returns the specified package fragment in the given project and root, or
@@ -865,9 +865,8 @@
IPackageFragmentRoot root= getPackageFragmentRoot(projectName, rootPath);
if (root == null) {
return null;
- } else {
- return root.getPackageFragment(packageName);
}
+ return root.getPackageFragment(packageName);
}
/**
* Returns the specified package fragment root in the given project, or
@@ -950,12 +949,12 @@
CharOperation.replace(
displayString.toCharArray(),
getExternalJCLPath().toString().toCharArray(),
- ("\"+ getExternalJCLPath() +\"").toCharArray());
+ ("\"+ getExternalJCLPath() + \"").toCharArray());
toDisplay =
CharOperation.replace(
toDisplay,
getExternalJCLSourcePath().toString().toCharArray(),
- ("\"+ getExternalJCLSourcePath() +\"").toCharArray());
+ ("\"+ getExternalJCLSourcePath() + \"").toCharArray());
return new String(toDisplay);
}
public byte[] read(java.io.File file) throws java.io.IOException {
@@ -984,19 +983,17 @@
if (delta == null) {
return null;
- } else {
- if (delta.getElement().equals(element)) {
- return delta;
- } else {
- for (int i= 0; i < delta.getAffectedChildren().length; i++) {
- IJavaElementDelta child= searchForDelta(element, delta.getAffectedChildren()[i]);
- if (child != null) {
- return child;
- }
- }
- return null;
+ }
+ if (delta.getElement().equals(element)) {
+ return delta;
+ }
+ for (int i= 0; i < delta.getAffectedChildren().length; i++) {
+ IJavaElementDelta child= searchForDelta(element, delta.getAffectedChildren()[i]);
+ if (child != null) {
+ return child;
}
}
+ return null;
}
protected void search(IJavaElement element, int limitTo, IJavaSearchScope scope, SearchRequestor requestor) throws CoreException {
new SearchEngine().search(
@@ -1052,15 +1049,14 @@
if (!jclDir.mkdir()) {
//mkdir failed
throw new IOException("Could not create the directory " + jclDir);
- } else {
- //copy the two files to the JCL directory
- java.io.File resourceJCLMin =
- new java.io.File(resourceJCLDir + separator + "jclMin.jar");
- copy(resourceJCLMin, jclMin);
- java.io.File resourceJCLMinsrc =
- new java.io.File(resourceJCLDir + separator + "jclMinsrc.zip");
- copy(resourceJCLMinsrc, jclMinsrc);
}
+ //copy the two files to the JCL directory
+ java.io.File resourceJCLMin =
+ new java.io.File(resourceJCLDir + separator + "jclMin.jar");
+ copy(resourceJCLMin, jclMin);
+ java.io.File resourceJCLMinsrc =
+ new java.io.File(resourceJCLDir + separator + "jclMinsrc.zip");
+ copy(resourceJCLMinsrc, jclMinsrc);
} else {
//check that the two files, jclMin.jar and jclMinsrc.zip are present
//copy either file that is missing or less recent than the one in workspace
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
index 1c7f5ce..e446767 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
@@ -79,7 +79,7 @@
}
public static Test suite() {
return buildTestSuite(ClasspathTests.class);
-// return buildTestSuite(ClasspathTests.class, "testClasspathValidation", null);
+ //return buildTestSuite(ClasspathTests.class, "testClasspathValidation02", null);
}
protected void assertCycleMarkers(IJavaProject project, IJavaProject[] p, int[] expectedCycleParticipants) throws CoreException {
waitForAutoBuild();
@@ -1592,6 +1592,71 @@
}
}
/**
+ * 62713 - check nested output folder detection
+ */
+public void testClasspathValidation39() throws CoreException {
+ try {
+ IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
+ IClasspathEntry[] originalCP = proj.getRawClasspath();
+
+ IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+2];
+ System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
+ newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P"), new IPath[]{new Path("test/")}, new Path("/P/bin/test"));
+ newCP[originalCP.length+1] = JavaCore.newSourceEntry(new Path("/P/test"), new IPath[]{}, new Path("/P/bin"));
+
+ IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
+
+ assertStatus(
+ "Cannot nest output folder \'P/bin/test\' inside output folder \'P/bin\'.",
+ status);
+ } finally {
+ this.deleteProject("P");
+ }
+}
+/**
+ * 62713 - variation
+ */
+public void testClasspathValidation40() throws CoreException {
+ try {
+ IJavaProject proj = this.createJavaProject("P", new String[] {}, "");
+ IClasspathEntry[] originalCP = proj.getRawClasspath();
+
+ IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+2];
+ System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
+ newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P"), new IPath[]{new Path("test/")}, new Path("/P/bin"));
+ newCP[originalCP.length+1] = JavaCore.newSourceEntry(new Path("/P/test"), new IPath[]{}, new Path("/P/bin/test"));
+
+ IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
+
+ assertStatus(
+ "Cannot nest output folder \'P/bin/test\' inside output folder \'P/bin\'.",
+ status);
+ } finally {
+ this.deleteProject("P");
+ }
+}
+/**
+ * 62713 - variation
+ */
+public void testClasspathValidation41() throws CoreException {
+ try {
+ IJavaProject proj = this.createJavaProject("P", new String[] {}, "bin");
+ IClasspathEntry[] originalCP = proj.getRawClasspath();
+
+ IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+1];
+ System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
+ newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src"), new IPath[]{}, new Path("/P/"));
+
+ IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
+
+ assertStatus(
+ "Cannot nest \'P/src\' inside output folder \'P/\'.",
+ status);
+ } finally {
+ this.deleteProject("P");
+ }
+}
+/**
* Setting the classpath with two entries specifying the same path
* should fail.
*/
@@ -2134,7 +2199,7 @@
}
}
/**
- * Ensure that reading an empty custom putput from the .classpath returns a non-null output location.
+ * Ensure that reading an empty custom output from the .classpath returns a non-null output location.
* (regression test for 28531 Classpath Entry: Output folder can not be set to project)
*/
public void testReadEmptyCustomOutput() throws CoreException {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
index a7a2e11..dcedb9c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CodeCorrectionTests.java
@@ -101,32 +101,31 @@
suite.addTest(new CodeCorrectionTests("testCorrectMethod1"));
return suite;
- } else {
- suite.addTest(new CodeCorrectionTests("testCorrectFieldType1"));
- suite.addTest(new CodeCorrectionTests("testCorrectFieldType2"));
- suite.addTest(new CodeCorrectionTests("testCorrectFieldType3"));
- suite.addTest(new CodeCorrectionTests("testCorrectLocalVariableType1"));
- suite.addTest(new CodeCorrectionTests("testCorrectLocalVariableType2"));
- suite.addTest(new CodeCorrectionTests("testCorrectImport1"));
- suite.addTest(new CodeCorrectionTests("testCorrectImport2"));
- suite.addTest(new CodeCorrectionTests("testCorrectImport3"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperClass1"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperClass2"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface1"));
- suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface2"));
- suite.addTest(new CodeCorrectionTests("testCorrectException1"));
- suite.addTest(new CodeCorrectionTests("testCorrectException2"));
- suite.addTest(new CodeCorrectionTests("testCorrectMethod1"));
- suite.addTest(new CodeCorrectionTests("testCorrectMethod2"));
- suite.addTest(new CodeCorrectionTests("testCorrectField1"));
- suite.addTest(new CodeCorrectionTests("testCorrectField2"));
- suite.addTest(new CodeCorrectionTests("testCorrectLocalVariable1"));
- suite.addTest(new CodeCorrectionTests("testCorrectArgument1"));
- suite.addTest(new CodeCorrectionTests("testCorrectReturnType1"));
- suite.addTest(new CodeCorrectionTests("testCorrectReturnType2"));
-
- return suite;
}
+ suite.addTest(new CodeCorrectionTests("testCorrectFieldType1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectFieldType2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectFieldType3"));
+ suite.addTest(new CodeCorrectionTests("testCorrectLocalVariableType1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectLocalVariableType2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectImport1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectImport2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectImport3"));
+ suite.addTest(new CodeCorrectionTests("testCorrectSuperClass1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectSuperClass2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectSuperInterface2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectException1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectException2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectMethod1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectMethod2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectField1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectField2"));
+ suite.addTest(new CodeCorrectionTests("testCorrectLocalVariable1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectArgument1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectReturnType1"));
+ suite.addTest(new CodeCorrectionTests("testCorrectReturnType2"));
+
+ return suite;
}
public void testCorrectFieldType1() throws JavaModelException {
CorrectionEngine engine = new CorrectionEngine(JavaCore.getOptions());
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java
index ea90e0f..c8eb3ea 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java
@@ -164,9 +164,8 @@
if (name.equals(original.getParent().getElementName())) {
//method is a constructor
return ((IType) container).getMethod(container.getElementName(), ((IMethod) original).getParameterTypes());
- } else {
- return ((IType) container).getMethod(name, ((IMethod) original).getParameterTypes());
}
+ return ((IType) container).getMethod(name, ((IMethod) original).getParameterTypes());
case IJavaElement.FIELD :
return ((IType) container).getField(name);
case IJavaElement.TYPE :
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java
index 9ad0f25..75dc32c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/DefaultJavaElementComparator.java
@@ -172,30 +172,26 @@
}
if (Flags.isStatic(methodDeclaration.getModifiers())) {
return this.categories[STATIC_METHOD_CATEGORY];
- } else {
- return this.categories[METHOD_CATEGORY];
}
+ return this.categories[METHOD_CATEGORY];
case ASTNode.FIELD_DECLARATION :
FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
if (Flags.isStatic(fieldDeclaration.getModifiers())) {
return this.categories[STATIC_FIELD_CATEGORY];
- } else {
- return this.categories[FIELD_CATEGORY];
}
+ return this.categories[FIELD_CATEGORY];
case ASTNode.TYPE_DECLARATION :
TypeDeclaration typeDeclaration = (TypeDeclaration) node;
if (Flags.isStatic(typeDeclaration.getModifiers())) {
return this.categories[STATIC_TYPE_CATEGORY];
- } else {
- return this.categories[TYPE_CATEGORY];
}
+ return this.categories[TYPE_CATEGORY];
case ASTNode.INITIALIZER :
Initializer initializer = (Initializer) node;
if (Flags.isStatic(initializer.getModifiers())) {
return this.categories[STATIC_INITIALIZER_CATEGORY];
- } else {
- return this.categories[INITIALIZER_CATEGORY];
}
+ return this.categories[INITIALIZER_CATEGORY];
}
return 0;
}
@@ -291,9 +287,8 @@
private String buildSignature(Name name) {
if (name.isSimpleName()) {
return ((SimpleName) name).getIdentifier();
- } else {
- QualifiedName qualifiedName = (QualifiedName) name;
- return buildSignature(qualifiedName.getQualifier()) + "." + buildSignature(qualifiedName.getName()); //$NON-NLS-1$
}
+ QualifiedName qualifiedName = (QualifiedName) name;
+ return buildSignature(qualifiedName.getQualifier()) + "." + buildSignature(qualifiedName.getName()); //$NON-NLS-1$
}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
index 98aeb13..c6bd640 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java
@@ -135,6 +135,7 @@
suite.addTest(new JavaElementDeltaTests("testAddCuInDefaultPkg2"));
suite.addTest(new JavaElementDeltaTests("testMoveCuInEnclosingPkg"));
suite.addTest(new JavaElementDeltaTests("testCompilationUnitRemoveAndAdd"));
+ suite.addTest(new JavaElementDeltaTests("testAddCuAfterProjectOpen"));
// commit/save working copies
suite.addTest(new JavaElementDeltaTests("testModifyMethodBodyAndSave"));
@@ -277,6 +278,43 @@
}
}
/*
+ * Add cu after opening its project
+ * (regression test for 56870 copied file not shown in package explorer / java browser [ccp])
+ */
+public void testAddCuAfterProjectOpen() throws CoreException {
+ try {
+ IJavaProject p1 = this.createJavaProject("P1", new String[] {"src"}, "bin");
+ IJavaProject p2 = this.createJavaProject("P2", new String[] {"src"}, "bin");
+ this.createFile("P2/src/X.java",
+ "public class X {\n" +
+ "}");
+ IProject project = p2.getProject();
+ project.close(null);
+
+ // invalidate roots
+ p1.setRawClasspath(new IClasspathEntry[] {}, null);
+
+ // open project
+ project.open(null);
+
+ this.startDeltas();
+ this.createFile("P2/src/Y.java",
+ "public class Y {\n" +
+ "}");
+ assertDeltas(
+ "Unexpected delta",
+ "P2[*]: {CHILDREN}\n" +
+ " src[*]: {CHILDREN}\n" +
+ " <default>[*]: {CHILDREN}\n" +
+ " Y.java[+]: {}"
+ );
+ } finally {
+ this.stopDeltas();
+ this.deleteProject("P1");
+ this.deleteProject("P2");
+ }
+}
+/*
* Add the .classpath file to a Java project that was missing it.
* (regression test for bug 26128 packages don't appear in package explorer view)
*/
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 6347938..91b432e 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
@@ -92,7 +92,6 @@
}
public static void buildSuite(TestSuite suite, String support) {
-// TestSuite suite = new Suite("Doc "+support);
// Tests on type declarations
suite.addTest(new JavaSearchJavadocTests("testJavadocTypeDeclaration", support));
suite.addTest(new JavaSearchJavadocTests("testJavadocTypeDeclarationWithJavadoc", support));
@@ -154,8 +153,6 @@
suite.addTest(new JavaSearchJavadocTests("testBug49994constructor", support));
suite.addTest(new JavaSearchJavadocTests("testBug54962"));
suite.addTest(new JavaSearchJavadocTests("testBug54962qualified"));
-
-// return suite;
}
/* (non-Javadoc)
@@ -174,7 +171,6 @@
buffer.append(token);
}
}
-// System.out.println(getName()+" - Expected: "+buffer.toString());
super.assertSearchResults(message, buffer.toString(), collector);
}
}
@@ -212,22 +208,18 @@
}
public void testJavadocTypeDeclarationWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- type,
- DECLARATIONS,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocSearched.java j1.JavadocSearched [JavadocSearched] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ type,
+ DECLARATIONS,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocSearched.java j1.JavadocSearched [JavadocSearched] EXACT_MATCH",
+ result);
}
/*
@@ -266,22 +258,18 @@
public void testJavadocFieldDeclarationWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
IField field = type.getField("javadocSearchedVar");
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- field,
- DECLARATIONS,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocSearched.java j1.JavadocSearched.javadocSearchedVar [javadocSearchedVar] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ field,
+ DECLARATIONS,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocSearched.java j1.JavadocSearched.javadocSearchedVar [javadocSearchedVar] EXACT_MATCH",
+ result);
}
/*
@@ -335,43 +323,35 @@
}
public void testJavadocMethodDeclarationWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- IMethod method = type.getMethod("javadocSearchedMethod", null);
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- method,
- DECLARATIONS,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocSearched.java void j1.JavadocSearched.javadocSearchedMethod() [javadocSearchedMethod] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ IMethod method = type.getMethod("javadocSearchedMethod", null);
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ method,
+ DECLARATIONS,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocSearched.java void j1.JavadocSearched.javadocSearchedMethod() [javadocSearchedMethod] EXACT_MATCH",
+ result);
}
public void testJavadocMethodArgDeclarationWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- IMethod method = type.getMethod("javadocSearchedMethod", new String[] { "QString;" });
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- method,
- DECLARATIONS,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocSearched.java void j1.JavadocSearched.javadocSearchedMethod(String) [javadocSearchedMethod] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ IMethod method = type.getMethod("javadocSearchedMethod", new String[] { "QString;" });
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ method,
+ DECLARATIONS,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocSearched.java void j1.JavadocSearched.javadocSearchedMethod(String) [javadocSearchedMethod] EXACT_MATCH",
+ result);
}
/*
@@ -428,61 +408,53 @@
}
public void testJavadocTypeReferenceWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- type,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [j1.JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [j1.JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ type,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [j1.JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [j1.JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
+ result);
}
public void testJavadocTypeStringReferenceWithJavadoc() throws CoreException {
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- "JavadocSearched",
- TYPE,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ "JavadocSearched",
+ TYPE,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n"+
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
+ result);
}
/*
@@ -524,44 +496,36 @@
public void testJavadocFieldReferenceWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
IField field = type.getField("javadocSearchedVar");
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- field,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedVar] POTENTIAL_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedVar] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ field,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedVar] POTENTIAL_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedVar] EXACT_MATCH",
+ result);
}
public void testJavadocFieldStringReferenceWithJavadoc() throws CoreException {
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- "javadocSearchedVar",
- FIELD,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedVar] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedVar] POTENTIAL_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedVar] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ "javadocSearchedVar",
+ FIELD,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedVar] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedVar] POTENTIAL_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedVar] EXACT_MATCH",
+ result);
}
/*
@@ -618,66 +582,54 @@
}
public void testJavadocMethodReferenceWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- IMethod method = type.getMethod("javadocSearchedMethod", null);
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- method,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedMethod] POTENTIAL_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ IMethod method = type.getMethod("javadocSearchedMethod", null);
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ method,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedMethod] POTENTIAL_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH",
+ result);
}
public void testJavadocMethodArgReferenceWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- IMethod method = type.getMethod("javadocSearchedMethod", new String[] { "QString;" });
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- method,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ IMethod method = type.getMethod("javadocSearchedMethod", new String[] { "QString;" });
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ method,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH",
+ result);
}
public void testJavadocMethodStringReferenceWithJavadoc() throws CoreException {
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- "javadocSearchedMethod",
- METHOD,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedMethod] EXACT_MATCH\n" +
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedMethod] EXACT_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ "javadocSearchedMethod",
+ METHOD,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedMethod] EXACT_MATCH\n" +
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [javadocSearchedMethod] EXACT_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [javadocSearchedMethod] EXACT_MATCH",
+ result);
}
/*
@@ -732,64 +684,70 @@
}
public void testJavadocConstructorReferenceWithJavadoc() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- IMethod method = type.getMethod("JavadocSearched", null);
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- method,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
- }
- public void testJavadocConstructorArgReferenceWithJavadoc() throws CoreException {
- IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
-// try {
- setJavadocOptions();
- IMethod method = type.getMethod("JavadocSearched", new String[] { "QString;" });
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- method,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
- }
- public void testJavadocConstructorStringReferenceWithJavadoc() throws CoreException {
-// try {
- setJavadocOptions();
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- "JavadocSearched",
- CONSTRUCTOR,
+ setJavadocOptions();
+ IMethod method = type.getMethod("JavadocSearched", null);
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ method,
REFERENCES,
getJavaSearchScope(),
result
- );
- assertSearchResults(
- "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
- "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n" +
+ );
+ assertSearchResults(
"src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
result);
-// } finally {
-// resetProjectOptions();
-// }
+ }
+ public void testJavadocConstructorArgReferenceWithJavadoc() throws CoreException {
+ IType type = getCompilationUnit("JavaSearch", "src", "j1", "JavadocSearched.java").getType("JavadocSearched");
+ setJavadocOptions();
+ IMethod method = type.getMethod("JavadocSearched", new String[] { "QString;" });
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ method,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
+ result);
+ }
+ public void testJavadocConstructorStringReferenceWithJavadoc() throws CoreException {
+ setJavadocOptions();
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ "JavadocSearched",
+ CONSTRUCTOR,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "src/j1/JavadocInvalidRef.java void j1.JavadocInvalidRef.invalid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH\n" +
+ "src/j1/JavadocValidRef.java void j1.JavadocValidRef.valid() [JavadocSearched] EXACT_MATCH",
+ result);
+ }
+
+ /**
+ * Method reference through array test.
+ * (regression test for 1GHDA2V: ITPJCORE:WINNT - ClassCastException when doing a search)
+ */
+ public void testMethodReferenceThroughArray() throws CoreException {
+ IType type = getClassFile("JavaSearch", getExternalJCLPathString(), "java.lang", "Object.class").getType();
+ IMethod method = type.getMethod("equals", new String[] { "QObject;" });
+ JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
+ search(
+ method,
+ REFERENCES,
+ getJavaSearchScope(),
+ resultCollector);
+ assertSearchResults(
+ "src/E.java Object E.foo() [clone()]",
+ resultCollector);
}
/**
@@ -799,23 +757,19 @@
*/
public void testBug47909() throws CoreException {
IType type = getCompilationUnit("JavaSearch", "src", "j3", "Y.java").getType("Y");
-// try {
- setJavadocOptions();
- IMethod method = type.getMethod("Y", new String[] { "I" });
- JavaSearchResultCollector result = new JavaSearchResultCollector();
- result.showAccuracy = true;
- search(
- method,
- REFERENCES,
- getJavaSearchScope(),
- result
- );
- assertSearchResults(
- "test47909.jar void j3.X.bar() EXACT_MATCH",
- result);
-// } finally {
-// resetProjectOptions();
-// }
+ setJavadocOptions();
+ IMethod method = type.getMethod("Y", new String[] { "I" });
+ JavaSearchResultCollector result = new JavaSearchResultCollector();
+ result.showAccuracy = true;
+ search(
+ method,
+ REFERENCES,
+ getJavaSearchScope(),
+ result
+ );
+ assertSearchResults(
+ "test47909.jar void j3.X.bar() EXACT_MATCH",
+ 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 035a402..9b89454 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
@@ -45,23 +45,27 @@
try {
if (results.length() > 0) results.append("\n");
IResource resource = match.getResource();
- IPath path = resource.getProjectRelativePath();
IJavaElement element = (IJavaElement) match.getElement();
- if (path.segmentCount() == 0) {
- IJavaElement root = element;
- while (root != null && !(root instanceof IPackageFragmentRoot)) {
- root = root.getParent();
- }
- if (root != null) {
- IPackageFragmentRoot pkgFragmentRoot = (IPackageFragmentRoot)root;
- if (pkgFragmentRoot.isExternal()) {
- results.append(pkgFragmentRoot.getPath().toOSString());
- } else {
- results.append(pkgFragmentRoot.getPath());
+ if (resource != null) {
+ IPath path = resource.getProjectRelativePath();
+ if (path.segmentCount() == 0) {
+ IJavaElement root = element;
+ while (root != null && !(root instanceof IPackageFragmentRoot)) {
+ root = root.getParent();
}
+ if (root != null) {
+ IPackageFragmentRoot pkgFragmentRoot = (IPackageFragmentRoot)root;
+ if (pkgFragmentRoot.isExternal()) {
+ results.append(pkgFragmentRoot.getPath().toOSString());
+ } else {
+ results.append(pkgFragmentRoot.getPath());
+ }
+ }
+ } else {
+ results.append(path);
}
} else {
- results.append(path);
+ results.append(element.getPath());
}
if (this.showProject) {
IProject project = element.getJavaProject().getProject();
@@ -295,6 +299,7 @@
// package declaration
suite.addTest(new JavaSearchTests("testSimplePackageDeclaration"));
suite.addTest(new JavaSearchTests("testVariousPackageDeclarations"));
+ suite.addTest(new JavaSearchTests("testPackageDeclaration"));
// package reference
suite.addTest(new JavaSearchTests("testSimplePackageReference"));
@@ -426,6 +431,7 @@
suite.addTest(new JavaSearchTests("testFieldReference4"));
suite.addTest(new JavaSearchTests("testFieldReference5"));
suite.addTest(new JavaSearchTests("testFieldReference6"));
+ suite.addTest(new JavaSearchTests("testFieldReference7"));
suite.addTest(new JavaSearchTests("testFieldReferenceInInnerClass"));
suite.addTest(new JavaSearchTests("testFieldReferenceInAnonymousClass"));
suite.addTest(new JavaSearchTests("testFieldReferenceThroughSubclass"));
@@ -1159,6 +1165,24 @@
resultCollector);
}
/**
+ * Field reference test.
+ * (regression test for bug 61017 Refactoring - test case that results in uncompilable source)
+ */
+public void testFieldReference7() throws CoreException {
+ IType type = getCompilationUnit("JavaSearch", "src", "s5", "A.java").getType("A");
+ IField field = type.getField("b");
+
+ JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
+ search(
+ field,
+ REFERENCES,
+ getJavaSearchScope(),
+ resultCollector);
+ assertSearchResults(
+ "src/s5/A.java void s5.A.method() [b]",
+ resultCollector);
+}
+/**
* Field reference in anonymous class test.
* (regression test for PR 1GL12XE: ITPJCORE:WIN2000 - search: missing field references in inner class)
*/
@@ -2079,6 +2103,22 @@
resultCollector);
}
/**
+ * Package declaration test.
+ * (regression test for bug 62698 NPE while searching for declaration of binary package)
+ */
+public void testPackageDeclaration() throws CoreException {
+ IPackageFragment pkg = getPackageFragment("JavaSearch", getExternalJCLPathString(), "java.lang");
+ JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
+ search(
+ pkg,
+ DECLARATIONS,
+ getJavaSearchScope(),
+ resultCollector);
+ assertSearchResults(
+ getExternalJCLPath() + " java.lang",
+ resultCollector);
+}
+/**
* 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/ModifyingResourceTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java
index e156880..1cdf9e5 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java
@@ -222,25 +222,21 @@
IJavaElement element = JavaCore.create(this.getFolder(path));
if (element instanceof IPackageFragmentRoot) {
return ((IPackageFragmentRoot)element).getPackageFragment("");
- } else {
- return (IPackageFragment)element;
}
- } else {
- IProject project = this.getProject(path);
- return JavaCore.create(project).getPackageFragmentRoot(project).getPackageFragment("");
+ return (IPackageFragment)element;
}
+ IProject project = this.getProject(path);
+ return JavaCore.create(project).getPackageFragmentRoot(project).getPackageFragment("");
}
protected IPackageFragmentRoot getPackageFragmentRoot(String path) {
if (path.indexOf('/', 1) != -1) { // if path as more than one segment
if (path.endsWith(".jar")) {
return (IPackageFragmentRoot)JavaCore.create(this.getFile(path));
- } else {
- return (IPackageFragmentRoot)JavaCore.create(this.getFolder(path));
}
- } else {
- IProject project = this.getProject(path);
- return JavaCore.create(project).getPackageFragmentRoot(project);
+ return (IPackageFragmentRoot)JavaCore.create(this.getFolder(path));
}
+ IProject project = this.getProject(path);
+ return JavaCore.create(project).getPackageFragmentRoot(project);
}
protected String getSortedByProjectDeltas() {
StringBuffer buffer = new StringBuffer();
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java
index 5789a33..718c123 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NameLookupTests2.java
@@ -42,8 +42,8 @@
}
public void testAddPackageFragmentRootAndPackageFrament() throws CoreException {
try {
- IJavaProject p1 = this.createJavaProject("P1", new String[] {"src1"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, "");
+ IJavaProject p1 = createJavaProject("P1", new String[] {"src1"}, "bin");
+ IJavaProject p2 = createJavaProject("P2", new String[] {}, "");
IClasspathEntry[] classpath =
new IClasspathEntry[] {
JavaCore.newProjectEntry(new Path("/P1"))
@@ -59,7 +59,7 @@
JavaCore.newSourceEntry(new Path("/P1/src2"))
};
p1.setRawClasspath(classpath2, null);
- this.createFolder("/P1/src2/p1");
+ createFolder("/P1/src2/p1");
res = getNameLookup((JavaProject)p2).findPackageFragments("p1", false);
assertTrue(
@@ -69,14 +69,14 @@
res[0].getElementName().equals("p1"));
} finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
+ deleteProject("P1");
+ deleteProject("P2");
}
}
public void testAddPackageFragment() throws CoreException {
try {
- this.createJavaProject("P1", new String[] {"src1"}, "bin");
- IJavaProject p2 = this.createJavaProject("P2", new String[] {}, "");
+ createJavaProject("P1", new String[] {"src1"}, "bin");
+ IJavaProject p2 = createJavaProject("P2", new String[] {}, "");
IClasspathEntry[] classpath =
new IClasspathEntry[] {
JavaCore.newProjectEntry(new Path("/P1"))
@@ -86,7 +86,7 @@
IPackageFragment[] res = getNameLookup((JavaProject)p2).findPackageFragments("p1", false);
assertTrue("Should get no package fragment", res == null);
- this.createFolder("/P1/src1/p1");
+ createFolder("/P1/src1/p1");
res = getNameLookup((JavaProject)p2).findPackageFragments("p1", false);
assertTrue(
@@ -96,8 +96,8 @@
res[0].getElementName().equals("p1"));
} finally {
- this.deleteProject("P1");
- this.deleteProject("P2");
+ deleteProject("P1");
+ deleteProject("P2");
}
}
/*
@@ -106,8 +106,8 @@
*/
public void testAddPackageFragment2() throws CoreException {
try {
- JavaProject project = (JavaProject)this.createJavaProject("P", new String[] {"src"}, "bin");
- this.createFolder("/P/src/p1");
+ JavaProject project = (JavaProject)createJavaProject("P", new String[] {"src"}, "bin");
+ createFolder("/P/src/p1");
IPackageFragment[] pkgs = getNameLookup(project).findPackageFragments("p1", false);
assertElementsEqual(
@@ -115,7 +115,7 @@
"p1 [in src [in P]]",
pkgs);
- this.createFolder("/P/src/p2");
+ createFolder("/P/src/p2");
pkgs = getNameLookup(project).findPackageFragments("p2", false);
assertElementsEqual(
@@ -123,7 +123,25 @@
"p2 [in src [in P]]",
pkgs);
} finally {
- this.deleteProject("P");
+ deleteProject("P");
+ }
+}
+/*
+ * Find a default package fragment in a non-default root by its path.
+ * (regression test for bug 63245 findPackageFragment won't return default package)
+ */
+public void testFindDefaultPackageFragmentInNonDefaultRoot() throws CoreException {
+ try {
+ JavaProject project = (JavaProject)createJavaProject("P", new String[] {"src"}, "bin");
+
+ IPackageFragment pkg = getNameLookup(project).findPackageFragment(new Path("/P/src"));
+ assertElementsEqual(
+ "Didn't find default package",
+ "<default> [in src [in P]]",
+ new IJavaElement[] {pkg});
+
+ } finally {
+ deleteProject("P");
}
}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingExpressionsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingExpressionsTest.java
index 0b81400..b7f1353 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingExpressionsTest.java
@@ -35,11 +35,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingExpressionsTest("testThisExpression"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingExpressionsTest("testThisExpression"));
+ return suite;
}
public void testArrayAccess() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInsertBoundTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInsertBoundTest.java
index 6b08abd..fbb1b98 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInsertBoundTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingInsertBoundTest.java
@@ -41,11 +41,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingInsertBoundTest("testRemove3"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingInsertBoundTest("testRemove3"));
+ return suite;
}
private MethodDeclaration newMethodDeclaration(AST ast, String name) {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingJavadocTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingJavadocTest.java
index dea9efa..dcfb29c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingJavadocTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingJavadocTest.java
@@ -37,11 +37,10 @@
public static Test suite() {
if (false) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingJavadocTest("testMoveTags"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingJavadocTest("testMoveTags"));
+ return suite;
}
public void testParamName() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMethodDeclTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMethodDeclTest.java
index ae64d28..2ee8575 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMethodDeclTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMethodDeclTest.java
@@ -37,11 +37,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingMethodDeclTest("testMethodDeclChanges"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingMethodDeclTest("testMethodDeclChanges"));
+ return suite;
}
public void testMethodDeclChanges() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMoveCodeTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMoveCodeTest.java
index bca79c9..fcbae1e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMoveCodeTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingMoveCodeTest.java
@@ -37,11 +37,10 @@
public static Test suite() {
if (false) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingMoveCodeTest("testCopyMultipleNodes"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingMoveCodeTest("testCopyMultipleNodes"));
+ return suite;
}
public void testMove() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
index 3f8665b..ac92c8a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
@@ -36,17 +36,12 @@
public static Test suite() {
if (false) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingStatementsTest("testInsert2"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingStatementsTest("testInsert2"));
+ return suite;
}
-
-
-
-
public void testInsert1() throws Exception {
IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
/* foo(): append a return statement */
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTrackingTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTrackingTest.java
index c7e1ebe..724cb02 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTrackingTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTrackingTest.java
@@ -39,11 +39,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingTrackingTest("testNamesWithPlaceholder"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingTrackingTest("testNamesWithPlaceholder"));
+ return suite;
}
public void testNamesWithDelete() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
index 11dd49f..71b3859 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java
@@ -37,11 +37,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingTypeDeclTest("testVariableDeclarationFragment"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingTypeDeclTest("testVariableDeclarationFragment"));
+ return suite;
}
public void testTypeDeclChanges() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/SourceModifierTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/SourceModifierTest.java
index 99bd62f..797a08b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/SourceModifierTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/SourceModifierTest.java
@@ -38,11 +38,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new SourceModifierTest("testCollapsedTargetNodes2"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new SourceModifierTest("testCollapsedTargetNodes2"));
+ return suite;
}
public void testRemoveIndents() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java
index 37e80f4..ed83f02 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java
@@ -34,11 +34,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingModifyingCopyTest("test0009"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingModifyingCopyTest("test0009"));
+ return suite;
}
public void test0001() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingInsertTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingInsertTest.java
index ee65438..85b1940 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingInsertTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingInsertTest.java
@@ -33,11 +33,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingModifyingInsertTest("test0009"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingModifyingInsertTest("test0009"));
+ return suite;
}
/**
* insert a new import declaration
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingMoveTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingMoveTest.java
index 1ffd114..88c2e16 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingMoveTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingMoveTest.java
@@ -34,11 +34,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingModifyingMoveTest("test0009"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingModifyingMoveTest("test0009"));
+ return suite;
}
public void test0001() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java
index 648aa83..9274aff 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java
@@ -34,11 +34,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingModifyingOtherTest("test0009"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingModifyingOtherTest("test0009"));
+ return suite;
}
public void test0000() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingRemoveTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingRemoveTest.java
index bc5a78b..f6e14ef 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingRemoveTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingRemoveTest.java
@@ -34,11 +34,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingModifyingRemoveTest("test0009"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingModifyingRemoveTest("test0009"));
+ return suite;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingReplaceTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingReplaceTest.java
index 99081aa..5411912 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingReplaceTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingReplaceTest.java
@@ -34,11 +34,10 @@
public static Test suite() {
if (true) {
return allTests();
- } else {
- TestSuite suite= new Suite("one test");
- suite.addTest(new ASTRewritingModifyingReplaceTest("test0009"));
- return suite;
}
+ TestSuite suite= new Suite("one test");
+ suite.addTest(new ASTRewritingModifyingReplaceTest("test0009"));
+ return suite;
}
public void test0001() throws Exception {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java
index a5d9c93..742340c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java
@@ -147,11 +147,10 @@
buffer.append("buf.append(\"");
}
continue;
- } else {
- buffer.append("\");\n");
- for (int i = 0; i < indent; i++) buffer.append("\t");
- buffer.append("buf.append(\"");
}
+ buffer.append("\");\n");
+ for (int i = 0; i < indent; i++) buffer.append("\t");
+ buffer.append("buf.append(\"");
} else {
continue;
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X1.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X1.java
index fd7bdfd..b10c28d 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X1.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X1.java
@@ -3,5 +3,5 @@
* {@inheritDoc}
* @deprecated
*/
-public class X {
+public class X1 {
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X2.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X2.java
index d603bb8..382683e 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X2.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X2.java
@@ -2,5 +2,5 @@
/**
* {@inheritDoc}
*/
-public class X {
+public class X2 {
}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X3.java b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X3.java
index c7ab1bf..8f1c92e 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X3.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X3.java
@@ -2,5 +2,5 @@
/**
* @deprecated
*/
-public class X {
+public class X3 {
}
diff --git a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
index 42be479..88e6d7d 100644
--- a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
+++ b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
@@ -238,12 +238,12 @@
}
} else {
if (deprecation) {
- cmd.createArgument().setValue("-warn:allDeprecation"); //$NON-NLS-1$
+ cmd.createArgument().setValue("-warn:+allDeprecation"); //$NON-NLS-1$
} else {
cmd.createArgument().setValue("-warn:-allDeprecation,deprecation"); //$NON-NLS-1$
}
if (compilerArgs.length == 0) {
- cmd.createArgument().setValue("-warn:constructorName,packageDefaultMethod,maskedCatchBlocks,unusedImports,staticReceiver"); //$NON-NLS-1$
+ cmd.createArgument().setValue("-warn:+constructorName,packageDefaultMethod,maskedCatchBlocks,unusedImports,staticReceiver"); //$NON-NLS-1$
}
}
/*
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 179996b..19e9c1e 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
@@ -702,9 +702,10 @@
disableWarnings();
continue;
}
- if (length < 6)
+ if (length <= 6) {
throw new InvalidInputException(
Main.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$
+ }
int warnTokenStart;
boolean isEnabling;
switch (warningOption.charAt(6)) {
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 4326fec..ebedcf8 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -159,7 +159,7 @@
<p><hr><h1>
Eclipse Platform Build Notes <br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC1 Build - ?th May 2004
+Eclipse SDK 3.0RC1 Build - 26th May 2004 - 3.0 RELEASE CANDIDATE 1
<br>Project org.eclipse.jdt.core v_434
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_434">cvs</a>).
<h2>
@@ -168,6 +168,46 @@
</ul>
<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56870">56870</a>
+copied file not shown in package explorer / java browser [ccp]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63748">63748</a>
+Type Hierarchy: null pointer when pressing F4 on ListCellRenderer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38839">38839</a>
+org.eclipse.jdt.internal.compiler.parser.Scanner throws thousands of Exceptions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62869">62869</a>
+[navigation] 'Go to Next Annotation' doesn't find next error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63871">63871</a>
+Using M9, -warn: option crashes the batch compiler
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63434">63434</a>
+NPE during checkout/build
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62737">62737</a>
+Code formatter doesn't work on some files
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62639">62639</a>
+[1.5] Cheetah and extending Vector
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62769">62769</a>
+Javadoc errors in 200405180816
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62952">62952</a>
+Ant adapter behavior is a little strange
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62704">62704</a>
+Using 05180816, //toto is a task if //toto is a task tag.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51660">51660</a>
+[DOM/AST] AST.parse* should handle all legal doc tags
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51606">51606</a>
+Javadoc - {@inheritDoc} should be inefficient when not in first text element
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62713">62713</a>
+should not be able to nest output folders [build path]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63245">63245</a>
+findPackageFragment won't return default package
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62698">62698</a>
+NPE while searching for declaration of binary package
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61017">61017</a>
+Refactoring - test case that results in uncompilable source
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63044">63044</a>
+Reference to a constructor inside a javadoc should point to a type binding and not a constructor binding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62812">62812</a>
+Some malformed javadoc tags are not reported as malformed
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62810">62810</a>
+Deadlock when closing editors and save
<a name="v_433"></a>
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
index 5e27d1f..c4f0fa5 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
@@ -85,6 +85,9 @@
*/
public boolean getNextCharAsJavaIdentifierPart() {
+ if (this.currentPosition >= this.source.length) // handle the obvious case upfront
+ return false;
+
int temp = this.currentPosition;
try {
if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
index c24a165..05e3706 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
@@ -326,16 +326,14 @@
// OpenBlock ::= $empty
super.consumeOpenBlock();
- try {
- blockStarts[realBlockPtr] = scanner.startPosition;
- } catch (IndexOutOfBoundsException e) {
- //realBlockPtr is correct
- int oldStackLength = blockStarts.length;
- int oldStack[] = blockStarts;
- blockStarts = new int[oldStackLength + StackIncrement];
- System.arraycopy(oldStack, 0, blockStarts, 0, oldStackLength);
- blockStarts[realBlockPtr] = scanner.startPosition;
+ int stackLength = this.blockStarts.length;
+ if (this.realBlockPtr >= stackLength) {
+ System.arraycopy(
+ this.blockStarts, 0,
+ this.blockStarts = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.blockStarts[this.realBlockPtr] = scanner.startPosition;
}
protected void consumePackageDeclarationName() {
// PackageDeclarationName ::= 'package' Name
@@ -1273,21 +1271,19 @@
this.previousKind = 0;
this.previousInfo = 0;
- try {
- this.elementPtr++;
- this.elementKindStack[this.elementPtr] = kind;
- this.elementInfoStack[this.elementPtr] = info;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.elementKindStack.length;
- int oldElementStack[] = this.elementKindStack;
- int oldElementInfoStack[] = this.elementInfoStack;
- this.elementKindStack = new int[oldStackLength + StackIncrement];
- this.elementInfoStack = new int[oldStackLength + StackIncrement];
- System.arraycopy(oldElementStack, 0, this.elementKindStack, 0, oldStackLength);
- System.arraycopy(oldElementInfoStack, 0, this.elementInfoStack, 0, oldStackLength);
- this.elementKindStack[this.elementPtr] = kind;
- this.elementInfoStack[this.elementPtr] = info;
+ int stackLength = this.elementKindStack.length;
+ if (++this.elementPtr >= stackLength) {
+ System.arraycopy(
+ this.elementKindStack, 0,
+ this.elementKindStack = new int[stackLength + StackIncrement], 0,
+ stackLength);
+ System.arraycopy(
+ this.elementInfoStack, 0,
+ this.elementInfoStack = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.elementKindStack[this.elementPtr] = kind;
+ this.elementInfoStack[this.elementPtr] = info;
}
public void recoveryExitFromVariable() {
if(currentElement != null && currentElement instanceof RecoveredField
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
index 0c7e008..fafcbc3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
@@ -826,6 +826,8 @@
/** @since 3.0 */
int JavadocUnterminatedInlineTag = Javadoc + Internal + 512;
/** @since 3.0 */
+ int JavadocMalformedSeeReference = Javadoc + Internal + 513;
+ /** @since 3.0 */
int JavadocMessagePrefix = Internal + 515;
/**
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
index e335104..92c85dc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
@@ -187,6 +187,8 @@
"compilation.loadBinary" , //$NON-NLS-1$
new String[] {
new String(binaryType.getName())}));
+// new Exception("TRACE BINARY").printStackTrace(System.out);
+// System.out.println();
}
lookupEnvironment.createBinaryTypeFrom(binaryType, packageBinding);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index 76b32fc..577b67a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -625,7 +625,6 @@
}
}
- ReferenceBinding[] defaultHandledExceptions = new ReferenceBinding[] { scope.getJavaLangThrowable()}; // tolerate any kind of exception
InitializationFlowContext initializerContext = new InitializationFlowContext(null, this, initializerScope);
InitializationFlowContext staticInitializerContext = new InitializationFlowContext(null, this, staticInitializerScope);
FlowInfo nonStaticFieldInfo = flowInfo.copy().unconditionalInits().discardFieldInitializations();
@@ -637,7 +636,7 @@
/*if (field.isField()){
staticInitializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2
} else {*/
- staticInitializerContext.handledExceptions = defaultHandledExceptions; // tolerate them all, and record them
+ staticInitializerContext.handledExceptions = AnyException; // tolerate them all, and record them
/*}*/
staticFieldInfo =
field.analyseCode(
@@ -654,7 +653,7 @@
/*if (field.isField()){
initializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2
} else {*/
- initializerContext.handledExceptions = defaultHandledExceptions; // tolerate them all, and record them
+ initializerContext.handledExceptions = AnyException; // tolerate them all, and record them
/*}*/
nonStaticFieldInfo =
field.analyseCode(initializerScope, initializerContext, nonStaticFieldInfo);
@@ -883,7 +882,7 @@
}
try {
if ((this.bits & UndocumentedEmptyBlockMASK) != 0) {
- this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd+1);
+ this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd);
}
this.maxFieldCount = 0;
int lastVisibleFieldID = -1;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
index c3f6b55..340781f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
@@ -95,7 +95,10 @@
for (int raisedIndex = 0; raisedIndex < raisedCount; raisedIndex++) {
TypeBinding raisedException;
if ((raisedException = raisedExceptions[raisedIndex]) != null) {
- switch (Scope.compareTypes(raisedException, caughtException)) {
+ int state = caughtException == null
+ ? EqualOrMoreSpecific /* any exception */
+ : Scope.compareTypes(raisedException, caughtException);
+ switch (state) {
case EqualOrMoreSpecific :
exceptionContext.recordHandlingException(
caughtException,
@@ -213,7 +216,10 @@
caughtIndex < caughtCount;
caughtIndex++) {
ReferenceBinding caughtException = caughtExceptions[caughtIndex];
- switch (Scope.compareTypes(raisedException, caughtException)) {
+ int state = caughtException == null
+ ? EqualOrMoreSpecific /* any exception */
+ : Scope.compareTypes(raisedException, caughtException);
+ switch (state) {
case EqualOrMoreSpecific :
exceptionContext.recordHandlingException(
caughtException,
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index 88b311b..8862bea 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -136,6 +136,11 @@
}
void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
+
+ // default initialization for super-interfaces early, in case some aborting compilation error occurs,
+ // and still want to use binaries passed that point (e.g. type hierarchy resolver, see bug 63748).
+ this.superInterfaces = NoSuperInterfaces;
+
// need enclosing type to access type variables
char[] enclosingTypeName = binaryType.getEnclosingTypeName();
if (enclosingTypeName != null) {
@@ -527,6 +532,24 @@
}
return null;
}
+/**
+ * Rewrite of default getMemberType to avoid resolving eagerly all member types when one is requested
+ */
+public ReferenceBinding getMemberType(char[] typeName) {
+ for (int i = this.memberTypes.length; --i >= 0;) {
+ ReferenceBinding memberType = this.memberTypes[i];
+ if (memberType instanceof UnresolvedReferenceBinding) {
+ char[] name = memberType.sourceName; // source name is qualified with enclosing type name
+ int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; // enclosing$
+ if (name.length == (prefixLength + typeName.length)) // enclosing $ typeName
+ if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) // only check trailing portion
+ return this.memberTypes[i] = resolveType(memberType, this.environment, false); // no raw conversion for now
+ } else if (CharOperation.equals(typeName, memberType.sourceName)) {
+ return memberType;
+ }
+ }
+ return null;
+}
// NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed
public MethodBinding[] getMethods(char[] selector) {
@@ -555,6 +578,11 @@
}
return NoMethods;
}
+public boolean hasMemberTypes() {
+ return this.memberTypes.length > 0;
+}
+// NOTE: member types of binary types are resolved when needed
+
public TypeVariableBinding getTypeVariable(char[] variableName) {
TypeVariableBinding variable = super.getTypeVariable(variableName);
resolveTypesFor(variable);
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 20ec486..7f4a0a5 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
@@ -537,7 +537,7 @@
do {
if ((currentType.tagBits & HasNoMemberTypes) != 0)
break; // already know it has no inherited member types, can stop looking up
- if (currentType.memberTypes() != NoMemberTypes)
+ if (currentType.hasMemberTypes()) // avoid resolving member types eagerly
return; // has member types
ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
if (itsInterfaces != NoSuperInterfaces) {
@@ -736,7 +736,12 @@
problemReporter().hierarchyHasProblems(sourceType);
}
connectMemberTypes();
- checkForInheritedMemberTypes(sourceType);
+ try {
+ checkForInheritedMemberTypes(sourceType);
+ } catch (AbortCompilation e) {
+ e.updateContext(referenceContext, referenceCompilationUnit().compilationResult);
+ throw e;
+ }
}
private void connectTypeHierarchyWithoutMembers() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index 0512999..c3786c7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -398,6 +398,9 @@
public PackageBinding getPackage() {
return fPackage;
}
+public boolean hasMemberTypes() {
+ return false;
+}
public TypeVariableBinding getTypeVariable(char[] variableName) {
TypeVariableBinding[] typeVariables = typeVariables();
for (int i = typeVariables.length; --i >= 0;)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 1dccc14..50f63c6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -638,21 +638,21 @@
}
public ReferenceBinding[] memberTypes() {
- return memberTypes;
+ return this.memberTypes;
}
public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBinding newDeclaringClass) {
- if (synthetics == null) {
- synthetics = new HashMap[4];
+ if (this.synthetics == null) {
+ this.synthetics = new HashMap[4];
}
- if (synthetics[RECEIVER_TYPE_EMUL] == null) {
- synthetics[RECEIVER_TYPE_EMUL] = new HashMap(5);
+ if (this.synthetics[RECEIVER_TYPE_EMUL] == null) {
+ this.synthetics[RECEIVER_TYPE_EMUL] = new HashMap(5);
}
- Hashtable fieldMap = (Hashtable) synthetics[RECEIVER_TYPE_EMUL].get(targetField);
+ Hashtable fieldMap = (Hashtable) this.synthetics[RECEIVER_TYPE_EMUL].get(targetField);
if (fieldMap == null) {
fieldMap = new Hashtable(5);
- synthetics[RECEIVER_TYPE_EMUL].put(targetField, fieldMap);
+ this.synthetics[RECEIVER_TYPE_EMUL].put(targetField, fieldMap);
}
FieldBinding updatedField = (FieldBinding) fieldMap.get(newDeclaringClass);
if (updatedField == null){
@@ -664,18 +664,18 @@
public MethodBinding getUpdatedMethodBinding(MethodBinding targetMethod, ReferenceBinding newDeclaringClass) {
- if (synthetics == null) {
- synthetics = new HashMap[4];
+ if (this.synthetics == null) {
+ this.synthetics = new HashMap[4];
}
- if (synthetics[RECEIVER_TYPE_EMUL] == null) {
- synthetics[RECEIVER_TYPE_EMUL] = new HashMap(5);
+ if (this.synthetics[RECEIVER_TYPE_EMUL] == null) {
+ this.synthetics[RECEIVER_TYPE_EMUL] = new HashMap(5);
}
Hashtable methodMap = (Hashtable) synthetics[RECEIVER_TYPE_EMUL].get(targetMethod);
if (methodMap == null) {
methodMap = new Hashtable(5);
- synthetics[RECEIVER_TYPE_EMUL].put(targetMethod, methodMap);
+ this.synthetics[RECEIVER_TYPE_EMUL].put(targetMethod, methodMap);
}
MethodBinding updatedMethod = (MethodBinding) methodMap.get(newDeclaringClass);
if (updatedMethod == null){
@@ -684,7 +684,9 @@
}
return updatedMethod;
}
-
+public boolean hasMemberTypes() {
+ return this.memberTypes.length > 0;
+}
// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
public MethodBinding[] methods() {
if ((modifiers & AccUnresolved) == 0)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
index c0e0549..2403287 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -79,6 +79,7 @@
// Method collections
final TypeBinding[] NoParameters = new TypeBinding[0];
final ReferenceBinding[] NoExceptions = new ReferenceBinding[0];
+ final ReferenceBinding[] AnyException = new ReferenceBinding[] { null }; // special handler for all exceptions
// Type collections
final FieldBinding[] NoFields = new FieldBinding[0];
final MethodBinding[] NoMethods = new MethodBinding[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 915253c..bba4d35 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
@@ -160,8 +160,8 @@
switch (nextCharacter) {
case '@' :
boolean valid = false;
- // Start tag parsing only if we are on line beginning or at inline tag beginning
- if (!this.lineStarted || previousChar == '{') {
+ // Start tag parsing only if we have a java identifier start character and if we are on line beginning or at inline tag beginning
+ if ((!this.lineStarted || previousChar == '{') && Character.isJavaIdentifierStart(peekChar())) {
this.lineStarted = true;
if (this.inlineTagStarted) {
this.inlineTagStarted = false;
@@ -189,12 +189,47 @@
this.scanner.resetTo(this.index, this.endComment);
this.currentTokenType = -1; // flush token cache at line begin
try {
- int tk = readTokenAndConsume();
- this.tagSourceStart = this.kind == COMPIL_PARSER ? this.scanner.getCurrentTokenStartPosition() : previousPosition;
+ int token = readTokenAndConsume();
+ this.tagSourceStart = this.scanner.getCurrentTokenStartPosition();
this.tagSourceEnd = this.scanner.getCurrentTokenEndPosition();
- switch (tk) {
+ char[] tag = this.scanner.getCurrentIdentifierSource(); // first token is either an identifier or a keyword
+ if (this.kind == DOM_PARSER) {
+ // For DOM parser, try to get tag name other than java identifier
+ // (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=51660)
+ int tk = token;
+ int le = this.lineEnd;
+ char pc = peekChar();
+ tagNameToken: while (tk != TerminalTokens.TokenNameEOF) {
+ this.tagSourceEnd = this.scanner.getCurrentTokenEndPosition();
+ token = tk;
+ // !, ", #, %, &, ', -, :, <, >
+ if (Character.isWhitespace(pc)) break;
+ switch (pc) {
+ case '}':
+ case '!':
+ case '#':
+ case '%':
+ case '&':
+ case '\'':
+ case ':':
+ case '-':
+ case '<' :
+ case '>':
+ break tagNameToken;
+ }
+ tk = readTokenAndConsume();
+ pc = peekChar();
+ }
+ int length = this.tagSourceEnd-this.tagSourceStart+1;
+ tag = new char[length];
+ System.arraycopy(this.source, this.tagSourceStart, tag, 0, length);
+ this.index = this.tagSourceEnd+1;
+ this.scanner.currentPosition = this.tagSourceEnd+1;
+ this.tagSourceStart = previousPosition;
+ this.lineEnd = le;
+ }
+ switch (token) {
case TerminalTokens.TokenNameIdentifier :
- char[] tag = this.scanner.getCurrentIdentifierSource();
if (CharOperation.equals(tag, TAG_DEPRECATED)) {
this.deprecated = true;
if (this.kind == DOM_PARSER) {
@@ -203,7 +238,12 @@
valid = true;
}
} else if (CharOperation.equals(tag, TAG_INHERITDOC)) {
- this.inherited = true;
+ // inhibits inherited flag when tags have been already stored
+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=51606
+ // Note that for DOM_PARSER, nodes stack may be not empty even no '@' tag
+ // was encountered in comment. But it cannot be the case for COMPILER_PARSER
+ // and so is enough as it is only this parser which signals the missing tag warnings...
+ this.inherited = this.astPtr==-1;
if (this.kind == DOM_PARSER) {
valid = parseTag();
} else {
@@ -251,7 +291,7 @@
break;
default:
if (this.kind == DOM_PARSER) {
- switch (tk) {
+ switch (token) {
case TerminalTokens.TokenNameabstract:
case TerminalTokens.TokenNameassert:
case TerminalTokens.TokenNameboolean:
@@ -422,7 +462,7 @@
return this.scanner.getCurrentTokenEndPosition();
}
}
-
+
/*
* Parse argument in @see tag method reference
*/
@@ -433,6 +473,7 @@
int iToken = 0;
char[] argName = null;
List arguments = new ArrayList(10);
+ int start = this.scanner.getCurrentTokenStartPosition();
// Parse arguments declaration if method reference
nextArg : while (this.index < this.scanner.eofPosition) {
@@ -453,6 +494,11 @@
}
if (typeRef == null) {
if (firstArg && this.currentTokenType == TerminalTokens.TokenNameRPAREN) {
+ char pc = peekChar();
+ if (!Character.isWhitespace(pc) && (!this.inlineTagStarted || pc != '}')) {
+ if (this.sourceParser != null) this.sourceParser.problemReporter().javadocMalformedSeeReference(start, this.lineEnd);
+ return null;
+ }
this.lineStarted = true;
return createMethodReference(receiver, null);
}
@@ -516,6 +562,11 @@
consumeToken();
iToken++;
} else if (token == TerminalTokens.TokenNameRPAREN) {
+ char pc = peekChar();
+ if (!Character.isWhitespace(pc) && (!this.inlineTagStarted || pc != '}')) {
+ if (this.sourceParser != null) this.sourceParser.problemReporter().javadocMalformedSeeReference(start, this.lineEnd);
+ return null;
+ }
// Create new argument
Object argument = createArgumentReference(name, dim, typeRef, dimPositions, argNamePos);
arguments.add(argument);
@@ -877,36 +928,29 @@
*/
protected void pushIdentifier(boolean newLength) {
- try {
- this.identifierStack[++this.identifierPtr] = this.scanner.getCurrentIdentifierSource();
- this.identifierPositionStack[this.identifierPtr] = (((long) this.scanner.startPosition) << 32)
- + (this.scanner.currentPosition - 1);
- } catch (IndexOutOfBoundsException e) {
- //---stack reallaocation (identifierPtr is correct)---
- int oldStackLength = this.identifierStack.length;
- char[][] oldStack = this.identifierStack;
- this.identifierStack = new char[oldStackLength + 10][];
- System.arraycopy(oldStack, 0, this.identifierStack, 0, oldStackLength);
- this.identifierStack[this.identifierPtr] = this.scanner.getCurrentTokenSource();
- // identifier position stack
- long[] oldPos = this.identifierPositionStack;
- this.identifierPositionStack = new long[oldStackLength + 10];
- System.arraycopy(oldPos, 0, this.identifierPositionStack, 0, oldStackLength);
- this.identifierPositionStack[this.identifierPtr] = (((long) this.scanner.startPosition) << 32)
- + (this.scanner.currentPosition - 1);
+ int stackLength = this.identifierStack.length;
+ if (++this.identifierPtr >= stackLength) {
+ System.arraycopy(
+ this.identifierStack, 0,
+ this.identifierStack = new char[stackLength + 10][], 0,
+ stackLength);
+ System.arraycopy(
+ this.identifierPositionStack, 0,
+ this.identifierPositionStack = new long[stackLength + 10], 0,
+ stackLength);
}
+ this.identifierStack[this.identifierPtr] = this.scanner.getCurrentIdentifierSource();
+ this.identifierPositionStack[this.identifierPtr] = (((long) this.scanner.startPosition) << 32) + (this.scanner.currentPosition - 1);
if (newLength) {
- try {
- this.identifierLengthStack[++this.identifierLengthPtr] = 1;
- } catch (IndexOutOfBoundsException e) {
- /* ---stack reallocation (identifierLengthPtr is correct)--- */
- int oldStackLength = this.identifierLengthStack.length;
- int oldStack[] = this.identifierLengthStack;
- this.identifierLengthStack = new int[oldStackLength + 10];
- System.arraycopy(oldStack, 0, this.identifierLengthStack, 0, oldStackLength);
- this.identifierLengthStack[this.identifierLengthPtr] = 1;
+ stackLength = this.identifierLengthStack.length;
+ if (++this.identifierLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.identifierLengthStack, 0,
+ this.identifierLengthStack = new int[stackLength + 10], 0,
+ stackLength);
}
+ this.identifierLengthStack[this.identifierLengthPtr] = 1;
} else {
this.identifierLengthStack[this.identifierLengthPtr]++;
}
@@ -923,27 +967,25 @@
return;
}
- try {
- this.astStack[++this.astPtr] = node;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.astStack.length;
- Object[] oldStack = this.astStack;
- this.astStack = new Object[oldStackLength + AstStackIncrement];
- System.arraycopy(oldStack, 0, this.astStack, 0, oldStackLength);
- this.astPtr = oldStackLength;
- this.astStack[this.astPtr] = node;
+ int stackLength = this.astStack.length;
+ if (++this.astPtr >= stackLength) {
+ System.arraycopy(
+ this.astStack, 0,
+ this.astStack = new Object[stackLength + AstStackIncrement], 0,
+ stackLength);
+ this.astPtr = stackLength;
}
+ this.astStack[this.astPtr] = node;
if (newLength) {
- try {
- this.astLengthStack[++this.astLengthPtr] = 1;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.astLengthStack.length;
- int[] oldPos = this.astLengthStack;
- this.astLengthStack = new int[oldStackLength + AstStackIncrement];
- System.arraycopy(oldPos, 0, this.astLengthStack, 0, oldStackLength);
- this.astLengthStack[this.astLengthPtr] = 1;
+ stackLength = this.astLengthStack.length;
+ if (++this.astLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.astLengthStack, 0,
+ this.astLengthStack = new int[stackLength + AstStackIncrement], 0,
+ stackLength);
}
+ this.astLengthStack[this.astLengthPtr] = 1;
} else {
this.astLengthStack[this.astLengthPtr]++;
}
@@ -965,10 +1007,34 @@
}
/*
+ * Return current character without move index position.
+ */
+ private char peekChar() {
+ int idx = this.index;
+ char c = this.source[idx++];
+ if (c == '\\' && this.source[idx] == 'u') {
+ int c1, c2, c3, c4;
+ idx++;
+ while (this.source[idx] == 'u')
+ idx++;
+ if (!(((c1 = Character.getNumericValue(this.source[idx++])) > 15 || c1 < 0)
+ || ((c2 = Character.getNumericValue(this.source[idx++])) > 15 || c2 < 0)
+ || ((c3 = Character.getNumericValue(this.source[idx++])) > 15 || c3 < 0) || ((c4 = Character.getNumericValue(this.source[idx++])) > 15 || c4 < 0))) {
+ c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+ }
+ }
+ return c;
+ }
+
+ /*
* Push a throws type ref in ast node stack.
*/
protected abstract boolean pushThrowName(Object typeRef, boolean real);
+ /*
+ * Read current character and move index position.
+ * Warning: scanner position is unchanged using this method!
+ */
protected char readChar() {
char c = this.source[this.index++];
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 75c655c..70bb4f0 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
@@ -307,15 +307,14 @@
if (this.invParamsPtr == -1l) {
this.invParamsStack = new JavadocSingleNameReference[10];
}
- try {
- this.invParamsStack[++this.invParamsPtr] = nameRef;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.invParamsStack.length;
- JavadocSingleNameReference[] oldStack = this.invParamsStack;
- this.invParamsStack = new JavadocSingleNameReference[oldStackLength + AstStackIncrement];
- System.arraycopy(oldStack, 0, this.invParamsStack, 0, oldStackLength);
- this.invParamsStack[this.invParamsPtr] = nameRef;
+ int stackLength = this.invParamsStack.length;
+ if (++this.invParamsPtr >= stackLength) {
+ System.arraycopy(
+ this.invParamsStack, 0,
+ this.invParamsStack = new JavadocSingleNameReference[stackLength + AstStackIncrement], 0,
+ stackLength);
}
+ this.invParamsStack[this.invParamsPtr] = nameRef;
return false;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index a730589..9fb0dd1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -3940,17 +3940,19 @@
}
protected void consumeNestedType() {
// NestedType ::= $empty
- this.nestedType++;
- try {
- this.nestedMethod[this.nestedType] = 0;
- } catch (IndexOutOfBoundsException e) {
- //except in test's cases, it should never raise
- int oldL = this.nestedMethod.length;
- System.arraycopy(this.nestedMethod , 0, (this.nestedMethod = new int[oldL + 30]), 0, oldL);
- this.nestedMethod[this.nestedType] = 0;
- // increase the size of the fieldsCounter as well. It has to be consistent with the size of the this.nestedMethod collection
- System.arraycopy(this.variablesCounter, 0, (this.variablesCounter = new int[oldL + 30]), 0, oldL);
+ int length = this.nestedMethod.length;
+ if (++this.nestedType >= length) {
+ System.arraycopy(
+ this.nestedMethod, 0,
+ this.nestedMethod = new int[length + 30], 0,
+ length);
+ // increase the size of the variablesCounter as well. It has to be consistent with the size of the nestedMethod collection
+ System.arraycopy(
+ this.variablesCounter, 0,
+ this.variablesCounter = new int[length + 30], 0,
+ length);
}
+ this.nestedMethod[this.nestedType] = 0;
this.variablesCounter[this.nestedType] = 0;
}
protected void consumeNormalAnnotation() {
@@ -4015,16 +4017,14 @@
// OpenBlock ::= $empty
pushOnIntStack(this.scanner.startPosition);
- try {
- this.realBlockStack[++this.realBlockPtr] = 0;
- } catch (IndexOutOfBoundsException e) {
- //this.realBlockPtr is correct
- int oldStackLength = this.realBlockStack.length;
- int oldStack[] = this.realBlockStack;
- this.realBlockStack = new int[oldStackLength + StackIncrement];
- System.arraycopy(oldStack, 0, this.realBlockStack, 0, oldStackLength);
- this.realBlockStack[this.realBlockPtr] = 0;
+ int stackLength = this.realBlockStack.length;
+ if (++this.realBlockPtr >= stackLength) {
+ System.arraycopy(
+ this.realBlockStack, 0,
+ this.realBlockStack = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.realBlockStack[this.realBlockPtr] = 0;
}
protected void consumePackageDeclaration() {
// PackageDeclaration ::= 'package' Name ';'
@@ -8121,15 +8121,14 @@
this.stateStackTop = -1;
this.currentToken = getFirstToken();
ProcessTerminals : for (;;) {
- try {
- this.stack[++this.stateStackTop] = act;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.stack.length;
- int oldStack[] = this.stack;
- this.stack = new int[oldStackLength + StackIncrement];
- System.arraycopy(oldStack, 0, this.stack, 0, oldStackLength);
- this.stack[this.stateStackTop] = act;
+ int stackLength = this.stack.length;
+ if (++this.stateStackTop >= stackLength) {
+ System.arraycopy(
+ this.stack, 0,
+ this.stack = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.stack[this.stateStackTop] = act;
act = tAction(act, this.currentToken);
if (act == ERROR_ACTION || this.restartRecovery) {
@@ -8545,167 +8544,175 @@
protected void pushIdentifier() {
/*push the consumeToken on the identifier stack.
Increase the total number of identifier in the stack.
- this.identifierPtr points on the next top */
+ identifierPtr points on the next top */
- try {
- this.identifierStack[++this.identifierPtr] = this.scanner.getCurrentIdentifierSource();
- this.identifierPositionStack[this.identifierPtr] =
- (((long) this.scanner.startPosition) << 32) + (this.scanner.currentPosition - 1);
- } catch (IndexOutOfBoundsException e) {
- /*---stack reallaocation (this.identifierPtr is correct)---*/
- int oldStackLength = this.identifierStack.length;
- System.arraycopy(this.identifierStack, 0, this.identifierStack = new char[oldStackLength + 20][], 0, oldStackLength);
- this.identifierStack[this.identifierPtr] = this.scanner.getCurrentTokenSource();
- /*identifier position stack*/
- System.arraycopy(this.identifierPositionStack, 0, this.identifierPositionStack = new long[oldStackLength + 20], 0, oldStackLength);
- this.identifierPositionStack[this.identifierPtr] =
- (((long) this.scanner.startPosition) << 32) + (this.scanner.currentPosition - 1);
+ int stackLength = this.identifierStack.length;
+ if (++this.identifierPtr >= stackLength) {
+ System.arraycopy(
+ this.identifierStack, 0,
+ this.identifierStack = new char[stackLength + 20][], 0,
+ stackLength);
+ System.arraycopy(
+ this.identifierPositionStack, 0,
+ this.identifierPositionStack = new long[stackLength + 20], 0,
+ stackLength);
}
+ this.identifierStack[this.identifierPtr] = this.scanner.getCurrentIdentifierSource();
+ this.identifierPositionStack[this.identifierPtr] =
+ (((long) this.scanner.startPosition) << 32) + (this.scanner.currentPosition - 1);
- try {
- this.identifierLengthStack[++this.identifierLengthPtr] = 1;
- } catch (IndexOutOfBoundsException e) {
- /*---stack reallocation (this.identifierLengthPtr is correct)---*/
- int oldStackLength = this.identifierLengthStack.length;
- System.arraycopy(this.identifierLengthStack, 0, this.identifierLengthStack = new int[oldStackLength + 10], 0, oldStackLength);
- this.identifierLengthStack[this.identifierLengthPtr] = 1;
+ stackLength = this.identifierLengthStack.length;
+ if (++this.identifierLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.identifierLengthStack, 0,
+ this.identifierLengthStack = new int[stackLength + 10], 0,
+ stackLength);
}
-
+ this.identifierLengthStack[this.identifierLengthPtr] = 1;
}
protected void pushIdentifier(int flag) {
/*push a special flag on the stack :
-zero stands for optional Name
-negative number for direct ref to base types.
- this.identifierLengthPtr points on the top */
+ identifierLengthPtr points on the top */
- try {
- this.identifierLengthStack[++this.identifierLengthPtr] = flag;
- } catch (IndexOutOfBoundsException e) {
- /*---stack reallaocation (this.identifierLengthPtr is correct)---*/
- int oldStackLength = this.identifierLengthStack.length;
- System.arraycopy(this.identifierLengthStack, 0, this.identifierLengthStack = new int[oldStackLength + 10], 0, oldStackLength);
- this.identifierLengthStack[this.identifierLengthPtr] = flag;
+ int stackLength = this.identifierLengthStack.length;
+ if (++this.identifierLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.identifierLengthStack, 0,
+ this.identifierLengthStack = new int[stackLength + 10], 0,
+ stackLength);
}
-
+ this.identifierLengthStack[this.identifierLengthPtr] = flag;
}
protected void pushOnAstLengthStack(int pos) {
- try {
- this.astLengthStack[++this.astLengthPtr] = pos;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.astLengthStack.length;
- System.arraycopy(this.astLengthStack, 0, this.astLengthStack = new int[oldStackLength + StackIncrement], 0, oldStackLength);
- this.astLengthStack[this.astLengthPtr] = pos;
+
+ int stackLength = this.astLengthStack.length;
+ if (++this.astLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.astLengthStack, 0,
+ this.astLengthStack = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.astLengthStack[this.astLengthPtr] = pos;
}
protected void pushOnAstStack(ASTNode node) {
/*add a new obj on top of the ast stack
- this.astPtr points on the top*/
+ astPtr points on the top*/
- try {
- this.astStack[++this.astPtr] = node;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.astStack.length;
- System.arraycopy(this.astStack, 0, this.astStack = new ASTNode[oldStackLength + AstStackIncrement], 0, oldStackLength);
- this.astPtr = oldStackLength;
- this.astStack[this.astPtr] = node;
+ int stackLength = this.astStack.length;
+ if (++this.astPtr >= stackLength) {
+ System.arraycopy(
+ this.astStack, 0,
+ this.astStack = new ASTNode[stackLength + AstStackIncrement], 0,
+ stackLength);
+ this.astPtr = stackLength;
}
+ this.astStack[this.astPtr] = node;
- try {
- this.astLengthStack[++this.astLengthPtr] = 1;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.astLengthStack.length;
- System.arraycopy(this.astLengthStack, 0, this.astLengthStack = new int[oldStackLength + AstStackIncrement], 0, oldStackLength);
- this.astLengthStack[this.astLengthPtr] = 1;
+ stackLength = this.astLengthStack.length;
+ if (++this.astLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.astLengthStack, 0,
+ this.astLengthStack = new int[stackLength + AstStackIncrement], 0,
+ stackLength);
}
+ this.astLengthStack[this.astLengthPtr] = 1;
}
protected void pushOnExpressionStack(Expression expr) {
- try {
- this.expressionStack[++this.expressionPtr] = expr;
- } catch (IndexOutOfBoundsException e) {
- //this.expressionPtr is correct
- int oldStackLength = this.expressionStack.length;
- System.arraycopy(this.expressionStack, 0, this.expressionStack = new Expression[oldStackLength + ExpressionStackIncrement], 0, oldStackLength);
- this.expressionStack[this.expressionPtr] = expr;
+ int stackLength = this.expressionStack.length;
+ if (++this.expressionPtr >= stackLength) {
+ System.arraycopy(
+ this.expressionStack, 0,
+ this.expressionStack = new Expression[stackLength + ExpressionStackIncrement], 0,
+ stackLength);
}
+ this.expressionStack[this.expressionPtr] = expr;
- try {
- this.expressionLengthStack[++this.expressionLengthPtr] = 1;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.expressionLengthStack.length;
- System.arraycopy(this.expressionLengthStack, 0, this.expressionLengthStack = new int[oldStackLength + ExpressionStackIncrement], 0, oldStackLength);
- this.expressionLengthStack[this.expressionLengthPtr] = 1;
+ stackLength = this.expressionLengthStack.length;
+ if (++this.expressionLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.expressionLengthStack, 0,
+ this.expressionLengthStack = new int[stackLength + ExpressionStackIncrement], 0,
+ stackLength);
}
+ this.expressionLengthStack[this.expressionLengthPtr] = 1;
}
protected void pushOnExpressionStackLengthStack(int pos) {
- try {
- this.expressionLengthStack[++this.expressionLengthPtr] = pos;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.expressionLengthStack.length;
- System.arraycopy(this.expressionLengthStack, 0, this.expressionLengthStack = new int[oldStackLength + StackIncrement], 0, oldStackLength);
- this.expressionLengthStack[this.expressionLengthPtr] = pos;
+
+ int stackLength = this.expressionLengthStack.length;
+ if (++this.expressionLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.expressionLengthStack, 0,
+ this.expressionLengthStack = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.expressionLengthStack[this.expressionLengthPtr] = pos;
}
protected void pushOnGenericsStack(ASTNode node) {
/*add a new obj on top of the generics stack
- this.genericsPtr points on the top*/
+ genericsPtr points on the top*/
- try {
- this.genericsStack[++this.genericsPtr] = node;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.genericsStack.length;
- System.arraycopy(this.genericsStack, 0, this.genericsStack = new ASTNode[oldStackLength + GenericsStackIncrement], 0, oldStackLength);
- this.genericsPtr = oldStackLength;
- this.genericsStack[this.genericsPtr] = node;
+ int stackLength = this.genericsStack.length;
+ if (++this.genericsPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsStack, 0,
+ this.genericsStack = new ASTNode[stackLength + GenericsStackIncrement], 0,
+ stackLength);
}
+ this.genericsStack[this.genericsPtr] = node;
- try {
- this.genericsLengthStack[++this.genericsLengthPtr] = 1;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.genericsLengthStack.length;
- System.arraycopy(this.genericsLengthStack, 0, this.genericsLengthStack = new int[oldStackLength + GenericsStackIncrement], 0, oldStackLength);
- this.genericsLengthStack[this.genericsLengthPtr] = 1;
+ stackLength = this.genericsLengthStack.length;
+ if (++this.genericsLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsLengthStack, 0,
+ this.genericsLengthStack = new int[stackLength + GenericsStackIncrement], 0,
+ stackLength);
}
+ this.genericsLengthStack[this.genericsLengthPtr] = 1;
}
protected void pushOnGenericsIdentifiersLengthStack(int pos) {
- try {
- this.genericsIdentifiersLengthStack[++this.genericsIdentifiersLengthPtr] = pos;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.genericsIdentifiersLengthStack.length;
- System.arraycopy(this.genericsIdentifiersLengthStack, 0, (this.genericsIdentifiersLengthStack = new int[oldStackLength + GenericsStackIncrement]), 0, oldStackLength);
- this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr] = pos;
+ int stackLength = this.genericsIdentifiersLengthStack.length;
+ if (++this.genericsIdentifiersLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsIdentifiersLengthStack, 0,
+ this.genericsIdentifiersLengthStack = new int[stackLength + GenericsStackIncrement], 0,
+ stackLength);
}
+ this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr] = pos;
}
protected void pushOnGenericsLengthStack(int pos) {
- try {
- this.genericsLengthStack[++this.genericsLengthPtr] = pos;
- } catch (IndexOutOfBoundsException e) {
- int oldStackLength = this.genericsLengthStack.length;
- int[] oldPos = this.genericsLengthStack;
- this.genericsLengthStack = new int[oldStackLength + GenericsStackIncrement];
- System.arraycopy(oldPos, 0, this.genericsLengthStack, 0, oldStackLength);
- this.genericsLengthStack[this.genericsLengthPtr] = pos;
+ int stackLength = this.genericsLengthStack.length;
+ if (++this.genericsLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsLengthStack, 0,
+ this.genericsLengthStack = new int[stackLength + GenericsStackIncrement], 0,
+ stackLength);
}
+ this.genericsLengthStack[this.genericsLengthPtr] = pos;
}
protected void pushOnIntStack(int pos) {
- try {
- this.intStack[++this.intPtr] = pos;
- } catch (IndexOutOfBoundsException e) {
- //this.intPtr is correct
- int oldStackLength = this.intStack.length;
- System.arraycopy(this.intStack, 0, this.intStack = new int[oldStackLength + StackIncrement], 0, oldStackLength);
- this.intStack[this.intPtr] = pos;
+
+ int stackLength = this.intStack.length;
+ if (++this.intPtr >= stackLength) {
+ System.arraycopy(
+ this.intStack, 0,
+ this.intStack = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.intStack[this.intPtr] = pos;
}
protected void pushOnRealBlockStack(int i){
- try {
- this.realBlockStack[++this.realBlockPtr] = i;
- } catch (IndexOutOfBoundsException e) {
- //this.realBlockPtr is correct
- int oldStackLength = this.realBlockStack.length;
- System.arraycopy(this.realBlockStack, 0, this.realBlockStack = new int[oldStackLength + StackIncrement], 0, oldStackLength);
- this.realBlockStack[this.realBlockPtr] = i;
+
+ int stackLength = this.realBlockStack.length;
+ if (++this.realBlockPtr >= stackLength) {
+ System.arraycopy(
+ this.realBlockStack, 0,
+ this.realBlockStack = new int[stackLength + StackIncrement], 0,
+ stackLength);
}
+ this.realBlockStack[this.realBlockPtr] = i;
}
public void recoveryExitFromVariable() {
if(this.currentElement != null && this.currentElement.parent != null) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 24185a9..a115af2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -205,6 +205,7 @@
}
// chech presence of task: tags
+// TODO (frederic) see if we need to take unicode characters into account...
public void checkTaskTag(int commentStart, int commentEnd) {
char[] src = this.source;
@@ -214,8 +215,9 @@
return;
}
int foundTaskIndex = this.foundTaskCount;
- char previous = commentStart==0 ? 0 : this.source[commentStart-1];
- nextChar : for (int i = commentStart; i < commentEnd && i < this.eofPosition; i++) {
+ char previous = src[commentStart+1]; // should be '*' or '/'
+ nextChar : for (
+ int i = commentStart + 2; i < commentEnd && i < this.eofPosition; i++) {
char[] tag = null;
char[] priority = null;
// check for tag occurrence only if not ambiguous with javadoc tag
@@ -234,7 +236,8 @@
for (int t = 0; t < tagLength; t++) {
char sc, tc;
- if ((i+t) >= this.eofPosition) continue nextTag;
+ int x = i+t;
+ if (x >= this.eofPosition || x >= commentEnd) continue nextTag;
if ((sc = src[i + t]) != (tc = tag[t])) { // case sensitive check
if (this.isTaskCaseSensitive || (Character.toLowerCase(sc) != Character.toLowerCase(tc))) { // case insensitive check
continue nextTag;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 1f06b37..c25c316 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -539,6 +539,7 @@
case IProblem.JavadocDuplicateReturnTag:
case IProblem.JavadocInvalidThrowsClass:
case IProblem.JavadocInvalidSeeReference:
+ case IProblem.JavadocMalformedSeeReference:
case IProblem.JavadocInvalidSeeHref:
case IProblem.JavadocInvalidSeeArgs:
case IProblem.JavadocInvalidTag:
@@ -2668,6 +2669,9 @@
location.sourceEnd);
}
}
+public void javadocMalformedSeeReference(int sourceStart, int sourceEnd) {
+ this.handle(IProblem.JavadocMalformedSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
+}
public void javadocMissing(int sourceStart, int sourceEnd, int modifiers){
boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocComments) != ProblemSeverities.Ignore)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
index d669087..8295a36 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -385,6 +385,7 @@
510 = The type {0} is defined in an inherited type and an enclosing scope
511 = {0} is an ambiguous method reference or is not a field
512 = Missing closing brace for inline tag
+513 = Malformed reference (missing separator after method reference closing brace)
515 = Javadoc:
### GENERICS
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index 754efa8..189fb10 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -1015,7 +1015,7 @@
/**
* Sets default node flags of new nodes of this AST.
*
- * @param default node flags of new nodes of this AST
+ * @param flag node flags of new nodes of this AST
* @since 3.0
*/
void setDefaultNodeFlag(int flag) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
index a943911..95b4c54 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
@@ -2669,23 +2669,25 @@
int start = name.getStartPosition();
// get compiler node and record nodes
org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(start);
+ // record nodes
if (compilerNode != null) {
- recordNodes(name, compilerNode);
recordNodes(methodRef, compilerNode);
- }
- // Replace qualifier to have all nodes recorded
- if (methodRef.getQualifier() != null) {
+ // get type ref
org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = null;
if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression) {
typeRef = ((org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression)compilerNode).type;
+ if (typeRef != null) recordNodes(name, typeRef);
}
else if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend) {
org.eclipse.jdt.internal.compiler.ast.Expression expression = ((org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend)compilerNode).receiver;
if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
}
+ // TODO (frederic) remove following line to fix bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650
+ recordNodes(name, compilerNode);
}
- if (typeRef != null) {
+ // record name and qualifier
+ if (typeRef != null && methodRef.getQualifier() != null) {
recordName(methodRef.getQualifier(), typeRef);
}
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
index 12c1cfa..ba3033c 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
@@ -1530,7 +1530,6 @@
* </ul>
*
* @param property the property
- * @return the value, or <code>null</code> if none
* @exception RuntimeException if this node does not have the
* given property, or if the given property cannot be set
* @since 3.0
@@ -2300,8 +2299,8 @@
* method uses object identity (==). Use <code>subtreeMatch</code> to
* compare two subtrees for equality.
*
- * @param obj {@inheritdoc}
- * @return {@inheritdoc}
+ * @param obj {@inheritDoc}
+ * @return {@inheritDoc}
* @see #subtreeMatch(ASTMatcher matcher, Object other)
*/
public final boolean equals(Object obj) {
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 9ca41af..a7a5d9f 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
@@ -51,7 +51,7 @@
* <li>Source string from {@link #setSource(char[]) char[]},
* {@link #setSource(ICompilationUnit) ICompilationUnit},
* or {@link #setSource(IClassFile) IClassFile}, and limited
- * to a specified {@linkplain #setSourceRange(int,int) subrange.</li>
+ * to a specified {@linkplain #setSourceRange(int,int) subrange}.</li>
* <li>Whether {@linkplain #setResolveBindings(boolean) bindings} will be created.</li>
* <li>Which {@linkplain #setWorkingCopyOwner(WorkingCopyOwner)
* working set owner} to use when resolving bindings).</li>
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java
index e9611ce..d4e90d5 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java
@@ -21,7 +21,7 @@
* </pre>
* <p>
* Note that annotation type member declarations are only meaningful as
- * elements of {@link AnnotationTypeDeclaration#members AnnotationTypeDeclaration.members}.
+ * elements of {@link AnnotationTypeDeclaration#bodyDeclarations()}.
* </p>
* <p>
* When a Javadoc comment is present, the source
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildListPropertyDescriptor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildListPropertyDescriptor.java
index 3892553..39d7944 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildListPropertyDescriptor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildListPropertyDescriptor.java
@@ -15,7 +15,7 @@
* A child list property is one whose value is a list of
* {@link ASTNode}.
*
- * @see ASTNode#getStructuralProperty(SimplePropertyDescriptor)
+ * @see org.eclipse.jdt.core.dom.ASTNode#getStructuralProperty(StructuralPropertyDescriptor)
* @since 3.0
*/
public final class ChildListPropertyDescriptor extends StructuralPropertyDescriptor {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildPropertyDescriptor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildPropertyDescriptor.java
index 146c61a..a58ec5a 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildPropertyDescriptor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildPropertyDescriptor.java
@@ -15,8 +15,8 @@
* A child property is one whose value is an
* {@link ASTNode}.
*
- * @see ASTNode#getStructuralProperty(SimplePropertyDescriptor)
- * @see ASTNode#setStructuralProperty(SimplePropertyDescriptor,Object)
+ * @see org.eclipse.jdt.core.dom.ASTNode#getStructuralProperty(StructuralPropertyDescriptor)
+ * @see org.eclipse.jdt.core.dom.ASTNode#setStructuralProperty(StructuralPropertyDescriptor, Object)
* @since 3.0
*/
public final class ChildPropertyDescriptor extends StructuralPropertyDescriptor {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
index a750888..51294e4 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
@@ -466,7 +466,7 @@
* Sets the type instantiated in this class instance creation
* expression (added in JLS3 API).
*
- * @param name the new type
+ * @param type the new type
* @exception IllegalArgumentException if:
* <ul>
* <li>the node belongs to a different AST</li>
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
index bc1e92a..2f87ddb 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
@@ -381,7 +381,7 @@
* </ul>
* </p>
* <p>
- * Each call to {@link ASTParser#createAST(IProgressMonitor)} with a request for bindings
+ * Each call to {@link ASTParser#createAST(org.eclipse.core.runtime.IProgressMonitor)} with a request for bindings
* gives rise to separate universe of binding objects. This method always returns
* <code>null</code> when the binding object comes from a different AST.
* Use <code>findDeclaringNode(binding.getKey())</code> when the binding comes
@@ -837,7 +837,7 @@
* @param options the table of formatter options
* (key type: <code>String</code>; value type: <code>String</code>);
* or <code>null</code> to use the standard global options
- * {@link JavaCore#getOptions() JavaCore.getOptions()}.
+ * {@link org.eclipse.jdt.core.JavaCore#getOptions() JavaCore.getOptions()}.
* @return text edit object describing the changes to the
* document corresponding to the recorded AST modifications
* @exception IllegalArgumentException if the document passed is
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
index 04c3601..f8f9405 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
@@ -25,6 +25,7 @@
import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
import org.eclipse.jdt.internal.compiler.ast.FalseLiteral;
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
+import org.eclipse.jdt.internal.compiler.ast.ImplicitDocTypeReference;
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.JavadocFieldReference;
@@ -353,6 +354,9 @@
} else if (node instanceof AllocationExpression) {
AllocationExpression allocation = (AllocationExpression) node;
return getMethodBinding(allocation.binding);
+ } else if (node instanceof ImplicitDocTypeReference) {
+ ImplicitDocTypeReference implicitRef = (ImplicitDocTypeReference) node;
+ return getTypeBinding(implicitRef.resolvedType);
}
return null;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java
index 312e5d8..c899516 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java
@@ -172,8 +172,8 @@
* not be different; in these cases, the client should compare bindings
* via their binding keys (<code>getKey</code>) if available.
*
- * @param obj {@inheritdoc}
- * @return {@inheritdoc}
+ * @param obj {@inheritDoc}
+ * @return {@inheritDoc}
* @see #getKey()
*/
public boolean equals(Object obj);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimplePropertyDescriptor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimplePropertyDescriptor.java
index 322d7f3..14ad1a1 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimplePropertyDescriptor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimplePropertyDescriptor.java
@@ -17,8 +17,8 @@
* or some simple value type (such as <code>String</code> or
* <code>InfixExpression.Operator</code>).
*
- * @see ASTNode#getStructuralProperty(SimplePropertyDescriptor)
- * @see ASTNode#setStructuralProperty(SimplePropertyDescriptor,Object)
+ * @see org.eclipse.jdt.core.dom.ASTNode#getStructuralProperty(StructuralPropertyDescriptor)
+ * @see org.eclipse.jdt.core.dom.ASTNode#setStructuralProperty(StructuralPropertyDescriptor, Object)
* @since 3.0
*/
public final class SimplePropertyDescriptor extends StructuralPropertyDescriptor {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StructuralPropertyDescriptor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StructuralPropertyDescriptor.java
index 5c486df..2c04bff 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StructuralPropertyDescriptor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StructuralPropertyDescriptor.java
@@ -82,7 +82,7 @@
/**
* Returns whether this property is a simple property
- * (instance of {@link SimplePropertyDescriptor).
+ * (instance of {@link SimplePropertyDescriptor}.
*
* @return <code>true</code> if this is a simple property, and
* <code>false</code> otherwise
@@ -93,7 +93,7 @@
/**
* Returns whether this property is a child property
- * (instance of {@link ChildPropertyDescriptor).
+ * (instance of {@link ChildPropertyDescriptor}.
*
* @return <code>true</code> if this is a child property, and
* <code>false</code> otherwise
@@ -104,7 +104,7 @@
/**
* Returns whether this property is a child list property
- * (instance of {@link ChildListPropertyDescriptor).
+ * (instance of {@link ChildListPropertyDescriptor}.
*
* @return <code>true</code> if this is a child list property, and
* <code>false</code> otherwise
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
index b3fb6cc..b5c6d54 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
@@ -300,7 +300,7 @@
* The fragments cover everything following the tag name
* (or everything if there is no tag name), and generally omit
* embedded line breaks (and leading whitespace on new lines,
- * including any leading "*"). {@link TagElement}
+ * including any leading "*"). {@link org.eclipse.jdt.core.dom.TagElement}
* nodes are used to represent tag elements (e.g., "@link")
* nested within this tag element.
* </p>
@@ -313,10 +313,10 @@
* TagElement with tag name "@param";
* 2 fragments: SimpleName ("args"), TextElement
* (" the program arguments")</li>
- * <li>"@return See {@link #foo foo} instead." -
+ * <li>"@return See {@link #foo foo} instead." -
* TagElement with tag name "@return";
* 3 fragments: TextElement ("See "),
- * TagElement (for "@link #foo foo"),
+ * TagElement (for "@link #foo foo"),
* TextElement (" instead.")</li>
* </ul>
* The use of Name, MethodRef, and MemberRef nodes within
@@ -327,7 +327,7 @@
* Adding and removing nodes from this list affects this node
* dynamically. The nodes in this list may be of various
* types, including {@link TextElement},
- * {@link TagElement}, {@link Name},
+ * {@link org.eclipse.jdt.core.dom.TagElement}, {@link Name},
* {@link MemberRef}, and {@link MethodRef}.
* Clients should assume that the list of types may grow in
* the future, and write their code to deal with unexpected
@@ -351,7 +351,7 @@
* "@see" are only meaningful as top-level tags.
* <p>
* This convenience methods checks to see whether the parent
- * of this node is of type {@link TagElement)}.
+ * of this node is of type {@link org.eclipse.jdt.core.dom.TagElement}.
* </p>
*
* @return <code>true</code> if this node is a nested tag element,
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Location.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Location.java
index ff865c9..ef192a3 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Location.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Location.java
@@ -24,9 +24,10 @@
public boolean needSpace;
public boolean pendingSpace;
public int nlsTagCounter;
+ public int lastLocalDeclarationSourceStart;
// chunk management
- public int lastNumberOfNewLines;
+ public int lastNumberOfNewLines;
// edits management
int editsIndex;
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 2c404de..b951deb 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
@@ -291,11 +291,13 @@
public void enterAlignment(Alignment alignment){
alignment.enclosing = this.currentAlignment;
+ alignment.location.lastLocalDeclarationSourceStart = this.formatter.lastLocalDeclarationSourceStart;
this.currentAlignment = alignment;
}
public void enterMemberAlignment(Alignment alignment) {
alignment.enclosing = this.memberAlignment;
+ alignment.location.lastLocalDeclarationSourceStart = this.formatter.lastLocalDeclarationSourceStart;
this.memberAlignment = alignment;
}
@@ -309,7 +311,7 @@
throw new AbortFormatting("could not find matching alignment: "+alignment); //$NON-NLS-1$
}
this.indentationLevel = alignment.location.outputIndentationLevel;
-
+ this.formatter.lastLocalDeclarationSourceStart = alignment.location.lastLocalDeclarationSourceStart;
if (discardAlignment){
this.currentAlignment = alignment.enclosing;
}
@@ -325,6 +327,7 @@
throw new AbortFormatting("could not find matching alignment: "+alignment); //$NON-NLS-1$
}
this.indentationLevel = current.location.outputIndentationLevel;
+ this.formatter.lastLocalDeclarationSourceStart = alignment.location.lastLocalDeclarationSourceStart;
this.memberAlignment = current.enclosing;
}
@@ -1261,7 +1264,6 @@
this.scanner.resetTo(this.currentAlignment.location.inputOffset, this.scanner.eofPosition);
// clean alignment chunkKind so it will think it is a new chunk again
this.currentAlignment.chunkKind = 0;
- this.formatter.lastLocalDeclarationSourceStart = -1;
}
void redoMemberAlignment(AlignmentException e){
@@ -1270,7 +1272,6 @@
this.scanner.resetTo(this.memberAlignment.location.inputOffset, this.scanner.eofPosition);
// clean alignment chunkKind so it will think it is a new chunk again
this.memberAlignment.chunkKind = 0;
- this.formatter.lastLocalDeclarationSourceStart = -1;
}
public void reset() {
@@ -1293,6 +1294,7 @@
if (this.editsIndex > 0) {
this.edits[this.editsIndex - 1] = location.textEdit;
}
+ this.formatter.lastLocalDeclarationSourceStart = location.lastLocalDeclarationSourceStart;
}
private void resize() {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
index cefb8dc..470e510 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
@@ -78,13 +78,13 @@
* <ul>
* <li>{@link JavaCore#newLibraryEntry(IPath, IPath, IPath, boolean)} and variants</li>
* <li>{@link JavaCore#newProjectEntry(IPath, boolean)} and variants</li>
- * <li>{@link JavaCore#create(IWorkspaceRoot)</li>
- * <li>{@link JavaCore#create(IProject)</li>
- * <li>{@link IJavaModel#getJavaProjects()</li>
- * <li>{@link IJavaProject#getRawClasspath()</li>
- * <li>{@link IJavaProject#readRawClasspath()</li>
- * <li>{@link IJavaProject#getOutputLocation()</li>
- * <li>{@link IJavaProject#readOutputLocation()</li>
+ * <li>{@link JavaCore#create(org.eclipse.core.resources.IWorkspaceRoot)}</li>
+ * <li>{@link JavaCore#create(org.eclipse.core.resources.IProject)}</li>
+ * <li>{@link IJavaModel#getJavaProjects()}</li>
+ * <li>{@link IJavaProject#getRawClasspath()}</li>
+ * <li>{@link IJavaProject#readRawClasspath()}</li>
+ * <li>{@link IJavaProject#getOutputLocation()}</li>
+ * <li>{@link IJavaProject#readOutputLocation()}</li>
* <li>Java element operations marked as "handle-only"</li>
* </ul>
* The effects of using other Java model APIs are unspecified.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java
index 61c8088..7adfc8f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java
@@ -518,7 +518,7 @@
* </p>
*
* @param astLevel either {@link #NO_AST} if no AST is wanted,
- * or the {@linkplain AST#AST(int) AST API level} of the AST if one is wanted
+ * or the {@linkplain AST#newAST(int) AST API level} of the AST if one is wanted
* @param forceProblemDetection boolean indicating whether problem should be
* recomputed even if the source hasn't changed
* @param owner the owner of working copies that take precedence over the
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
index 63e4d47..408ba59 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
@@ -445,7 +445,7 @@
* @param parameterTypes the list of parameter type signatures
* @param returnType the return type signature
* @return the encoded method signature
- * @see Signature#createMethodSignature(String[], String, String[], String[])
+ * @see Signature#createMethodSignature(char[][], char[])
*/
public static String createMethodSignature(String[] parameterTypes, String returnType) {
int parameterTypesLenth = parameterTypes.length;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/ICodeSnippetRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/ICodeSnippetRequestor.java
index c114de8..68e2c92 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/ICodeSnippetRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/ICodeSnippetRequestor.java
@@ -22,8 +22,8 @@
* Clients may implement this interface to provide a bridge a running Java VM.
* </p>
*
- * @see IEvaluationContext#evaluateCodeSnippet(String, ICodeSnippetRequestor, IProgressMonitor)
- * @see IEvaluationContext#evaluateCodeSnippet(String, String[], String[], int[], IType, boolean, boolean, ICodeSnippetRequestor, IProgressMonitor)
+ * @see IEvaluationContext#evaluateCodeSnippet(String, ICodeSnippetRequestor, org.eclipse.core.runtime.IProgressMonitor)
+ * @see IEvaluationContext#evaluateCodeSnippet(String, String[], String[], int[], org.eclipse.jdt.core.IType, boolean, boolean, ICodeSnippetRequestor, org.eclipse.core.runtime.IProgressMonitor)
*/
public interface ICodeSnippetRequestor {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMImport.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMImport.java
index 317502c..317a625 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMImport.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMImport.java
@@ -42,7 +42,7 @@
* Returns the modifier flags for this import. The flags can be examined using class
* <code>Flags</code>. Only the static flag is meaningful for import declarations.
* @return the modifier flags for this import
- * @see Flags
+ * @see org.eclipse.jdt.core.Flags
* @since 3.0
*/
int getFlags();
@@ -57,7 +57,7 @@
* and subject to change.
* </p>
* @param flags the modifier flags for this import
- * @see Flags
+ * @see org.eclipse.jdt.core.Flags
* @since 3.0
*/
void setFlags(int flags);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ICodeAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ICodeAttribute.java
index 7343a41..bdd82fe 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ICodeAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ICodeAttribute.java
@@ -98,9 +98,6 @@
/**
* Define a Java opcodes walker. All actions are defined in the visitor.
- * @param writer The writer used to generate the disassemble output
- * @param lineSeparator The line separator used to put each opcode on its own line
- * @param tabNumber the number of indentation (SPACE or TAB)
* @param visitor The visitor to use to walk the opcodes.
*
* @exception ClassFormatException Exception thrown if the opcodes contain invalid bytes
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java
index f69ff29..1e14e85 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java
@@ -1301,16 +1301,14 @@
}
protected void pushOnIntArrayStack(int[] positions) {
- try {
- intArrayStack[++intArrayPtr] = positions;
- } catch (IndexOutOfBoundsException e) {
- //intPtr is correct
- int oldStackLength = intArrayStack.length;
- int oldStack[][] = intArrayStack;
- intArrayStack = new int[oldStackLength + StackIncrement][];
- System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength);
- intArrayStack[intArrayPtr] = positions;
+ int stackLength = this.intArrayStack.length;
+ if (++this.intArrayPtr >= stackLength) {
+ System.arraycopy(
+ this.intArrayStack, 0,
+ this.intArrayStack = new int[stackLength + StackIncrement][], 0,
+ stackLength);
}
+ intArrayStack[intArrayPtr] = positions;
}
protected void resetModifiers() {
super.resetModifiers();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
index 090ea46..2eae361 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -797,26 +797,29 @@
}
// ensure custom output doesn't conflict with other outputs
- int index;
-
// check exact match
- if ((index = Util.indexOfMatchingPath(customOutput, outputLocations, outputCount)) != -1) {
+ if (Util.indexOfMatchingPath(customOutput, outputLocations, outputCount) != -1) {
continue; // already found
}
-
- // check nesting
- if ((index = Util.indexOfEnclosingPath(customOutput, outputLocations, outputCount)) != -1) {
- if (index == 0) {
- // custom output is nested in project's output: need to check if all source entries have a custom
- // output before complaining
- if (potentialNestedOutput == null) potentialNestedOutput = customOutput;
- } else {
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestOutputInOutput", customOutput.makeRelative().toString(), outputLocations[index].makeRelative().toString())); //$NON-NLS-1$
- }
- }
+ // accumulate all outputs, will check nesting once all available (to handle ordering issues)
outputLocations[outputCount++] = customOutput;
}
- }
+ }
+ }
+ // check nesting across output locations
+ for (int i = 1 /*no check for default output*/ ; i < outputCount; i++) {
+ IPath customOutput = outputLocations[i];
+ int index;
+ // check nesting
+ if ((index = Util.indexOfEnclosingPath(customOutput, outputLocations, outputCount)) != -1 && index != i) {
+ if (index == 0) {
+ // custom output is nested in project's output: need to check if all source entries have a custom
+ // output before complaining
+ if (potentialNestedOutput == null) potentialNestedOutput = customOutput;
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestOutputInOutput", customOutput.makeRelative().toString(), outputLocations[index].makeRelative().toString())); //$NON-NLS-1$
+ }
+ }
}
// allow custom output nesting in project's output if all source entries have a custom output
if (sourceEntryCount <= outputCount-1) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
index 3cf9322..621fb49 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
@@ -420,6 +420,7 @@
this.removeFromParentInfo(javaProject);
this.manager.removePerProjectInfo(javaProject);
}
+ this.state.rootsAreStale = true;
} else if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
boolean wasJavaProject = this.manager.getJavaModel().findJavaProject(project) != null;
boolean isJavaProject = JavaProject.hasJavaNature(project);
@@ -1536,10 +1537,11 @@
}
}
- JavaElementDelta elementDelta = currentDelta().find(element);
+ JavaElementDelta current = currentDelta();
+ JavaElementDelta elementDelta = current.find(element);
if (elementDelta == null) {
- currentDelta().changed(element, IJavaElementDelta.F_CONTENT);
- elementDelta = currentDelta().find(element);
+ // don't use find after creating the delta as it can be null (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63434)
+ elementDelta = current.changed(element, IJavaElementDelta.F_CONTENT);
}
elementDelta.addResourceDelta(delta);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDelta.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDelta.java
index f60a59c..ea3d2a6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDelta.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDelta.java
@@ -224,10 +224,11 @@
* The constructor should be used to create the root delta
* and then a change operation should call this method.
*/
-public void changed(IJavaElement element, int changeFlag) {
+public JavaElementDelta changed(IJavaElement element, int changeFlag) {
JavaElementDelta changedDelta = new JavaElementDelta(element);
changedDelta.changed(changeFlag);
insertDeltaTree(element, changedDelta);
+ return changedDelta;
}
/**
* Mark this delta as a content changed delta.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index 804e0a8..2583ce3 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -742,46 +742,49 @@
* and register it.
* Close the working copy, its buffer and remove it from the shared working copy table.
* Ignore if no per-working copy info existed.
- * NOTE: it must be synchronized as it may interact with the element info cache (if useCount is decremented to 0), see bug 50667.
+ * NOTE: it must NOT be synchronized as it may interact with the element info cache (if useCount is decremented to 0), see bug 50667.
* Returns the new use count (or -1 if it didn't exist).
*/
- public synchronized int discardPerWorkingCopyInfo(CompilationUnit workingCopy) throws JavaModelException {
+ public int discardPerWorkingCopyInfo(CompilationUnit workingCopy) throws JavaModelException {
+
+ // create the delta builder (this remembers the current content of the working copy)
+ // outside the perWorkingCopyInfos lock (see bug 50667)
+ JavaElementDeltaBuilder deltaBuilder = null;
+ if (workingCopy.isPrimary()) {
+ deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
+ }
+ PerWorkingCopyInfo info = null;
synchronized(this.perWorkingCopyInfos) {
WorkingCopyOwner owner = workingCopy.owner;
Map workingCopyToInfos = (Map)this.perWorkingCopyInfos.get(owner);
if (workingCopyToInfos == null) return -1;
- PerWorkingCopyInfo info = (PerWorkingCopyInfo)workingCopyToInfos.get(workingCopy);
+ info = (PerWorkingCopyInfo)workingCopyToInfos.get(workingCopy);
if (info == null) return -1;
if (--info.useCount == 0) {
- // create the delta builder (this remembers the current content of the working copy)
- JavaElementDeltaBuilder deltaBuilder = null;
- if (workingCopy.isPrimary()) {
- deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
- }
-
// remove per working copy info
workingCopyToInfos.remove(workingCopy);
if (workingCopyToInfos.isEmpty()) {
this.perWorkingCopyInfos.remove(owner);
}
-
- // remove infos + close buffer (since no longer working copy)
- removeInfoAndChildren(workingCopy);
- workingCopy.closeBuffer();
-
- // compute the delta if needed and register it if there are changes
- if (deltaBuilder != null) {
- deltaBuilder.buildDeltas();
- if ((deltaBuilder.delta != null) && (deltaBuilder.delta.getAffectedChildren().length > 0)) {
- getDeltaProcessor().registerJavaModelDelta(deltaBuilder.delta);
- }
- }
-
}
- return info.useCount;
}
+ if (info.useCount == 0) { // info cannot be null here (check was done above)
+ // remove infos + close buffer (since no longer working copy)
+ // outside the perWorkingCopyInfos lock (see bug 50667)
+ removeInfoAndChildren(workingCopy);
+ workingCopy.closeBuffer();
+
+ // compute the delta if needed and register it if there are changes
+ if (deltaBuilder != null) {
+ deltaBuilder.buildDeltas();
+ if ((deltaBuilder.delta != null) && (deltaBuilder.delta.getAffectedChildren().length > 0)) {
+ getDeltaProcessor().registerJavaModelDelta(deltaBuilder.delta);
+ }
+ }
+ }
+ return info.useCount;
}
/**
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 2e60ff9..4720d1b 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
@@ -999,7 +999,7 @@
/*
* non path canonicalizing version
*/
- public IPackageFragment findPackageFragment0(IPath path)
+ private IPackageFragment findPackageFragment0(IPath path)
throws JavaModelException {
NameLookup lookup = newNameLookup((WorkingCopyOwner)null/*no need to look at working copies for pkgs*/);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
index 97278d8..dc0234a 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
@@ -27,7 +27,6 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
@@ -248,10 +247,10 @@
if (fromFactory == null) {
return null;
}
- if (fromFactory instanceof IPackageFragment) {
- return (IPackageFragment) fromFactory;
- } else
- if (fromFactory instanceof IJavaProject) {
+ switch (fromFactory.getElementType()) {
+ case IJavaElement.PACKAGE_FRAGMENT:
+ return (IPackageFragment) fromFactory;
+ case IJavaElement.JAVA_PROJECT:
// default package in a default root
JavaProject project = (JavaProject) fromFactory;
try {
@@ -272,7 +271,10 @@
} catch (JavaModelException e) {
return null;
}
- }
+ return null;
+ case IJavaElement.PACKAGE_FRAGMENT_ROOT:
+ return ((IPackageFragmentRoot)fromFactory).getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME);
+ }
}
return null;
}
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 c75b3cf..337ba9c 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
@@ -756,8 +756,12 @@
}
public boolean subOrSuperOfFocus(ReferenceBinding typeBinding) {
if (this.focusType == null) return true; // accept all types (case of hierarchy in a region)
- if (this.subTypeOfType(this.focusType, typeBinding)) return true;
- if (!this.superTypesOnly && this.subTypeOfType(typeBinding, this.focusType)) return true;
+ try {
+ if (this.subTypeOfType(this.focusType, typeBinding)) return true;
+ if (!this.superTypesOnly && this.subTypeOfType(typeBinding, this.focusType)) return true;
+ } catch (AbortCompilation e) {
+ // unresolved superclass/superinterface -> ignore
+ }
return false;
}
private boolean subTypeOfType(ReferenceBinding subType, ReferenceBinding typeBinding) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java
index 2c8414e..c926580 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java
@@ -234,22 +234,19 @@
int scannerStart = this.scanner.commentStarts[i]<0 ? -this.scanner.commentStarts[i] : this.scanner.commentStarts[i];
int commentStart = this.commentPtr == -1 ? -1 : (this.commentStarts[this.commentPtr]<0 ? -this.commentStarts[this.commentPtr] : this.commentStarts[this.commentPtr]);
if (commentStart == -1 || scannerStart > commentStart) {
- try {
- this.commentPtr++;
- this.commentStarts[this.commentPtr] = this.scanner.commentStarts[i];
- this.commentStops[this.commentPtr] = this.scanner.commentStops[i];
- } catch (IndexOutOfBoundsException e) {
- // this.commentPtr is still correct
- int oldStackLength = this.commentStarts.length;
- int oldCommentStarts[] = this.commentStarts;
- this.commentStarts = new int[oldStackLength + CommentIncrement];
- System.arraycopy(oldCommentStarts, 0, this.commentStarts, 0, oldStackLength);
- this.commentStarts[this.commentPtr] = this.scanner.commentStarts[i];
- int oldCommentStops[] = this.commentStops;
- this.commentStops = new int[oldStackLength + CommentIncrement];
- System.arraycopy(oldCommentStops, 0, this.commentStops, 0, oldStackLength);
- this.commentStops[this.commentPtr] = this.scanner.commentStops[i];
+ int stackLength = this.commentStarts.length;
+ if (++this.commentPtr >= stackLength) {
+ System.arraycopy(
+ this.commentStarts, 0,
+ this.commentStarts = new int[stackLength + CommentIncrement], 0,
+ stackLength);
+ System.arraycopy(
+ this.commentStops, 0,
+ this.commentStops = new int[stackLength + CommentIncrement], 0,
+ stackLength);
}
+ this.commentStarts[this.commentPtr] = this.scanner.commentStarts[i];
+ this.commentStops[this.commentPtr] = this.scanner.commentStops[i];
}
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
index 0b98dd7..6713b43 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
@@ -208,8 +208,9 @@
return;
}
int foundTaskIndex = this.foundTaskCount;
- char previous = commentStart==0 ? 0 : this.source[commentStart-1];
- nextChar : for (int i = commentStart; i < commentEnd && i < this.eofPosition; i++) {
+ char previous = src[commentStart+1]; // should be '*' or '/'
+ nextChar : for (
+ int i = commentStart + 2; i < commentEnd && i < this.eofPosition; i++) {
char[] tag = null;
char[] priority = null;
// check for tag occurrence only if not ambiguous with javadoc tag
@@ -228,7 +229,8 @@
for (int t = 0; t < tagLength; t++) {
char sc, tc;
- if ((i+t) >= this.eofPosition) continue nextTag;
+ int x = i+t;
+ if (x >= this.eofPosition || x >= commentEnd) continue nextTag;
if ((sc = src[i + t]) != (tc = tag[t])) { // case sensitive check
if (this.isTaskCaseSensitive || (Character.toLowerCase(sc) != Character.toLowerCase(tc))) { // case insensitive check
continue nextTag;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
index 8971266..58f6713 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
@@ -867,15 +867,22 @@
}
/*
- * Returns the index of the first argument paths which is strictly enclosing the path to check
+ * Returns the index of the most specific argument paths which is strictly enclosing the path to check
*/
public static int indexOfEnclosingPath(IPath checkedPath, IPath[] paths, int pathCount) {
+ int bestMatch = -1, bestLength = -1;
for (int i = 0; i < pathCount; i++){
if (paths[i].equals(checkedPath)) continue;
- if (paths[i].isPrefixOf(checkedPath)) return i;
+ if (paths[i].isPrefixOf(checkedPath)) {
+ int currentLength = paths[i].segmentCount();
+ if (currentLength > bestLength) {
+ bestLength = currentLength;
+ bestMatch = i;
+ }
+ }
}
- return -1;
+ return bestMatch;
}
/*
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java
index 49eb03e..5aa54a7 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java
@@ -93,7 +93,7 @@
*
* @return whether this scope contains any <code>.class</code> files
* @deprecated Use
- * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[]))
+ * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
* with the package fragment roots that correspond to the binaries instead.
*/
boolean includesBinaries();
@@ -103,7 +103,7 @@
*
* @return whether this scope includes classpaths
* @deprecated Use
- * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[]))
+ * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
* with a Java project instead.
*/
boolean includesClasspaths();
@@ -113,7 +113,7 @@
*
* @param includesBinaries whether this scope contains any <code>.class</code> files
* @deprecated Use
- * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[]))
+ * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
* with the package fragment roots that correspond to the binaries instead.
*/
public void setIncludesBinaries(boolean includesBinaries);
@@ -123,7 +123,7 @@
*
* @param includesClasspaths whether this scope includes classpaths
* @deprecated Use
- * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[]))
+ * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
* with a Java project instead.
*/
public void setIncludesClasspaths(boolean includesClasspaths);
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java
index fab8778..5cda669 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java
@@ -41,7 +41,7 @@
/**
* Adds the given index entry (category and key) coming from this
* document to the index. This method must be called from
- * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath).
+ * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}.
*
* @param category the category of the index entry
* @param key the key of the index entry
@@ -110,7 +110,7 @@
/**
* Removes all index entries from the index for the given document.
* This method must be called from
- * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath).
+ * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}.
*/
public void removeAllIndexEntries() {
super.removeAllIndexEntries();
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java
index de497a6..b7f1ee7 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java
@@ -108,7 +108,7 @@
/**
* Indexes the given document in the given index. A search participant
* asked to index a document should parse it and call
- * {@link #addIndexEntry(char[], char[], SearchDocument)} as many times as
+ * {@link SearchDocument#addIndexEntry(char[], char[])} as many times as
* needed to add index entries to the index. If delegating to another
* participant, it should use the original index location (and not the
* delegatee's one). In the particular case of delegating to the default
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java
index 8cf71fb..65c51be 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java
@@ -259,8 +259,10 @@
int lastDot = CharOperation.lastIndexOf('.', bindingName);
if (lastDot > -1)
bindingName = CharOperation.subarray(bindingName, lastDot+1, bindingName.length);
- if (matchesName(this.pattern.name, bindingName))
- return matchField(fieldBinding, false);
+ if (matchesName(this.pattern.name, bindingName)) {
+ int level = matchField(fieldBinding, false);
+ if (level != IMPOSSIBLE_MATCH) return level;
+ }
}
int otherMax = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length;
for (int i = 0; i < otherMax; i++) {
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 019b5f4..0490ff4 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
@@ -891,9 +891,8 @@
} else if (searchPattern instanceof PackageDeclarationPattern) {
IJavaElement focus = ((InternalSearchPattern) searchPattern).focus;
if (focus != null) {
- IResource resource = focus.getResource();
- SearchDocument document = participant.getDocument(resource.getFullPath().toString());
- this.currentPossibleMatch = new PossibleMatch(this, resource, null, document);
+ SearchDocument document = participant.getDocument(focus.getPath().toString());
+ this.currentPossibleMatch = new PossibleMatch(this, focus.getResource(), null, document);
if (encloses(focus)) {
SearchMatch match = newDeclarationMatch(focus, SearchMatch.A_ACCURATE, -1, -1);
report(match);