diff options
author | aclement <aclement> | 2006-06-06 08:38:28 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-06-06 08:38:28 +0000 |
commit | 5e74f35fa0ac6002b0a291259b88c1b0017fbf40 (patch) | |
tree | 4058bc2e6745d73742c7faeea0d0130addf04879 /asm | |
parent | d1dbf827ea64012890fd2de97d684722f81f3226 (diff) | |
download | aspectj-5e74f35fa0ac6002b0a291259b88c1b0017fbf40.tar.gz aspectj-5e74f35fa0ac6002b0a291259b88c1b0017fbf40.zip |
some code for 141730 - store type signatures in program elements rather than processed type names.
Diffstat (limited to 'asm')
-rw-r--r-- | asm/.classpath | 13 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/AsmManager.java | 3 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/IHierarchy.java | 3 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/INameConvertor.java | 17 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/IProgramElement.java | 7 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java | 9 | ||||
-rw-r--r-- | asm/src/org/aspectj/asm/internal/ProgramElement.java | 50 |
7 files changed, 80 insertions, 22 deletions
diff --git a/asm/.classpath b/asm/.classpath index 5781c41ae..a96910321 100644 --- a/asm/.classpath +++ b/asm/.classpath @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="testsrc"/> - <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> - <classpathentry kind="src" path="/bridge"/> - <classpathentry kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/junit-src.jar"/> - <classpathentry kind="output" path="bin"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="testsrc"/> + <classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/> + <classpathentry kind="src" path="/bridge"/> + <classpathentry sourcepath="/lib/junit/junit-src.jar" kind="lib" path="/lib/junit/junit.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/util"/> + <classpathentry kind="output" path="bin"/> </classpath> diff --git a/asm/src/org/aspectj/asm/AsmManager.java b/asm/src/org/aspectj/asm/AsmManager.java index e9b8c4bc1..f7d0c677e 100644 --- a/asm/src/org/aspectj/asm/AsmManager.java +++ b/asm/src/org/aspectj/asm/AsmManager.java @@ -77,8 +77,9 @@ public class AsmManager { handleProvider = new OptimizedFullPathHandleProvider(); } - public void createNewASM() { + public void createNewASM(INameConvertor convertor) { hierarchy = new AspectJElementHierarchy(); + hierarchy.setNameConvertor(convertor); mapper = new RelationshipMap(hierarchy); } diff --git a/asm/src/org/aspectj/asm/IHierarchy.java b/asm/src/org/aspectj/asm/IHierarchy.java index d458da338..82428481b 100644 --- a/asm/src/org/aspectj/asm/IHierarchy.java +++ b/asm/src/org/aspectj/asm/IHierarchy.java @@ -102,4 +102,7 @@ public interface IHierarchy extends Serializable { public void flushHandleMap(); public void updateHandleMap(Set deletedFiles); + + public void setNameConvertor(INameConvertor convertor); + public INameConvertor getNameConvertor(); }
\ No newline at end of file diff --git a/asm/src/org/aspectj/asm/INameConvertor.java b/asm/src/org/aspectj/asm/INameConvertor.java new file mode 100644 index 000000000..58197bbf7 --- /dev/null +++ b/asm/src/org/aspectj/asm/INameConvertor.java @@ -0,0 +1,17 @@ +/******************************************************************** + * Copyright (c) 2006 Contributors. All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version + *******************************************************************/ +package org.aspectj.asm; + +public interface INameConvertor { + + public char[] convertName(char[] name); + +} diff --git a/asm/src/org/aspectj/asm/IProgramElement.java b/asm/src/org/aspectj/asm/IProgramElement.java index d0024aac8..f88c2dbba 100644 --- a/asm/src/org/aspectj/asm/IProgramElement.java +++ b/asm/src/org/aspectj/asm/IProgramElement.java @@ -116,12 +116,13 @@ public interface IProgramElement extends Serializable { public String toLabelString(); public String toLabelString(boolean getFullyQualifiedArgTypes); - public List getParameterTypes(); - public void setParameterTypes(List list); - public List getParameterNames(); public void setParameterNames(List list); + public List getParameterSignatures(); + public void setParameterSignatures(List list); + public List getParameterTypes(); + /** * The format of the string handle is not specified, but is stable across * compilation sessions. diff --git a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java index 42c60a203..62a1a31a8 100644 --- a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java +++ b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java @@ -29,6 +29,7 @@ public class AspectJElementHierarchy implements IHierarchy { protected IProgramElement root = null; protected String configFile = null; + private transient INameConvertor convertor = null; private Map fileMap = null; private Map handleMap = null; @@ -449,5 +450,13 @@ public class AspectJElementHierarchy implements IHierarchy { return hid.substring(0,hid.indexOf("|")); } + public void setNameConvertor(INameConvertor convertor) { + this.convertor = convertor; + } + + public INameConvertor getNameConvertor() { + return convertor; + } + } diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java index 35b6a60be..0e8826fc1 100644 --- a/asm/src/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java @@ -22,9 +22,11 @@ import java.util.Map; import org.aspectj.asm.AsmManager; import org.aspectj.asm.HierarchyWalker; +import org.aspectj.asm.INameConvertor; import org.aspectj.asm.IProgramElement; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; +import org.aspectj.util.CharOperation; /** @@ -408,16 +410,22 @@ public class ProgramElement implements IProgramElement { sb.append(name); List ptypes = getParameterTypes(); - if (ptypes != null) { + if (ptypes != null && (!ptypes.isEmpty() + || this.kind.equals(IProgramElement.Kind.METHOD)) + || this.kind.equals(IProgramElement.Kind.CONSTRUCTOR) + || this.kind.equals(IProgramElement.Kind.ADVICE) + || this.kind.equals(IProgramElement.Kind.POINTCUT) + || this.kind.equals(IProgramElement.Kind.INTER_TYPE_METHOD) + || this.kind.equals(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR)) { sb.append('('); for (Iterator it = ptypes.iterator(); it.hasNext(); ) { - String arg = (String)it.next(); + char[] arg = (char[])it.next(); if (getFullyQualifiedArgTypes) { sb.append(arg); } else { - int index = arg.lastIndexOf("."); + int index = CharOperation.lastIndexOf('.',arg); if (index != -1) { - sb.append(arg.substring(index + 1)); + sb.append(CharOperation.subarray(arg,index+1,arg.length)); } else { sb.append(arg); } @@ -503,17 +511,35 @@ public class ProgramElement implements IProgramElement { //parameterNames = list; } - public List getParameterTypes() { - List parameterTypes = (List)kvpairs.get("parameterTypes"); - return parameterTypes; + public List getParameterTypes() { + List l = getParameterSignatures(); + if (l == null || l.isEmpty()) { + return Collections.EMPTY_LIST; + } + List params = new ArrayList(); + for (Iterator iter = l.iterator(); iter.hasNext();) { + char[] param = (char[])iter.next(); + INameConvertor convertor = AsmManager.getDefault().getHierarchy().getNameConvertor(); + if (convertor != null) { + params.add(convertor.convertName(param)); + } else { + params.add(param); + } + } + return params; } - public void setParameterTypes(List list) { - if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); - if (list==null || list.size()==0) kvpairs.put("parameterTypes",Collections.EMPTY_LIST); - else kvpairs.put("parameterTypes",list); -// parameterTypes = list; + + public List getParameterSignatures() { + List parameters = (List)kvpairs.get("parameterSigs"); + return parameters; } + public void setParameterSignatures(List list) { + if (kvpairs==Collections.EMPTY_MAP) kvpairs = new HashMap(); + if (list==null || list.size()==0) kvpairs.put("parameterSigs",Collections.EMPTY_LIST); + else kvpairs.put("parameterSigs",list); + } + public String getDetails() { String details = (String)kvpairs.get("details"); return details; |