]> source.dussan.org Git - aspectj.git/commitdiff
265993: more jdt like handles
authoraclement <aclement>
Tue, 24 Mar 2009 01:53:51 +0000 (01:53 +0000)
committeraclement <aclement>
Tue, 24 Mar 2009 01:53:51 +0000 (01:53 +0000)
asm/src/org/aspectj/asm/IProgramElement.java
asm/src/org/aspectj/asm/internal/JDTLikeHandleProvider.java
asm/src/org/aspectj/asm/internal/ProgramElement.java

index 18ec291322e34c9940c63c50fbbbc428f708afc0..f13759b12866d54e54cabcdfc59ddcbb4f07e3ec 100644 (file)
@@ -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;
                }
index c822fbf48007160629cd7f5d0742c07c4b087875..92a1d28791406d8425eacc775214822074c87b3d 100644 (file)
@@ -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();
        }
index 8d3f740441bfe16a4c0e1325a9820cdb1e1ec557..4c6bcd37b5e76682bdd4ebadf7c0723b20c5c36c 100644 (file)
@@ -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() {