Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327491 - JdtClasspathUriResolver doesn't resolve files from JAR's root.
Summary: JdtClasspathUriResolver doesn't resolve files from JAR's root.
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-11 20:53 EDT by Moritz Eysholdt CLA
Modified: 2017-10-31 11:23 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: kepler+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Eysholdt CLA 2010-10-11 20:53:16 EDT
Context: org.eclipse.xtext.ui.util.JdtClasspathUriResolver

To reproduce:
Put plugins/org.eclipse.xtext_1.0.1.v201008112031.jar on the classpath. It contains:
/model/parsetree.ecore and
/parsetree.ecore

Use JdtClasspathUriResolver to resolve "classpath:/model/parsetree.ecore" and "classpath:/parsetree.ecore". It works in the first case, it doesn't in the second.
Comment 1 Sven Efftinge CLA 2012-11-19 08:24:30 EST
Seems to be a problem in JDT's PackageFragmentRoot not returning the nonJavResources for the default package.
added a test case : org.eclipse.xtext.ui.tests.core.util.JdtClasspathUriResolverTest.testClasspathUriForFileInRootInJarInWorkspaceWithFragment()
Comment 2 Sebastian Zarnekow CLA 2013-04-19 06:12:39 EDT
This looks clearly strange to me:

public Object[] getNonJavaResources() throws JavaModelException {
	if (isDefaultPackage()) {
		// We don't want to show non java resources of the default package (see PR #1G58NB8)
		return JavaElementInfo.NO_NON_JAVA_RESOURCES;
	} else {
		return storedNonJavaResources();
	}
}

We could hijack this method reflectively, though.

protected Object[] storedNonJavaResources() throws JavaModelException {
	return ((JarPackageFragmentInfo) getElementInfo()).getNonJavaResources();
}
Comment 3 Sebastian Zarnekow CLA 2013-04-19 07:08:33 EDT
Turns out that org.eclipse.jdt.core.IPackageFragmentRoot.getNonJavaResources() is the way to go for the default package.
Comment 4 Sebastian Zarnekow CLA 2013-04-19 08:04:21 EDT
Pushed to review.
Comment 5 Eclipse Webmaster CLA 2017-10-31 11:23:52 EDT
Requested via bug 522520.

-M.