aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2002-12-23 23:17:47 +0000
committerjhugunin <jhugunin>2002-12-23 23:17:47 +0000
commitc453b5555c372b0052abd037adf8d6bd9b1e95b2 (patch)
tree41dd7ca19a9148fc61fa7ac53e4d21c4ad02542e
parent4e52d3a759b8b5b5566c186eacbffbdff21058fd (diff)
downloadaspectj-c453b5555c372b0052abd037adf8d6bd9b1e95b2.tar.gz
aspectj-c453b5555c372b0052abd037adf8d6bd9b1e95b2.zip
fixed to use A.aspectOf() instead of A.ajc$perSingletonField for getting
singleton aspects this lets us produce much better errors when the field is null
-rw-r--r--weaver/testdata/NonStaticBeforeFancyHelloWorld.txt3
-rw-r--r--weaver/testdata/NonStaticBeforeHelloWorld.txt3
-rw-r--r--weaver/testdata/TraceJarHello.txt8
-rw-r--r--weaver/testsrc/Aspect.java2
4 files changed, 10 insertions, 6 deletions
diff --git a/weaver/testdata/NonStaticBeforeFancyHelloWorld.txt b/weaver/testdata/NonStaticBeforeFancyHelloWorld.txt
index 84821964a..9fc369039 100644
--- a/weaver/testdata/NonStaticBeforeFancyHelloWorld.txt
+++ b/weaver/testdata/NonStaticBeforeFancyHelloWorld.txt
@@ -10,7 +10,7 @@ public abstract class FancyHelloWorld extends java.lang.Object:
public static void main(String[]):
method-execution(void FancyHelloWorld.main(java.lang.String[]))
| field-get(java.io.PrintStream java.lang.System.out)
- | | GETSTATIC Aspect.ajc$perSingletonInstance LAspect;
+ | | INVOKESTATIC Aspect.aspectOf ()LAspect;
| | INVOKEVIRTUAL Aspect.ajc_before ()V
| | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 9)
| field-get(java.io.PrintStream java.lang.System.out)
@@ -76,4 +76,5 @@ public abstract class FancyHelloWorld extends java.lang.Object:
| ARETURN
method-execution(java.lang.String FancyHelloWorld.getName())
end public static String getName()
+
end public abstract class FancyHelloWorld
diff --git a/weaver/testdata/NonStaticBeforeHelloWorld.txt b/weaver/testdata/NonStaticBeforeHelloWorld.txt
index 2786f0844..b8b7fb001 100644
--- a/weaver/testdata/NonStaticBeforeHelloWorld.txt
+++ b/weaver/testdata/NonStaticBeforeHelloWorld.txt
@@ -10,7 +10,7 @@ public class HelloWorld extends java.lang.Object:
public static void main(String[]):
method-execution(void HelloWorld.main(java.lang.String[]))
| field-get(java.io.PrintStream java.lang.System.out)
- | | GETSTATIC Aspect.ajc$perSingletonInstance LAspect;
+ | | INVOKESTATIC Aspect.aspectOf ()LAspect;
| | INVOKEVIRTUAL Aspect.ajc_before ()V
| | GETSTATIC java.lang.System.out Ljava/io/PrintStream; (line 8)
| field-get(java.io.PrintStream java.lang.System.out)
@@ -21,4 +21,5 @@ public class HelloWorld extends java.lang.Object:
| RETURN (line 11)
method-execution(void HelloWorld.main(java.lang.String[]))
end public static void main(String[])
+
end public class HelloWorld
diff --git a/weaver/testdata/TraceJarHello.txt b/weaver/testdata/TraceJarHello.txt
index 0741a7ac1..6d96a9025 100644
--- a/weaver/testdata/TraceJarHello.txt
+++ b/weaver/testdata/TraceJarHello.txt
@@ -62,10 +62,10 @@ public class DynamicHelloWorld extends java.lang.Object implements java.io.Seria
ALOAD_2
ASTORE 4
method-execution(java.lang.String DynamicHelloWorld.doit(java.lang.String, java.util.List))
- | GETSTATIC MyTrace.ajc$perSingletonInstance LMyTrace;
+ | INVOKESTATIC MyTrace.aspectOf ()LMyTrace;
| ALOAD_0
| INVOKEVIRTUAL Trace.ajc$before$Trace$51 (Ljava/lang/Object;)V
- | GETSTATIC MyTrace.ajc$perSingletonInstance LMyTrace;
+ | INVOKESTATIC MyTrace.aspectOf ()LMyTrace;
| BIPUSH 3
| ANEWARRAY java.lang.Object
| ASTORE 6
@@ -90,7 +90,7 @@ public class DynamicHelloWorld extends java.lang.Object implements java.io.Seria
| GOTO L0
| L0: DUP
| ASTORE 7
- | GETSTATIC MyTrace.ajc$perSingletonInstance LMyTrace;
+ | INVOKESTATIC MyTrace.aspectOf ()LMyTrace;
| ALOAD_0
| ALOAD 7
| INVOKEVIRTUAL MyTrace.ajc$afterReturning$MyTrace$6e (Ljava/lang/Object;Ljava/lang/Object;)V
@@ -113,7 +113,7 @@ public class DynamicHelloWorld extends java.lang.Object implements java.io.Seria
end static final String doit_aroundBody0(DynamicHelloWorld, String, java.util.List)
static final String doit_aroundBody2(DynamicHelloWorld, String, java.util.List):
- GETSTATIC MyTrace.ajc$perSingletonInstance LMyTrace;
+ INVOKESTATIC MyTrace.aspectOf ()LMyTrace;
ALOAD_0
BIPUSH 3
ANEWARRAY java.lang.Object
diff --git a/weaver/testsrc/Aspect.java b/weaver/testsrc/Aspect.java
index bdb8108f4..1447c5335 100644
--- a/weaver/testsrc/Aspect.java
+++ b/weaver/testsrc/Aspect.java
@@ -329,6 +329,8 @@ public class Aspect {
}
public static Aspect aspectOf() {
+ if (ajc$perSingletonInstance != null) return ajc$perSingletonInstance;
+
return (Aspect) ajc$perCflowStack.peekInstance();
}