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 89949 Details for
Bug 217910
Parameter annotations should be displayed in front of each parameter in disassembled code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
patch_217910.txt (text/plain), 7.50 KB, created by
Olivier Thomann
on 2008-02-17 20:33:51 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2008-02-17 20:33:51 EST
Size:
7.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/util/Disassembler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java,v >retrieving revision 1.92 >diff -u -r1.92 Disassembler.java >--- model/org/eclipse/jdt/internal/core/util/Disassembler.java 11 Feb 2008 19:21:35 -0000 1.92 >+++ model/org/eclipse/jdt/internal/core/util/Disassembler.java 18 Feb 2008 01:33:23 -0000 >@@ -562,29 +562,78 @@ > } > CharOperation.replace(methodDescriptor, '/', '.'); > final boolean isVarArgs = isVarArgs(methodInfo); >+ char[] methodHeader = null; > if (methodInfo.isConstructor()) { > if (checkMode(mode, WORKING_COPY) && signatureAttribute != null) { > final char[] signature = signatureAttribute.getSignature(); > CharOperation.replace(signature, '/', '.'); > disassembleGenericSignature(mode, buffer, signature); > buffer.append(' '); >- buffer.append(Signature.toCharArray(signature, returnClassName(className, '.', COMPACT), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), false, isVarArgs)); >+ methodHeader = Signature.toCharArray(signature, returnClassName(className, '.', COMPACT), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), false, isVarArgs); > } else { >- buffer.append(Signature.toCharArray(methodDescriptor, returnClassName(className, '.', COMPACT), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), false, isVarArgs)); >+ methodHeader = Signature.toCharArray(methodDescriptor, returnClassName(className, '.', COMPACT), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), false, isVarArgs); > } > } else if (methodInfo.isClinit()) { >- buffer.append(Messages.bind(Messages.classfileformat_clinitname)); >+ methodHeader = Messages.bind(Messages.classfileformat_clinitname).toCharArray(); > } else { > if (checkMode(mode, WORKING_COPY) && signatureAttribute != null) { > final char[] signature = signatureAttribute.getSignature(); > CharOperation.replace(signature, '/', '.'); > disassembleGenericSignature(mode, buffer, signature); > buffer.append(' '); >- buffer.append(Signature.toCharArray(signature, methodInfo.getName(), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), true, isVarArgs)); >+ methodHeader = Signature.toCharArray(signature, methodInfo.getName(), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), true, isVarArgs); > } else { >- buffer.append(Signature.toCharArray(methodDescriptor, methodInfo.getName(), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), true, isVarArgs)); >+ methodHeader = Signature.toCharArray(methodDescriptor, methodInfo.getName(), getParameterNames(methodDescriptor, codeAttribute, accessFlags) , !checkMode(mode, COMPACT), true, isVarArgs); > } > } >+ if (checkMode(mode, DETAILED) && (runtimeInvisibleParameterAnnotationsAttribute != null || runtimeVisibleParameterAnnotationsAttribute != null)) { >+ IParameterAnnotation[] invisibleParameterAnnotations = null; >+ IParameterAnnotation[] visibleParameterAnnotations = null; >+ int length = -1; >+ if (runtimeInvisibleParameterAnnotationsAttribute != null) { >+ IRuntimeInvisibleParameterAnnotationsAttribute attribute = (IRuntimeInvisibleParameterAnnotationsAttribute) runtimeInvisibleParameterAnnotationsAttribute; >+ invisibleParameterAnnotations = attribute.getParameterAnnotations(); >+ length = invisibleParameterAnnotations.length; >+ } >+ if (runtimeVisibleParameterAnnotationsAttribute != null) { >+ IRuntimeVisibleParameterAnnotationsAttribute attribute = (IRuntimeVisibleParameterAnnotationsAttribute) runtimeVisibleParameterAnnotationsAttribute; >+ visibleParameterAnnotations = attribute.getParameterAnnotations(); >+ length = visibleParameterAnnotations.length; >+ } >+ int insertionPosition = CharOperation.indexOf('(', methodHeader) + 1; >+ int start = 0; >+ StringBuffer stringBuffer = new StringBuffer(); >+ stringBuffer.append(methodHeader, 0, insertionPosition); >+ for (int i = 0; i < length; i++) { >+ if (i > 0) { >+ stringBuffer.append(' '); >+ } >+ int stringBufferSize = stringBuffer.length(); >+ if (runtimeVisibleParameterAnnotationsAttribute != null) { >+ disassembleAsModifier((IRuntimeVisibleParameterAnnotationsAttribute) runtimeVisibleParameterAnnotationsAttribute, stringBuffer, i, lineSeparator, tabNumber, mode); >+ } >+ if (runtimeInvisibleParameterAnnotationsAttribute != null) { >+ if (stringBuffer.length() != stringBufferSize) { >+ stringBuffer.append(' '); >+ stringBufferSize = stringBuffer.length(); >+ } >+ disassembleAsModifier((IRuntimeInvisibleParameterAnnotationsAttribute) runtimeInvisibleParameterAnnotationsAttribute, stringBuffer, i, lineSeparator, tabNumber, mode); >+ } >+ if (i == 0 && stringBuffer.length() != stringBufferSize) { >+ stringBuffer.append(' '); >+ } >+ start = insertionPosition; >+ insertionPosition = CharOperation.indexOf(',', methodHeader, start + 1) + 1; >+ if (insertionPosition == 0) { >+ stringBuffer.append(methodHeader, start, methodHeader.length - start); >+ } else { >+ stringBuffer.append(methodHeader, start, insertionPosition - start); >+ } >+ } >+ buffer.append(stringBuffer); >+ } else { >+ buffer.append(methodHeader); >+ } > IExceptionAttribute exceptionAttribute = methodInfo.getExceptionAttribute(); > if (exceptionAttribute != null) { > buffer.append(" throws "); //$NON-NLS-1$ >@@ -1857,6 +1906,30 @@ > } > } > >+ private void disassembleAsModifier(IRuntimeInvisibleParameterAnnotationsAttribute runtimeInvisibleParameterAnnotationsAttribute, StringBuffer buffer, int index, String lineSeparator, int tabNumber, int mode) { >+ IParameterAnnotation[] parameterAnnotations = runtimeInvisibleParameterAnnotationsAttribute.getParameterAnnotations(); >+ if (parameterAnnotations.length > index) { >+ disassembleAsModifier(parameterAnnotations[index], buffer, lineSeparator, tabNumber + 1, mode); >+ } >+ } >+ >+ private void disassembleAsModifier(IRuntimeVisibleParameterAnnotationsAttribute runtimeVisibleParameterAnnotationsAttribute, StringBuffer buffer, int index, String lineSeparator, int tabNumber, int mode) { >+ IParameterAnnotation[] parameterAnnotations = runtimeVisibleParameterAnnotationsAttribute.getParameterAnnotations(); >+ if (parameterAnnotations.length > index) { >+ disassembleAsModifier(parameterAnnotations[index], buffer, lineSeparator, tabNumber + 1, mode); >+ } >+ } >+ >+ private void disassembleAsModifier(IParameterAnnotation parameterAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { >+ IAnnotation[] annotations = parameterAnnotation.getAnnotations(); >+ for (int i = 0, max = annotations.length; i < max; i++) { >+ if (i > 0) { >+ buffer.append(' '); >+ } >+ disassembleAsModifier(annotations[i], buffer, lineSeparator, tabNumber + 1, mode); >+ } >+ } >+ > private void disassembleAsModifier(IRuntimeVisibleAnnotationsAttribute runtimeVisibleAnnotationsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) { > IAnnotation[] annotations = runtimeVisibleAnnotationsAttribute.getAnnotations(); > for (int i = 0, max = annotations.length; i < max; i++) {
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 217910
: 89949