### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java,v retrieving revision 1.85 diff -u -r1.85 AllocationExpression.java --- compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 3 Feb 2011 13:31:20 -0000 1.85 +++ compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 4 Mar 2011 18:24:45 -0000 @@ -184,7 +184,7 @@ * exact need. */ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; ReferenceBinding allocatedTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure(); // perform some emulation work in case there is some and we are inside a local type only @@ -203,7 +203,7 @@ } public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; // if constructor from parameterized type got found, use the original constructor at codegen time MethodBinding codegenBinding = this.binding.original(); Index: compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java,v retrieving revision 1.68 diff -u -r1.68 AssertStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java 4 Mar 2011 12:41:22 -0000 1.68 +++ compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java 4 Mar 2011 18:24:45 -0000 @@ -174,7 +174,7 @@ } public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { // need assertion flag: $assertionsDisabled on outer most source clas // (in case of static member of interface, will use the outermost static member - bug 22334) SourceTypeBinding outerMostClass = currentScope.enclosingSourceType(); Index: compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java,v retrieving revision 1.62 diff -u -r1.62 Clinit.java --- compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java 5 Jan 2011 19:57:26 -0000 1.62 +++ compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java 4 Mar 2011 18:24:45 -0000 @@ -61,7 +61,7 @@ FlowInfo.DEAD_END); // check for missing returning path - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { this.bits |= ASTNode.NeedFreeReturn; } Index: compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java,v retrieving revision 1.113 diff -u -r1.113 ConstructorDeclaration.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 28 Feb 2011 21:45:48 -0000 1.113 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 4 Mar 2011 18:24:45 -0000 @@ -156,7 +156,7 @@ } } // check for missing returning path - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { this.bits |= ASTNode.NeedFreeReturn; } Index: compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java,v retrieving revision 1.62 diff -u -r1.62 DoStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java 23 Aug 2010 08:41:25 -0000 1.62 +++ compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java 4 Mar 2011 18:24:45 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -72,7 +72,7 @@ // code generation can be optimized when no need to continue in the loop if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits & - FlowInfo.UNREACHABLE) != 0) { + FlowInfo.UNREACHABLE_OR_DEAD) != 0) { this.continueLabel = null; } if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) { Index: compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java,v retrieving revision 1.74 diff -u -r1.74 ExplicitConstructorCall.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 12 Aug 2010 16:58:28 -0000 1.74 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 4 Mar 2011 18:24:45 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -196,7 +196,7 @@ void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { ReferenceBinding superTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure(); - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { // perform some emulation work in case there is some and we are inside a local type only if (superTypeErasure.isNestedType() && currentScope.enclosingSourceType().isLocalType()) { @@ -212,7 +212,7 @@ } public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { // if constructor from parameterized type got found, use the original constructor at codegen time MethodBinding codegenBinding = this.binding.original(); Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java,v retrieving revision 1.131 diff -u -r1.131 FieldReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 17 Dec 2010 09:38:55 -0000 1.131 +++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 4 Mar 2011 18:24:45 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -439,7 +439,7 @@ * No need to emulate access to protected fields since not implicitly accessed */ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; // if field from parameterized type got found, use the original field at codegen time FieldBinding codegenBinding = this.binding.original(); Index: compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java,v retrieving revision 1.70 diff -u -r1.70 ForStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java 4 Mar 2011 12:41:22 -0000 1.70 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java 4 Mar 2011 18:24:46 -0000 @@ -145,7 +145,7 @@ // code generation can be optimized when no need to continue in the loop if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits & - FlowInfo.UNREACHABLE) != 0) { + FlowInfo.UNREACHABLE_OR_DEAD) != 0) { this.continueLabel = null; } else { Index: compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java,v retrieving revision 1.64 diff -u -r1.64 ForeachStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java 9 Aug 2010 04:09:41 -0000 1.64 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java 4 Mar 2011 18:24:46 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -108,7 +108,7 @@ addInitializationsFrom(condInfo.initsWhenFalse()); // TODO (maxime) no need to test when false: can optimize (same for action being unreachable above) if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits & - FlowInfo.UNREACHABLE) != 0) { + FlowInfo.UNREACHABLE_OR_DEAD) != 0) { this.continueLabel = null; } else { actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue); Index: compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java,v retrieving revision 1.70 diff -u -r1.70 IfStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java 4 Mar 2011 12:41:21 -0000 1.70 +++ compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java 4 Mar 2011 18:24:46 -0000 @@ -99,7 +99,7 @@ thenFlowInfo = this.thenStatement.analyseCode(currentScope, flowContext, thenFlowInfo); } // code gen: optimizing the jump around the ELSE part - if ((thenFlowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) { + if ((thenFlowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) { this.bits |= ASTNode.ThenExit; } @@ -164,10 +164,7 @@ if (hasThenPart) { BranchLabel falseLabel = null; // generate boolean condition only if needed - if (((this.bits & ASTNode.IsElseStatementUnreachable) != 0) || - (cst != Constant.NotAConstant && cst.booleanValue() == true)) { - // No need to generate if condition statement when we know that only the then action - // will be executed + if (cst != Constant.NotAConstant && cst.booleanValue() == true) { this.condition.generateCode(currentScope, codeStream, false); } else { this.condition.generateOptimizedBoolean( @@ -206,10 +203,7 @@ } } else if (hasElsePart) { // generate boolean condition only if needed - if (((this.bits & ASTNode.IsThenStatementUnreachable) != 0) || - (cst != Constant.NotAConstant && cst.booleanValue() == false)) { - // No need to generate if condition statement when we know that only the else action - // will be executed + if (cst != Constant.NotAConstant && cst.booleanValue() == false) { this.condition.generateCode(currentScope, codeStream, false); } else { this.condition.generateOptimizedBoolean( Index: compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java,v retrieving revision 1.151 diff -u -r1.151 MessageSend.java --- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 16 Jan 2011 22:43:21 -0000 1.151 +++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 4 Mar 2011 18:24:46 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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,7 @@ } public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo){ - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; // if method from parameterized type got found, use the original method at codegen time MethodBinding codegenBinding = this.binding.original(); Index: compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java,v retrieving revision 1.79 diff -u -r1.79 MethodDeclaration.java --- compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 16 Jan 2011 22:43:21 -0000 1.79 +++ compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 4 Mar 2011 18:24:46 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -111,7 +111,7 @@ // check for missing returning path TypeBinding returnTypeBinding = this.binding.returnType; if ((returnTypeBinding == TypeBinding.VOID) || isAbstract()) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { this.bits |= ASTNode.NeedFreeReturn; } } else { Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java,v retrieving revision 1.101 diff -u -r1.101 QualifiedAllocationExpression.java --- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 12 Aug 2010 16:58:28 -0000 1.101 +++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 4 Mar 2011 18:24:46 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -192,7 +192,7 @@ * exact need. */ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { ReferenceBinding allocatedTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure(); // perform some extra emulation work in case there is some and we are inside a local type only Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java,v retrieving revision 1.149 diff -u -r1.149 QualifiedNameReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java 17 Dec 2010 09:38:55 -0000 1.149 +++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java 4 Mar 2011 18:24:48 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -807,7 +807,7 @@ * index is <0 to denote write access emulation */ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FieldBinding fieldBinding, int index, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; // index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings', index < 0 denotes a write access (to last binding) if (fieldBinding.constant() != Constant.NotAConstant) return; Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java,v retrieving revision 1.129 diff -u -r1.129 SingleNameReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 17 Dec 2010 09:38:55 -0000 1.129 +++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 4 Mar 2011 18:24:48 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -829,7 +829,7 @@ } public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; //If inlinable field, forget the access emulation, the code gen will directly target it if (this.constant != Constant.NotAConstant) Index: compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java,v retrieving revision 1.51 diff -u -r1.51 Statement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java 22 Jan 2011 23:39:25 -0000 1.51 +++ compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java 4 Mar 2011 18:24:48 -0000 @@ -72,7 +72,8 @@ // complaintLevel = 0 if was reachable up until now, 1 if fake reachable (deadcode), 2 if fatal unreachable (error) public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel) { if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) { - this.bits &= ~ASTNode.IsReachable; + if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0) + this.bits &= ~ASTNode.IsReachable; if (flowInfo == FlowInfo.DEAD_END) { if (previousComplaintLevel < COMPLAINED_UNREACHABLE) { scope.problemReporter().unreachableCode(this); Index: compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java,v retrieving revision 1.53 diff -u -r1.53 SynchronizedStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java 7 Mar 2009 01:08:07 -0000 1.53 +++ compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java 4 Mar 2011 18:24:48 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -64,7 +64,7 @@ currentScope.methodScope().recordInitializationStates(flowInfo); // optimizing code gen - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) { this.bits |= ASTNode.BlockExit; } Index: compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java,v retrieving revision 1.117 diff -u -r1.117 TryStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 4 Mar 2011 12:41:21 -0000 1.117 +++ compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 4 Mar 2011 18:24:48 -0000 @@ -101,7 +101,7 @@ tryInfo = flowInfo; } else { tryInfo = this.tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy()); - if ((tryInfo.tagBits & FlowInfo.UNREACHABLE) != 0) + if ((tryInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) this.bits |= ASTNode.IsTryBlockExiting; } @@ -210,7 +210,7 @@ tryInfo = flowInfo; } else { tryInfo = this.tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy()); - if ((tryInfo.tagBits & FlowInfo.UNREACHABLE) != 0) + if ((tryInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) this.bits |= ASTNode.IsTryBlockExiting; } Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java,v retrieving revision 1.167 diff -u -r1.167 TypeDeclaration.java --- compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 4 Mar 2011 12:41:21 -0000 1.167 +++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 4 Mar 2011 18:24:49 -0000 @@ -192,7 +192,7 @@ if (this.ignoreFurtherInvestigation) return flowInfo; try { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { this.bits |= ASTNode.IsReachable; LocalTypeBinding localType = (LocalTypeBinding) this.binding; localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType)); @@ -230,7 +230,7 @@ if (this.ignoreFurtherInvestigation) return; try { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { this.bits |= ASTNode.IsReachable; LocalTypeBinding localType = (LocalTypeBinding) this.binding; localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType)); @@ -633,7 +633,7 @@ for (int i = 0, count = this.fields.length; i < count; i++) { FieldDeclaration field = this.fields[i]; if (field.isStatic()) { - if ((staticFieldInfo.tagBits & FlowInfo.UNREACHABLE) != 0) + if ((staticFieldInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) field.bits &= ~ASTNode.IsReachable; /*if (field.isField()){ @@ -649,7 +649,7 @@ staticFieldInfo = FlowInfo.initial(this.maxFieldCount).setReachMode(FlowInfo.UNREACHABLE_OR_DEAD); } } else { - if ((nonStaticFieldInfo.tagBits & FlowInfo.UNREACHABLE) != 0) + if ((nonStaticFieldInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) field.bits &= ~ASTNode.IsReachable; /*if (field.isField()){ @@ -725,7 +725,7 @@ * 15.9.2 */ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; NestedTypeBinding nestedType = (NestedTypeBinding) this.binding; MethodScope methodScope = currentScope.methodScope(); @@ -776,7 +776,7 @@ * Local member cannot be static. */ public void manageEnclosingInstanceAccessIfNecessary(ClassScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { NestedTypeBinding nestedType = (NestedTypeBinding) this.binding; nestedType.addSyntheticArgumentAndField(this.binding.enclosingType()); } Index: compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java,v retrieving revision 1.67 diff -u -r1.67 WhileStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java 4 Mar 2011 12:41:22 -0000 1.67 +++ compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java 4 Mar 2011 18:24:49 -0000 @@ -120,11 +120,10 @@ // code generation can be optimized when no need to continue in the loop exitBranch = flowInfo.copy(); // need to start over from flowInfo so as to get null inits - - if ((actionInfo.tagBits & - loopingContext.initsOnContinue.tagBits & - FlowInfo.UNREACHABLE) != 0) { - this.continueLabel = null; + int combinedTagBits = actionInfo.tagBits & loopingContext.initsOnContinue.tagBits; + if ((combinedTagBits & FlowInfo.UNREACHABLE) != 0) { + if ((combinedTagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) + this.continueLabel = null; exitBranch.addInitializationsFrom(condInfo.initsWhenFalse()); } else { condLoopContext.complainOnDeferredFinalChecks(currentScope, Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java,v retrieving revision 1.47 diff -u -r1.47 CodeSnippetFieldReference.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java 22 Oct 2010 22:42:55 -0000 1.47 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java 4 Mar 2011 18:24:49 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -278,7 +278,7 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess){ // The private access will be managed through the code generation - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; } public TypeBinding resolveType(BlockScope scope) { // Answer the signature type of the field. Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java,v retrieving revision 1.63 diff -u -r1.63 CodeSnippetMessageSend.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 5 Feb 2009 09:38:11 -0000 1.63 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 4 Mar 2011 18:24:49 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -168,7 +168,7 @@ } public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) { - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) { // if method from parameterized type got found, use the original method at codegen time MethodBinding codegenBinding = this.binding.original(); if (codegenBinding != this.binding) { Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java,v retrieving revision 1.62 diff -u -r1.62 CodeSnippetSingleNameReference.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 9 Nov 2010 19:59:19 -0000 1.62 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 4 Mar 2011 18:24:49 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -576,7 +576,7 @@ return; } - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return; + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; //If inlinable field, forget the access emulation, the code gen will directly target it if (this.constant != Constant.NotAConstant) return; #P org.eclipse.jdt.core.tests Index: Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/ConformTest.java =================================================================== RCS file: /home/cvs/numbat/org.eclipse.jdt.core.tests/Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/ConformTest.java,v retrieving revision 1.156 diff -u -r1.156 ConformTest.java --- Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/ConformTest.java 27 May 2010 14:12:25 -0000 1.156 +++ Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/ConformTest.java 4 Mar 2011 18:25:02 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2011 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 @@ -6501,182 +6501,207 @@ CompilerOptions compilerOptions = new CompilerOptions(getCompilerOptions()); String expectedOutput = compilerOptions.targetJDK <= ClassFileConstants.JDK1_5 ? - " // Method descriptor #15 (Z)V\n" + - " // Stack: 4, Locals: 8\n" + - " private void foo(boolean delete);\n" + - " 0 aload_0 [this]\n" + - " 1 invokevirtual X.bar() : java.lang.String [16]\n" + - " 4 astore_2 [s]\n" + - " 5 new java.lang.StringBuffer [20]\n" + - " 8 dup\n" + - " 9 invokespecial java.lang.StringBuffer() [22]\n" + - " 12 astore_3 [buffer]\n" + - " 13 iconst_1\n" + - " 14 anewarray java.lang.String [23]\n" + - " 17 dup\n" + - " 18 iconst_0\n" + - " 19 ldc [25]\n" + - " 21 aastore\n" + - " 22 astore 4 [datas]\n" + - " 24 iconst_1\n" + - " 25 anewarray java.lang.Object [3]\n" + - " 28 dup\n" + - " 29 iconst_0\n" + - " 30 aload_2 [s]\n" + - " 31 aastore\n" + - " 32 astore 5 [data]\n" + - " 34 aload_3 [buffer]\n" + - " 35 aload 4 [datas]\n" + - " 37 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + - " 40 aload 5 [data]\n" + - " 42 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + - " 45 pop\n" + - " 46 goto 54\n" + - " 49 astore 6 [e]\n" + - " 51 aload 6 [e]\n" + - " 53 athrow\n" + - " 54 iload_1 [delete]\n" + - " 55 ifeq 85\n" + - " 58 aload_3 [buffer]\n" + - " 59 iconst_0\n" + - " 60 aload_3 [buffer]\n" + - " 61 invokevirtual java.lang.StringBuffer.length() : int [31]\n" + - " 64 invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" + - " 67 pop\n" + - " 68 goto 85\n" + - " 71 astore 4\n" + - " 73 aconst_null\n" + - " 74 astore_3 [buffer]\n" + - " 75 goto 87\n" + - " 78 astore 7\n" + - " 80 aconst_null\n" + - " 81 astore_3 [buffer]\n" + - " 82 aload 7\n" + - " 84 athrow\n" + - " 85 aconst_null\n" + - " 86 astore_3 [buffer]\n" + - " 87 return\n" + - " Exception Table:\n" + - " [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" + - " [pc: 13, pc: 68] -> 71 when : java.lang.Exception\n" + - " [pc: 13, pc: 73] -> 78 when : any\n" + - " Line numbers:\n" + - " [pc: 0, line: 4]\n" + - " [pc: 5, line: 5]\n" + - " [pc: 13, line: 9]\n" + - " [pc: 24, line: 10]\n" + - " [pc: 34, line: 12]\n" + - " [pc: 49, line: 13]\n" + - " [pc: 51, line: 15]\n" + - " [pc: 54, line: 19]\n" + - " [pc: 58, line: 20]\n" + - " [pc: 71, line: 22]\n" + - " [pc: 73, line: 24]\n" + - " [pc: 78, line: 23]\n" + - " [pc: 80, line: 24]\n" + - " [pc: 82, line: 25]\n" + - " [pc: 85, line: 24]\n" + - " [pc: 87, line: 26]\n" + - " Local variable table:\n" + - " [pc: 0, pc: 88] local: this index: 0 type: X\n" + - " [pc: 0, pc: 88] local: delete index: 1 type: boolean\n" + - " [pc: 5, pc: 88] local: s index: 2 type: java.lang.String\n" + - " [pc: 13, pc: 88] local: buffer index: 3 type: java.lang.StringBuffer\n" + - " [pc: 24, pc: 71] local: datas index: 4 type: java.lang.String[]\n" + - " [pc: 34, pc: 71] local: data index: 5 type: java.lang.Object[]\n" + - " [pc: 51, pc: 54] local: e index: 6 type: java.lang.Exception\n" + " // Method descriptor #15 (Z)V\n" + + " // Stack: 4, Locals: 8\n" + + " private void foo(boolean delete);\n" + + " 0 aload_0 [this]\n" + + " 1 invokevirtual X.bar() : java.lang.String [16]\n" + + " 4 astore_2 [s]\n" + + " 5 new java.lang.StringBuffer [20]\n" + + " 8 dup\n" + + " 9 invokespecial java.lang.StringBuffer() [22]\n" + + " 12 astore_3 [buffer]\n" + + " 13 iconst_1\n" + + " 14 anewarray java.lang.String [23]\n" + + " 17 dup\n" + + " 18 iconst_0\n" + + " 19 ldc [25]\n" + + " 21 aastore\n" + + " 22 astore 4 [datas]\n" + + " 24 iconst_1\n" + + " 25 anewarray java.lang.Object [3]\n" + + " 28 dup\n" + + " 29 iconst_0\n" + + " 30 aload_2 [s]\n" + + " 31 aastore\n" + + " 32 astore 5 [data]\n" + + " 34 aload_3 [buffer]\n" + + " 35 aload 4 [datas]\n" + + " 37 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + + " 40 aload 5 [data]\n" + + " 42 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + + " 45 pop\n" + + " 46 goto 62\n" + + " 49 astore 6 [e]\n" + + " 51 aload 6 [e]\n" + + " 53 ifnull 59\n" + + " 56 aload 6 [e]\n" + + " 58 athrow\n" + + " 59 aconst_null\n" + + " 60 astore_3 [buffer]\n" + + " 61 return\n" + + " 62 iload_1 [delete]\n" + + " 63 ifeq 93\n" + + " 66 aload_3 [buffer]\n" + + " 67 iconst_0\n" + + " 68 aload_3 [buffer]\n" + + " 69 invokevirtual java.lang.StringBuffer.length() : int [31]\n" + + " 72 invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" + + " 75 pop\n" + + " 76 goto 93\n" + + " 79 astore 4\n" + + " 81 aconst_null\n" + + " 82 astore_3 [buffer]\n" + + " 83 goto 95\n" + + " 86 astore 7\n" + + " 88 aconst_null\n" + + " 89 astore_3 [buffer]\n" + + " 90 aload 7\n" + + " 92 athrow\n" + + " 93 aconst_null\n" + + " 94 astore_3 [buffer]\n" + + " 95 return\n" + + " Exception Table:\n" + + " [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" + + " [pc: 13, pc: 59] -> 79 when : java.lang.Exception\n" + + " [pc: 62, pc: 76] -> 79 when : java.lang.Exception\n" + + " [pc: 13, pc: 59] -> 86 when : any\n" + + " [pc: 62, pc: 81] -> 86 when : any\n" + + " Line numbers:\n" + + " [pc: 0, line: 4]\n" + + " [pc: 5, line: 5]\n" + + " [pc: 13, line: 9]\n" + + " [pc: 24, line: 10]\n" + + " [pc: 34, line: 12]\n" + + " [pc: 49, line: 13]\n" + + " [pc: 51, line: 14]\n" + + " [pc: 56, line: 15]\n" + + " [pc: 59, line: 24]\n" + + " [pc: 61, line: 16]\n" + + " [pc: 62, line: 19]\n" + + " [pc: 66, line: 20]\n" + + " [pc: 79, line: 22]\n" + + " [pc: 81, line: 24]\n" + + " [pc: 86, line: 23]\n" + + " [pc: 88, line: 24]\n" + + " [pc: 90, line: 25]\n" + + " [pc: 93, line: 24]\n" + + " [pc: 95, line: 26]\n" + + " Local variable table:\n" + + " [pc: 0, pc: 96] local: this index: 0 type: X\n" + + " [pc: 0, pc: 96] local: delete index: 1 type: boolean\n" + + " [pc: 5, pc: 96] local: s index: 2 type: java.lang.String\n" + + " [pc: 13, pc: 96] local: buffer index: 3 type: java.lang.StringBuffer\n" + + " [pc: 24, pc: 59] local: datas index: 4 type: java.lang.String[]\n" + + " [pc: 62, pc: 79] local: datas index: 4 type: java.lang.String[]\n" + + " [pc: 34, pc: 59] local: data index: 5 type: java.lang.Object[]\n" + + " [pc: 62, pc: 79] local: data index: 5 type: java.lang.Object[]\n" + + " [pc: 51, pc: 59] local: e index: 6 type: java.lang.Exception\n" : " // Method descriptor #15 (Z)V\n" + - " // Stack: 4, Locals: 8\n" + - " private void foo(boolean delete);\n" + - " 0 aload_0 [this]\n" + - " 1 invokevirtual X.bar() : java.lang.String [16]\n" + - " 4 astore_2 [s]\n" + - " 5 new java.lang.StringBuffer [20]\n" + - " 8 dup\n" + - " 9 invokespecial java.lang.StringBuffer() [22]\n" + - " 12 astore_3 [buffer]\n" + - " 13 iconst_1\n" + - " 14 anewarray java.lang.String [23]\n" + - " 17 dup\n" + - " 18 iconst_0\n" + - " 19 ldc [25]\n" + - " 21 aastore\n" + - " 22 astore 4 [datas]\n" + - " 24 iconst_1\n" + - " 25 anewarray java.lang.Object [3]\n" + - " 28 dup\n" + - " 29 iconst_0\n" + - " 30 aload_2 [s]\n" + - " 31 aastore\n" + - " 32 astore 5 [data]\n" + - " 34 aload_3 [buffer]\n" + - " 35 aload 4 [datas]\n" + - " 37 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + - " 40 aload 5 [data]\n" + - " 42 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + - " 45 pop\n" + - " 46 goto 54\n" + - " 49 astore 6 [e]\n" + - " 51 aload 6 [e]\n" + - " 53 athrow\n" + - " 54 iload_1 [delete]\n" + - " 55 ifeq 85\n" + - " 58 aload_3 [buffer]\n" + - " 59 iconst_0\n" + - " 60 aload_3 [buffer]\n" + - " 61 invokevirtual java.lang.StringBuffer.length() : int [31]\n" + - " 64 invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" + - " 67 pop\n" + - " 68 goto 85\n" + - " 71 astore 4\n" + - " 73 aconst_null\n" + - " 74 astore_3 [buffer]\n" + - " 75 goto 87\n" + - " 78 astore 7\n" + - " 80 aconst_null\n" + - " 81 astore_3 [buffer]\n" + - " 82 aload 7\n" + - " 84 athrow\n" + - " 85 aconst_null\n" + - " 86 astore_3 [buffer]\n" + - " 87 return\n" + - " Exception Table:\n" + - " [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" + - " [pc: 13, pc: 68] -> 71 when : java.lang.Exception\n" + - " [pc: 13, pc: 73] -> 78 when : any\n" + - " Line numbers:\n" + - " [pc: 0, line: 4]\n" + - " [pc: 5, line: 5]\n" + - " [pc: 13, line: 9]\n" + - " [pc: 24, line: 10]\n" + - " [pc: 34, line: 12]\n" + - " [pc: 49, line: 13]\n" + - " [pc: 51, line: 15]\n" + - " [pc: 54, line: 19]\n" + - " [pc: 58, line: 20]\n" + - " [pc: 71, line: 22]\n" + - " [pc: 73, line: 24]\n" + - " [pc: 78, line: 23]\n" + - " [pc: 80, line: 24]\n" + - " [pc: 82, line: 25]\n" + - " [pc: 85, line: 24]\n" + - " [pc: 87, line: 26]\n" + - " Local variable table:\n" + - " [pc: 0, pc: 88] local: this index: 0 type: X\n" + - " [pc: 0, pc: 88] local: delete index: 1 type: boolean\n" + - " [pc: 5, pc: 88] local: s index: 2 type: java.lang.String\n" + - " [pc: 13, pc: 88] local: buffer index: 3 type: java.lang.StringBuffer\n" + - " [pc: 24, pc: 71] local: datas index: 4 type: java.lang.String[]\n" + - " [pc: 34, pc: 71] local: data index: 5 type: java.lang.Object[]\n" + - " [pc: 51, pc: 54] local: e index: 6 type: java.lang.Exception\n" + - " Stack map table: number of frames 7\n" + - " [pc: 49, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer, java.lang.String[], java.lang.Object[]}]\n" + - " [pc: 54, same]\n" + - " [pc: 68, same]\n" + - " [pc: 71, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer}]\n" + - " [pc: 78, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" + - " [pc: 85, same]\n" + - " [pc: 87, same]\n"; + " // Stack: 4, Locals: 8\n" + + " private void foo(boolean delete);\n" + + " 0 aload_0 [this]\n" + + " 1 invokevirtual X.bar() : java.lang.String [16]\n" + + " 4 astore_2 [s]\n" + + " 5 new java.lang.StringBuffer [20]\n" + + " 8 dup\n" + + " 9 invokespecial java.lang.StringBuffer() [22]\n" + + " 12 astore_3 [buffer]\n" + + " 13 iconst_1\n" + + " 14 anewarray java.lang.String [23]\n" + + " 17 dup\n" + + " 18 iconst_0\n" + + " 19 ldc [25]\n" + + " 21 aastore\n" + + " 22 astore 4 [datas]\n" + + " 24 iconst_1\n" + + " 25 anewarray java.lang.Object [3]\n" + + " 28 dup\n" + + " 29 iconst_0\n" + + " 30 aload_2 [s]\n" + + " 31 aastore\n" + + " 32 astore 5 [data]\n" + + " 34 aload_3 [buffer]\n" + + " 35 aload 4 [datas]\n" + + " 37 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + + " 40 aload 5 [data]\n" + + " 42 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + + " 45 pop\n" + + " 46 goto 62\n" + + " 49 astore 6 [e]\n" + + " 51 aload 6 [e]\n" + + " 53 ifnull 59\n" + + " 56 aload 6 [e]\n" + + " 58 athrow\n" + + " 59 aconst_null\n" + + " 60 astore_3 [buffer]\n" + + " 61 return\n" + + " 62 iload_1 [delete]\n" + + " 63 ifeq 93\n" + + " 66 aload_3 [buffer]\n" + + " 67 iconst_0\n" + + " 68 aload_3 [buffer]\n" + + " 69 invokevirtual java.lang.StringBuffer.length() : int [31]\n" + + " 72 invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" + + " 75 pop\n" + + " 76 goto 93\n" + + " 79 astore 4\n" + + " 81 aconst_null\n" + + " 82 astore_3 [buffer]\n" + + " 83 goto 95\n" + + " 86 astore 7\n" + + " 88 aconst_null\n" + + " 89 astore_3 [buffer]\n" + + " 90 aload 7\n" + + " 92 athrow\n" + + " 93 aconst_null\n" + + " 94 astore_3 [buffer]\n" + + " 95 return\n" + + " Exception Table:\n" + + " [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" + + " [pc: 13, pc: 59] -> 79 when : java.lang.Exception\n" + + " [pc: 62, pc: 76] -> 79 when : java.lang.Exception\n" + + " [pc: 13, pc: 59] -> 86 when : any\n" + + " [pc: 62, pc: 81] -> 86 when : any\n" + + " Line numbers:\n" + + " [pc: 0, line: 4]\n" + + " [pc: 5, line: 5]\n" + + " [pc: 13, line: 9]\n" + + " [pc: 24, line: 10]\n" + + " [pc: 34, line: 12]\n" + + " [pc: 49, line: 13]\n" + + " [pc: 51, line: 14]\n" + + " [pc: 56, line: 15]\n" + + " [pc: 59, line: 24]\n" + + " [pc: 61, line: 16]\n" + + " [pc: 62, line: 19]\n" + + " [pc: 66, line: 20]\n" + + " [pc: 79, line: 22]\n" + + " [pc: 81, line: 24]\n" + + " [pc: 86, line: 23]\n" + + " [pc: 88, line: 24]\n" + + " [pc: 90, line: 25]\n" + + " [pc: 93, line: 24]\n" + + " [pc: 95, line: 26]\n" + + " Local variable table:\n" + + " [pc: 0, pc: 96] local: this index: 0 type: X\n" + + " [pc: 0, pc: 96] local: delete index: 1 type: boolean\n" + + " [pc: 5, pc: 96] local: s index: 2 type: java.lang.String\n" + + " [pc: 13, pc: 96] local: buffer index: 3 type: java.lang.StringBuffer\n" + + " [pc: 24, pc: 59] local: datas index: 4 type: java.lang.String[]\n" + + " [pc: 62, pc: 79] local: datas index: 4 type: java.lang.String[]\n" + + " [pc: 34, pc: 59] local: data index: 5 type: java.lang.Object[]\n" + + " [pc: 62, pc: 79] local: data index: 5 type: java.lang.Object[]\n" + + " [pc: 51, pc: 59] local: e index: 6 type: java.lang.Exception\n" + + " Stack map table: number of frames 8\n" + + " [pc: 49, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer, java.lang.String[], java.lang.Object[]}]\n" + + " [pc: 59, chop 2 local(s)]\n" + + " [pc: 62, append: {java.lang.String[], java.lang.Object[]}]\n" + + " [pc: 76, same]\n" + + " [pc: 79, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer}]\n" + + " [pc: 86, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" + + " [pc: 93, same]\n" + + " [pc: 95, same]\n"; File f = new File(OUTPUT_DIR + File.separator + "X.class"); byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java,v retrieving revision 1.33 diff -u -r1.33 ConstantTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java 20 Jul 2010 20:23:20 -0000 1.33 +++ src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java 4 Mar 2011 18:25:08 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2010 IBM Corporation and others. + * Copyright (c) 2003, 2011 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 @@ -360,129 +360,133 @@ String expectedOutput = " // Method descriptor #15 ([Ljava/lang/String;)V\n" + - " // Stack: 3, Locals: 4\n" + - " public static void main(java.lang.String[] args);\n" + - " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 3 ldc [22]\n" + - " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 8 aconst_null\n" + - " 9 goto 13\n" + - " 12 aconst_null\n" + - " 13 aconst_null\n" + - " 14 goto 18\n" + - " 17 aconst_null\n" + - " 18 if_acmpne 29\n" + - " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 24 ldc [30]\n" + - " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 29 new java.lang.StringBuffer [32]\n" + - " 32 dup\n" + - " 33 ldc [34]\n" + - " 35 invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" + - " 38 aconst_null\n" + - " 39 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" + - " 42 ldc [42]\n" + - " 44 invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" + - " 47 invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" + - " 50 ldc [51]\n" + - " 52 if_acmpne 59\n" + - " 55 iconst_1\n" + - " 56 goto 60\n" + - " 59 iconst_0\n" + - " 60 istore_1 [b]\n" + - " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 64 ldc [53]\n" + - " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 69 aconst_null\n" + - " 70 astore_2 [s]\n" + - " 71 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 74 ldc [55]\n" + - " 76 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 79 ldc [57]\n" + - " 81 astore_3 [s2]\n" + - " 82 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 85 ldc [59]\n" + - " 87 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" + - " 90 return\n" + - " Line numbers:\n" + - " [pc: 0, line: 3]\n" + - " [pc: 8, line: 4]\n" + - " [pc: 21, line: 5]\n" + - " [pc: 29, line: 6]\n" + - " [pc: 61, line: 7]\n" + - " [pc: 69, line: 8]\n" + - " [pc: 71, line: 9]\n" + - " [pc: 79, line: 10]\n" + - " [pc: 82, line: 11]\n" + - " [pc: 90, line: 12]\n" + - " Local variable table:\n" + - " [pc: 0, pc: 91] local: args index: 0 type: java.lang.String[]\n" + - " [pc: 61, pc: 91] local: b index: 1 type: boolean\n" + - " [pc: 71, pc: 91] local: s index: 2 type: java.lang.String\n" + - " [pc: 82, pc: 91] local: s2 index: 3 type: java.lang.String\n"; + " // Stack: 3, Locals: 4\n" + + " public static void main(java.lang.String[] args);\n" + + " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 3 ldc [22]\n" + + " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 8 aconst_null\n" + + " 9 goto 13\n" + + " 12 aconst_null\n" + + " 13 aconst_null\n" + + " 14 goto 18\n" + + " 17 aconst_null\n" + + " 18 if_acmpne 29\n" + + " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 24 ldc [30]\n" + + " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 29 new java.lang.StringBuffer [32]\n" + + " 32 dup\n" + + " 33 ldc [34]\n" + + " 35 invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" + + " 38 aconst_null\n" + + " 39 invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" + + " 42 ldc [42]\n" + + " 44 invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" + + " 47 invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" + + " 50 ldc [51]\n" + + " 52 if_acmpne 59\n" + + " 55 iconst_1\n" + + " 56 goto 60\n" + + " 59 iconst_0\n" + + " 60 istore_1 [b]\n" + + " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 64 ldc [53]\n" + + " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 69 aconst_null\n" + + " 70 astore_2 [s]\n" + + " 71 aload_2 [s]\n" + + " 72 ifnonnull 83\n" + + " 75 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 78 ldc [55]\n" + + " 80 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 83 ldc [57]\n" + + " 85 astore_3 [s2]\n" + + " 86 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 89 ldc [59]\n" + + " 91 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" + + " 94 return\n" + + " Line numbers:\n" + + " [pc: 0, line: 3]\n" + + " [pc: 8, line: 4]\n" + + " [pc: 21, line: 5]\n" + + " [pc: 29, line: 6]\n" + + " [pc: 61, line: 7]\n" + + " [pc: 69, line: 8]\n" + + " [pc: 71, line: 9]\n" + + " [pc: 83, line: 10]\n" + + " [pc: 86, line: 11]\n" + + " [pc: 94, line: 12]\n" + + " Local variable table:\n" + + " [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" + + " [pc: 61, pc: 95] local: b index: 1 type: boolean\n" + + " [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" + + " [pc: 86, pc: 95] local: s2 index: 3 type: java.lang.String\n"; String expectedOutput15 = " // Method descriptor #15 ([Ljava/lang/String;)V\n" + - " // Stack: 3, Locals: 4\n" + - " public static void main(java.lang.String[] args);\n" + - " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 3 ldc [22]\n" + - " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 8 aconst_null\n" + - " 9 goto 13\n" + - " 12 aconst_null\n" + - " 13 aconst_null\n" + - " 14 goto 18\n" + - " 17 aconst_null\n" + - " 18 if_acmpne 29\n" + - " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 24 ldc [30]\n" + - " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 29 new java.lang.StringBuilder [32]\n" + - " 32 dup\n" + - " 33 ldc [34]\n" + - " 35 invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" + - " 38 aconst_null\n" + - " 39 invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" + - " 42 ldc [42]\n" + - " 44 invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" + - " 47 invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" + - " 50 ldc [51]\n" + - " 52 if_acmpne 59\n" + - " 55 iconst_1\n" + - " 56 goto 60\n" + - " 59 iconst_0\n" + - " 60 istore_1 [b]\n" + - " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 64 ldc [53]\n" + - " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 69 aconst_null\n" + - " 70 astore_2 [s]\n" + - " 71 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 74 ldc [55]\n" + - " 76 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + - " 79 ldc [57]\n" + - " 81 astore_3 [s2]\n" + - " 82 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + - " 85 ldc [59]\n" + - " 87 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" + - " 90 return\n" + - " Line numbers:\n" + - " [pc: 0, line: 3]\n" + - " [pc: 8, line: 4]\n" + - " [pc: 21, line: 5]\n" + - " [pc: 29, line: 6]\n" + - " [pc: 61, line: 7]\n" + - " [pc: 69, line: 8]\n" + - " [pc: 71, line: 9]\n" + - " [pc: 79, line: 10]\n" + - " [pc: 82, line: 11]\n" + - " [pc: 90, line: 12]\n" + - " Local variable table:\n" + - " [pc: 0, pc: 91] local: args index: 0 type: java.lang.String[]\n" + - " [pc: 61, pc: 91] local: b index: 1 type: boolean\n" + - " [pc: 71, pc: 91] local: s index: 2 type: java.lang.String\n" + - " [pc: 82, pc: 91] local: s2 index: 3 type: java.lang.String\n"; + " // Stack: 3, Locals: 4\n" + + " public static void main(java.lang.String[] args);\n" + + " 0 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 3 ldc [22]\n" + + " 5 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 8 aconst_null\n" + + " 9 goto 13\n" + + " 12 aconst_null\n" + + " 13 aconst_null\n" + + " 14 goto 18\n" + + " 17 aconst_null\n" + + " 18 if_acmpne 29\n" + + " 21 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 24 ldc [30]\n" + + " 26 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 29 new java.lang.StringBuilder [32]\n" + + " 32 dup\n" + + " 33 ldc [34]\n" + + " 35 invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" + + " 38 aconst_null\n" + + " 39 invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" + + " 42 ldc [42]\n" + + " 44 invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" + + " 47 invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" + + " 50 ldc [51]\n" + + " 52 if_acmpne 59\n" + + " 55 iconst_1\n" + + " 56 goto 60\n" + + " 59 iconst_0\n" + + " 60 istore_1 [b]\n" + + " 61 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 64 ldc [53]\n" + + " 66 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 69 aconst_null\n" + + " 70 astore_2 [s]\n" + + " 71 aload_2 [s]\n" + + " 72 ifnonnull 83\n" + + " 75 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 78 ldc [55]\n" + + " 80 invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + + " 83 ldc [57]\n" + + " 85 astore_3 [s2]\n" + + " 86 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 89 ldc [59]\n" + + " 91 invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" + + " 94 return\n" + + " Line numbers:\n" + + " [pc: 0, line: 3]\n" + + " [pc: 8, line: 4]\n" + + " [pc: 21, line: 5]\n" + + " [pc: 29, line: 6]\n" + + " [pc: 61, line: 7]\n" + + " [pc: 69, line: 8]\n" + + " [pc: 71, line: 9]\n" + + " [pc: 83, line: 10]\n" + + " [pc: 86, line: 11]\n" + + " [pc: 94, line: 12]\n" + + " Local variable table:\n" + + " [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" + + " [pc: 61, pc: 95] local: b index: 1 type: boolean\n" + + " [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" + + " [pc: 86, pc: 95] local: s2 index: 3 type: java.lang.String\n"; if (this.complianceLevel >= ClassFileConstants.JDK1_5) { int index = actualOutput.indexOf(expectedOutput15); Index: src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java,v retrieving revision 1.115 diff -u -r1.115 NullReferenceTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 4 Mar 2011 12:41:15 -0000 1.115 +++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 4 Mar 2011 18:25:08 -0000 @@ -43,7 +43,7 @@ // Only the highest compliance level is run; add the VM argument // -Dcompliance=1.4 (for example) to lower it if needed static { -// TESTS_NAMES = new String[] { "testBug336428e" }; +// TESTS_NAMES = new String[] { "testBug326950" }; // TESTS_NUMBERS = new int[] { 561 }; // TESTS_RANGE = new int[] { 1, 2049 }; } @@ -11781,10 +11781,16 @@ " 2 aconst_null\n" + " 3 astore_2 [s2]\n" + " 4 aload_1 [s]\n" + - " 5 ifnull 12\n" + + " 5 ifnull 26\n" + " 8 aload_2 [s2]\n" + - " 9 ifnull 12\n" + - " 12 return\n"; + " 9 ifnull 26\n" + + " 12 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 15 aload_1 [s]\n" + + " 16 invokevirtual java.io.PrintStream.println(java.lang.String) : void [22]\n" + + " 19 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 22 aload_2 [s2]\n" + + " 23 invokevirtual java.io.PrintStream.println(java.lang.String) : void [22]\n" + + " 26 return\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); } @@ -14238,4 +14244,166 @@ "Dead code\n" + "----------\n"); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950 +public void testBug326950a() throws Exception { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public static void main(String[] args) {\n" + + " String s = null;\n" + + " if (s == null) {\n" + + " System.out.println(\"SUCCESS\");\n" + + " } else {\n" + + " System.out.println(\"Dead code, but don't optimize me out\");\n" + + " }\n" + + " }\n" + + "}", + }, + "SUCCESS", + null, + true, + null, + options, + null); + String expectedOutput = + " public static void main(java.lang.String[] args);\n" + + " 0 aconst_null\n" + + " 1 astore_1 [s]\n" + + " 2 aload_1 [s]\n" + + " 3 ifnonnull 17\n" + + " 6 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 9 ldc [22]\n" + + " 11 invokevirtual java.io.PrintStream.println(java.lang.String) : void [24]\n" + + " 14 goto 25\n" + + " 17 getstatic java.lang.System.out : java.io.PrintStream [16]\n" + + " 20 ldc [30]\n" + + " 22 invokevirtual java.io.PrintStream.println(java.lang.String) : void [24]\n" + + " 25 return\n"; + checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950 +// Code marked dead due to if(false), etc. can be optimized out +public void testBug326950b() throws Exception { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public static void main(String[] args) {\n" + + " int i = 0;\n" + + " if (false) {\n" + + " System.out.println(\"Deadcode and you can optimize me out\");\n" + + " }\n" + + " if (true) {\n" + + " i++;\n" + + " } else {\n" + + " System.out.println(\"Deadcode and you can optimize me out\");\n" + + " }\n" + + " }\n" + + "}", + }, + "", + null, + true, + null, + options, + null); + String expectedOutput = + " public static void main(java.lang.String[] args);\n" + + " 0 iconst_0\n" + + " 1 istore_1 [i]\n" + + " 2 iinc 1 1 [i]\n" + + " 5 return\n"; + checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950 +// Free return should be generated for a method even if it ends with dead code +public void testBug326950c() throws Exception { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public void foo(String[] args) {\n" + + " String s = \"\";\n" + + " int i = 0;\n" + + " if (s != null) {\n" + + " return;\n" + + " }\n" + + " i++;\n" + + " }\n" + + "}", + }, + "", + null, + true, + null, + options, + null); + String expectedOutput = + " public void foo(java.lang.String[] args);\n" + + " 0 ldc [16]\n" + + " 2 astore_2 [s]\n" + + " 3 iconst_0\n" + + " 4 istore_3 [i]\n" + + " 5 aload_2 [s]\n" + + " 6 ifnull 10\n" + + " 9 return\n" + + " 10 iinc 3 1 [i]\n" + + " 13 return\n"; + checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950 +// Free return should be generated for a constructor even if it ends with dead code +public void testBug326950d() throws Exception { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING); + options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " X() {\n" + + " String s = \"\";\n" + + " int i = 0;\n" + + " if (s != null) {\n" + + " return;\n" + + " }\n" + + " i++;\n" + + " }\n" + + "}", + }, + "", + null, + true, + null, + options, + null); + String expectedOutput = + " X();\n" + + " 0 aload_0 [this]\n" + + " 1 invokespecial java.lang.Object() [8]\n" + + " 4 ldc [10]\n" + + " 6 astore_1 [s]\n" + + " 7 iconst_0\n" + + " 8 istore_2 [i]\n" + + " 9 aload_1 [s]\n" + + " 10 ifnull 14\n" + + " 13 return\n" + + " 14 iinc 2 1 [i]\n" + + " 17 return\n"; + checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); +} } \ No newline at end of file