On Sun, 16 Nov 2025 16:02:58 GMT, Chen Liang <[email protected]> wrote:

> `AnnotatedElement` methods specify they throw NPE if they take any null 
> argument: `isAnnotationPresent`, `get(Declared)Annotation`, 
> `get(Declared)AnnnotationsByType`. However, `AnnotatedType` has 
> implementation quality issues that it does not throw NPE for 
> `isAnnotationPresent` and `get(Declared)Annotation`.
> 
> This patch fixes this oversight by adding explicit null checks. For 
> `get(Declared)AnnotationsByType`, even though it did throw exceptions, it was 
> in the middle of parsing, so throwing it in the beginning is better.

I'm trying to judge the behavior/compatibility impact. Are there cases where 
NPE will be thrown for cases that is doesn't throw today? I get it that the 
parameter checking doesn't check it and instead the NPE comes from deep in the 
implementation, just want to understand if there is any impact of the change or 
not.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28341#issuecomment-3539020865

Reply via email to