### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/DebugAttributeTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DebugAttributeTest.java,v retrieving revision 1.11 diff -u -r1.11 DebugAttributeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/DebugAttributeTest.java 17 Dec 2008 17:37:41 -0000 1.11 +++ src/org/eclipse/jdt/core/tests/compiler/regression/DebugAttributeTest.java 28 Jan 2009 17:44:17 -0000 @@ -233,4 +233,56 @@ assertEquals("Wrong contents", expectedOutput, result); } } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=262717 +public void test004() throws Exception { + this.runConformTest( + new String[] { + "X.java", + "public class X{\n" + + " public class Inner {\n" + + " public void foo() {\n" + + " int i = 0;\n" + + " final int NEW = 1;\n" + + " if (i == NEW) {\n" + + " System.out.println();\n" + + " }\n" + + " bar();\n" + + " }\n" + + " }\n" + + " public void bar() {\n" + + " System.out.println(\"SUCCESS\");\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " new X().new Inner().foo();\n" + + " }\n" + + "}", + }, + "SUCCESS"); + + String expectedOutput = + " 22 return\n" + + " Line numbers:\n" + + " [pc: 0, line: 4]\n" + + " [pc: 2, line: 5]\n" + + " [pc: 4, line: 6]\n" + + " [pc: 9, line: 7]\n" + + " [pc: 15, line: 9]\n" + + " [pc: 22, line: 10]\n" + + " Local variable table:\n" + + " [pc: 0, pc: 23] local: this index: 0 type: X.Inner\n" + + " [pc: 2, pc: 23] local: i index: 1 type: int\n" + + " [pc: 4, pc: 23] local: NEW index: 2 type: int\n"; + + File f = new File(OUTPUT_DIR + File.separator + "X$Inner.class"); + byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); + ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); + String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED); + int index = result.indexOf(expectedOutput); + if (index == -1 || expectedOutput.length() == 0) { + System.out.println(Util.displayString(result, 3)); + } + if (index == -1) { + assertEquals("Wrong contents", expectedOutput, result); + } +} } #P org.eclipse.jdt.core 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.140 diff -u -r1.140 MessageSend.java --- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 8 Jan 2009 20:51:05 -0000 1.140 +++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 28 Jan 2009 17:44:18 -0000 @@ -131,7 +131,6 @@ boolean isStatic = codegenBinding.isStatic(); if (isStatic) { this.receiver.generateCode(currentScope, codeStream, false); - codeStream.recordPositionsFrom(pc, this.sourceStart); } else if ((this.bits & ASTNode.DepthMASK) != 0 && this.receiver.isImplicitThis()) { // outer access ? // outer method can be reached through emulation if implicit access ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT); @@ -142,8 +141,8 @@ if ((this.bits & NeedReceiverGenericCast) != 0) { codeStream.checkcast(this.actualReceiverType); } - codeStream.recordPositionsFrom(pc, this.sourceStart); } + codeStream.recordPositionsFrom(pc, this.sourceStart); // generate arguments generateArguments(this.binding, this.arguments, currentScope, codeStream); pc = codeStream.position;