aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormwebster <mwebster>2006-09-04 14:24:51 +0000
committermwebster <mwebster>2006-09-04 14:24:51 +0000
commit090de7e4c5c9618f965259f93de6d490050543da (patch)
tree9a39483fc3002f11ea750a6675ae0583d1604f97
parent14e8b7d8f0c94d316665036c3968821f8874678e (diff)
downloadaspectj-090de7e4c5c9618f965259f93de6d490050543da.tar.gz
aspectj-090de7e4c5c9618f965259f93de6d490050543da.zip
Bug 155972 "NullPointerException in ConstructorSignature.getConstructor()"
-rw-r--r--lib/aspectj/lib/aspectjrt.jarbin115011 -> 114999 bytes
-rw-r--r--lib/test/aspectjrt.jarbin115011 -> 114999 bytes
-rw-r--r--runtime/src/org/aspectj/runtime/reflect/ConstructorSignatureImpl.java2
-rw-r--r--runtime/src/org/aspectj/runtime/reflect/FieldSignatureImpl.java2
-rw-r--r--runtime/src/org/aspectj/runtime/reflect/InitializerSignatureImpl.java2
-rw-r--r--tests/bugs153/pr155972/ConstructorTest.java8
-rw-r--r--tests/bugs153/pr155972/FieldTest.java9
-rw-r--r--tests/bugs153/pr155972/InitializerTest.java8
-rw-r--r--tests/bugs153/pr155972/SignatureImplAspect.aj30
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java12
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/ajc153.xml27
11 files changed, 97 insertions, 3 deletions
diff --git a/lib/aspectj/lib/aspectjrt.jar b/lib/aspectj/lib/aspectjrt.jar
index f0a934778..63ed037da 100644
--- a/lib/aspectj/lib/aspectjrt.jar
+++ b/lib/aspectj/lib/aspectjrt.jar
Binary files differ
diff --git a/lib/test/aspectjrt.jar b/lib/test/aspectjrt.jar
index f0a934778..63ed037da 100644
--- a/lib/test/aspectjrt.jar
+++ b/lib/test/aspectjrt.jar
Binary files differ
diff --git a/runtime/src/org/aspectj/runtime/reflect/ConstructorSignatureImpl.java b/runtime/src/org/aspectj/runtime/reflect/ConstructorSignatureImpl.java
index 985300360..a7f688d58 100644
--- a/runtime/src/org/aspectj/runtime/reflect/ConstructorSignatureImpl.java
+++ b/runtime/src/org/aspectj/runtime/reflect/ConstructorSignatureImpl.java
@@ -48,7 +48,7 @@ class ConstructorSignatureImpl extends CodeSignatureImpl implements ConstructorS
public Constructor getConstructor() {
if (constructor == null) {
try {
- constructor = declaringType.getDeclaredConstructor(getParameterTypes());
+ constructor = getDeclaringType().getDeclaredConstructor(getParameterTypes());
} catch (Exception ex) {
; // nothing we can do, caller will see null
}
diff --git a/runtime/src/org/aspectj/runtime/reflect/FieldSignatureImpl.java b/runtime/src/org/aspectj/runtime/reflect/FieldSignatureImpl.java
index f22b603a5..8c3de24c4 100644
--- a/runtime/src/org/aspectj/runtime/reflect/FieldSignatureImpl.java
+++ b/runtime/src/org/aspectj/runtime/reflect/FieldSignatureImpl.java
@@ -55,7 +55,7 @@ public class FieldSignatureImpl extends MemberSignatureImpl implements FieldSign
public Field getField() {
if (field == null) {
try {
- field = declaringType.getDeclaredField(getName());
+ field = getDeclaringType().getDeclaredField(getName());
} catch (Exception ex) {
; // nothing we can do, caller will see null
}
diff --git a/runtime/src/org/aspectj/runtime/reflect/InitializerSignatureImpl.java b/runtime/src/org/aspectj/runtime/reflect/InitializerSignatureImpl.java
index 8b074e707..adb8f840e 100644
--- a/runtime/src/org/aspectj/runtime/reflect/InitializerSignatureImpl.java
+++ b/runtime/src/org/aspectj/runtime/reflect/InitializerSignatureImpl.java
@@ -50,7 +50,7 @@ class InitializerSignatureImpl extends CodeSignatureImpl implements InitializerS
public Constructor getInitializer() {
if (constructor == null) {
try {
- constructor = declaringType.getDeclaredConstructor(getParameterTypes());
+ constructor = getDeclaringType().getDeclaredConstructor(getParameterTypes());
} catch (Exception ex) {
; // nothing we can do, caller will see null
}
diff --git a/tests/bugs153/pr155972/ConstructorTest.java b/tests/bugs153/pr155972/ConstructorTest.java
new file mode 100644
index 000000000..f3aac9072
--- /dev/null
+++ b/tests/bugs153/pr155972/ConstructorTest.java
@@ -0,0 +1,8 @@
+
+public class ConstructorTest {
+
+ public static void main(String[] args) {
+ new ConstructorTest();
+ }
+
+}
diff --git a/tests/bugs153/pr155972/FieldTest.java b/tests/bugs153/pr155972/FieldTest.java
new file mode 100644
index 000000000..53ae50f63
--- /dev/null
+++ b/tests/bugs153/pr155972/FieldTest.java
@@ -0,0 +1,9 @@
+public class FieldTest {
+
+ private static int intField;
+
+ public static void main(String[] args) {
+ intField = 999;
+ }
+
+}
diff --git a/tests/bugs153/pr155972/InitializerTest.java b/tests/bugs153/pr155972/InitializerTest.java
new file mode 100644
index 000000000..94b3ed434
--- /dev/null
+++ b/tests/bugs153/pr155972/InitializerTest.java
@@ -0,0 +1,8 @@
+
+public class InitializerTest {
+
+
+ public static void main(String[] args) {
+ }
+
+}
diff --git a/tests/bugs153/pr155972/SignatureImplAspect.aj b/tests/bugs153/pr155972/SignatureImplAspect.aj
new file mode 100644
index 000000000..e28eb1bdc
--- /dev/null
+++ b/tests/bugs153/pr155972/SignatureImplAspect.aj
@@ -0,0 +1,30 @@
+
+
+import java.lang.reflect.Member;
+
+import org.aspectj.lang.reflect.ConstructorSignature;
+import org.aspectj.lang.reflect.FieldSignature;
+import org.aspectj.lang.reflect.InitializerSignature;
+
+public aspect SignatureImplAspect {
+ before () : (execution(ConstructorTest.new(..))) {
+ //thisJoinPointStaticPart.getSignature().getDeclaringType();
+ Member m = ((ConstructorSignature) thisJoinPointStaticPart
+ .getSignature()).getConstructor();
+ System.out.println(m.getName());
+ }
+
+ before() : set(int FieldTest.intField) {
+ //thisJoinPointStaticPart.getSignature().getDeclaringType();
+ Member m = ((FieldSignature) thisJoinPointStaticPart
+ .getSignature()).getField();
+ System.out.println(m.getName());
+ }
+
+ before() : staticinitialization(InitializerTest) {
+ //thisJoinPointStaticPart.getSignature().getDeclaringType();
+ Member m = ((InitializerSignature) thisJoinPointStaticPart
+ .getSignature()).getInitializer();
+ System.out.println(m.getName());
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
index 65f9f913e..8f53af8fc 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
@@ -71,6 +71,18 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("reweavableAspectNotRegistered error");
}
+ public void testNPEinConstructorSignatureImpl_pr155972 () {
+ runTest("NPE in ConstructorSignatureImpl");
+ }
+
+ public void testNPEinFieldSignatureImpl_pr155972 () {
+ runTest("NPE in FieldSignatureImpl");
+ }
+
+ public void testNPEinInitializerSignatureImpl_pr155972 () {
+ runTest("NPE in InitializerSignatureImpl");
+ }
+
/////////////////////////////////////////
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc153Tests.class);
diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
index 68bd94185..2dc4ec7e7 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
+++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
@@ -356,4 +356,31 @@
</run>
</ajc-test>
+ <ajc-test dir="bugs153/pr155972" title="NPE in ConstructorSignatureImpl">
+ <compile files="ConstructorTest.java, SignatureImplAspect.aj" options="-Xlint:ignore"/>
+ <run class="ConstructorTest">
+ <stdout>
+ <line text="ConstructorTest"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs153/pr155972" title="NPE in FieldSignatureImpl">
+ <compile files="FieldTest.java, SignatureImplAspect.aj" options="-Xlint:ignore"/>
+ <run class="FieldTest">
+ <stdout>
+ <line text="intField"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs153/pr155972" title="NPE in InitializerSignatureImpl">
+ <compile files="InitializerTest.java, SignatureImplAspect.aj" options="-Xlint:ignore"/>
+ <run class="InitializerTest">
+ <stdout>
+ <line text="InitializerTest"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
</suite> \ No newline at end of file