update jdt.core to I20161202-2000
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 141b2d2..0f31c25 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -83,6 +83,7 @@
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.impl.IrritantSet;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
@@ -1156,6 +1157,23 @@
return defaultOptions;
}
+ protected void enableAllWarningsForIrritants(Map<String, String> options, IrritantSet irritants) {
+ int[] bits = irritants.getBits();
+ for (int i = 0; i < bits.length; i++) {
+ int bit = bits[i];
+ for (int b = 0; b < IrritantSet.GROUP_SHIFT; b++) {
+ int single = bit & (1 << b);
+ if (single != 0) {
+ single |= (i<<IrritantSet.GROUP_SHIFT);
+ if (single == CompilerOptions.MissingNonNullByDefaultAnnotation)
+ continue;
+ String optionKey = CompilerOptions.optionKeyFromIrritant(single);
+ options.put(optionKey, CompilerOptions.WARNING);
+ }
+ }
+ }
+ }
+
protected String[] getDefaultClassPaths() {
return DefaultJavaRuntimeEnvironment.getDefaultClassPaths();
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
index a7fa3ea..26318e9 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
@@ -34,10 +34,14 @@
import junit.framework.Test;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.ToolFactory;
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.Compiler;
+import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
import org.eclipse.jdt.internal.compiler.IProblemFactory;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
@@ -49,6 +53,7 @@
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.impl.IrritantSet;
import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
@@ -7689,6 +7694,7 @@
public void test230() {
Map options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
+ enableAllWarningsForIrritants(options, IrritantSet.UNUSED);
this.runNegativeTest(
true,
new String[] {
@@ -7727,6 +7733,7 @@
public void test231() {
Map options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
+ enableAllWarningsForIrritants(options, IrritantSet.UNUSED);
this.runNegativeTest(
true,
new String[] {
@@ -8119,6 +8126,7 @@
options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.IGNORE);
options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
options.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.WARNING);
+ enableAllWarningsForIrritants(options, IrritantSet.UNUSED);
this.runNegativeTest(
true,
new String[] {
@@ -10232,6 +10240,7 @@
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
public void testBug365437a() {
Map customOptions = getCompilerOptions();
+ enableAllWarningsForIrritants(customOptions, IrritantSet.NULL);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
String testFiles [] = new String[] {
"p/A.java",
@@ -10330,6 +10339,7 @@
public void testBug365437c() {
if (this.complianceLevel < ClassFileConstants.JDK1_7) return;
Map customOptions = getCompilerOptions();
+ enableAllWarningsForIrritants(customOptions, IrritantSet.NULL);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
String testFiles [] = new String[] {
"p/A.java",
@@ -10379,6 +10389,7 @@
// unused constructor
public void testBug365437d() {
Map customOptions = getCompilerOptions();
+ enableAllWarningsForIrritants(customOptions, IrritantSet.NULL);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
@@ -10458,6 +10469,7 @@
// unused field
public void testBug365437e() {
Map customOptions = getCompilerOptions();
+ enableAllWarningsForIrritants(customOptions, IrritantSet.NULL);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
@@ -10530,6 +10542,7 @@
// unused type
public void testBug365437f() {
Map customOptions = getCompilerOptions();
+ enableAllWarningsForIrritants(customOptions, IrritantSet.NULL);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
@@ -11803,4 +11816,58 @@
"",
null, true, options);
}
+public void testBug506888f() throws Exception {
+
+ class MyCompilerRequestor implements ICompilerRequestor {
+ String[] problemArguments = null;
+
+ @Override
+ public void acceptResult(CompilationResult result) {
+ for (CategorizedProblem problem : result.getAllProblems()) {
+ String[] arguments = problem.getArguments();
+ if (arguments != null && arguments.length > 0) {
+ this.problemArguments = arguments;
+ return;
+ }
+ }
+ }
+ }
+
+ if (this.complianceLevel <= ClassFileConstants.JDK1_5) {
+ return;
+ }
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING);
+ MyCompilerRequestor requestor = new MyCompilerRequestor();
+ runTest(new String[] {
+ "X.java",
+ "public class X {\n" +
+ " \n" +
+ " @SuppressWarnings({\"unused\"})\n" +
+ " void foo() {\n" +
+ " }\n" +
+ "} \n",
+ },
+ false,
+ "----------\n" +
+ "1. INFO in X.java (at line 3)\n" +
+ " @SuppressWarnings({\"unused\"})\n" +
+ " ^^^^^^^^\n" +
+ "At least one of the problems in category \'unused\' is not analysed due to a compiler option being ignored\n" +
+ "----------\n",
+ "" /*expectedOutputString */,
+ "" /* expectedErrorString */,
+ false /* forceExecution */,
+ null /* classLib */,
+ true /* shouldFlushOutputDirectory */,
+ null /* vmArguments */,
+ options,
+ new Requestor(true, requestor, false, true),
+ JavacTestOptions.DEFAULT);
+ assertNotNull(requestor.problemArguments);
+ assertEquals(1, requestor.problemArguments.length);
+ assertEquals(JavaCore.COMPILER_PB_UNUSED_PARAMETER, requestor.problemArguments[0]);
+}
}
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 2e44cd4..8a09df9 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
@@ -11742,7 +11742,7 @@
"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
" @SuppressWarnings(\"unused\")\n" +
" ^^^^^^^^\n" +
- "Unnecessary @SuppressWarnings(\"unused\")\n" +
+ "At least one of the problems in category 'unused' is not analysed due to a compiler option being ignored\n" +
"----------\n" +
"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
" private int i;\n" +
@@ -11833,7 +11833,7 @@
"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 2)\n" +
" @SuppressWarnings(\"unused\")\n" +
" ^^^^^^^^\n" +
- "Unnecessary @SuppressWarnings(\"unused\")\n" +
+ "At least one of the problems in category 'unused' is not analysed due to a compiler option being ignored\n" +
"----------\n" +
"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 3)\n" +
" private int i;\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
index 4ba47f9..63234c1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
@@ -1994,10 +1994,10 @@
expectedProblemAttributes.put("UnsafeTypeConversion", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
expectedProblemAttributes.put("UnterminatedComment", SKIP);
expectedProblemAttributes.put("UnterminatedString", SKIP);
- expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING));
+ expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION));
expectedProblemAttributes.put("UnusedImport", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_IMPORT));
expectedProblemAttributes.put("UnusedLabel", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_LABEL));
- expectedProblemAttributes.put("UnusedMethodDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING));
+ expectedProblemAttributes.put("UnusedMethodDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION));
expectedProblemAttributes.put("UnusedObjectAllocation", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_OBJECT_ALLOCATION));
expectedProblemAttributes.put("UnusedPrivateConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER));
expectedProblemAttributes.put("UnusedPrivateField", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER));
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
index a6d3fe7..21d62b5 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2014 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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
@@ -2701,6 +2701,50 @@
},
"test");
}
+public void testBug499809() {
+ this.runConformTest(
+ new String[] {
+ "Foo.java",
+ "public class Foo {\n" +
+ " static void foo( ) {\n" +
+ " String _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, a, b,\n" +
+ " c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, s0, s1, s2, s3, s4, s5, s6, s7;\n" +
+ " Object ob = new Object();\n" +
+ " int int1 = 0, int2 = 2, int3, int4;\n" +
+ " if (ob != null) {\n" +
+ " int4 = 1;\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"Done\");\n" +
+ " }\n" +
+ "}\n"
+ },
+ "Done");
+}
+public void testBug499809a() {
+ this.runConformTest(
+ new String[] {
+ "Foo.java",
+ "public class Foo {\n" +
+ " static void foo( ) {\n" +
+ " String _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, a, b,\n" +
+ " c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, s0, s1, s2, s3, s4, s5, s6, s7;\n" +
+ " Object ob = new Object();\n" +
+ " int int1 = 0, int2 = 2, int3, int4;\n" +
+ " if (ob == null) {\n" +
+ " int1 = 1;\n" +
+ " } else {\n" +
+ " int4 = 1;\n" +
+ " }\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"Done\");\n" +
+ " }\n" +
+ "}\n"
+ },
+ "Done");
+}
public static Class testClass() {
return FlowAnalysisTest.class;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
index d43b037..9aebfa6 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
@@ -13358,4 +13358,52 @@
"----------\n"
);
}
+public void testBug508497() {
+ runConformTestWithLibs(
+ new String[] {
+ "Reference.java",
+ "interface Fluent<SELF extends Fluent<SELF>> {\n" +
+ " SELF self();\n" +
+ "}\n" +
+ "abstract class Reference<T> {\n" +
+ " abstract T get();\n" +
+ "}\n" +
+ "",
+ },
+ getCompilerOptions(),
+ ""
+ );
+ runConformTestWithLibs(
+ new String[] {
+ "B2.java",
+ "class B2 {\n" +
+ " void b1(Fluent f) {\n" +
+ " f.self();\n" +
+ " }\n" +
+ "\n" +
+ " void b2(Reference<@org.eclipse.jdt.annotation.NonNull Fluent> ref) {\n" +
+ " ref.get().self();\n" +
+ " }\n" +
+ "}\n" +
+ "",
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. WARNING in B2.java (at line 2)\n" +
+ " void b1(Fluent f) {\n" +
+ " ^^^^^^\n" +
+ "Fluent is a raw type. References to generic type Fluent<SELF> should be parameterized\n" +
+ "----------\n" +
+ "2. WARNING in B2.java (at line 6)\n" +
+ " void b2(Reference<@org.eclipse.jdt.annotation.NonNull Fluent> ref) {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Fluent is a raw type. References to generic type Fluent<SELF> should be parameterized\n" +
+ "----------\n" +
+ "3. INFO in B2.java (at line 7)\n" +
+ " ref.get().self();\n" +
+ " ^^^^^^^^^\n" +
+ "Unsafe interpretation of method return type as \'@NonNull\' based on the receiver type \'Reference<@NonNull Fluent>\'. Type \'Reference<T>\' doesn\'t seem to be designed with null type annotations in mind\n" +
+ "----------\n"
+ );
+}
}
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 aaa5457..a182ec7 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
@@ -24,6 +24,7 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.impl.IrritantSet;
@SuppressWarnings({ "unchecked", "rawtypes" })
public class ResourceLeakTests extends AbstractRegressionTest {
@@ -266,6 +267,7 @@
public void test056d_suppress() {
if (this.complianceLevel < ClassFileConstants.JDK1_5) return; // annotations used
Map options = getCompilerOptions();
+ enableAllWarningsForIrritants(options, IrritantSet.RESOURCE);
options.put(CompilerOptions.OPTION_ReportUnclosedCloseable, CompilerOptions.ERROR);
options.put(CompilerOptions.OPTION_ReportPotentiallyUnclosedCloseable, CompilerOptions.WARNING);
options.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED);
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java
index bc2e744..fb358e8 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java
@@ -1839,4 +1839,41 @@
assertProblems(problems, new String[] {
"Pb(149) Dead code"
}, new int[] { 7 });
- }}
+ }
+ public void testBug507256() throws Exception {
+ myCreateJavaProject("TestLibs");
+ addLibraryWithExternalAnnotations(this.project, "lib1.jar", "annots", new String[] {
+ "/UnannotatedLib/libs/Lib1.java",
+ "package libs;\n" +
+ "\n" +
+ "public interface Lib1 {\n" +
+ " void methodWithParamAfterWildcard(Class<?> c, Object s);\n" +
+ "}\n"
+ }, null);
+ // annotations directly on a wildcard (*, +, -)
+ createFileInProject("annots/libs", "Lib1.eea",
+ "class libs/Lib1\n" +
+ "\n" +
+ "methodWithParamAfterWildcard\n" +
+ " (Ljava/lang/Class<*>;Ljava/lang/Object;)V\n" +
+ " (L1java/lang/Class<*>;L1java/lang/Object;)V\n" +
+ "\n" +
+ "\n");
+ IPackageFragment fragment = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
+ ICompilationUnit unit = fragment.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " void test1(Lib1 lib) {\n" +
+ " lib.methodWithParamAfterWildcard(Object.class, null);\n" + // error, second param must not be null
+ " }\n" +
+ "}\n",
+ true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
+ CompilationUnit reconciled = unit.reconcile(AST.JLS8, true, null, new NullProgressMonitor());
+ IProblem[] problems = reconciled.getProblems();
+ assertProblems(problems, new String[] {
+ "Pb(910) Null type mismatch: required '@NonNull Object' but the provided value is null"
+ }, new int[] { 6 });
+ }
+}
diff --git a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/BuildJarIndex.java b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/BuildJarIndex.java
index cd7238a..fcb9685 100644
--- a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/BuildJarIndex.java
+++ b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/BuildJarIndex.java
@@ -48,7 +48,7 @@
try {
JavaIndexer.generateIndexForJar(this.jarPath, this.indexPath);
} catch (IOException e) {
- throw new BuildException(AntAdapterMessages.getString("buildJarIndex.ioexception.occured", e.getLocalizedMessage())); //$NON-NLS-1$
+ throw new BuildException(AntAdapterMessages.getString("buildJarIndex.ioexception.occured", e.getLocalizedMessage()), e); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java
index 5aef721..0947c64 100644
--- a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java
+++ b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java
@@ -60,7 +60,7 @@
try {
jarFile = new ZipFile(this.file);
} catch (ZipException e) {
- throw new BuildException(AntAdapterMessages.getString("checkDebugAttributes.file.argument.must.be.a.classfile.or.a.jarfile")); //$NON-NLS-1$
+ throw new BuildException(AntAdapterMessages.getString("checkDebugAttributes.file.argument.must.be.a.classfile.or.a.jarfile"), e); //$NON-NLS-1$
} finally {
if (jarFile != null) {
jarFile.close();
@@ -78,7 +78,7 @@
getProject().setUserProperty(this.property, "has debug"); //$NON-NLS-1$
}
} catch (IOException e) {
- throw new BuildException(AntAdapterMessages.getString("checkDebugAttributes.ioexception.occured") + this.file); //$NON-NLS-1$
+ throw new BuildException(AntAdapterMessages.getString("checkDebugAttributes.ioexception.occured") + this.file, e); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
index c2bdf71..507f55d 100644
--- a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
+++ b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
@@ -84,7 +84,7 @@
}
return resultValue;
} catch (ClassNotFoundException cnfe) {
- throw new BuildException(AntAdapterMessages.getString("ant.jdtadapter.error.cannotFindJDTCompiler")); //$NON-NLS-1$
+ throw new BuildException(AntAdapterMessages.getString("ant.jdtadapter.error.cannotFindJDTCompiler"), cnfe); //$NON-NLS-1$
} catch (Exception ex) {
throw new BuildException(ex);
}
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 5d7f49b..12a301c 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
@@ -1270,9 +1270,9 @@
this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
}
} catch (FileNotFoundException e) {
- throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$
+ throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLog", logFileName), e); //$NON-NLS-1$
} catch (UnsupportedEncodingException e) {
- throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName)); //$NON-NLS-1$
+ throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName), e); //$NON-NLS-1$
}
}
private void startLoggingExtraProblems(int count) {
@@ -1983,7 +1983,7 @@
new InputStreamReader(new ByteArrayInputStream(new byte[0]), customEncoding);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(
- this.bind("configure.unsupportedEncoding", customEncoding)); //$NON-NLS-1$
+ this.bind("configure.unsupportedEncoding", customEncoding), e); //$NON-NLS-1$
}
}
currentArg = currentArg.substring(0, encodingStart - 1);
@@ -2605,7 +2605,7 @@
throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
}
} catch (NumberFormatException e) {
- throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
+ throw new IllegalArgumentException(this.bind("configure.repetition", currentArg), e); //$NON-NLS-1$
}
mode = DEFAULT;
continue;
@@ -2617,7 +2617,7 @@
}
this.options.put(CompilerOptions.OPTION_MaxProblemPerUnit, currentArg);
} catch (NumberFormatException e) {
- throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$
+ throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg), e); //$NON-NLS-1$
}
mode = DEFAULT;
continue;
@@ -2667,7 +2667,7 @@
new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(
- this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$
+ this.bind("configure.unsupportedEncoding", currentArg), e); //$NON-NLS-1$
}
specifiedEncodings.add(currentArg);
this.options.put(CompilerOptions.OPTION_Encoding, currentArg);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java
index cf7b55c..fd6da1b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java
@@ -586,7 +586,8 @@
if (an == NULLABLE || an == NONNULL)
start++;
}
- int end = wrapperWithStart(start).computeEnd();
+ SignatureWrapper wrapper1 = wrapperWithStart(start);
+ int end = wrapper1.skipAngleContents(wrapper1.computeEnd());
return end;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java
index 288fb8f..2d5fd51 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -214,7 +214,9 @@
public UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits) {
return unconditionalInits().mergedWith(otherInits);
}
-
+public UnconditionalFlowInfo mergeDefiniteInitsWith(UnconditionalFlowInfo otherInits) {
+ return unconditionalInits().mergeDefiniteInitsWith(otherInits);
+}
public UnconditionalFlowInfo nullInfoLessUnconditionalCopy() {
return unconditionalInitsWithoutSideEffect().
nullInfoLessUnconditionalCopy();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
index 382cb83..c1687f0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
@@ -549,7 +549,8 @@
unconditionalInits();
// if a variable is only initialized in one branch and not initialized in the other,
// then we need to cast a doubt on its initialization in the merged info
- mergedInfo.definiteInits &= initsWhenFalse.unconditionalCopy().definiteInits;
+ mergedInfo.mergeDefiniteInitsWith(initsWhenFalse.unconditionalCopy());
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=415997, classify unreachability precisely, IsElseStatementUnreachable could be due to null analysis
if ((mergedInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0 && (initsWhenFalse.tagBits & FlowInfo.UNREACHABLE) == FlowInfo.UNREACHABLE_BY_NULLANALYSIS) {
mergedInfo.tagBits &= ~UNREACHABLE_OR_DEAD;
@@ -569,7 +570,7 @@
unconditionalInits();
// if a variable is only initialized in one branch and not initialized in the other,
// then we need to cast a doubt on its initialization in the merged info
- mergedInfo.definiteInits &= initsWhenTrue.unconditionalCopy().definiteInits;
+ mergedInfo.mergeDefiniteInitsWith(initsWhenTrue.unconditionalCopy());
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=415997, classify unreachability precisely, IsThenStatementUnreachable could be due to null analysis
if ((mergedInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0 && (initsWhenTrue.tagBits & FlowInfo.UNREACHABLE) == FlowInfo.UNREACHABLE_BY_NULLANALYSIS) {
mergedInfo.tagBits &= ~UNREACHABLE_OR_DEAD;
@@ -626,6 +627,8 @@
abstract public UnconditionalFlowInfo mergedWith(
UnconditionalFlowInfo otherInits);
+abstract public UnconditionalFlowInfo mergeDefiniteInitsWith(UnconditionalFlowInfo otherInits);
+
/**
* Return a copy of this unconditional flow info, deprived from its null
* info. {@link #DEAD_END DEAD_END} is returned unmodified.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java
index 4e34ec5..57808b5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -2204,7 +2204,54 @@
public UnconditionalFlowInfo unconditionalInitsWithoutSideEffect() {
return this;
}
+public UnconditionalFlowInfo mergeDefiniteInitsWith(UnconditionalFlowInfo otherInits) {
+ if ((otherInits.tagBits & UNREACHABLE_OR_DEAD) != 0 && this != DEAD_END) {
+ return this;
+ }
+ if ((this.tagBits & UNREACHABLE_OR_DEAD) != 0) {
+ return (UnconditionalFlowInfo) otherInits.copy(); // make sure otherInits won't be affected
+ }
+ // intersection of definitely assigned variables,
+ this.definiteInits &= otherInits.definiteInits;
+ if (this.extra != null) {
+ if (otherInits.extra != null) {
+ // both sides have extra storage
+ int i = 0, length, otherLength;
+ if ((length = this.extra[0].length) < (otherLength = otherInits.extra[0].length)) {
+ // current storage is shorter -> grow current
+ for (int j = 0; j < extraLength; j++) {
+ System.arraycopy(this.extra[j], 0,
+ (this.extra[j] = new long[otherLength]), 0, length);
+ }
+ for (; i < length; i++) {
+ this.extra[0][i] &= otherInits.extra[0][i];
+ }
+ for (; i < otherLength; i++) {
+ this.extra[0][i] = otherInits.extra[0][i];
+ }
+ }
+ else {
+ // current storage is longer
+ for (; i < otherLength; i++) {
+ this.extra[0][i] &= otherInits.extra[0][i];
+ }
+ }
+ } else {
+ for (int i = 0; i < this.extra[0].length; i++) {
+ this.extra[0][i] = 0;
+ }
+ }
+ }
+ else if (otherInits.extra != null) {
+ // no storage here, but other has extra storage.
+ int otherLength = otherInits.extra[0].length;
+ createExtraSpace(otherLength);
+ System.arraycopy(otherInits.extra[0], 0, this.extra[0], 0,
+ otherLength);
+ }
+ return this;
+}
public void resetAssignmentInfo(LocalVariableBinding local) {
resetAssignmentInfo(local.id + this.maxFieldCount);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index c65ac55..9b15cbf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -754,7 +754,7 @@
case UnqualifiedFieldAccess :
return OPTION_ReportUnqualifiedFieldAccess;
case UnusedDeclaredThrownException :
- return OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding;
+ return OPTION_ReportUnusedDeclaredThrownException;
case FinallyBlockNotCompleting :
return OPTION_ReportFinallyBlockNotCompletingNormally;
case InvalidJavadoc :
@@ -1629,10 +1629,15 @@
int[] bits = irritants.getBits();
for (int i = 0; i < IrritantSet.GROUP_MAX; i++) {
int bit = bits[i];
- if (bit > 0) {
- bit |= (i << IrritantSet.GROUP_SHIFT);
- if (!(this.warningThreshold.isSet(bit) || this.errorThreshold.isSet(bit) || this.infoThreshold.isSet(bit))) {
- return bit;
+ for (int b = 0; b < IrritantSet.GROUP_SHIFT; b++) {
+ int single = bit & (1 << b);
+ if (single > 0) {
+ single |= (i << IrritantSet.GROUP_SHIFT);
+ if (single == MissingNonNullByDefaultAnnotation)
+ continue;
+ if (!(this.warningThreshold.isSet(single) || this.errorThreshold.isSet(single) || this.infoThreshold.isSet(single))) {
+ return single;
+ }
}
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
index 07a9bcb..a474c96 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
@@ -1330,7 +1330,7 @@
else // WildcardBinding, CaptureBinding have no sourceName
nameBuffer.append(this.type.readableName());
}
- if (this.arguments != null && this.arguments.length > 0) { // empty arguments array happens when PTB has been created just to capture type annotations
+ if (this.arguments != null && this.arguments.length > 0 && !isRawType()) { // empty arguments array happens when PTB has been created just to capture type annotations
nameBuffer.append('<');
for (int i = 0, length = this.arguments.length; i < length; i++) {
if (i > 0) nameBuffer.append(',');
@@ -1358,7 +1358,7 @@
else // WildcardBinding, CaptureBinding have no sourceName
nameBuffer.append(this.type.shortReadableName());
}
- if (this.arguments != null && this.arguments.length > 0) { // empty arguments array happens when PTB has been created just to capture type annotations
+ if (this.arguments != null && this.arguments.length > 0 && !isRawType()) { // empty arguments array happens when PTB has been created just to capture type annotations
nameBuffer.append('<');
for (int i = 0, length = this.arguments.length; i < length; i++) {
if (i > 0) nameBuffer.append(',');
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
index a30f5a5..bea65e6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
@@ -1229,7 +1229,7 @@
count++;
}
} catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index 0482311..97bdfd8 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -501,7 +501,7 @@
return (CompilationUnit) result;
} catch (IllegalStateException e) {
// convert ASTParser's complaints into old form
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
}
@@ -575,7 +575,7 @@
return (CompilationUnit) result;
} catch (IllegalStateException e) {
// convert ASTParser's complaints into old form
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
}
@@ -813,21 +813,19 @@
} catch (NoSuchMethodException e) {
// all AST node classes have a Foo(AST) constructor
// therefore nodeClass is not legit
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
} catch (InstantiationException e) {
// all concrete AST node classes can be instantiated
// therefore nodeClass is not legit
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
} catch (IllegalAccessException e) {
// all AST node classes have an accessible Foo(AST) constructor
// therefore nodeClass is not legit
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
// concrete AST node classes do not die in the constructor
// therefore nodeClass is not legit
- IllegalArgumentException iae = new IllegalArgumentException();
- iae.initCause(e.getCause());
- throw iae;
+ throw new IllegalArgumentException(e.getCause());
}
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
index fd23cc2..3addd30 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
@@ -273,7 +273,7 @@
throw new IllegalStateException("invalid environment settings"); //$NON-NLS-1$
}
} catch (IllegalArgumentException e) {
- throw new IllegalStateException("invalid environment settings"); //$NON-NLS-1$
+ throw new IllegalStateException("invalid environment settings", e); //$NON-NLS-1$
}
return allClasspaths;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java
index b4b1da6..512a8d0 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java
@@ -286,7 +286,7 @@
throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
}
} catch (InvalidInputException e) {
- throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
+ throw new IllegalArgumentException("illegal character literal", e);//$NON-NLS-1$
}
}
nextChar = scanner.getNextChar();
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
index 6653512..065c011 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
@@ -770,7 +770,7 @@
throw new IllegalArgumentException(element + " has an unexpected type"); //$NON-NLS-1$
binaryElementPositions.put(key, i);
} catch (JavaModelException e) {
- throw new IllegalArgumentException(element + " does not exist"); //$NON-NLS-1$
+ throw new IllegalArgumentException(element + " does not exist", e); //$NON-NLS-1$
}
}
}
@@ -793,7 +793,7 @@
try {
finder.search();
} catch (JavaModelException e) {
- throw new IllegalArgumentException(element + " does not exist"); //$NON-NLS-1$
+ throw new IllegalArgumentException(element + " does not exist", e); //$NON-NLS-1$
}
this.bindings[index] = finder.foundBinding;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java
index 85ae7ff..4d4abe5 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java
@@ -264,7 +264,7 @@
throw new IllegalArgumentException();
}
} catch (InvalidInputException e) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
preValueChange(COMMENT_PROPERTY);
this.comment = docComment;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java
index bb1d90b..68b971e 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java
@@ -208,10 +208,8 @@
// this is the case when there is only one identifier see 87849
throw new IllegalArgumentException("Invalid identifier : >" + identifier + "<"); //$NON-NLS-1$//$NON-NLS-2$
}
- } catch(InvalidInputException e) {
- IllegalArgumentException iae = new IllegalArgumentException("Invalid identifier : >" + identifier + "<"); //$NON-NLS-1$//$NON-NLS-2$
- iae.initCause(e);
- throw iae;
+ } catch (InvalidInputException e) {
+ throw new IllegalArgumentException("Invalid identifier : >" + identifier + "<", e); //$NON-NLS-1$//$NON-NLS-2$
}
} finally {
this.ast.scanner.sourceLevel = sourceLevel;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Statement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Statement.java
index dffc912..60ba518 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Statement.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Statement.java
@@ -155,7 +155,7 @@
throw new IllegalArgumentException();
}
} catch (InvalidInputException e) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
}
// we do not consider the obsolete comment as a structureal property
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index 422bc4f..35b7fd5 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -4367,9 +4367,7 @@
}
final void handleException(Throwable e) {
- IllegalArgumentException runtimeException= new IllegalArgumentException("Document does not match the AST"); //$NON-NLS-1$
- runtimeException.initCause(e);
- throw runtimeException;
+ throw new IllegalArgumentException("Document does not match the AST", e); //$NON-NLS-1$
}
// {ObjectTeams: visit methods for analyzing OT nodes
public boolean visit(RoleTypeDeclaration node)
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
index 335ef4f..a5a08e1 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
@@ -468,7 +468,7 @@
try {
doc.addPosition(POS_CATEGORY, positions[i]);
} catch (BadLocationException e) {
- throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length(), e); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
}
}
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
index adb1566..987a744 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -4408,7 +4408,7 @@
int existingValue = Integer.parseInt(value);
return (existingValue & Alignment.M_FORCE) != 0;
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Alignment value is not an integer: " + value); //$NON-NLS-1$
+ throw new IllegalArgumentException("Alignment value is not an integer: " + value, e); //$NON-NLS-1$
}
}
@@ -4435,7 +4435,7 @@
return INDENT_DEFAULT;
}
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Alignment value is not an integer: " + value); //$NON-NLS-1$
+ throw new IllegalArgumentException("Alignment value is not an integer: " + value, e); //$NON-NLS-1$
}
}
@@ -4478,7 +4478,7 @@
return WRAP_NO_SPLIT;
}
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Alignment value is not an integer: " + value); //$NON-NLS-1$
+ throw new IllegalArgumentException("Alignment value is not an integer: " + value, e); //$NON-NLS-1$
}
}
/**
@@ -4504,7 +4504,7 @@
}
return String.valueOf(existingValue);
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Alignment value is not an integer: " + value); //$NON-NLS-1$
+ throw new IllegalArgumentException("Alignment value is not an integer: " + value, e); //$NON-NLS-1$
}
}
@@ -4547,7 +4547,7 @@
}
return String.valueOf(existingValue);
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Alignment value is not an integer: " + value); //$NON-NLS-1$
+ throw new IllegalArgumentException("Alignment value is not an integer: " + value, e); //$NON-NLS-1$
}
}
/**
@@ -4605,7 +4605,7 @@
}
return String.valueOf(existingValue);
} catch (NumberFormatException e) {
- throw new IllegalArgumentException("Alignment value is not an integer: " + value); //$NON-NLS-1$
+ throw new IllegalArgumentException("Alignment value is not an integer: " + value, e); //$NON-NLS-1$
}
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index 084f53f..4532ac2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -5517,8 +5517,7 @@
public static void rebuildIndex(IProgressMonitor monitor) throws CoreException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 10);
IndexManager manager = JavaModelManager.getIndexManager();
- subMonitor.split(1);
- manager.deleteIndexFiles();
+ manager.deleteIndexFiles(subMonitor.split(1));
manager.reset();
Indexer.getInstance().rebuildIndex(subMonitor.split(7));
updateLegacyIndex(subMonitor.split(2));
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
index a9bc0a8..3d16eed 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
@@ -1520,7 +1520,7 @@
}
return count;
} catch (ArrayIndexOutOfBoundsException e) { // signature is syntactically incorrect if last character is C_ARRAY
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
}
@@ -1663,7 +1663,7 @@
count++;
}
} catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
}
@@ -1717,7 +1717,7 @@
i = e + 1;
}
} catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(e);
}
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java
index 0250d5d..4de81cb 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java
@@ -28,7 +28,7 @@
return super.clone();
}
catch (CloneNotSupportedException e) {
- throw new Error();
+ throw new Error(e);
}
}
public IJavaElement[] getChildren() {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
index 96862c4..aaac33f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -917,9 +917,9 @@
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
cpElement = parser.parse(new InputSource(reader)).getDocumentElement();
} catch (SAXException e) {
- throw new IOException(Messages.file_badFormat);
+ throw new IOException(Messages.file_badFormat, e);
} catch (ParserConfigurationException e) {
- throw new IOException(Messages.file_badFormat);
+ throw new IOException(Messages.file_badFormat, e);
} finally {
reader.close();
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibrary.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibrary.java
index 13a38c3..f205707 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibrary.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibrary.java
@@ -154,9 +154,9 @@
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
cpElement = parser.parse(new InputSource(reader)).getDocumentElement();
} catch (SAXException e) {
- throw new IOException(Messages.file_badFormat);
+ throw new IOException(Messages.file_badFormat, e);
} catch (ParserConfigurationException e) {
- throw new IOException(Messages.file_badFormat);
+ throw new IOException(Messages.file_badFormat, e);
} finally {
reader.close();
}