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

Bug 354103

Summary: JRE_CONTAINER optimization in JdtToBeBuiltComputer
Product: [Modeling] TMF Reporter: Vladimir Piskarev <vpiskarov>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow, sven.efftinge
Version: 2.0.0Flags: sven.efftinge: indigo+
Target Milestone: SR2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch sven.efftinge: iplog+

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