From 78decedeb5b689a9f2ec1bad7a813b2108c0f845 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 24 Mar 2009 01:53:51 +0000 Subject: [PATCH] 265993: more jdt like handles --- asm/src/org/aspectj/asm/IProgramElement.java | 8 +++++-- .../asm/internal/JDTLikeHandleProvider.java | 19 +++++++++++---- .../aspectj/asm/internal/ProgramElement.java | 23 +++++++++++++++---- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/asm/src/org/aspectj/asm/IProgramElement.java b/asm/src/org/aspectj/asm/IProgramElement.java index 18ec29132..f13759b12 100644 --- a/asm/src/org/aspectj/asm/IProgramElement.java +++ b/asm/src/org/aspectj/asm/IProgramElement.java @@ -158,7 +158,9 @@ public interface IProgramElement extends Serializable { public List getParameterSignatures(); - public void setParameterSignatures(List list); + public List getParameterSignaturesSourceRefs(); + + public void setParameterSignatures(List list, List paramSourceRefs); public List getParameterTypes(); @@ -320,7 +322,8 @@ public interface IProgramElement extends Serializable { INTERFACE, ASPECT, ENUM, ENUM_VALUE, ANNOTATION, INITIALIZER, INTER_TYPE_FIELD, INTER_TYPE_METHOD, INTER_TYPE_CONSTRUCTOR, INTER_TYPE_PARENT, CONSTRUCTOR, METHOD, FIELD, POINTCUT, ADVICE, DECLARE_PARENTS, DECLARE_WARNING, DECLARE_ERROR, DECLARE_SOFT, DECLARE_PRECEDENCE, CODE, ERROR, DECLARE_ANNOTATION_AT_CONSTRUCTOR, - DECLARE_ANNOTATION_AT_FIELD, DECLARE_ANNOTATION_AT_METHOD, DECLARE_ANNOTATION_AT_TYPE, SOURCE_FOLDER, PACKAGE_DECLARATION + DECLARE_ANNOTATION_AT_FIELD, DECLARE_ANNOTATION_AT_METHOD, DECLARE_ANNOTATION_AT_TYPE, SOURCE_FOLDER, + PACKAGE_DECLARATION }; @@ -367,6 +370,7 @@ public interface IProgramElement extends Serializable { public boolean isSourceFile() { return this == FILE_ASPECTJ || this == FILE_JAVA; } + public boolean isFile() { return this == FILE; } diff --git a/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java b/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java index c822fbf48..92a1d2879 100644 --- a/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java +++ b/asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java @@ -128,12 +128,21 @@ public class JDTLikeHandleProvider implements IElementHandleProvider { if (ipe.getParameterSignatures() == null || ipe.getParameterSignatures().isEmpty()) { return ""; } - StringBuffer sb = new StringBuffer(); + List sourceRefs = ipe.getParameterSignaturesSourceRefs(); List parameterTypes = ipe.getParameterSignatures(); - for (Iterator iter = parameterTypes.iterator(); iter.hasNext();) { - char[] element = (char[]) iter.next(); - sb.append(HandleProviderDelimiter.getDelimiter(ipe)); - sb.append(NameConvertor.createShortName(element, false, false)); + StringBuffer sb = new StringBuffer(); + if (sourceRefs != null) { + for (int i = 0; i < sourceRefs.size(); i++) { + String sourceRef = (String) sourceRefs.get(i); + sb.append(HandleProviderDelimiter.getDelimiter(ipe)); + sb.append(sourceRef); + } + } else { + for (Iterator iter = parameterTypes.iterator(); iter.hasNext();) { + char[] element = (char[]) iter.next(); + sb.append(HandleProviderDelimiter.getDelimiter(ipe)); + sb.append(NameConvertor.createShortName(element, false, false)); + } } return sb.toString(); } diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java index 8d3f74044..4c6bcd37b 100644 --- a/asm/src/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java @@ -594,13 +594,28 @@ public class ProgramElement implements IProgramElement { return parameters; } - public void setParameterSignatures(List list) { - if (kvpairs == Collections.EMPTY_MAP) + public List getParameterSignaturesSourceRefs() { + List parameters = (List) kvpairs.get("parameterSigsSourceRefs"); + return parameters; + } + + /** + * Set the parameter signatures for this method/constructor. The bit flags tell us if any were not singletypereferences in the + * the source. A singletypereference would be 'String' - whilst a qualifiedtypereference would be 'java.lang.String' - this has + * an effect on the handles. + */ + public void setParameterSignatures(List list, List sourceRefs) { + if (kvpairs == Collections.EMPTY_MAP) { kvpairs = new HashMap(); - if (list == null || list.size() == 0) + } + if (list == null || list.size() == 0) { kvpairs.put("parameterSigs", Collections.EMPTY_LIST); - else + } else { kvpairs.put("parameterSigs", list); + } + if (sourceRefs != null && sourceRefs.size() != 0) { + kvpairs.put("parameterSigsSourceRefs", sourceRefs); + } } public String getDetails() { -- 2.39.5