Community
Participate
Working Groups
Build RC2 As shown in bug 34008, we never remember that a package fragment root has no source attachment. Thus we try to find a source attachment recommendation for each query to getSourceAttachmentPath() and getSourceAttachmentRootPath()
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.
You can use the test case described in bug 34008.
Got approval for RC3
Fix released to HEAD.
Verified.