Update jdt.core from I20150603-2000 for 4.5RC4
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java
index ed8ec35..fe3d00e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java
@@ -1440,8 +1440,8 @@
JavacTestOptions.EclipseJustification.EclipseBug235546 /* javac test options */);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=235550
-public void _test058_definite_unassignment_try_finally() {
- runNegativeTest(
+public void test058_definite_unassignment_try_finally() {
+ runConformTest(
// test directory preparation
new String[] { /* test files */
"X.java",
@@ -1455,13 +1455,14 @@
" i = 0;\n" +
" }\n" +
" } while (args.length > 0);\n" +
+ " System.out.println(i);\n" +
" }\n" +
"}"
},
- // compiler results
- "----------\n" + /* expected compiler log */
- "1. ERROR in X.java...\n" +
- "----------\n");
+ // runtime result:
+ "0");
+ // NB: javac reports: "error: variable i might be assigned in loop"
+ // I hold to be wrong
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=235555
public void test059_definite_unassignment_assign_in_for_condition() {
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 20cc8b1..68ec751 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
@@ -1906,7 +1906,7 @@
" suppress + enable @SuppressWarnings\n" +
" When used with -err:, it can also silent optional\n" +
" errors and warnings\n" +
- " switchDefault + switch statement lacking a default case\n" +
+ " switchDefault switch statement lacking a default case\n" +
" syncOverride missing synchronized in synchr. method override\n" +
" syntacticAnalysis perform syntax-based null analysis for fields\n" +
" syntheticAccess synthetic access for innerclass\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
index e0c74e8..e489fbd 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java
@@ -5622,7 +5622,56 @@
"}\n"},
"one::two");
}
-
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=467825 Missing code implementation in the compiler
+public void test467825() {
+ this.runConformTest(
+ new String[] {
+ "Main.java",
+ "import java.util.function.Function;\n" +
+ "public class Main {\n" +
+ " public Function<String, String> f(int x) {\n" +
+ " class A {\n" +
+ " void g() {\n" +
+ " System.out.println(x);\n" +
+ " }\n" +
+ " }\n" +
+ " return s -> {\n" +
+ " A a = new A();\n" +
+ " return s;\n" +
+ " };\n" +
+ " }\n" +
+ "}\n"
+ });
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=467825 Missing code implementation in the compiler
+public void test467825a() {
+ this.runConformTest(
+ new String[] {
+ "Test.java",
+ "import java.util.function.Function;\n" +
+ "interface Foo {void alpha(Bar pBar);}\n" +
+ "class Bar {Object bravo() {return null;}}\n" +
+ "class Test {\n" +
+ " Foo foo(Function pFunction) {\n" +
+ " class Baz {\n" +
+ " public Baz(Object pObj) {\n" +
+ " }\n" +
+ " class NestedBaz extends Baz {\n" +
+ " NestedBaz(Object pObj) {\n" +
+ " super(pObj);\n" +
+ " pFunction.apply(pObj);\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ " return pBar -> {\n" +
+ " Object o = new Baz(pBar).new NestedBaz(pBar.bravo());\n" +
+ " };\n" +
+ " }\n" +
+ " void charlie(Object pRemovals) {}\n" +
+ " void delta(Foo pListener) {}\n" +
+ "}\n"
+ });
+}
public static Class testClass() {
return LambdaExpressionsTest.class;
}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 0b62ba2..209dd3a 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -418,7 +418,7 @@
\ suppress + enable @SuppressWarnings\n\
\ When used with -err:, it can also silent optional\n\
\ errors and warnings\n\
-\ switchDefault + switch statement lacking a default case\n\
+\ switchDefault switch statement lacking a default case\n\
\ syncOverride missing synchronized in synchr. method override\n\
\ syntacticAnalysis perform syntax-based null analysis for fields\n\
\ syntheticAccess synthetic access for innerclass\n\
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
index 9050d33..4a9914d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
@@ -548,8 +548,8 @@
protected void backupAptProblems() {
if (this.unitsToProcess == null) return;
- for (CompilationUnitDeclaration unitDecl : this.unitsToProcess) {
- if (unitDecl == null) continue;
+ for (int i = 0; i < this.totalUnits; i++) {
+ CompilationUnitDeclaration unitDecl = this.unitsToProcess[i];
CompilationResult result = unitDecl.compilationResult;
if (result != null && result.hasErrors()) {
CategorizedProblem[] errors = result.getErrors();
@@ -577,11 +577,12 @@
protected void restoreAptProblems() {
if (this.unitsToProcess != null && this.aptProblems!= null) {
- for (CompilationUnitDeclaration unit : this.unitsToProcess) {
- APTProblem[] problems = this.aptProblems.get(new String(unit.getFileName()));
+ for (int i = 0; i < this.totalUnits; i++) {
+ CompilationUnitDeclaration unitDecl = this.unitsToProcess[i];
+ APTProblem[] problems = this.aptProblems.get(new String(unitDecl.getFileName()));
if (problems != null) {
for (APTProblem problem : problems) {
- unit.compilationResult.record(problem.problem, problem.context);
+ unitDecl.compilationResult.record(problem.problem, problem.context);
}
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index f1ef793..afe2c4b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -323,7 +323,7 @@
// perform some emulation work in case there is some and we are inside a local type only
if (allocatedTypeErasure.isNestedType()
- && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaScope())) {
+ && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaSubscope())) {
if (allocatedTypeErasure.isLocalType()) {
((LocalTypeBinding) allocatedTypeErasure).addInnerEmulationDependent(currentScope, false);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index 31ebefe..7bd0404 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -333,7 +333,7 @@
// perform some extra emulation work in case there is some and we are inside a local type only
if (allocatedTypeErasure.isNestedType()
- && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaScope())) {
+ && (currentScope.enclosingSourceType().isLocalType() || currentScope.isLambdaSubscope())) {
if (allocatedTypeErasure.isLocalType()) {
((LocalTypeBinding) allocatedTypeErasure).addInnerEmulationDependent(currentScope, this.enclosingInstance != null);