Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326286

Summary: ClassNotFoundException using "Step Into" debugging JUnit test
Product: [Eclipse Project] JDT Reporter: Stefan Moebius <stmoebius>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: RESOLVED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Stefan Moebius CLA 2010-09-27 06:35:58 EDT
Build Identifier: 20100917-0705

The debugger cannot find some classes when using "Step Into". Using "Step Over"/"Continue" works fine. This is reproducible on Eclipse 3.4 and 3.6.1 (Helios Service Release 1, Build 20100917-0705).

Reproducible: Always

Steps to Reproduce:
1. Create a new class with the following content:

import org.junit.Test;

public class Bar {

	public static class Selftest {

		@Test
		public void test() {
			System.out.println(this.getClass());
			Foo foo = createFoo();
			System.out.println(foo.getClass());
		}
	}

	public static Foo createFoo() {
		Foo foo = new Foo();
		System.out.println(foo.getClass());
		return foo;
	}

	private static class Foo {

		Foo() {
			System.out.println(this.getClass());
		}
	}
}

2. Place a breakpoint on the line "Foo foo = new Foo();"
3. Debug Selftest as a JUnit test.
4. Use "Step Into" after hitting the breakpoint.

Expected result:
Step into Foo.Foo().

Actual result:
ClassNotFoundException

Workaround exists by putting a breakpoint inside the constructor.
Comment 1 Darin Wright CLA 2010-09-27 09:30:00 EDT
It does work... it just takes a while to get there. You need to step out/in several times until you enter the constructor. I assume the classloader makes several attempts to find the class Foo.