[java-annotations] More annotations for reflection; Nullable for generic return type

Should fix IDEA-366828 AnnotatedElement#getAnnotation incorrectly seen as non-null in null-marked code

GitOrigin-RevId: ea8bf3f0e5f703090b0c56114c2d03aa9a75dc23
This commit is contained in:
Tagir Valeev
2025-02-14 13:09:29 +01:00
committed by intellij-monorepo-bot
parent 6e3a5e0e8e
commit e95fbbb2d4
2 changed files with 131 additions and 0 deletions

View File

@@ -146,6 +146,7 @@
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.Class A getAnnotation(java.lang.Class&lt;A&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -154,6 +155,7 @@
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.Class A getDeclaredAnnotation(java.lang.Class&lt;A&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -914,6 +916,7 @@
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.Package A getAnnotation(java.lang.Class&lt;A&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -922,6 +925,7 @@
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.Package A getDeclaredAnnotation(java.lang.Class&lt;A&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>

View File

@@ -1,7 +1,16 @@
<root>
<item name='java.lang.reflect.AccessibleObject T getAnnotation(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Nullable'/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.AccessibleObject T getAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.AccessibleObject T getDeclaredAnnotation(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.reflect.AccessibleObject T getDeclaredAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -19,6 +28,12 @@
<item name='java.lang.reflect.AccessibleObject T[] getDeclaredAnnotationsByType(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item
name='java.lang.reflect.AccessibleObject boolean isAnnotationPresent(java.lang.Class&lt;? extends java.lang.annotation.Annotation&gt;)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item
name='java.lang.reflect.AccessibleObject boolean isAnnotationPresent(java.lang.Class&lt;? extends java.lang.annotation.Annotation&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -46,10 +61,17 @@
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.reflect.AnnotatedElement T getAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.AnnotatedElement T getDeclaredAnnotation(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.reflect.AnnotatedElement T getDeclaredAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.AnnotatedElement T[] getAnnotationsByType(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -165,6 +187,7 @@
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.reflect.Constructor T getAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -272,16 +295,55 @@
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
</item>
<item name='java.lang.reflect.Executable T getAnnotation(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Nullable'/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Executable T getAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.Executable T[] getAnnotationsByType(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Executable T[] getAnnotationsByType(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.Executable java.lang.Class&lt;?&gt; getDeclaringClass()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.Executable java.lang.annotation.Annotation[] getDeclaredAnnotations()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
</item>
<item name='java.lang.reflect.Executable java.lang.annotation.Annotation[][] getParameterAnnotations()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]/[]"/>
</item>
<item name='java.lang.reflect.Executable java.lang.reflect.AnnotatedType[] getAnnotatedParameterTypes()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
</item>
<item name='java.lang.reflect.Field T getAnnotation(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.reflect.Field T getAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -424,6 +486,7 @@
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.reflect.Method T getAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
@@ -549,6 +612,70 @@
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
</item>
<item name='java.lang.reflect.Parameter T getAnnotation(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.reflect.Parameter T getAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.Parameter T getDeclaredAnnotation(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Nullable'/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Parameter T getDeclaredAnnotation(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.Parameter T[] getAnnotationsByType(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Parameter T[] getAnnotationsByType(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.Parameter T[] getDeclaredAnnotationsByType(java.lang.Class&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Parameter T[] getDeclaredAnnotationsByType(java.lang.Class&lt;T&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.reflect.Parameter boolean isImplicit()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Parameter boolean isSynthetic()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Parameter boolean isVarArgs()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Parameter java.lang.annotation.Annotation[] getAnnotations()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.Parameter java.lang.annotation.Annotation[] getDeclaredAnnotations()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
<annotation name='org.jetbrains.annotations.NotNull' typePath="/[]"/>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.reflect.ParameterizedType java.lang.reflect.Type getOwnerType()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>