eclipse-aspectj / aspectj

Other
272 stars 82 forks source link

fix NPE when using LTW cache; fix TODO in cache #287

Closed KimmingLau closed 4 months ago

KimmingLau commented 4 months ago

1.write SAME_BYTES to cacheMap when wovenbytes is null
2.fix TODO in SimpleCache#getAndInitialize, use Optional to help indicating case in which Hit cache but need to return null

Fixes #285.

kriegaex commented 4 months ago

Thanks for the reproducer and the proposed fix. Actually, there is one existing integration test in AspectJ which because of an erroneous import was never executed. Instead, another test with the same name from another package was executed twice. Anyway, I added another test similar to your reproducer for this bug, i.e. we have two tests reproducing the problem.

As for your fix, I think I will go with a simpler solution without Optional, but otherwise similar to your suggestion.

kriegaex commented 4 months ago

Superseded by #289. But I mentioned you as a co-author in the commit fixing the problem.