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

Bug 527861

Summary: [9] JarSourceLookupTests.testTranslateContainers fails when run on JDK 9
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: DebugAssignee: Sarika Sinha <sarika.sinha>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sarika.sinha
Version: 4.7.1a   
Target Milestone: 4.8 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Stephan Herrmann CLA 2017-11-28 08:16:38 EST
Running JarSourceLookupTests.testTranslateContainers on JDK 9 produces this failure:

junit.framework.AssertionFailedError: There should be 2 containers returned (JRE and classpath) expected:<2> but was:<3>
	at org.eclipse.jdt.debug.tests.sourcelookup.JarSourceLookupTests.testTranslateContainers(JarSourceLookupTests.java:139)

It seems, at 9 more resolving is done in StandardClasspathProvider.computeUnresolvedClasspath(ILaunchConfiguration), viz, the project dependency is unfolded into source folder and jar.

If that is intended, then the test can simply be adjusted (to expect 2 or more containers)?

Or is it actually a bug?
Comment 1 Sarika Sinha CLA 2017-11-29 01:56:42 EST
Fixed with
http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=0556fe386d619feaa523384aa437062745976ac3

It is expected from Java 9 onwards because of changes from Classpath to Dependencies.
Comment 2 Stephan Herrmann CLA 2017-11-30 07:58:34 EST
(In reply to Sarika Sinha from comment #1)
> Fixed with
> http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/
> ?id=0556fe386d619feaa523384aa437062745976ac3
> 
> It is expected from Java 9 onwards because of changes from Classpath to
> Dependencies.

I trust the solution is good, just the comments look contradictory now:

	// JRE Container is also part of it from Java 9 onwards
	assertEquals("There should be 3 containers returned (JRE and classpath)", 3, entries.length);

JRE has always been part of it "(JRE and classpath)", the thing that's different in 9 is that source folder & jar appear as separate entries, where previously we only saw that project (IIRC).
Comment 3 Sarika Sinha CLA 2017-12-07 19:58:57 EST
Sorry for the confusion, will correct the comment.

Entries are the same now and then. Difference is that apart from JRE container, both the entries were part of one entry as DefaultProject Entry till Java 8 but now they come separately as we don't have the nested project structure now.