Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 530142 - [9] Module autocompletion ignores Automatic-Module-Name for Classpath Container entries
Summary: [9] Module autocompletion ignores Automatic-Module-Name for Classpath Contain...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.8   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.8 M5   Edit
Assignee: Till Brychcy CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 529982 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-22 12:56 EST by Till Brychcy CLA
Modified: 2018-01-29 10:06 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Till Brychcy CLA 2018-01-22 12:56:53 EST
DESCRIPTION:
Create a simply maven project with the following pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>completionbug</groupId>
	<artifactId>m1</artifactId>
	<version>1.0-SNAPSHOT</version>
	<packaging>jar</packaging>

	<dependencies>
		<dependency>
			<groupId>org.eclipse.collections</groupId>
			<artifactId>eclipse-collections-api</artifactId>
			<version>9.1.0</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.7.0</version>
				<configuration>
					<source>9</source>
					<target>9</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Now create module-info.java and try to complete:
module m1 {
	requires //<- complete before comment
}

"eclipse-collections-api" is proposed, but the Automatic-Module-Name for this jar is "org.eclipse.collections.api".

ANALYSIS:
In PackageFragmentRoot.getAutomaticModuleDescription(), getRawClasspathEntry() is used, which returns the entry for the "Maven Dependencies" classpath container, but there is no handling for this kind of classpath entry in the switch in PackageFragmentRoot.getAutomaticModuleDescription(IClasspathEntry)

PATCH: 
Use getResolvedClasspathEntry() in PackageFragmentRoot.getAutomaticModuleDescription()
Comment 1 Eclipse Genie CLA 2018-01-22 12:59:29 EST
New Gerrit change created: https://git.eclipse.org/r/115822
Comment 3 Till Brychcy CLA 2018-01-22 14:10:12 EST
(In reply to Eclipse Genie from comment #2)
> Gerrit change https://git.eclipse.org/r/115822 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=9599981de1e324d33a872e84d29687e9cc17ab39

Released for 4.8M5
Comment 4 Stephan Herrmann CLA 2018-01-22 16:38:57 EST
Thanks for cleaning up after me :)
Comment 5 Sasikanth Bharadwaj CLA 2018-01-25 03:12:42 EST
Verified for 4.8 M5 using I20180124-2000 build
Comment 6 Manoj N Palat CLA 2018-01-29 10:06:15 EST
*** Bug 529982 has been marked as a duplicate of this bug. ***