Paul Clapham wrote:Good to hear that!
As for "what happens under the hood", that isn't what you need to know. You need to know how variables work in Java. Here's a link to a pretty decent tutorial which tells you about that: Variable Scope in Java.
And then you say that some other code tries to use some other value, and it's null. Right?
Well no, it's not what I'm saying or what I tryied to say.
Thanks for your help but I think you misunderstood the point. The behaviour I was facing was not inside the aspect but inside the method that is matching the aspect:
playerRepository.findById(id) was returning null as result, even if the entity exists, so I was facing a null pointer exception:
playerRepository.findById(id).orElse(null);.
I'm not sure that it's related to the variables scope, but if you say that for some reason the variable
result is needed by the
getById method, so probably it could be related to that variable (not specifically about the scope you're telling me), then if it is I want to know the reason why.