Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-08-25 16:04:34 +0000
committerJayaprakash Arthanareeswaran2012-10-09 06:58:19 +0000
commit7ad108ea3de2b7d68d2737f4428379110b97b811 (patch)
tree39ae506a6aa306c2241dd17ac8c8083bd8d6219b /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java
parent8c030d505f30b0cafedd9f4204a10256b97739b1 (diff)
downloadeclipse.jdt.core-7ad108ea3de2b7d68d2737f4428379110b97b811.tar.gz
eclipse.jdt.core-7ad108ea3de2b7d68d2737f4428379110b97b811.tar.xz
eclipse.jdt.core-7ad108ea3de2b7d68d2737f4428379110b97b811.zip
Fixed Bug 345305 - [compiler][null] Compiler misidentifies a case of
"variable can only be null" Fixed by decoupling null analysis for try-finally from def.assign analysis. Change-Id: I17285d5034aa6cdcc390c41bbde121cb024b648c
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java21
1 files changed, 17 insertions, 4 deletions
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 8a0b1d2e29..fa1fba243a 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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,12 +7,15 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 185682 - Increment/decrement operators mark local variables as read
+ * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
+ * bug 185682 - Increment/decrement operators mark local variables as read
+ * bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
import java.util.Map;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -369,7 +372,9 @@ public void test033() {
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84215
//TODO (philippe) should move to InitializationTest suite
public void test034() {
- this.runConformTest(
+ Map options = getCompilerOptions();
+ options.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.IGNORE);
+ this.runNegativeTest(
new String[] {
"X.java",
"public final class X \n" +
@@ -748,7 +753,15 @@ public void test034() {
" private String adsyasta;\n" +
"}\n",
},
- "");
+ "----------\n" +
+ "1. ERROR in X.java (at line 356)\n" +
+ " if (rs != null)\n" +
+ " ^^\n" +
+ "Redundant null check: The variable rs cannot be null at this location\n" +
+ "----------\n",
+ null/*classLibs*/,
+ true/*shouldFlush*/,
+ options);
}
/*
* Check scenario: i = i++

Back to the top