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 128924 Details for
Bug 268802
Useless call to getSource() in SourceTypeConverter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug268802_001.txt (text/plain), 3.12 KB, created by
David Audel
on 2009-03-16 10:55:07 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2009-03-16 10:55:07 EDT
Size:
3.12 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java,v >retrieving revision 1.62 >diff -u -r1.62 SourceTypeConverter.java >--- model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java 27 Jun 2008 16:04:14 -0000 1.62 >+++ model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java 16 Mar 2009 14:55:00 -0000 >@@ -577,32 +577,34 @@ > } > > private Annotation[] convertAnnotations(IAnnotatable element) throws JavaModelException { >- char[] cuSource = getSource(); > IAnnotation[] annotations = element.getAnnotations(); > int length = annotations.length; > Annotation[] astAnnotations = new Annotation[length]; >- int recordedAnnotations = 0; >- for (int i = 0; i < length; i++) { >- ISourceRange positions = annotations[i].getSourceRange(); >- int start = positions.getOffset(); >- int end = start + positions.getLength(); >- char[] annotationSource = CharOperation.subarray(cuSource, start, end); >- if (annotationSource != null) { >- Expression expression = parseMemberValue(annotationSource); >- /* >- * expression can be null or not an annotation if the source has changed between >- * the moment where the annotation source positions have been retrieved and the moment were >- * this parsing occurred. >- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=90916 >- */ >- if (expression instanceof Annotation) { >- astAnnotations[recordedAnnotations++] = (Annotation) expression; >- } >+ if (length > 0) { >+ char[] cuSource = getSource(); >+ int recordedAnnotations = 0; >+ for (int i = 0; i < length; i++) { >+ ISourceRange positions = annotations[i].getSourceRange(); >+ int start = positions.getOffset(); >+ int end = start + positions.getLength(); >+ char[] annotationSource = CharOperation.subarray(cuSource, start, end); >+ if (annotationSource != null) { >+ Expression expression = parseMemberValue(annotationSource); >+ /* >+ * expression can be null or not an annotation if the source has changed between >+ * the moment where the annotation source positions have been retrieved and the moment were >+ * this parsing occurred. >+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=90916 >+ */ >+ if (expression instanceof Annotation) { >+ astAnnotations[recordedAnnotations++] = (Annotation) expression; >+ } >+ } >+ } >+ if (length != recordedAnnotations) { >+ // resize to remove null annotations >+ System.arraycopy(astAnnotations, 0, (astAnnotations = new Annotation[recordedAnnotations]), 0, recordedAnnotations); > } >- } >- if (length != recordedAnnotations) { >- // resize to remove null annotations >- System.arraycopy(astAnnotations, 0, (astAnnotations = new Annotation[recordedAnnotations]), 0, recordedAnnotations); > } > return astAnnotations; > }
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
Actions:
View
|
Diff
Attachments on
bug 268802
: 128924