Giter Site home page Giter Site logo

Comments (1)

trancexpress avatar trancexpress commented on July 17, 2024

The build path page decides the JRE is on the module path with this stack trace:

"main" #1 prio=6 os_prio=0 cpu=7618.77ms elapsed=2454.16s tid=0x00007f6560015440 nid=0x3e19 runnable  [0x00007f65647fc000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.addModuleNodes(CPListElement.java:214)
        at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.<init>(CPListElement.java:178)
        at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.create(CPListElement.java:772)
        at org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.create(CPListElement.java:710)
        at org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock.getCPListElements(BuildPathsBlock.java:446)
        at org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock.init(BuildPathsBlock.java:341)
        at org.eclipse.jdt.internal.ui.preferences.BuildPathsPropertyPage.createWithJava(BuildPathsPropertyPage.java:170)
        at org.eclipse.jdt.internal.ui.preferences.BuildPathsPropertyPage.createContents(BuildPathsPropertyPage.java:88)
        at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:244)
        at org.eclipse.jdt.internal.ui.preferences.BuildPathsPropertyPage.createControl(BuildPathsPropertyPage.java:99)
        at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1434)
        at org.eclipse.jface.preference.PreferenceDialog$8.run(PreferenceDialog.java:1197)

With this code:

	private boolean addModuleNodes(IClasspathEntry containerEntry, IClasspathEntry pseudoEntry) {
		boolean modulesAdded= false;
		if (containerEntry != null) {
			IPackageFragmentRoot[] fragmentRoots= fProject.findPackageFragmentRoots(containerEntry);
			if (fragmentRoots != null) {
				// detect if system library:
				boolean addChildren= false;
				if (fragmentRoots.length > 0) {
					IModuleDescription module= fragmentRoots[0].getModuleDescription();
					if (module != null && module.isSystemModule())
						addChildren= true;

isSystemModule() is implemented here: org.eclipse.jdt.internal.core.BinaryModule.isSystemModule():

	@Override
	public boolean isSystemModule() {
		IPackageFragmentRoot pfr = (IPackageFragmentRoot) getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
		return pfr instanceof JrtPackageFragmentRoot;
	}
	@Overri

I guess we can add code like that in JavaSearchNameEnvironment.

It would be good to know where the compiler does this as well, since the compiler also adds the JRE on the module path... Likely its done with the instanceof JrtPackageFragmentRoot statements in org.eclipse.jdt.internal.core.SearchableEnvironment.

from eclipse.jdt.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.