From ab65cbdd5887a1ea4b4e96db044584e347265f9e Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Tue, 13 Jun 2023 09:21:52 +0200 Subject: [PATCH] Add null checks for Shadow.getResolvedSignature() Fixes #243. Signed-off-by: Alexander Kriegisch --- .../src/main/java/org/aspectj/weaver/Shadow.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java index f6c7b7bd8..9e8a2ceec 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java @@ -178,10 +178,11 @@ public abstract class Shadow { if (isShadowForMonitor()) { return UnresolvedType.ARRAY_WITH_JUST_OBJECT; } + ResolvedMember resolvedSig = getResolvedSignature(); if (getKind() == FieldSet) { - return new UnresolvedType[] { getResolvedSignature().getGenericReturnType() }; + return new UnresolvedType[] { resolvedSig == null ? null : resolvedSig.getGenericReturnType() }; } - return getResolvedSignature().getGenericParameterTypes(); + return resolvedSig == null ? null : resolvedSig.getGenericParameterTypes(); } public UnresolvedType getArgType(int arg) { @@ -282,7 +283,8 @@ public abstract class Shadow { } else if (kind == SynchronizationLock || kind == SynchronizationUnlock) { return UnresolvedType.VOID; } - return getResolvedSignature().getGenericReturnType(); + ResolvedMember resolvedSig = getResolvedSignature(); + return resolvedSig == null ? null : resolvedSig.getGenericReturnType(); } public static String METHOD_EXECUTION = "method-execution"; -- 2.39.5