From: aclement Date: Tue, 24 Mar 2009 01:53:51 +0000 (+0000) Subject: 265993: more jdt like handles X-Git-Tag: V1_6_4~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=78decedeb5b689a9f2ec1bad7a813b2108c0f845;p=aspectj.git 265993: more jdt like handles --- 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() {