Describe the bug
As demonstrated in #4016 the implementation for checking if NonNull annotations are present (e.g. when generating constructors) is inefficient.
- The time taken to find a match depends on the order of the array being search, with android NonNull annotations performing best.
- The method implementing the match does work that does not apply to this list of annotations (i.e. looking for
$ within the FQCN) and the fix appears to be the correct lookup.
To Reproduce
Run the benchmark.compile and benchmark ant tasks from branch https://github.com/SolumXplain/lombok/tree/refs/heads/hasNonNullOptimize-jmh against the last and last but one commits of the PR branch.
Expected behavior
There should not be a significant difference between matching different NonNull annotations.
Version info (please complete the following information):
- Lombok version: 1.18.30
- Platform: all - PoC just demonstrates javac fix for now