Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java
index 9b12104810..55d4cac4ea 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 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,6 +7,8 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Stephan Herrmann - Contribution for
+ * bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -33,6 +35,8 @@ public ArrayReference(Expression rec, Expression pos) {
public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean compoundAssignment) {
// TODO (maxime) optimization: unconditionalInits is applied to all existing calls
+ // account for potential ArrayIndexOutOfBoundsException:
+ flowContext.recordAbruptExit();
if (assignment.expression == null) {
return analyseCode(currentScope, flowContext, flowInfo);
}
@@ -47,7 +51,10 @@ public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowConte
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
this.receiver.checkNPE(currentScope, flowContext, flowInfo);
flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo);
- return this.position.analyseCode(currentScope, flowContext, flowInfo);
+ flowInfo = this.position.analyseCode(currentScope, flowContext, flowInfo);
+ // account for potential ArrayIndexOutOfBoundsException:
+ flowContext.recordAbruptExit();
+ return flowInfo;
}
public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {

Back to the top