Re: [aspectj-users] pointcut to match "return" statements

2014-01-06 Thread Andy Clement
Have you tried the support for null/notnull checks that are supported in the Eclipse Java compiler? http://wiki.eclipse.org/JDT_Core/Null_Analysis - this compiler can be used outside of eclipse. I don't know if it precisely checks the kind of thing you are describing though. As already discussed h

Re: [aspectj-users] pointcut to match "return" statements

2014-01-06 Thread Sean Patrick Floyd
On 06.01.2014 15:59, Alexander Kriegisch wrote: A) Returning null is not necessarily a programming error. Not handling null results gracefully might be though. I'm aware of that, that's why we allow the @Nullable annotation for such cases. B) How should it be possible to statically determi

Re: [aspectj-users] pointcut to match "return" statements

2014-01-06 Thread Alexander Kriegisch
A) Returning null is not necessarily a programming error. Not handling null results gracefully might be though. B) How should it be possible to statically determine a non-trivial (dynamically created) return value during compile time? If you want to catch typical, statically determinable bugs u

Re: [aspectj-users] pointcut to match "return" statements

2014-01-06 Thread Sean Patrick Floyd
On 06.01.2014 15:26, Alexander Kriegisch wrote: You can neither match "return null" nor assignments to local variables, only assignments to member variables. What you can do is match returning calls or executions and check their results dynamically like this: after() returning(Object res

Re: [aspectj-users] pointcut to match "return" statements

2014-01-06 Thread Alexander Kriegisch
You can neither match "return null" nor assignments to local variables, only assignments to member variables. What you can do is match returning calls or executions and check their results dynamically like this: after() returning(Object result) : execution(!void *(..)) { if (result

[aspectj-users] pointcut to match "return" statements

2014-01-06 Thread Sean Patrick Floyd
Hi, is there any way for me to match "return null" statements statically? I would like to create a policy enforcement aspect that forbids null returns unless the method is marked as @Nullable. I'm aware this check wouldn't be perfect because it could always be tricked with a variable: String res