summaryrefslogtreecommitdiffstats
path: root/bcel-builder/src
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-21 14:59:55 +0000
committeracolyer <acolyer>2005-09-21 14:59:55 +0000
commita39f595c0cdcddf8eac0b99e1918d0578f2dc501 (patch)
tree94865da1d5f277582d9d0720347693cd3b3c258a /bcel-builder/src
parentfc2d08e2ae9d03fb377bd0ed0bd56983af4687a5 (diff)
downloadaspectj-a39f595c0cdcddf8eac0b99e1918d0578f2dc501.tar.gz
aspectj-a39f595c0cdcddf8eac0b99e1918d0578f2dc501.zip
tests and implementation for 108120 - runtime pointcut parsing and matching.
Diffstat (limited to 'bcel-builder/src')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java23
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java14
2 files changed, 35 insertions, 2 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
index 29676da59..e92f6a798 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
@@ -77,7 +77,7 @@ import java.util.StringTokenizer;
* class file. Those interested in programatically generating classes
* should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
- * @version $Id: JavaClass.java,v 1.6 2005/07/08 15:17:23 aclement Exp $
+ * @version $Id: JavaClass.java,v 1.7 2005/09/21 15:02:05 acolyer Exp $
* @see org.aspectj.apache.bcel.generic.ClassGen
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
@@ -454,6 +454,27 @@ public class JavaClass extends AccessFlags implements Cloneable, Node {
return null;
}
+
+ public Method getMethod(java.lang.reflect.Constructor c) {
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+
+ if (method.getName().equals("<init>")
+ && (c.getModifiers() == method.getModifiers())
+ && Type.getSignature(c).equals(method.getSignature())) {
+ return method;
+ }
+ }
+
+ return null;
+ }
+
+ public Field getField(java.lang.reflect.Field field) {
+ for (int i = 0; i < fields.length; i++) {
+ if (fields[i].getName().equals(field.getName())) return fields[i];
+ }
+ return null;
+ }
/**
* @return Minor number of class file version.
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java
index dee474795..c20a4ff04 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/Type.java
@@ -65,7 +65,7 @@ import org.aspectj.apache.bcel.classfile.Utility;
* Abstract super class for all possible java types, namely basic types
* such as int, object types like String and array types, e.g. int[]
*
- * @version $Id: Type.java,v 1.5 2005/06/01 14:57:23 aclement Exp $
+ * @version $Id: Type.java,v 1.6 2005/09/21 15:02:04 acolyer Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*
* modified:
@@ -305,6 +305,18 @@ public abstract class Type implements java.io.Serializable {
return sb.toString();
}
+ public static String getSignature(java.lang.reflect.Constructor cons) {
+ StringBuffer sb = new StringBuffer("(");
+ Class[] params = cons.getParameterTypes(); // avoid clone
+
+ for(int j = 0; j < params.length; j++) {
+ sb.append(getType(params[j]).getSignature());
+ }
+
+ sb.append(")V");
+ return sb.toString();
+ }
+
public static class TypeHolder {
private Type t;
private int consumed;