View | Details | Raw Unified | Return to bug 262717 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/DebugAttributeTest.java (+52 lines)
Lines 233-236 Link Here
233
		assertEquals("Wrong contents", expectedOutput, result);
233
		assertEquals("Wrong contents", expectedOutput, result);
234
	}
234
	}
235
}
235
}
236
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=262717
237
public void test004() throws Exception {
238
	this.runConformTest(
239
		new String[] {
240
			"X.java",
241
			"public class X{\n" + 
242
			"	public class Inner {\n" + 
243
			"		public void foo() {\n" + 
244
			"			int i = 0;\n" + 
245
			"			final int NEW = 1;\n" + 
246
			"			if (i == NEW) {\n" + 
247
			"				System.out.println();\n" + 
248
			"			}\n" + 
249
			"			bar();\n" + 
250
			"		}\n" + 
251
			"	}\n" + 
252
			"	public void bar() {\n" + 
253
			"		System.out.println(\"SUCCESS\");\n" + 
254
			"	}\n" + 
255
			"	public static void main(String[] args) {\n" + 
256
			"		new X().new Inner().foo();\n" + 
257
			"	}\n" + 
258
			"}",
259
		},
260
		"SUCCESS");
261
262
	String expectedOutput =
263
		"    22  return\n" + 
264
		"      Line numbers:\n" + 
265
		"        [pc: 0, line: 4]\n" + 
266
		"        [pc: 2, line: 5]\n" + 
267
		"        [pc: 4, line: 6]\n" + 
268
		"        [pc: 9, line: 7]\n" + 
269
		"        [pc: 15, line: 9]\n" + 
270
		"        [pc: 22, line: 10]\n" + 
271
		"      Local variable table:\n" + 
272
		"        [pc: 0, pc: 23] local: this index: 0 type: X.Inner\n" + 
273
		"        [pc: 2, pc: 23] local: i index: 1 type: int\n" + 
274
		"        [pc: 4, pc: 23] local: NEW index: 2 type: int\n";
275
276
	File f = new File(OUTPUT_DIR + File.separator + "X$Inner.class");
277
	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
278
	ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
279
	String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
280
	int index = result.indexOf(expectedOutput);
281
	if (index == -1 || expectedOutput.length() == 0) {
282
		System.out.println(Util.displayString(result, 3));
283
	}
284
	if (index == -1) {
285
		assertEquals("Wrong contents", expectedOutput, result);
286
	}
287
}
236
}
288
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-2 / +1 lines)
Lines 131-137 Link Here
131
	boolean isStatic = codegenBinding.isStatic();
131
	boolean isStatic = codegenBinding.isStatic();
132
	if (isStatic) {
132
	if (isStatic) {
133
		this.receiver.generateCode(currentScope, codeStream, false);
133
		this.receiver.generateCode(currentScope, codeStream, false);
134
		codeStream.recordPositionsFrom(pc, this.sourceStart);
135
	} else if ((this.bits & ASTNode.DepthMASK) != 0 && this.receiver.isImplicitThis()) { // outer access ?
134
	} else if ((this.bits & ASTNode.DepthMASK) != 0 && this.receiver.isImplicitThis()) { // outer access ?
136
		// outer method can be reached through emulation if implicit access
135
		// outer method can be reached through emulation if implicit access
137
		ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
136
		ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
Lines 142-149 Link Here
142
		if ((this.bits & NeedReceiverGenericCast) != 0) {
141
		if ((this.bits & NeedReceiverGenericCast) != 0) {
143
			codeStream.checkcast(this.actualReceiverType);
142
			codeStream.checkcast(this.actualReceiverType);
144
		}
143
		}
145
		codeStream.recordPositionsFrom(pc, this.sourceStart);
146
	}
144
	}
145
	codeStream.recordPositionsFrom(pc, this.sourceStart);
147
	// generate arguments
146
	// generate arguments
148
	generateArguments(this.binding, this.arguments, currentScope, codeStream);
147
	generateArguments(this.binding, this.arguments, currentScope, codeStream);
149
	pc = codeStream.position;
148
	pc = codeStream.position;

Return to bug 262717