Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 143082 Details for
Bug 285230
[performance] Duplicate buffers created for internal classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to ClassFile.java and SourceMapper.java
jdt_ClassFile_buffer_cache.patch (text/plain), 3.56 KB, created by
Kelly Campbell
on 2009-07-30 16:14:37 EDT
(
hide
)
Description:
Patch to ClassFile.java and SourceMapper.java
Filename:
MIME Type:
Creator:
Kelly Campbell
Created:
2009-07-30 16:14:37 EDT
Size:
3.56 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/SourceMapper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java,v >retrieving revision 1.141 >diff -u -r1.141 SourceMapper.java >--- model/org/eclipse/jdt/internal/core/SourceMapper.java 8 Jul 2009 06:32:32 -0000 1.141 >+++ model/org/eclipse/jdt/internal/core/SourceMapper.java 30 Jul 2009 20:05:56 -0000 >@@ -1208,7 +1216,10 @@ > this.methodParameterNames = new char[1][][]; > this.anonymousCounter = 0; > >- HashMap oldSourceRanges = (HashMap) this.sourceRanges.clone(); >+ HashMap oldSourceRanges = null; >+ if (elementToFind != null) { >+ oldSourceRanges = (HashMap) this.sourceRanges.clone(); >+ } > try { > IProblemFactory factory = new DefaultProblemFactory(); > SourceElementParser parser = null; >Index: model/org/eclipse/jdt/internal/core/ClassFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java,v >retrieving revision 1.145 >diff -u -r1.145 ClassFile.java >--- model/org/eclipse/jdt/internal/core/ClassFile.java 8 Jul 2009 06:32:33 -0000 1.145 >+++ model/org/eclipse/jdt/internal/core/ClassFile.java 30 Jul 2009 20:05:56 -0000 >@@ -625,17 +625,24 @@ > * @see Openable > */ > protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException { >+ // Check the cache for the top-level type first >+ IType sourceType = getSourceType(); >+ IBuffer buffer = getBufferManager().getBuffer(sourceType.getClassFile()); > SourceMapper mapper = getSourceMapper(); >- if (mapper != null) { >- return mapSource(mapper, info instanceof IBinaryType ? (IBinaryType) info : null); >+ IBinaryType typeInfo = info instanceof IBinaryType ? (IBinaryType) info : null; >+ if (buffer == null) { >+ if (mapper != null) { >+ buffer = mapSource(mapper, typeInfo, sourceType.getClassFile()); >+ } > } >- return null; >+ return buffer; > } >-private IBuffer mapSource(SourceMapper mapper, IBinaryType info) { >+/** Loads the buffer via SourceMapper, and maps it in SourceMapper */ >+private IBuffer mapSource(SourceMapper mapper, IBinaryType info, IClassFile bufferOwner) { > char[] contents = mapper.findSource(getType(), info); > if (contents != null) { > // create buffer >- IBuffer buffer = BufferManager.createBuffer(this); >+ IBuffer buffer = BufferManager.createBuffer(bufferOwner); > if (buffer == null) return null; > BufferManager bufManager = getBufferManager(); > bufManager.addBuffer(buffer); >@@ -649,12 +656,12 @@ > buffer.addBufferChangedListener(this); > > // do the source mapping >- mapper.mapSource(getType(), contents, info); >+ mapper.mapSource(getSourceType(), contents, info); > > return buffer; > } else { > // create buffer >- IBuffer buffer = BufferManager.createNullBuffer(this); >+ IBuffer buffer = BufferManager.createNullBuffer(bufferOwner); > if (buffer == null) return null; > BufferManager bufManager = getBufferManager(); > bufManager.addBuffer(buffer); >@@ -674,6 +681,18 @@ > else > return simpleName; > } >+ >+/** Returns the type of the top-level declaring class used to find the source code */ >+private IType getSourceType() { >+ IType type = getType(); >+ IType enclosingType = type.getDeclaringType(); >+ while (enclosingType != null) { >+ type = enclosingType; >+ enclosingType = type.getDeclaringType(); >+ } >+ return type; >+} >+ > /** > * Returns the Java Model representation of the given name > * which is provided in diet class file format, or <code>null</code>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
john.arthorne
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 285230
:
143082
|
144892