diff options
author | wisberg <wisberg> | 2005-04-21 17:33:45 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2005-04-21 17:33:45 +0000 |
commit | 21f753b76c1bafb580f32888ea9ea6bae0b45d88 (patch) | |
tree | b74c1ed613ce65f8c4e95ba1002653226719a32e /runtime/src | |
parent | 7a613809e63e1a3320a7598e8d7381e70c717adc (diff) | |
download | aspectj-21f753b76c1bafb580f32888ea9ea6bae0b45d88.tar.gz aspectj-21f753b76c1bafb580f32888ea9ea6bae0b45d88.zip |
back to 1.3 exception API, report bad method via NoAspectBoundException.
Diffstat (limited to 'runtime/src')
-rw-r--r-- | runtime/src/org/aspectj/lang/Aspects.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/runtime/src/org/aspectj/lang/Aspects.java b/runtime/src/org/aspectj/lang/Aspects.java index d907fce59..2b0c8540c 100644 --- a/runtime/src/org/aspectj/lang/Aspects.java +++ b/runtime/src/org/aspectj/lang/Aspects.java @@ -71,22 +71,21 @@ public class Aspects { private static Method getSingletonAspectOf(Class aspectClass) throws NoSuchMethodException { Method method = aspectClass.getDeclaredMethod(ASPECTOF, EMPTY_CLASS_ARRAY); - method.setAccessible(true); - if (!method.isAccessible() - || !Modifier.isPublic(method.getModifiers()) - || !Modifier.isStatic(method.getModifiers())) { - throw new RuntimeException(aspectClass.getName(), new Exception("aspectOf is not public static")); - } - return method; + return checkAspectOf(method, aspectClass); } private static Method getPerObjectAspectOf(Class aspectClass) throws NoSuchMethodException { Method method = aspectClass.getDeclaredMethod(ASPECTOF, PEROBJECT_CLASS_ARRAY); + return checkAspectOf(method, aspectClass); + } + + private static Method checkAspectOf(Method method, Class aspectClass) + throws NoSuchMethodException { method.setAccessible(true); if (!method.isAccessible() || !Modifier.isPublic(method.getModifiers()) - || !Modifier.isStatic(method.getModifiers())) { - throw new RuntimeException(aspectClass.getName(), new Exception("aspectOf is not public static")); + || !Modifier.isStatic(method.getModifiers())) { + new NoSuchMethodException(aspectClass.getName() + ".aspectOf(..) is not accessible public static"); } return method; } |