Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] How to identify the return value's annotation in compile time

Title: How to identify the return value's annotation in compile time

Hi

I want to define a compile-time pointcut (to use in "declare error") which identifies whether a method's return value has a certain annotation defined on it.

Here is an example. I want my aspect to create a compilation error on the method g().

class ReturnValue1 { }

@Ohno class ReturnValue2 { }

class MyClass {

        ReturnValue1 f() { … }    // this is OK

        ReturnValue2 g() { … }   // this is invalid

}

Anyone has an idea how to do this?

Thanks


Back to the top