update jdt.core & tests from I20140311-0800 - end of this branch!
replay from commit de91a8b71b6719cd9ae8cd576a92e58e3cdf2536
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
index 1c94118..214844f 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14066,4 +14066,53 @@
"1 problem (1 warning)\n",
true);
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=419351
+public void testBug419351() {
+ String backup = System.getProperty("java.endorsed.dirs");
+ String currentWorkingDirectoryPath = System.getProperty("user.dir");
+ if (currentWorkingDirectoryPath == null) {
+ fail("BatchCompilerTest#testBug419351 could not access the current working directory " + currentWorkingDirectoryPath);
+ } else if (!new File(currentWorkingDirectoryPath).isDirectory()) {
+ fail("BatchCompilerTest#testBug419351 current working directory is not a directory " + currentWorkingDirectoryPath);
+ }
+ String endorsedPath = currentWorkingDirectoryPath + File.separator + "endorsed";
+ new File(endorsedPath).mkdir();
+ String lib1Path = endorsedPath + File.separator + "lib1.jar";
+ try {
+ System.setProperty("java.endorsed.dirs", endorsedPath);
+ Util.createJar(
+ new String[] {
+ "java/lang/String.java",
+ "package java.lang;\n" +
+ "public class String {\n" +
+ " public String(java.lang.Object obj) {}\n" +
+ "}\n"
+ },
+ null,
+ lib1Path,
+ JavaCore.VERSION_1_5);
+ this.runConformTest(
+ new String[] {
+ "src/X.java",
+ "public class X {\n" +
+ " public void foo(Object obj) {\n" +
+ " java.lang.String str = new java.lang.String(obj);\n" +
+ " }\n" +
+ "}\n",
+ },
+ "\"" + OUTPUT_DIR + File.separator + "src/X.java\""
+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\""
+ + " -1.4 -nowarn"
+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ",
+ "",
+ "",
+ true);
+ } catch (IOException e) {
+ System.err.println("BatchCompilerTest#testBug419351 could not write to current working directory " + currentWorkingDirectoryPath);
+ } finally {
+ System.setProperty("java.endorsed.dirs", backup);
+ new File(endorsedPath).delete();
+ new File(lib1Path).delete();
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
index 6f58202..2727d45 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 GK Software AG and others.
+ * Copyright (c) 2011, 2014 GK Software AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -4653,6 +4653,35 @@
options
);
}
+// https://bugs.eclipse.org/411098 - [compiler][resource] Invalid Resource Leak Warning using ternary operator inside try-with-resource
+// should report potential leak only.
+public void testBug411098_comment19() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
+ runNegativeTest(
+ new String[] {
+ "A.java",
+ "import java.io.PrintWriter;\n" +
+ "public class A {\n" +
+ " PrintWriter fWriter;\n" +
+ " void bug(boolean useField) {\n" +
+ " PrintWriter bug= useField ? fWriter : null;\n" +
+ " System.out.println(bug);\n" +
+ " }\n" +
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in A.java (at line 5)\n" +
+ " PrintWriter bug= useField ? fWriter : null;\n" +
+ " ^^^\n" +
+ "Potential resource leak: \'bug\' may not be closed\n" +
+ "----------\n",
+ null,
+ true,
+ options
+ );
+}
// normal java.util.stream.Stream doesn't hold on to any resources
public void testStream1() {
if (this.complianceLevel < ClassFileConstants.JDK1_8)
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java
index 165b19a..d78c27f 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1463,7 +1463,7 @@
"public class testDuplicateHashCode {\n" +
" public static void main(String[] argv) {\n" +
" String dispatcher = \"\u0000\";\n" +
- " for (int i = 0; i < 100; i++) {\n" +
+ " outer: for (int i = 0; i < 100; i++) {\n" +
" switch (dispatcher) {\n" +
" case \"\u0000\":\n" +
" System.out.print(\"1 \");\n" +
@@ -1482,7 +1482,7 @@
" break;\n" +
" default:\n" +
" System.out.println(\"Default\");\n" +
- " System.exit(0);\n" +
+ " break outer;\n" +
" case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
" System.out.print(\"8 \");\n" +
" break;\n" +
@@ -1519,7 +1519,7 @@
"public class testDuplicateHashCode {\n" +
" public static void main(String[] argv) {\n" +
" String dispatcher = \"\u0000\";\n" +
- " while(true) {\n" +
+ " outer: while(true) {\n" +
" switch (dispatcher) {\n" +
" case \"\u0000\":\n" +
" System.out.print(\"1 \");\n" +
@@ -1543,7 +1543,7 @@
" break;\n" +
" default:\n" +
" System.out.println(\"Default\");\n" +
- " System.exit(0);\n" +
+ " break outer;\n" +
" case \"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\":\n" +
" System.out.print(\"8 \");\n" +
" dispatcher = \"\u0000\u0000\u0000\u0000\u0000\u0000\";\n" +
@@ -1721,7 +1721,7 @@
" return string.substring(index,index + 1);\n" +
" }\n" +
" public static void main(String [] args) {\n" +
- " while (true) {\n" +
+ " outer: while (true) {\n" +
" String s = null;\n" +
" switch(s = dispatcher()) {\n" +
" case \"2\":\n" +
@@ -1739,7 +1739,7 @@
" System.out.print(s + \"(odd) \");\n" +
" break;\n" +
" default: System.out.print(\"DONE\");\n" +
- " System.exit(0);\n" +
+ " break outer;\n" +
" }\n" +
" }\n" +
" }\n" +
@@ -1771,7 +1771,7 @@
" return string.substring(index,index + 1);\n" +
" }\n" +
" public static void main(String [] args) {\n" +
- " while (true) {\n" +
+ " outer: while (true) {\n" +
" String s = null;\n" +
" switch(s = dispatcher()) {\n" +
" case \"4\": System.out.print(s);\n" +
@@ -1780,7 +1780,7 @@
" case \"1\": System.out.print(s + \" \");\n" +
" case \"0\": break;\n" +
" default: System.out.print(\"DONE\");\n" +
- " System.exit(0);\n" +
+ " break outer;\n" +
" }\n" +
" }\n" +
" }\n" +
@@ -1845,11 +1845,9 @@
" System.out.print(s + \"(odd) \");\n" +
" break;\n" +
" default: System.out.print(\"DONE\");\n" +
- " System.exit(0);\n" +
" break junk;\n" +
" }\n" +
" }\n" +
- " System.out.println(\"Broken\");\n" +
" }\n" +
"}\n",
};
diff --git a/org.eclipse.jdt.core.tests.compiler/test.xml b/org.eclipse.jdt.core.tests.compiler/test.xml
index 2ff4a27..c4e07bb 100644
--- a/org.eclipse.jdt.core.tests.compiler/test.xml
+++ b/org.eclipse.jdt.core.tests.compiler/test.xml
@@ -34,11 +34,6 @@
<!-- This target defines the tests that need to be run. -->
<target name="suite">
- <condition property="onWin32">
- <and>
- <os family="windows" />
- </and>
- </condition>
<!-- Parser tests -->
<property name="jdt-parser-folder"
value="${eclipse-home}/jdt_parser_folder"/>
@@ -64,7 +59,7 @@
<antcall target="evaluation_tests"/>
</target>
- <target name="evaluation_tests" if="onWin32">
+ <target name="evaluation_tests">
<!-- Evaluation tests -->
<property name="jdt-eval-folder"
value="${eclipse-home}/jdt_eval_folder"/>
diff --git a/org.eclipse.jdt.core.tests.model/.settings/org.eclipse.core.resources.prefs b/org.eclipse.jdt.core.tests.model/.settings/org.eclipse.core.resources.prefs
index d4ea5fb..f94dafb 100644
--- a/org.eclipse.jdt.core.tests.model/.settings/org.eclipse.core.resources.prefs
+++ b/org.eclipse.jdt.core.tests.model/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,5 @@
eclipse.preferences.version=1
encoding//workspace/AttachedJavadocProject/UTF8doc=UTF-8
encoding//workspace/AttachedJavadocProject/UTF8doc/p/TestBug394382.txt=UTF-8
+encoding//workspace/AttachedJavadocProject/UTF8doc2=UTF-8
encoding//workspace/Encoding/src/testUTF8/Test.java=UTF-8
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
index 7c27719..40271ea 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ray V. (voidstar@gmail.com) - Contribution for bug 282988
+ * Robin Stocker - Bug 49619 - [formatting] comment formatter leaves whitespace in comments
*******************************************************************************/
package org.eclipse.jdt.core.tests.formatter;
@@ -4727,17 +4728,17 @@
"\n" +
"/**\n" +
" * This sample produce an MalformedTreeException when formatted.\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * First paragraph {@link java.lang.String </code>a simple string<code>}.\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * Second paragraph.\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * Third paragraph.\n" +
" * </p>\n" +
- " * \n" +
+ " *\n" +
" */\n" +
"public class X01 {\n" +
"\n" +
@@ -4762,7 +4763,7 @@
"\n" +
"/**\n" +
" * This sample produce an AIIOBE when formatting.\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * First paragraph {@link java.lang.String </code>a simple string<code>}.\n" +
" */\n" +
@@ -4812,18 +4813,18 @@
" * <li>\n" +
" * <p>\n" +
" * First item\n" +
- " * \n" +
+ " *\n" +
" * <li>\n" +
" * <p>\n" +
" * Second item\n" +
- " * \n" +
+ " *\n" +
" * <li>\n" +
" * <p>\n" +
" * First paragraph of third item\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * Second paragraph of third item\n" +
- " * \n" +
+ " *\n" +
" * <blockquote>\n" +
" * <table cellpadding=0 cellspacing=0 summary=\"layout\">\n" +
" * <tr>\n" +
@@ -5037,7 +5038,7 @@
" /**\n" +
" * <p>\n" +
" * Following p tag can miss a space before after formatting\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * <BR>\n" +
" * <B>NOTE</B><BR>\n" +
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java
index 73878dd..7cf1a03 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Robin Stocker - Bug 49619 - [formatting] comment formatter leaves whitespace in comments
*******************************************************************************/
package org.eclipse.jdt.core.tests.formatter;
@@ -3499,7 +3500,7 @@
"\n" +
" /**\n" +
" * Gets the signers of this class.\n" +
- " * \n" +
+ " *\n" +
" * @return the signers of this class, or null if there are no signers. In\n" +
" * particular, this method returns null if this object represents a\n" +
" * primitive type or void.\n" +
@@ -4896,7 +4897,7 @@
" * viewer\'s functionalities must be specified. This implementation always\n" +
" * returns <code>\n" +
" * new String[] { IDocument.DEFAULT_CONTENT_TYPE }</code>.\n" +
- " * \n" +
+ " *\n" +
" * @param source\n" +
" * the source viewer to be configured by this configuration\n" +
" * @return the configured content types for the given viewer\n" +
@@ -4931,10 +4932,10 @@
" * Returns the composition of two functions. For {@code f: A->B} and\n" +
" * {@code g: B->C}, composition is defined as the function h such that\n" +
" * {@code h(a) == g(f(a))} for each {@code a}.\n" +
- " * \n" +
+ " *\n" +
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" +
" * composition</a>\n" +
- " * \n" +
+ " *\n" +
" * @param g\n" +
" * the second function to apply\n" +
" * @param f\n" +
@@ -4971,10 +4972,10 @@
" * Returns the composition of two functions. For <code> f: A->B</code> and\n" +
" * <code> g: B->C</code>, composition is defined as the function h such that\n" +
" * <code> h(a) == g(f(a))</code> for each <code> a</code>.\n" +
- " * \n" +
+ " *\n" +
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" +
" * composition</a>\n" +
- " * \n" +
+ " *\n" +
" * @param g\n" +
" * the second function to apply\n" +
" * @param f\n" +
@@ -5025,10 +5026,10 @@
" * </code> for each <code>\n" +
" * a\n" +
" * </code>.\n" +
- " * \n" +
+ " *\n" +
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" +
" * composition</a>\n" +
- " * \n" +
+ " *\n" +
" * @param g\n" +
" * the second function to apply\n" +
" * @param f\n" +
@@ -5062,7 +5063,7 @@
" /**\n" +
" * Implementations of {@code computeNext} <b>must</b> invoke this method\n" +
" * when there are no elements left in the iteration.\n" +
- " * \n" +
+ " *\n" +
" * @return {@code null}; a convenience so your {@link #computeNext}\n" +
" * implementation can use the simple statement\n" +
" * {@code return endOfData();}\n" +
@@ -5112,10 +5113,10 @@
" * .put("one", 1).put("two", 2).put("three", 3).build();\n" +
" * }\n" +
" * </pre>\n" +
- " * \n" +
+ " *\n" +
" * For <i>small</i> immutable bimaps, the {@code ImmutableBiMap.of()}\n" +
" * methods are even more convenient.\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * Builder instances can be reused - it is safe to call {@link #build}\n" +
" * multiple times to build multiple bimaps in series. Each bimap is a\n" +
@@ -5188,7 +5189,7 @@
" * The multiset is ordered by the first occurrence of each element. For\n" +
" * example, {@code ImmutableMultiset.copyOf(Arrays.asList(2, 3, 1, 3))}\n" +
" * yields a multiset with elements in the order {@code 2, 3, 3, 1}.\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * Note that if {@code c} is a {@code Collection<String>}, then\n" +
" * {@code ImmutableMultiset.copyOf(c)} returns an\n" +
@@ -5196,12 +5197,12 @@
" * {@code c}, while {@code ImmutableMultiset.of(c)} returns an\n" +
" * {@code ImmutableMultiset<Collection<String>>} containing one element (the\n" +
" * given collection itself).\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * <b>Note:</b> Despite what the method name suggests, if {@code elements}\n" +
" * is an {@code ImmutableMultiset}, no copy will actually be performed, and\n" +
" * the given multiset itself will be returned.\n" +
- " * \n" +
+ " *\n" +
" * @throws NullPointerException\n" +
" * if any of {@code elements} is null\n" +
" */\n" +
@@ -5259,10 +5260,10 @@
" * to store that value in the multimap will be the result of calling the\n" +
" * function on that value. Depending on the multimap implementation,\n" +
" * duplicate entries (equal keys and equal values) may be collapsed.\n" +
- " * \n" +
+ " *\n" +
" * <p>\n" +
" * For example,\n" +
- " * \n" +
+ " *\n" +
" * <pre class=\"code\">\n" +
" * List<String> badGuys =\n" +
" * Arrays.asList(\"Inky\", \"Blinky\", \"Pinky\", \"Pinky\", \"Clyde\");\n" +
@@ -5271,16 +5272,16 @@
" * Multimaps.index(badGuys, stringLengthFunction, index);\n" +
" * System.out.println(index);\n" +
" * </pre>\n" +
- " * \n" +
+ " *\n" +
" * prints\n" +
- " * \n" +
+ " *\n" +
" * <pre class=\"code\">\n" +
" * {4=[Inky], 5=[Pinky, Clyde], 6=[Blinky]}\n" +
" * </pre>\n" +
- " * \n" +
+ " *\n" +
" * The {@link HashMultimap} collapses the duplicate occurrence of\n" +
" * {@code (5, \"Pinky\")}.\n" +
- " * \n" +
+ " *\n" +
" * @param values\n" +
" * the values to add to the multimap\n" +
" * @param keyFunction\n" +
@@ -5332,7 +5333,7 @@
" * the case of overflow) to the call\n" +
" * {@code addAll(Collections.nCopies(element,\n" +
" * occurrences))}, which would presumably perform much more poorly.\n" +
- " * \n" +
+ " *\n" +
" * @param element\n" +
" * the element to add occurrences of; may be {@code null} only if\n" +
" * explicitly allowed by the implementation\n" +
@@ -5388,7 +5389,7 @@
" * {@code e1} and {@code e2} in the multiset. If the user attempts to add an\n" +
" * element to the multiset that violates this constraint, the\n" +
" * {@code add(Object)} call will throw a {@code ClassCastException}.\n" +
- " * \n" +
+ " *\n" +
" * @param comparator\n" +
" * the comparator that will be used to sort this multiset. A null\n" +
" * value indicates that the elements\' <i>natural ordering</i>\n" +
@@ -5421,7 +5422,7 @@
" * Returns the composition of a function and a predicate. For every\n" +
" * {@code x}, the generated predicate returns {@code predicate(function(x))}\n" +
" * .\n" +
- " * \n" +
+ " *\n" +
" * @return the composition of the provided function and predicate\n" +
" */\n" +
" void foo();\n" +
@@ -6712,7 +6713,7 @@
" /**\n" +
" * INTERNAL USE-ONLY Generate the byte for a problem method info that\n" +
" * correspond to a boggus method.\n" +
- " * \n" +
+ " *\n" +
" * @param method\n" +
" * org.eclipse.jdt.internal.compiler.ast.\n" +
" * AbstractMethodDeclaration\n" +
@@ -6783,7 +6784,7 @@
" /**\n" +
" * Compares two property values. For font or color the <i>description</i> of\n" +
" * the resource, {@link FontData} or {@link RGB}, is used for comparison.\n" +
- " * \n" +
+ " *\n" +
" * @param value1\n" +
" * first property value\n" +
" * @param value2\n" +
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
index abfdcdd..6688cca 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -6100,6 +6101,228 @@
deleteProject("P");
}
}
+/**
+ * Project's compliance: source: 1.5, compiler: 1.5
+ * Jar's compliance: source: 1.3, compiler: 1.3
+ * Jar contains a class with "enum" package and is located inside the project.
+ * The test verifies that class from the "enum" package is not proposed.
+ */
+public void testBug410207a() throws Exception {
+ try {
+ IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB", "/P/lib.jar"}, "bin", "1.5");
+ Util.createJar(new String[] {
+ "a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}",
+ "lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ },
+ p.getProject().getLocation().append("lib.jar").toOSString(),
+ "1.3");
+ refresh(p);
+ createFolder("/P/src/p/");
+ createFile(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(new );\n" +
+ " };\n" +
+ "}"
+ );
+ waitUntilIndexesReady();
+ ICompilationUnit cu = getCompilationUnit("P", "src", "p", "Main.java");
+ String source = cu.getSource();
+ String completeBehind = "external.setNonCompliant(new ";
+ int cursorLocation = source.lastIndexOf(completeBehind) + completeBehind.length();
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
+ cu.codeComplete(cursorLocation, requestor);
+ assertResults(
+ "Main[TYPE_REF]{Main, p, Lp.Main;, null, null, 27}",
+ requestor.getResults());
+ } finally {
+ deleteProject("P");
+ }
+}
+/**
+ * Project's compliance: source: 1.5, compiler: 1.5
+ * Jar's compliance: source: 1.4, compiler: 1.6
+ * Jar contains a class with "enum" package and is located inside the project.
+ * The test verifies that class from the "enum" package is not proposed. It verifies also that
+ * compiler compliance of the jar is not used as source compliance.
+ */
+public void testBug410207b() throws Exception {
+ try {
+ IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB", "/P/lib.jar"}, "bin", "1.5");
+ Map options = new HashMap();
+ options.put(CompilerOptions.OPTION_Source, "1.4");
+ Util.createJar(new String[] {
+ "a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}",
+ "lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ },
+ null,/*extraPathsAndContents*/
+ p.getProject().getLocation().append("lib.jar").toOSString(),
+ null,/*classpath*/
+ "1.6",
+ options);
+ refresh(p);
+ createFolder("/P/src/p/");
+ createFile(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(new );\n" +
+ " };\n" +
+ "}"
+ );
+ waitUntilIndexesReady();
+ ICompilationUnit cu = getCompilationUnit("P", "src", "p", "Main.java");
+ String source = cu.getSource();
+ String completeBehind = "external.setNonCompliant(new ";
+ int cursorLocation = source.lastIndexOf(completeBehind) + completeBehind.length();
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
+ cu.codeComplete(cursorLocation, requestor);
+ assertResults(
+ "Main[TYPE_REF]{Main, p, Lp.Main;, null, null, 27}",
+ requestor.getResults());
+ } finally {
+ deleteProject("P");
+ }
+}
+/**
+ * Two projects:
+ * Lib: source: 1.4, compiler: 1.4
+ * P: source: 1.5, compiler: 1.5
+ * Lib contains a class with "enum" package and is required by P (dependency on the bin folder).
+ * The test verifies that class from the "enum" package is not proposed for P.
+ */
+public void testBug410207c() throws Exception {
+ try {
+ createJavaProject("Lib", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin", "1.4");
+ createFolder("/Lib/src/a/enum/b");
+ createFile(
+ "/Lib/src/a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}"
+ );
+ createFolder("/Lib/src/lib");
+ createFile(
+ "/Lib/src/lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ );
+ getProject("Lib").build(IncrementalProjectBuilder.FULL_BUILD, null);
+ createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB", "/Lib/bin"}, "bin", "1.5");
+ createFolder("/P/src/p");
+ createFile(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(new );\n" +
+ " };\n" +
+ "}"
+ );
+ waitUntilIndexesReady();
+ ICompilationUnit cu = getCompilationUnit("P", "src", "p", "Main.java");
+ String source = cu.getSource();
+ String completeBehind = "external.setNonCompliant(new ";
+ int cursorLocation = source.lastIndexOf(completeBehind) + completeBehind.length();
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
+ cu.codeComplete(cursorLocation, requestor);
+ assertResults(
+ "Main[TYPE_REF]{Main, p, Lp.Main;, null, null, 27}",
+ requestor.getResults());
+ } finally {
+ deleteProjects(new String[] { "Lib", "P" });
+ }
+}
+/**
+ * Two projects:
+ * Lib: source: 1.4, compiler: 1.4
+ * P: source: 1.5, compiler: 1.5
+ * Lib contains a class with "enum" package and is required by P (dependency on the whole project).
+ * The test verifies that class from the "enum" package is not proposed for P.
+ */
+public void testBug410207d() throws Exception {
+ try {
+ createJavaProject("Lib", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin", "1.4");
+ createFolder("/Lib/src/a/enum/b");
+ createFile(
+ "/Lib/src/a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}"
+ );
+ createFolder("/Lib/src/lib");
+ createFile(
+ "/Lib/src/lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ );
+ getProject("Lib").build(IncrementalProjectBuilder.FULL_BUILD, null);
+ createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, new String[] {"/Lib"}, "bin", "1.5");
+ createFolder("/P/src/p");
+ createFile(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(new );\n" +
+ " };\n" +
+ "}"
+ );
+ waitUntilIndexesReady();
+ ICompilationUnit cu = getCompilationUnit("P", "src", "p", "Main.java");
+ String source = cu.getSource();
+ String completeBehind = "external.setNonCompliant(new ";
+ int cursorLocation = source.lastIndexOf(completeBehind) + completeBehind.length();
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
+ cu.codeComplete(cursorLocation, requestor);
+ assertResults(
+ "Main[TYPE_REF]{Main, p, Lp.Main;, null, null, 27}",
+ requestor.getResults());
+ } finally {
+ deleteProjects(new String[] { "Lib", "P" });
+ }
+}
// Bug 418011 - [1.8][code assist] NPE in code assist
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=418011
public void testBug418011() throws CoreException {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests2.java
index 15b8c25..a9b5963 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,8 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Stephan Herrmann - Contribution for
+ * Bug 377883 - NPE on open Call Hierarchy
*******************************************************************************/
package org.eclipse.jdt.core.tests.model;
@@ -30,6 +32,7 @@
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.core.search.SearchMatch;
import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.internal.core.search.matching.MethodPattern;
// The size of JavaSearchBugsTests.java is very big, Hence continuing here.
public class JavaSearchBugsTests2 extends AbstractJavaSearchTests {
@@ -1599,4 +1602,90 @@
deleteProject("P");
}
}
+ public void testBug395348() throws CoreException {
+ try {
+ IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5");
+ createFile("/P/X.java",
+ "public class X {\n"+
+ " static void f() {\n" +
+ " new Y<C2>() {\n"+
+ " public int compare(C2 o1) {\n" +
+ " return 0;\n" +
+ " }\n" +
+ " };\n"+
+ " }\n" +
+ "}\n" +
+ "interface Y<T> {\n" +
+ " public abstract int compare(T o1);\n" +
+ "}\n" +
+ "class C2 {}\n"
+ );
+ IMethod method = selectMethod(getCompilationUnit("/P/X.java"), "compare", 0);
+ MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(method, DECLARATIONS|IGNORE_DECLARING_TYPE|IGNORE_RETURN_TYPE, EQUIVALENT_RULE|EXACT_RULE);
+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, IJavaSearchScope.SOURCES);
+ search(pattern, scope, this.resultCollector);
+ assertSearchResults("X.java int void X.f():<anonymous>#1.compare(C2) [compare] EXACT_MATCH\n" +
+ "X.java int Y.compare(T) [compare] EXACT_MATCH"); // an NPE was thrown without the fix
+ } finally {
+ deleteProject("P");
+ }
+ }
+
+ public void testBug401272() throws CoreException, IOException {
+ // the strategy of this test was outlined in https://bugs.eclipse.org/bugs/show_bug.cgi?id=401272#c16
+ try {
+ IJavaProject p = createJavaProject("P", new String[] { "src" }, new String[] { "JCL15_LIB", "/P/libStuff.jar" }, "bin", "1.5");
+
+ org.eclipse.jdt.core.tests.util.Util.createJar(
+ new String[] {
+ // this class must be our possibleMatch #401
+ // it must be binary to trigger the ClassFileMatchLocator
+ // the match must be impossible-due-to-mismatching-type-variables to trigger matchLocator.getMethodBinding(this.pattern);
+ "p2/A.java",
+ "package p2;\n" +
+ "public class A<E> {\n" +
+ " public int test(E b) { return 1; }\n" +
+ " void bar() {\n" +
+ " test(null);\n" +
+ " }\n" +
+ "}\n",
+ // this class contains the method we search for, possibleMatch #402
+ // (must be > 401 possibleMatches to trigger environment cleanup)
+ "p2/B.java",
+ "package p2;\n" +
+ "public class B<T> {\n" +
+ " public int test(T t) {\n" +
+ " return 0;\n" +
+ " }\n" +
+ "}\n"
+ },
+ p.getProject().getLocation().append("libStuff.jar").toOSString(), "1.5");
+ refresh(p);
+
+ createFolder("/P/src/pkg");
+ // 400 matches, which populate MatchLocator.unitScope
+ // all 400 matches are processed in one go of MatchLocator.locateMatches(JavaProject, PossibleMatch[], int, int)
+ // next round will call nameEnvironment.cleanup() but reuse MatchLocator.unitScope ==> BOOM
+ for (int i = 0; i < 400; i++) {
+ createFile("/P/src/pkg/Bug"+i+".java",
+ "package pkg;\n"+
+ "public class Bug"+i+" {\n"+
+ " String[] test(p2.B<String> b) {\n" +
+ " return b.test(\"S\");\n" +
+ " }\n" +
+ "}");
+ }
+
+ waitUntilIndexesReady();
+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p },
+ IJavaSearchScope.SOURCES|IJavaSearchScope.SYSTEM_LIBRARIES|IJavaSearchScope.APPLICATION_LIBRARIES);
+
+ IMethod method = p.findType("p2.B").getMethods()[1];
+ search(method, METHOD, ALL_OCCURRENCES, scope, this.resultCollector);
+
+ assertSearchResults("libStuff.jar int p2.B.test(T) [No source] EXACT_MATCH"); // an NPE was thrown without the fix
+ } finally {
+ deleteProject("P");
+ }
+ }
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
index dfa3092..ba2e6fe 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation
* Technical University Berlin - adapted for Object Teams
* Stephan Herrmann - contribution for
- * bug 337868 - [compiler][model] incomplete support for package-info.java when using SearchableEnvironment
* bug 401035 - [1.8] A few tests have started failing recently
*******************************************************************************/
package org.eclipse.jdt.core.tests.model;
@@ -17,7 +16,9 @@
import java.io.File;
import java.io.IOException;
+import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Map;
import junit.framework.Test;
@@ -38,6 +39,7 @@
import org.eclipse.jdt.core.compiler.ReconcileContext;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.core.CompilationUnit;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
@@ -5520,4 +5522,209 @@
);
}
-}
\ No newline at end of file
+/**
+ * Project's compliance: source: 1.5, compiler: 1.5
+ * Jar's compliance: source: 1.3, compiler: 1.3
+ * Jar contains a class with "enum" package and is located inside the project.
+ * The test verifies that class from the "enum" package is correctly reconciled.
+ */
+public void testBug410207a() throws Exception {
+ try {
+ IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB", "/P/lib.jar"}, "bin", "1.5");
+ Util.createJar(new String[] {
+ "a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}",
+ "lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ },
+ p.getProject().getLocation().append("lib.jar").toOSString(),
+ "1.3");
+ refresh(p);
+ setUpWorkingCopy(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(null);\n" +
+ " };\n" +
+ "}"
+ );
+ this.problemRequestor.reset();
+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, true/*force problem detection*/, null, null);
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "----------\n"
+ );
+ } finally {
+ deleteProject("P");
+ }
+}
+/**
+ * Project's compliance: source: 1.5, compiler: 1.5
+ * Jar's compliance: source: 1.4, compiler: 1.6
+ * Jar contains a class with "enum" package and is located inside the project.
+ * The test verifies that class from the "enum" package is correctly reconciled.
+ */
+public void testBug410207b() throws Exception {
+ try {
+ IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB", "/P/lib.jar"}, "bin", "1.5");
+ Map options = new HashMap();
+ options.put(CompilerOptions.OPTION_Source, "1.4");
+ Util.createJar(new String[] {
+ "a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}",
+ "lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ },
+ null,/*extraPathsAndContents*/
+ p.getProject().getLocation().append("lib.jar").toOSString(),
+ null,/*classpath*/
+ "1.6",
+ options);
+ refresh(p);
+ setUpWorkingCopy(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(null);\n" +
+ " };\n" +
+ "}"
+ );
+ this.problemRequestor.reset();
+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, true/*force problem detection*/, null, null);
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "----------\n"
+ );
+ } finally {
+ deleteProject("P");
+ }
+}
+/**
+ * Two projects:
+ * Lib: source: 1.4, compiler: 1.4
+ * P: source: 1.5, compiler: 1.5
+ * Lib contains a class with "enum" package and is required by P (dependency on the bin folder).
+ * The test verifies that class from the "enum" package is correctly reconciled for P.
+ */
+public void testBug410207c() throws Exception {
+ try {
+ createJavaProject("Lib", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin", "1.4");
+ createFolder("/Lib/src/a/enum/b");
+ createFile(
+ "/Lib/src/a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}"
+ );
+ createFolder("/Lib/src/lib");
+ createFile(
+ "/Lib/src/lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ );
+ getProject("Lib").build(IncrementalProjectBuilder.FULL_BUILD, null);
+ createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB", "/Lib/bin"}, "bin", "1.5");
+ setUpWorkingCopy(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(null);\n" +
+ " };\n" +
+ "}"
+ );
+ this.problemRequestor.reset();
+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, true/*force problem detection*/, null, null);
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "----------\n"
+ );
+ } finally {
+ deleteProjects(new String[] { "Lib", "P" });
+ }
+}
+/**
+ * Two projects:
+ * Lib: source: 1.4, compiler: 1.4
+ * P: source: 1.5, compiler: 1.5
+ * Lib contains a class with "enum" package and is required by P (dependency on the whole project).
+ * The test verifies that class from the "enum" package is correctly reconciled for P.
+ */
+public void testBug410207d() throws Exception {
+ try {
+ createJavaProject("Lib", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin", "1.4");
+ createFolder("/Lib/src/a/enum/b");
+ createFile(
+ "/Lib/src/a/enum/b/NonCompliant.java",
+ "package a.enum.b;\n" +
+ "public class NonCompliant {\n" +
+ "}"
+ );
+ createFolder("/Lib/src/lib");
+ createFile(
+ "/Lib/src/lib/External.java",
+ "package lib;\n" +
+ "import a.enum.b.NonCompliant;\n" +
+ "public class External {\n" +
+ " public NonCompliant setNonCompliant(NonCompliant x) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ );
+ getProject("Lib").build(IncrementalProjectBuilder.FULL_BUILD, null);
+ createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB"}, new String[] {"/Lib"}, "bin", "1.5");
+ setUpWorkingCopy(
+ "/P/src/p/Main.java",
+ "package p;\n" +
+ "import lib.External;\n" +
+ "public class Main {\n" +
+ " public void m() {\n" +
+ " External external = new External();\n" +
+ " external.setNonCompliant(null);\n" +
+ " };\n" +
+ "}"
+ );
+ this.problemRequestor.reset();
+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, true/*force problem detection*/, null, null);
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "----------\n"
+ );
+ } finally {
+ deleteProjects(new String[] { "Lib", "P" });
+ }
+}
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test574/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test574/A_out.java
index e6d287d..750aa29 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test574/A_out.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test574/A_out.java
@@ -1,6 +1,6 @@
/**
* @author Zhao
- *
+ *
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java
index 1a69da5..06576a7 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java
@@ -1,7 +1,7 @@
public class X01 {
/**
- *
+ *
* Returns true if the operator
* expects...
**/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java
index 74ddcc2..b0fd893 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java
@@ -1,7 +1,7 @@
public class X01b {
/***
- *
+ *
* Test header/footer.
*/
void foo() {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java
index b9b615a..865e8bb 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java
@@ -1,7 +1,7 @@
public class X01c {
/*****************************************
- *
+ *
* Test header/footer.
*/
void foo() {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java
index 44e279e..66b2805 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java
@@ -1,7 +1,7 @@
public class X01d {
/**
- *
+ *
* Test header/footer.
***/
void foo() {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java
index dc1bd48..0e77129 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java
@@ -1,7 +1,7 @@
public class X01e {
/**
- *
+ *
* Test header/footer.
*
*****************************************/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java
index c6e4e03..39475e7 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java
@@ -1,7 +1,7 @@
public class X01f {
/*****************************************
- *
+ *
* Returns true
*
*****************************************/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java
index dae99f7..1b47e78 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java
@@ -1,7 +1,7 @@
public class X02 {
/**
- **
+ **
** Returns true
**/
void foo() {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java
index 76345d6..0fed0c4 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java
@@ -1,7 +1,7 @@
public class X03 {
/**
- **
+ **
** Returns true if the operator
* expects...
**/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/copyright/out/default/X1.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/copyright/out/default/X1.java
index 3752df1..e821c8c 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/copyright/out/default/X1.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/copyright/out/default/X1.java
@@ -5,7 +5,7 @@
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors: IBM Corporation - initial API and implementation
*/
public class X1 {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X01.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X01.java
index 2580970..dd7fad6 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X01.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X01.java
@@ -9,7 +9,7 @@
interface Example {
/**
- *
+ *
* These possibilities include:
* <ul>
* <li>Formatting of header comments.</li>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X11.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X11.java
index 0a979d7..6981ad8 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X11.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X11.java
@@ -7,7 +7,7 @@
* Note: do not add protected/public members to this class if you don't intend
* to make them public API.
* </p>
- *
+ *
* @see org.eclipse.core.runtime.content.XMLRootElementContentDescriber
* @see "http://www.w3.org/TR/REC-xml *"
*/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X16b.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X16b.java
index 586232c..78b3b60 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X16b.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/default/X16b.java
@@ -5,7 +5,7 @@
* Asserts that an argument is legal. If the given boolean is not
* <code>true</code>, an <code>IllegalArgumentException</code> is thrown.
* The given message is included in that exception, to aid debugging.
- *
+ *
* @param expression
* the outcode of the check
* @param message
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X01.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X01.java
index 5fad7ef..abe16f6 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X01.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X01.java
@@ -9,7 +9,7 @@
interface Example {
/**
- *
+ *
* These possibilities include:
* <ul>
* <li>Formatting of header comments.</li>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X16b.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X16b.java
index 07e981b..bf2461f 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X16b.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_descr/X16b.java
@@ -5,7 +5,7 @@
* Asserts that an argument is legal. If the given boolean is not
* <code>true</code>, an <code>IllegalArgumentException</code> is thrown.
* The given message is included in that exception, to aid debugging.
- *
+ *
* @param expression
* the outcode of the check
* @param message
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X01.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X01.java
index 7c3e257..a7c216a 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X01.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X01.java
@@ -9,7 +9,7 @@
interface Example {
/**
- *
+ *
* These possibilities include:
* <ul>
* <li>Formatting of header comments.</li>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X16b.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X16b.java
index 845a07e..61c43e7 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X16b.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/example/out/dont_indent_tags/X16b.java
@@ -5,7 +5,7 @@
* Asserts that an argument is legal. If the given boolean is not
* <code>true</code>, an <code>IllegalArgumentException</code> is thrown.
* The given message is included in that exception, to aid debugging.
- *
+ *
* @param expression
* the outcode of the check
* @param message
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/clear_blank_lines/X07.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/clear_blank_lines/X07.java
index 60861f3..a3958e9 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/clear_blank_lines/X07.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/clear_blank_lines/X07.java
@@ -8,7 +8,7 @@
* <pre>
*
*
- *
+ *
*
* public class Example {
* final int a = 1;
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X02.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X02.java
index 4a1514f..51a2d5c 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X02.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X02.java
@@ -23,7 +23,7 @@
*
* </pre>
*
- *
+ *
*
*
* Descriptions of parameters and return values are best appended at end of
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X07.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X07.java
index fc3e75e..0ce2052 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X07.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/pre/out/default/X07.java
@@ -6,7 +6,7 @@
* within javadoc comments:
*
*
- *
+ *
*
*
*
@@ -15,7 +15,7 @@
* <pre>
*
*
- *
+ *
*
* public class Example {
* final int a = 1;
@@ -27,7 +27,7 @@
*
* </pre>
*
- *
+ *
*
*
* Descriptions of parameters and return values are best appended at end of
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X04.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X04.java
index fa56990..3185b48 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X04.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X04.java
@@ -14,8 +14,8 @@
*
* </ul>
* toto
- *
- *
+ *
+ *
*/
int foo(int a, int b);
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X05.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X05.java
index c996b1a..ccb5981 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X05.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X05.java
@@ -3,7 +3,7 @@
interface X05 {
/**
- *
+ *
* Before P
* <p>
* Before UL
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X06.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X06.java
index 90ebb8b..c7b6510 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X06.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/html/ul/out/default/X06.java
@@ -3,7 +3,7 @@
interface X06 {
/**
- *
+ *
* <p>
* <ul>
* <li>Formatting of header comments.</li>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/default/X02.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/default/X02.java
index 37751e1..dac6ab6 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/default/X02.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/default/X02.java
@@ -2,7 +2,7 @@
/**
* @author Zhao
- *
+ *
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/dont_indent_tags/X02.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/dont_indent_tags/X02.java
index 2bfdf0f..38719de 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/dont_indent_tags/X02.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/tags/others/out/dont_indent_tags/X02.java
@@ -2,7 +2,7 @@
/**
* @author Zhao
- *
+ *
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java
index dfa2744..3d12bf5 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java
@@ -4,7 +4,7 @@
/**
* Creates the project location specification controls.
- *
+ *
* @param projectGroup
* the parent composite
* @param boolean - the initial enabled state of the widgets created
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java
index a580aec..71cdc37 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java
@@ -6,7 +6,7 @@
* INTERNAL USE-ONLY Generate the byte for a problem method info that
* correspond to a synthetic method that generate an access to a private
* constructor.
- *
+ *
* @param methodBinding
* org.eclipse.jdt.internal.compiler.nameloopkup.
* SyntheticAccessMethodBinding
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java
index 44e4b15..7db54d7 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java
@@ -6,7 +6,7 @@
* Returns a search pattern based on a given string pattern. The string
* patterns support '*' wild-cards. The remaining parameters are used to
* narrow down the type of expected results.
- *
+ *
* <br>
* Examples:
* <ul>
@@ -48,19 +48,19 @@
* In case the element is a method, declarations of matching
* methods in subtypes will also be found, allowing to find
* declarations of abstract methods, etc.</li>
- *
+ *
* <li><code>IJavaSearchConstants.REFERENCES</code>: will search
* references to the given element.</li>
- *
+ *
* <li><code>IJavaSearchConstants.ALL_OCCURRENCES</code>: will
* search for either declarations or references as specified
* above.</li>
- *
+ *
* <li><code>IJavaSearchConstants.IMPLEMENTORS</code>: for
* interface, will find all types which implements a given
* interface.</li>
* </ul>
- *
+ *
* @param isCaseSensitive
* indicates whether the search is case sensitive or not.
* @return a search pattern on the given string pattern, or
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X23.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X23.java
index 70902ca..a056936 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X23.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X23.java
@@ -69,7 +69,7 @@
* requesting additional information like source positions, full ASTs,
* non-recursive sorting, etc.)
* </p>
- *
+ *
* @param compilationUnit
* the given compilation unit, which must be a working copy
* @param positions
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X26.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X26.java
index 557a113..4260096 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X26.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X26.java
@@ -1,16 +1,16 @@
package test.wksp.eclipse;
/**
- *
+ *
* A ControlEditor is a manager for a Control that appears above a composite and
* tracks with the moving and resizing of that composite. It can be used to
* display one control above another control. This could be used when editing a
* control that does not have editing capabilities by using a text editor or for
* launching a dialog by placing a button above a control.
- *
+ *
* <p>
* Here is an example of using a ControlEditor:
- *
+ *
* <code><pre>
* Canvas canvas = new Canvas(shell, SWT.BORDER);
* canvas.setBounds(10, 10, 300, 300);
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java
index e7b9f7a..c89d262 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java
@@ -5,7 +5,7 @@
/**
* Returns a complete node containing the contents of the subtree rooted at @key
* in the receiver. Uses the public API.
- *
+ *
* @param key
* key of subtree whose contents we want to copy.
*/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java
index 6a1535c..f09407c 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X32.java
@@ -6,7 +6,7 @@
* This method calls
* <tt>realHandler.setURL(URL,String,String,int,String,String,String,String)</tt>
* .
- *
+ *
* @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
*/
void foo() {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X34.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X34.java
index 049c90c..648c918 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X34.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X34.java
@@ -5,25 +5,25 @@
/**
* Service property (named "service.ranking") identifying a
* service's ranking number (of type <tt>java.lang.Integer</tt>).
- *
+ *
* <p>
* This property may be supplied in the <tt>properties
* Dictionary</tt> object passed to the
* <tt>BundleContext.registerService</tt> method.
- *
+ *
* <p>
* The service ranking is used by the Framework to determine the
* <i>default</i> service to be returned from a call to the
* {@link BundleContext#getServiceReference}method: If more than one service
* implements the specified class, the <tt>ServiceReference</tt> object with
* the highest ranking is returned.
- *
+ *
* <p>
* The default ranking is zero (0). A service with a ranking of
* <tt>Integer.MAX_VALUE</tt> is very likely to be returned as the default
* service, whereas a service with a ranking of <tt>Integer.MIN_VALUE</tt>
* is very unlikely to be returned.
- *
+ *
* <p>
* If the supplied property value is not of type <tt>java.lang.Integer</tt>,
* it is deemed to have a ranking value of zero.
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java
index 50deea5..8f39cda 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java
@@ -4,7 +4,7 @@
/**
* Creates the project location specification controls.
- *
+ *
* @param projectGroup
* the parent composite
* @param boolean - the initial enabled state of the widgets created
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java
index d8bd3e2..8f3d83d 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java
@@ -6,7 +6,7 @@
* INTERNAL USE-ONLY Generate the byte for a problem method info that
* correspond to a synthetic method that generate an access to a private
* constructor.
- *
+ *
* @param methodBinding
* org.eclipse.jdt.internal.compiler.nameloopkup.
* SyntheticAccessMethodBinding
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java
index 0f9ef30..5eb8e1d 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java
@@ -6,7 +6,7 @@
* Returns a search pattern based on a given string pattern. The string
* patterns support '*' wild-cards. The remaining parameters are used to
* narrow down the type of expected results.
- *
+ *
* <br>
* Examples:
* <ul>
@@ -46,17 +46,17 @@
* element is a method, declarations of matching methods in subtypes
* will also be found, allowing to find declarations of abstract
* methods, etc.</li>
- *
+ *
* <li><code>IJavaSearchConstants.REFERENCES</code>: will search
* references to the given element.</li>
- *
+ *
* <li><code>IJavaSearchConstants.ALL_OCCURRENCES</code>: will search
* for either declarations or references as specified above.</li>
- *
+ *
* <li><code>IJavaSearchConstants.IMPLEMENTORS</code>: for interface,
* will find all types which implements a given interface.</li>
* </ul>
- *
+ *
* @param isCaseSensitive
* indicates whether the search is case sensitive or not.
* @return a search pattern on the given string pattern, or
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X23.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X23.java
index 369b9c5..508333a 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X23.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X23.java
@@ -69,7 +69,7 @@
* requesting additional information like source positions, full ASTs,
* non-recursive sorting, etc.)
* </p>
- *
+ *
* @param compilationUnit
* the given compilation unit, which must be a working copy
* @param positions
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java
index 663daa1..5ecb2c4 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java
@@ -5,7 +5,7 @@
/**
* Returns a complete node containing the contents of the subtree rooted at @key
* in the receiver. Uses the public API.
- *
+ *
* @param key
* key of subtree whose contents we want to copy.
*/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java
index 1cdd30b..11e6314 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java
@@ -4,7 +4,7 @@
/**
* Creates the project location specification controls.
- *
+ *
* @param projectGroup
* the parent composite
* @param boolean - the initial enabled state of the widgets created
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java
index c44fed0..15e652f 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java
@@ -6,7 +6,7 @@
* INTERNAL USE-ONLY Generate the byte for a problem method info that
* correspond to a synthetic method that generate an access to a private
* constructor.
- *
+ *
* @param methodBinding
* org.eclipse.jdt.internal.compiler.nameloopkup.
* SyntheticAccessMethodBinding
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java
index f3f2883..918e8e0 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java
@@ -6,7 +6,7 @@
* Returns a search pattern based on a given string pattern. The string
* patterns support '*' wild-cards. The remaining parameters are used to
* narrow down the type of expected results.
- *
+ *
* <br>
* Examples:
* <ul>
@@ -43,17 +43,17 @@
* declarations matching with the corresponding element. In case the element
* is a method, declarations of matching methods in subtypes will also be
* found, allowing to find declarations of abstract methods, etc.</li>
- *
+ *
* <li><code>IJavaSearchConstants.REFERENCES</code>: will search references
* to the given element.</li>
- *
+ *
* <li><code>IJavaSearchConstants.ALL_OCCURRENCES</code>: will search for
* either declarations or references as specified above.</li>
- *
+ *
* <li><code>IJavaSearchConstants.IMPLEMENTORS</code>: for interface, will
* find all types which implements a given interface.</li>
* </ul>
- *
+ *
* @param isCaseSensitive
* indicates whether the search is case sensitive or not.
* @return a search pattern on the given string pattern, or
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X23.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X23.java
index b95fafc..e81084b 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X23.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X23.java
@@ -69,7 +69,7 @@
* requesting additional information like source positions, full ASTs,
* non-recursive sorting, etc.)
* </p>
- *
+ *
* @param compilationUnit
* the given compilation unit, which must be a working copy
* @param positions
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java
index f24280f..135cbb2 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java
@@ -5,7 +5,7 @@
/**
* Returns a complete node containing the contents of the subtree rooted at @key
* in the receiver. Uses the public API.
- *
+ *
* @param key
* key of subtree whose contents we want to copy.
*/
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java
index 0b45c28..9bb356f 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java
@@ -13,7 +13,7 @@
* </em>}</li>
* </ul>
* </p>
- *
+ *
* @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget()
* @model annotation=
* "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java
index bcbe459..bae64e4 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java
@@ -5,7 +5,7 @@
* <em><b>Feature Value Spec</b></em>'. <!-- end-user-doc --> <!--
* begin-model-doc --> Value specification associated with a specific feature
* <!-- end-model-doc -->
- *
+ *
* @see org.eclipse.gmf.mappings.GMFMapPackage#getFeatureValueSpec()
* @model annotation=
* "http://www.eclipse.org/gmf/2005/constraints/meta def='ValueSpec'"
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java
index 1b2bf8b..3ea8c45 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java
@@ -3,11 +3,11 @@
/**
* <!-- begin-user-doc --> A representation of the model object '
* <em><b>Audited Metric Target</b></em>'. <!-- end-user-doc -->
- *
+ *
* <!-- begin-model-doc --> Target metric which can be evaluated by audit rule.
* The target context here is the metric rule resulting type classifier <!--
* end-model-doc -->
- *
+ *
* <p>
* The following features are supported:
* <ul>
@@ -15,7 +15,7 @@
* </em>}</li>
* </ul>
* </p>
- *
+ *
* @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget()
* @model annotation=
* "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java
index b524edb..66b7101 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java
@@ -3,11 +3,11 @@
/**
* <!-- begin-user-doc --> A representation of the model object '
* <em><b>Feature Value Spec</b></em>'. <!-- end-user-doc -->
- *
+ *
* <!-- begin-model-doc --> Value specification associated with a specific
* feature <!-- end-model-doc -->
- *
- *
+ *
+ *
* @see org.eclipse.gmf.mappings.GMFMapPackage#getFeatureValueSpec()
* @model annotation=
* "http://www.eclipse.org/gmf/2005/constraints/meta def='ValueSpec'"
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java
index deea513..27f03dd 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java
@@ -3,11 +3,11 @@
/**
* <!-- begin-user-doc --> A representation of the model object '
* <em><b>Audited Metric Target</b></em>'. <!-- end-user-doc -->
- *
+ *
* <!-- begin-model-doc --> Target metric which can be evaluated by audit rule.
* The target context here is the metric rule resulting type classifier <!--
* end-model-doc -->
- *
+ *
* <p>
* The following features are supported:
* <ul>
@@ -15,7 +15,7 @@
* </em>}</li>
* </ul>
* </p>
- *
+ *
* @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget()
* @model annotation=
* "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''"
diff --git a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java
index 7826e2c..ae026d2 100644
--- a/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java
+++ b/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java
@@ -3,11 +3,11 @@
/**
* <!-- begin-user-doc --> A representation of the model object '
* <em><b>Feature Value Spec</b></em>'. <!-- end-user-doc -->
- *
+ *
* <!-- begin-model-doc --> Value specification associated with a specific
* feature <!-- end-model-doc -->
- *
- *
+ *
+ *
* @see org.eclipse.gmf.mappings.GMFMapPackage#getFeatureValueSpec()
* @model annotation=
* "http://www.eclipse.org/gmf/2005/constraints/meta def='ValueSpec'"
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 6b67af7..a5543f5 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -4719,7 +4719,7 @@
* entries are searched for both sources and binaries except
* the sourcepath entries which are searched for sources only.
*/
- bootclasspaths.addAll(endorsedDirClasspaths);
+ bootclasspaths.addAll(0, endorsedDirClasspaths);
bootclasspaths.addAll(extdirsClasspaths);
bootclasspaths.addAll(sourcepathClasspaths);
bootclasspaths.addAll(classpaths);
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index 775439d..28d0b8c 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,6 +32,7 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.WorkingCopyOwner;
@@ -59,6 +60,7 @@
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
+import org.eclipse.jdt.internal.compiler.util.SimpleSetOfCharArray;
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
import org.eclipse.jdt.internal.compiler.util.ObjectVector;
@@ -74,6 +76,7 @@
import org.eclipse.jdt.internal.core.SourceTypeElementInfo;
import org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment;
import org.eclipse.jdt.internal.core.util.Messages;
+import org.eclipse.jdt.internal.core.util.Util;
import org.eclipse.objectteams.otdt.core.IOTType;
import org.eclipse.objectteams.otdt.core.OTModelManager;
import org.eclipse.objectteams.otdt.core.TypeHelper;
@@ -531,8 +534,6 @@
private final static int SUPERTYPE = 1;
private final static int SUBTYPE = 2;
- private final static char[] DOT_ENUM = ".enum".toCharArray(); //$NON-NLS-1$
-
int expectedTypesPtr = -1;
TypeBinding[] expectedTypes = new TypeBinding[1];
int expectedTypesFilter;
@@ -590,6 +591,10 @@
int startPosition, actualCompletionPosition, endPosition, offset;
int tokenStart, tokenEnd;
int javadocTagPosition; // Position of previous tag while completing in javadoc
+ String sourceLevel;
+ String complianceLevel;
+ SimpleSetOfCharArray validPackageNames = new SimpleSetOfCharArray(10);
+ SimpleSetOfCharArray invalidPackageNames = new SimpleSetOfCharArray(1);
HashtableOfObject knownPkgs = new HashtableOfObject(10);
HashtableOfObject knownTypes = new HashtableOfObject(10);
@@ -699,6 +704,8 @@
this.nameEnvironment = nameEnvironment;
this.typeCache = new HashtableOfObject(5);
this.openedBinaryTypes = 0;
+ this.sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
+ this.complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
this.problemFactory = new CompletionProblemFactory(Locale.getDefault());
this.problemReporter = new ProblemReporter(
@@ -1149,6 +1156,8 @@
if (this.knownPkgs.containsKey(packageName)) return;
+ if (!isValidPackageName(packageName)) return;
+
this.knownPkgs.put(packageName, this);
char[] completion;
@@ -1236,7 +1245,7 @@
}
}
- if (isForbiddenType(packageName, simpleTypeName, enclosingTypeNames)) {
+ if (isForbidden(packageName, simpleTypeName, enclosingTypeNames)) {
return;
}
@@ -12903,16 +12912,19 @@
private boolean isAllowingLongComputationProposals() {
return this.monitor != null;
}
- private boolean isForbidden(Binding binding) {
+ private boolean isForbidden(ReferenceBinding binding) {
for (int i = 0; i <= this.forbbidenBindingsPtr; i++) {
if(this.forbbidenBindings[i] == binding) {
return true;
}
}
+ if (!isValidPackageName(binding.qualifiedPackageName())) {
+ return true;
+ }
return false;
}
- private boolean isForbiddenType(char[] givenPkgName, char[] givenTypeName, char[][] enclosingTypeNames) {
+ private boolean isForbidden(char[] givenPkgName, char[] givenTypeName, char[][] enclosingTypeNames) {
// CharOperation.concatWith() handles the cases where input args are null/empty
char[] fullTypeName = CharOperation.concatWith(enclosingTypeNames, givenTypeName, '.');
for (int i = 0; i <= this.forbbidenBindingsPtr; i++) {
@@ -12928,11 +12940,8 @@
}
}
- // filter packages ending with enum for projects above 1.5
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264
- if (this.compilerOptions.sourceLevel >= ClassFileConstants.JDK1_5 &&
- CharOperation.endsWith(givenPkgName, DOT_ENUM)) { //note: it should be .enum and not just enum
- return true;
+ if (!isValidPackageName(givenPkgName)) {
+ return true;
}
return false;
@@ -12950,6 +12959,28 @@
return this.requestor.isIgnored(kind) ||
!this.requestor.isAllowingRequiredProposals(kind, requiredProposalKind);
}
+
+ private boolean isValidPackageName(char[] packageName) {
+ if (this.validPackageNames.includes(packageName)) {
+ return true;
+ }
+
+ if (this.invalidPackageNames.includes(packageName)) {
+ return false;
+ }
+
+ char[][] names = CharOperation.splitOn('.', packageName);
+ for (int i = 0, length = names.length; i < length; i++) {
+ if (!Util.isValidFolderNameForPackage(new String(names[i]), this.sourceLevel, this.complianceLevel)) {
+ this.invalidPackageNames.add(packageName);
+ return false;
+ }
+ }
+
+ this.validPackageNames.add(packageName);
+ return true;
+ }
+
private boolean isValidParent(ASTNode parent, ASTNode node, Scope scope){
if(parent instanceof ParameterizedSingleTypeReference) {
@@ -13617,6 +13648,8 @@
protected void reset() {
super.reset(false);
+ this.validPackageNames = new SimpleSetOfCharArray(10);
+ this.invalidPackageNames = new SimpleSetOfCharArray(1);
this.knownPkgs = new HashtableOfObject(10);
this.knownTypes = new HashtableOfObject(10);
if (this.noCacheNameEnvironment != null) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java
index 23e15bc..45b882b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2013 GK Software AG and others.
+ * Copyright (c) 2011, 2014 GK Software AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -213,7 +213,7 @@
*/
public static void preConnectTrackerAcrossAssignment(ASTNode location, LocalVariableBinding local, Expression rhs, FlowInfo flowInfo) {
FakedTrackingVariable closeTracker = null;
- if (rhs instanceof AllocationExpression || rhs instanceof ConditionalExpression) {
+ if (containsAllocation(rhs)) {
closeTracker = local.closeTracker;
if (closeTracker == null) {
if (rhs.resolvedType != TypeBinding.NULL) { // not NULL means valid closeable as per method precondition
@@ -230,6 +230,16 @@
}
}
+ private static boolean containsAllocation(ASTNode location) {
+ if (location instanceof AllocationExpression)
+ return true;
+ if (location instanceof ConditionalExpression) {
+ ConditionalExpression conditional = (ConditionalExpression) location;
+ return containsAllocation(conditional.valueIfTrue) || containsAllocation(conditional.valueIfFalse);
+ }
+ return false;
+ }
+
private static void preConnectTrackerAcrossAssignment(ASTNode location, LocalVariableBinding local, FlowInfo flowInfo,
FakedTrackingVariable closeTracker, Expression expression) {
if (expression instanceof AllocationExpression) {
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 9d87c1f..8c7f6fe 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
@@ -783,8 +783,8 @@
this.fields[i].setAnnotations(createAnnotations(binaryField.getAnnotations(), this.environment, missingTypeNames));
}
}
- }
- }
+ }
+ }
}
//{ObjectTeams: some fields are indeed value parameters:
private SyntheticArgumentBinding[] valueParameters = NO_SYNTH_ARGUMENTS;
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 7f5a1fa..d783526 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
@@ -702,10 +702,8 @@
### VARARGS
800 = Extended dimensions are illegal for a variable argument
-#801 = The argument of type {0} should explicitly be cast to {1} for the invocation of the varargs method {2}({3}) from type {4}. It could alternatively be cast to {5} for a varargs invocation
-801 = Type {0} of the last argument to method {2}({3}) doesn't exactly match the vararg parameter type. Cast to {1} to confirm the non-varargs invocation, or pass individual arguments of type {5} for a varargs invocation.
-#802 = The argument of type {0} should explicitly be cast to {1} for the invocation of the varargs constructor {2}({3}). It could alternatively be cast to {4} for a varargs invocation
-802 = Type {0} of the last argument to constructor {2}({3}) doesn't exactly match the vararg parameter type. Cast to {1} to confirm the non-varargs invocation, or pass individual arguments of type {4} for a varargs invocation.
+801 = Type {0} of the last argument to method {2}({3}) doesn''t exactly match the vararg parameter type. Cast to {1} to confirm the non-varargs invocation, or pass individual arguments of type {5} for a varargs invocation.
+802 = Type {0} of the last argument to constructor {2}({3}) doesn''t exactly match the vararg parameter type. Cast to {1} to confirm the non-varargs invocation, or pass individual arguments of type {4} for a varargs invocation.
803 = Varargs methods should only override or be overridden by other varargs methods unlike {2}.{0}({1}) and {4}.{0}({3})
804 = @SafeVarargs annotation cannot be applied to fixed arity method {0}
805 = @SafeVarargs annotation cannot be applied to non-final instance method {0}
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 23b3bc2..5e612be 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,11 +7,12 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Ray V. (voidstar@gmail.com) - Contribution for bug 282988
* Fraunhofer FIRST - extended API and implementation
* Technical University Berlin - extended API and implementation
+ * Ray V. (voidstar@gmail.com) - Contribution for bug 282988
* Jesper S Moller - Contribution for bug 402892
* Contribution for bug 402818
+ * Robin Stocker - Bug 49619 - [formatting] comment formatter leaves whitespace in comments
*******************************************************************************/
package org.eclipse.jdt.internal.formatter;
@@ -3725,8 +3726,10 @@
if (linesGap > 0) {
this.javadocGapLinesBuffer.setLength(0);
if (lineCount > 0) {
- // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619
- this.javadocGapLinesBuffer.append( ' ');
+ // only add trailing space if one was there before (bug 49619)
+ if (this.scanner.source[start] == ' ') {
+ this.javadocGapLinesBuffer.append(' ');
+ }
}
for (int i = 0; i < linesGap ; i++) {
if (clearBlankLines && lineCount >= newLines) {
@@ -3734,9 +3737,9 @@
// so remove any remaining blanks and leave
if (textEndPosition >= start) {
if (output == null) {
- addReplaceEdit(start, textEndPosition, this.javadocGapLinesBuffer.toString());
+ addReplaceEdit(start, textEndPosition, " "); //$NON-NLS-1$
} else {
- output.append(this.javadocGapLinesBuffer);
+ output.append(' ');
}
}
return;
@@ -3787,8 +3790,10 @@
// Insert new lines as not enough was encountered while scanning the whitespaces
this.javadocGapLinesBuffer.setLength(0);
if (lineCount > 0) {
- // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619
- this.javadocGapLinesBuffer.append( ' ');
+ // only add trailing space if one was there before (bug 49619)
+ if (this.scanner.source[start] == ' ') {
+ this.javadocGapLinesBuffer.append(' ');
+ }
}
for (int i = lineCount; i < newLines-1; i++) {
printJavadocNewLine(this.javadocGapLinesBuffer);
@@ -3818,8 +3823,10 @@
this.javadocGapLinesBuffer.setLength(0);
if (this.scanner.linePtr > linePtr) {
if (lineCount > 0) {
- // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619
- this.javadocGapLinesBuffer.append(' ');
+ // only add trailing space if one was there before (bug 49619)
+ if (this.scanner.source[start] == ' ') {
+ this.javadocGapLinesBuffer.append(' ');
+ }
}
this.javadocGapLinesBuffer.append(this.lineSeparator);
this.column = 1;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragment.java
index e248037..9066ec0 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragment.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -197,6 +197,9 @@
return storedNonJavaResources();
}
}
+protected boolean internalIsValidPackageName() {
+ return true;
+}
/**
* Jars and jar entries are all read only
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
index 37499ae..09f3365 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.core.util.HashtableOfArrayToObject;
import org.eclipse.jdt.internal.core.util.Util;
@@ -41,6 +42,11 @@
private final static ArrayList EMPTY_LIST = new ArrayList();
/**
+ * Compiler compliance level that was used to produce the jar.
+ */
+ protected final String complianceLevel;
+
+ /**
* The path to the jar file
* (a workspace relative path if the jar is internal,
* or an OS path if the jar is external)
@@ -55,6 +61,9 @@
protected JarPackageFragmentRoot(IPath externalJarPath, JavaProject project) {
super(null, project);
this.jarPath = externalJarPath;
+ Object file = JavaModel.getTarget(getPath(), true);
+ long level = Util.getJdkLevel(file);
+ this.complianceLevel = CompilerOptions.versionFromJdkLevel(level);
}
/**
* Constructs a package fragment root which is the root of the Java package directory hierarchy
@@ -63,6 +72,9 @@
protected JarPackageFragmentRoot(IResource resource, JavaProject project) {
super(resource, project);
this.jarPath = resource.getFullPath();
+ Object file = JavaModel.getTarget(getPath(), true);
+ long level = Util.getJdkLevel(file);
+ this.complianceLevel = CompilerOptions.versionFromJdkLevel(level);
}
/**
@@ -75,9 +87,6 @@
IJavaElement[] children;
ZipFile jar = null;
try {
- IJavaProject project = getJavaProject();
- String sourceLevel = project.getOption(JavaCore.COMPILER_SOURCE, true);
- String compliance = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
jar = getJar();
// always create the default package
@@ -85,7 +94,7 @@
for (Enumeration e= jar.entries(); e.hasMoreElements();) {
ZipEntry member= (ZipEntry) e.nextElement();
- initRawPackageInfo(rawPackageInfo, member.getName(), member.isDirectory(), sourceLevel, compliance);
+ initRawPackageInfo(rawPackageInfo, member.getName(), member.isDirectory());
}
// loop through all of referenced packages, creating package fragments if necessary
@@ -212,7 +221,7 @@
public int hashCode() {
return this.jarPath.hashCode();
}
- private void initRawPackageInfo(HashtableOfArrayToObject rawPackageInfo, String entryName, boolean isDirectory, String sourceLevel, String compliance) {
+ private void initRawPackageInfo(HashtableOfArrayToObject rawPackageInfo, String entryName, boolean isDirectory) {
int lastSeparator = isDirectory ? entryName.length()-1 : entryName.lastIndexOf('/');
String[] pkgName = Util.splitOn('/', entryName, 0, lastSeparator);
String[] existing = null;
@@ -225,7 +234,9 @@
}
JavaModelManager manager = JavaModelManager.getJavaModelManager();
for (int i = existingLength; i < length; i++) {
- if (Util.isValidFolderNameForPackage(pkgName[i], sourceLevel, compliance)) {
+ // sourceLevel must be null because we know nothing about it based on a jar file
+ // complianceLevel can be retrieved from a jar file
+ if (Util.isValidFolderNameForPackage(pkgName[i], null, this.complianceLevel)) {
System.arraycopy(existing, 0, existing = new String[i+1], 0, i);
existing[i] = manager.intern(pkgName[i]);
rawPackageInfo.put(existing, new ArrayList[] { EMPTY_LIST, EMPTY_LIST });
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
index 280c833..8f19188 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java
@@ -867,6 +867,7 @@
}
}
}
+
/*
* We don't use getContentEncoding() on the URL connection, because it might leave open streams behind.
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=117890
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
index 8b54471..9ccad47 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -57,9 +57,12 @@
public String[] names;
+ private boolean isValidPackageName;
+
protected PackageFragment(PackageFragmentRoot root, String[] names) {
super(root);
this.names = names;
+ this.isValidPackageName = internalIsValidPackageName();
}
/**
* @see Openable
@@ -384,14 +387,11 @@
}
return false;
}
-/**
- * @see IPackageFragment#isDefaultPackage()
- */
-public boolean isDefaultPackage() {
- return this.names.length == 0;
-}
-private boolean isValidPackageName() {
- JavaProject javaProject = (JavaProject) getJavaProject();
+protected boolean internalIsValidPackageName() {
+ // if package fragment refers to folder in another IProject, then
+ // resource().getProject() is different than getJavaProject().getProject()
+ // use the other java project's options to verify the name
+ IJavaProject javaProject = JavaCore.create(resource().getProject());
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0, length = this.names.length; i < length; i++) {
@@ -401,6 +401,15 @@
return true;
}
/**
+ * @see IPackageFragment#isDefaultPackage()
+ */
+public boolean isDefaultPackage() {
+ return this.names.length == 0;
+}
+protected final boolean isValidPackageName() {
+ return this.isValidPackageName;
+}
+/**
* @see ISourceManipulation#move(IJavaElement, IJavaElement, String, boolean, IProgressMonitor)
*/
public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
index 35c2efc..beba74d 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -221,14 +221,18 @@
vChildren.add(pkg);
}
try {
- JavaProject javaProject = (JavaProject)getJavaProject();
- JavaModelManager manager = JavaModelManager.getJavaModelManager();
IResource[] members = folder.members();
boolean hasIncluded = isIncluded;
int length = members.length;
- if (length >0) {
- String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
- String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+ if (length > 0) {
+ // if package fragment root refers to folder in another IProject, then
+ // folder.getProject() is different than getJavaProject().getProject()
+ // use the other java project's options to verify the name
+ IJavaProject otherJavaProject = JavaCore.create(folder.getProject());
+ String sourceLevel = otherJavaProject.getOption(JavaCore.COMPILER_SOURCE, true);
+ String complianceLevel = otherJavaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+ JavaProject javaProject = (JavaProject) getJavaProject();
+ JavaModelManager manager = JavaModelManager.getJavaModelManager();
for (int i = 0; i < length; i++) {
IResource member = members[i];
String memberName = member.getName();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java
index 431b9c7..c523f1b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -60,14 +60,18 @@
static Object[] computeFolderNonJavaResources(IPackageFragmentRoot root, IContainer folder, char[][] inclusionPatterns, char[][] exclusionPatterns) throws JavaModelException {
IResource[] nonJavaResources = new IResource[5];
int nonJavaResourcesCounter = 0;
- JavaProject project = (JavaProject) root.getJavaProject();
try {
- IClasspathEntry[] classpath = project.getResolvedClasspath();
IResource[] members = folder.members();
int length = members.length;
if (length > 0) {
- String sourceLevel = project.getOption(JavaCore.COMPILER_SOURCE, true);
- String complianceLevel = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+ // if package fragment root refers to folder in another IProject, then
+ // folder.getProject() is different than root.getJavaProject().getProject()
+ // use the other java project's options to verify the name
+ IJavaProject otherJavaProject = JavaCore.create(folder.getProject());
+ String sourceLevel = otherJavaProject.getOption(JavaCore.COMPILER_SOURCE, true);
+ String complianceLevel = otherJavaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+ JavaProject javaProject = (JavaProject) root.getJavaProject();
+ IClasspathEntry[] classpath = javaProject.getResolvedClasspath();
nextResource: for (int i = 0; i < length; i++) {
IResource member = members[i];
switch (member.getType()) {
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java
index 6c88897..7eeac86 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java
@@ -38,6 +38,12 @@
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class IndexSelector {
+
+ //TODO: Bug 386113: "Search references" and "Type hierarchy" show inconsistent results with "External Plug-in Libraries" project
+ public static final int PROJECT_CAN_SEE_FOCUS= 0;
+ public static final int PROJECT_SOURCE_CAN_NOT_SEE_FOCUS= 1;
+ public static final int PROJECT_CAN_NOT_SEE_FOCUS= 2;
+
IJavaSearchScope searchScope;
SearchPattern pattern;
IndexLocation[] indexLocations; // cache of the keys for looking index up
@@ -54,44 +60,52 @@
* a JarPackageFragmentRot) either because the focus is part of the project or the jar, or because it is
* accessible throught the project's classpath
*/
-public static boolean canSeeFocus(SearchPattern pattern, IPath projectOrJarPath) {
+public static int canSeeFocus(SearchPattern pattern, IPath projectOrJarPath) {
try {
IJavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
IJavaProject project = getJavaProject(projectOrJarPath, model);
IJavaElement[] focuses = getFocusedElementsAndTypes(pattern, project, null);
- if (focuses.length == 0) return false;
+ if (focuses.length == 0) return PROJECT_CAN_NOT_SEE_FOCUS;
if (project != null) {
return canSeeFocus(focuses, (JavaProject) project, null);
}
// projectOrJarPath is a jar
// it can see the focus only if it is on the classpath of a project that can see the focus
+ int result = PROJECT_CAN_NOT_SEE_FOCUS;
IJavaProject[] allProjects = model.getJavaProjects();
for (int i = 0, length = allProjects.length; i < length; i++) {
JavaProject otherProject = (JavaProject) allProjects[i];
IClasspathEntry entry = otherProject.getClasspathEntryFor(projectOrJarPath);
if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
- if (canSeeFocus(focuses, otherProject, null)) {
- return true;
- }
+ int canSeeFocus = canSeeFocus(focuses, otherProject, null);
+ if (canSeeFocus == PROJECT_CAN_SEE_FOCUS)
+ return PROJECT_CAN_SEE_FOCUS;
+ if (canSeeFocus == PROJECT_SOURCE_CAN_NOT_SEE_FOCUS)
+ result = PROJECT_SOURCE_CAN_NOT_SEE_FOCUS;
}
}
- return false;
+ return result;
} catch (JavaModelException e) {
- return false;
+ return PROJECT_CAN_NOT_SEE_FOCUS;
}
}
-private static boolean canSeeFocus(IJavaElement[] focuses, JavaProject javaProject, char[][][] focusQualifiedNames) {
+private static int canSeeFocus(IJavaElement[] focuses, JavaProject javaProject, char[][][] focusQualifiedNames) {
+ int result = PROJECT_CAN_NOT_SEE_FOCUS;
int length = focuses.length;
for (int i=0; i<length; i++) {
- if (canSeeFocus(focuses[i], javaProject, focusQualifiedNames)) return true;
+ int canSeeFocus = canSeeFocus(focuses[i], javaProject, focusQualifiedNames);
+ if (canSeeFocus == PROJECT_CAN_SEE_FOCUS)
+ return PROJECT_CAN_SEE_FOCUS;
+ if (canSeeFocus == PROJECT_SOURCE_CAN_NOT_SEE_FOCUS)
+ result = PROJECT_SOURCE_CAN_NOT_SEE_FOCUS;
}
- return false;
+ return result;
}
-private static boolean canSeeFocus(IJavaElement focus, JavaProject javaProject, char[][][] focusQualifiedNames) {
+private static int canSeeFocus(IJavaElement focus, JavaProject javaProject, char[][][] focusQualifiedNames) {
try {
- if (focus == null) return false;
- if (focus.equals(javaProject)) return true;
+ if (focus == null) return PROJECT_CAN_NOT_SEE_FOCUS;
+ if (focus.equals(javaProject)) return PROJECT_CAN_SEE_FOCUS;
if (focus instanceof JarPackageFragmentRoot) {
// focus is part of a jar
@@ -100,9 +114,9 @@
for (int i = 0, length = entries.length; i < length; i++) {
IClasspathEntry entry = entries[i];
if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && entry.getPath().equals(focusPath))
- return true;
+ return PROJECT_CAN_SEE_FOCUS;
}
- return false;
+ return PROJECT_CAN_NOT_SEE_FOCUS;
}
// look for dependent projects
IPath focusPath = ((JavaProject) focus).getProject().getFullPath();
@@ -119,18 +133,18 @@
if (values[j] == null) continue;
ReferenceCollection references = (ReferenceCollection) values[j];
if (references.includes(focusQualifiedNames, null, null)) {
- return true;
+ return PROJECT_CAN_SEE_FOCUS;
}
}
- return false;
+ return PROJECT_SOURCE_CAN_NOT_SEE_FOCUS;
}
}
- return true;
+ return PROJECT_CAN_SEE_FOCUS;
}
}
- return false;
+ return PROJECT_CAN_NOT_SEE_FOCUS;
} catch (JavaModelException e) {
- return false;
+ return PROJECT_CAN_NOT_SEE_FOCUS;
}
}
@@ -218,8 +232,11 @@
JavaProject project = (JavaProject) getJavaProject(path, model);
if (project != null) {
visitedProjects.add(project);
- if (canSeeFocus(focuses, project, focusQualifiedNames)) {
+ int canSeeFocus = canSeeFocus(focuses, project, focusQualifiedNames);
+ if (canSeeFocus == PROJECT_CAN_SEE_FOCUS) {
locations.add(manager.computeIndexLocation(path));
+ }
+ if (canSeeFocus != PROJECT_CAN_NOT_SEE_FOCUS) {
projectsCanSeeFocus[projectIndex++] = project;
}
} else {
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 6af72a7..ac15327 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,8 @@
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
* Technical University Berlin - extended API and implementation
+ * Stephan Herrmann - Contribution for
+ * Bug 377883 - NPE on open Call Hierarchy
*******************************************************************************/
package org.eclipse.jdt.internal.core.search.matching;
@@ -276,7 +278,7 @@
for (int i=0, length = copies.length; i<length; i++) {
org.eclipse.jdt.core.ICompilationUnit workingCopy = copies[i];
IPath projectOrJar = MatchLocator.getProjectOrJar(workingCopy).getPath();
- if (pattern.focus == null || IndexSelector.canSeeFocus(pattern, projectOrJar)) {
+ if (pattern.focus == null || IndexSelector.canSeeFocus(pattern, projectOrJar) != IndexSelector.PROJECT_CAN_NOT_SEE_FOCUS) {
result.put(
workingCopy.getPath().toString(),
new WorkingCopyDocument(workingCopy, participant)
@@ -1132,8 +1134,10 @@
public void initialize(JavaProject project, int possibleMatchSize) throws JavaModelException {
// clean up name environment only if there are several possible match as it is reused
// when only one possible match (bug 58581)
- if (this.nameEnvironment != null && possibleMatchSize != 1)
+ if (this.nameEnvironment != null && possibleMatchSize != 1) {
this.nameEnvironment.cleanup();
+ this.unitScope = null; // don't leak a reference to the cleaned-up name environment
+ }
SearchableEnvironment searchableEnvironment = project.newSearchableNameEnvironment(this.workingCopies);
@@ -1465,6 +1469,7 @@
this.progressMonitor.done();
if (this.nameEnvironment != null)
this.nameEnvironment.cleanup();
+ this.unitScope = null;
manager.flushZipFiles(this);
this.bindings = null;
}