From 002e7a56f128de8b8f0e27a19c3e8c171dfc983c Mon Sep 17 00:00:00 2001
From: Tucker Siegel <tgsiegel@terpmail.umd.edu>
Date: Fri, 7 Apr 2023 15:43:25 -0400
Subject: [PATCH] require edu.umd.dawn for use of annotations

---
 src/main/java/edu/umd/dawn/common/annotations/AspectBase.java | 4 ----
 .../edu/umd/dawn/common/annotations/DeprecatedAspect.java     | 2 +-
 .../umd/dawn/common/annotations/RoleRestrictionAspect.java    | 2 +-
 .../java/edu/umd/dawn/common/annotations/TraceableAspect.java | 2 +-
 .../edu/umd/dawn/common/annotations/UnfinishedAspect.java     | 2 +-
 5 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/main/java/edu/umd/dawn/common/annotations/AspectBase.java b/src/main/java/edu/umd/dawn/common/annotations/AspectBase.java
index dcda5ff..fe80d97 100644
--- a/src/main/java/edu/umd/dawn/common/annotations/AspectBase.java
+++ b/src/main/java/edu/umd/dawn/common/annotations/AspectBase.java
@@ -29,8 +29,4 @@ public class AspectBase<T extends Annotation> {
                 ((MethodSignature) jointPoint.getSignature()).getDeclaringType().getAnnotation(clazz);
     }
 
-    // protected T grabMethodArgument(ProceedingJoinPoint jointPoint, Class<T> clazz) {
-    //     return (T)
-    //             ((MethodSignature) jointPoint.getSignature()).getDeclaringType().getAnnotation(clazz);
-    // }
 }
diff --git a/src/main/java/edu/umd/dawn/common/annotations/DeprecatedAspect.java b/src/main/java/edu/umd/dawn/common/annotations/DeprecatedAspect.java
index 28acc59..7a65271 100644
--- a/src/main/java/edu/umd/dawn/common/annotations/DeprecatedAspect.java
+++ b/src/main/java/edu/umd/dawn/common/annotations/DeprecatedAspect.java
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
 @Log4j2
 public class DeprecatedAspect extends AspectBase<Deprecated> {
 
-    @Around("@annotation(Deprecated)")
+    @Around("@annotation(Deprecated) && within(edu.umd.dawn..**)")
     public Object run(ProceedingJoinPoint jointPoint) throws Exception, Throwable {
         Deprecated annotation = grabAnnotation(jointPoint, Deprecated.class);
         String descriptor = getFullDescriptor(jointPoint);
diff --git a/src/main/java/edu/umd/dawn/common/annotations/RoleRestrictionAspect.java b/src/main/java/edu/umd/dawn/common/annotations/RoleRestrictionAspect.java
index b57c860..e9d5f2f 100644
--- a/src/main/java/edu/umd/dawn/common/annotations/RoleRestrictionAspect.java
+++ b/src/main/java/edu/umd/dawn/common/annotations/RoleRestrictionAspect.java
@@ -24,7 +24,7 @@ public class RoleRestrictionAspect extends AspectBase<RoleRestriction> {
     @Value("${config.local}")
     private boolean local = false;
 
-    @Around("@annotation(RoleRestriction)")
+    @Around("@annotation(RoleRestriction) && within(edu.umd.dawn..**)")
     public Object run(ProceedingJoinPoint jointPoint) throws Exception, Throwable {
         RoleRestriction annotation = grabAnnotation(jointPoint, RoleRestriction.class);
         if (!local) {
diff --git a/src/main/java/edu/umd/dawn/common/annotations/TraceableAspect.java b/src/main/java/edu/umd/dawn/common/annotations/TraceableAspect.java
index f2afac9..aef02b1 100644
--- a/src/main/java/edu/umd/dawn/common/annotations/TraceableAspect.java
+++ b/src/main/java/edu/umd/dawn/common/annotations/TraceableAspect.java
@@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class TraceableAspect extends AspectBase<Traceable> {
 
-    @Around("@annotation(Traceable)")
+    @Around("@annotation(Traceable) && within(edu.umd.dawn..**)")
     public Object run(ProceedingJoinPoint jointPoint) throws Exception, Throwable {
         Traceable traceable = grabAnnotation(jointPoint, Traceable.class);
 
diff --git a/src/main/java/edu/umd/dawn/common/annotations/UnfinishedAspect.java b/src/main/java/edu/umd/dawn/common/annotations/UnfinishedAspect.java
index 781dbf5..d4b4fc3 100644
--- a/src/main/java/edu/umd/dawn/common/annotations/UnfinishedAspect.java
+++ b/src/main/java/edu/umd/dawn/common/annotations/UnfinishedAspect.java
@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
 @Log4j2
 public class UnfinishedAspect extends AspectBase<Unfinished> {
 
-    @Around("@annotation(Unfinished)")
+    @Around("@annotation(Unfinished) && within(edu.umd.dawn..**)")
     public Object run(ProceedingJoinPoint jointPoint) throws Exception, Throwable {
         Unfinished unfinished = grabAnnotation(jointPoint, Unfinished.class);
 
-- 
GitLab