diff options
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java')
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java index c17fa4e2e8..279fff0a36 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.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.flow; @@ -22,9 +24,12 @@ public class SwitchFlowContext extends FlowContext { public BranchLabel breakLabel; public UnconditionalFlowInfo initsOnBreak = FlowInfo.DEAD_END; -public SwitchFlowContext(FlowContext parent, ASTNode associatedNode, BranchLabel breakLabel) { +public SwitchFlowContext(FlowContext parent, ASTNode associatedNode, BranchLabel breakLabel, boolean isPreTest) { super(parent, associatedNode); this.breakLabel = breakLabel; + if (isPreTest && parent.conditionalLevel > -1) { + this.conditionalLevel++; + } } public BranchLabel breakLabel() { |