Summary: | Optimize source attachment query when no source attachment available | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Jerome Lanneluc <jerome_lanneluc> |
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.1 | ||
Target Milestone: | 2.1 RC3 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Jerome Lanneluc
2003-03-17 07:07:53 EST
Proposed fix on PackageFragmentRoot: - Add constant: protected final static String NO_SOURCE_ATTACHEMENT = ""; // $NON-NLS-1$ - Change getSourceAttachmentProperty() to: /** * Returns the server property for this package fragment root's * source attachement. */ protected String getSourceAttachmentProperty() throws JavaModelException { String propertyString = null; QualifiedName qName= getSourceAttachmentPropertyName(); try { propertyString = ResourcesPlugin.getWorkspace().getRoot ().getPersistentProperty(qName); // if no existing source attachment information, then lookup a recommendation from classpath entries if (propertyString == null) { IClasspathEntry recommendation = findSourceAttachmentRecommendation(); if (recommendation != null) { IPath rootPath = recommendation.getSourceAttachmentRootPath(); propertyString = recommendation.getSourceAttachmentPath ().toString() + ((rootPath == null) ? "" : //$NON-NLS-1$ (ATTACHMENT_PROPERTY_DELIMITER + rootPath.toString())); setSourceAttachmentProperty(propertyString); } else { // mark as being already looked up setSourceAttachmentProperty (NO_SOURCE_ATTACHEMENT); } } else if (NO_SOURCE_ATTACHEMENT.equals(propertyString)) { // already looked up and no source attachment found return null; } return propertyString; } catch (CoreException ce) { throw new JavaModelException(ce); } } Nice simple optimization fix for a performance release... Would like to get approval for RC3. NO_SOURCE_ATTACHEMENT could be used instead of "" in the code: propertyString = recommendation.getSourceAttachmentPath ().toString() + ((rootPath == null) ? "" : //$NON-NLS-1$ ... Would you have a test case that would allow me to check that this change improves the performance. Got approval for RC3 Fix released to HEAD. Verified. |