Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354103 - JRE_CONTAINER optimization in JdtToBeBuiltComputer
Summary: JRE_CONTAINER optimization in JdtToBeBuiltComputer
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-08 02:07 EDT by Vladimir Piskarev CLA
Modified: 2017-09-19 17:45 EDT (History)
2 users (show)

See Also:
sven.efftinge: indigo+


Attachments
Proposed patch (2.38 KB, patch)
2011-08-22 06:22 EDT, Vladimir Piskarev CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Piskarev CLA 2011-08-08 02:07:30 EDT
Build Identifier: I20110613-1736

JdtToBeBuiltComputer tries to optimize away costly traversing of JRE_CONTAINER. Unfortunately, the current implementation based on equality with 'org.eclipse.jdt.launching.JRE_CONTAINER' does not always work. The raw classpath entry for JRE_CONTAINER can just as well look as 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6' , in which case the optimization is not working, which can slow down things considerably.

Similar implementation is also used in JavaProjectsStateHelper.

A fix may look as root.getRawClasspathEntry().getPath().toString().startsWith("org.eclipse.jdt.launching.JRE_CONTAINER").

Reproducible: Always

Steps to Reproduce:
Make a full build of an Xtext Java project configured with a Java execution environment (e.g. JavaSE-1.6).
Comment 1 Vladimir Piskarev CLA 2011-08-22 06:22:22 EDT
Created attachment 201905 [details]
Proposed patch
Comment 2 Vladimir Piskarev CLA 2011-08-22 06:26:29 EDT
Any chance to get it included in SR2? The fix is trivial, but may provide a performance increase.
Comment 3 Sebastian Zarnekow CLA 2011-08-23 12:49:07 EDT
Thanks for the patch, Vladimir.

I modified it slightly to use JavaRuntime.newDefaultJREContainerPath().isPrefixOf(classpathEntry.getPath()) instead of a plain string comparison.

Pushed to master.
Comment 4 Vladimir Piskarev CLA 2011-08-23 14:15:26 EDT
Thanks for fixing it in a much cleaner way, Sebastian.
Comment 5 Karsten Thoms CLA 2017-09-19 17:34:36 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 17:45:44 EDT
Closing all bugs that were set to RESOLVED before Neon.0