### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java,v retrieving revision 1.22.2.1 diff -u -r1.22.2.1 StackMapFrameCodeStream.java --- compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java 1 Jul 2008 11:24:16 -0000 1.22.2.1 +++ compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java 8 Jul 2008 01:59:39 -0000 @@ -536,6 +536,10 @@ this.addFramePosition(this.position); } public void resetInWideMode() { + this.resetSecretLocals(); + super.resetInWideMode(); +} +public void resetSecretLocals() { for (int i = 0, max = this.locals.length; i < max; i++) { LocalVariableBinding localVariableBinding = this.locals[i]; if (localVariableBinding != null && localVariableBinding.isSecret()) { @@ -543,6 +547,5 @@ localVariableBinding.resetInitializations(); } } - super.resetInWideMode(); } } 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.92.2.1 diff -u -r1.92.2.1 ConstructorDeclaration.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 1 Jul 2008 11:24:16 -0000 1.92.2.1 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 8 Jul 2008 01:59:39 -0000 @@ -335,6 +335,11 @@ codeStream.recordPositionsFrom(0, this.bodyEnd); classFile.completeCodeAttribute(codeAttributeOffset); attributeNumber++; + if ((codeStream instanceof StackMapFrameCodeStream) + && needFieldInitializations + && declaringType.fields != null) { + ((StackMapFrameCodeStream) codeStream).resetSecretLocals(); + } } classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); } #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java,v retrieving revision 1.33.2.1 diff -u -r1.33.2.1 StackMapAttributeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 1 Jul 2008 11:24:08 -0000 1.33.2.1 +++ src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 8 Jul 2008 01:59:42 -0000 @@ -32,7 +32,7 @@ static { // TESTS_PREFIX = "testBug95521"; // TESTS_NAMES = new String[] { "testBug83127a" }; -// TESTS_NUMBERS = new int[] { 37 }; +// TESTS_NUMBERS = new int[] { 38 }; // TESTS_RANGE = new int[] { 23 -1,}; } public static Test suite() { @@ -6077,4 +6077,23 @@ }, "SUCCESS"); } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=238923 + public void test038() { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " {\n" + + " for (boolean b : new boolean[] {}) {}\n" + + " }\n" + + " public X() {}\n" + + " public X(boolean b) {}\n" + + " public static void main(String[] args) {\n" + + " System.out.print(\"SUCCESS\");\n" + + " }\n" + + "}", + }, + "SUCCESS"); + } }