[java-analysis] Hard-code that Throwable.initCause is mutates_this

This allows contract inference for methods like AssertionError(Object) constructor.
Fixes IDEA-260003 A warning is shown when Optional.get is called even when Optional.isPresent is verified before

GitOrigin-RevId: 548008f5462b828e0346f089474182f59ec39bd1
This commit is contained in:
Tagir Valeev
2021-01-22 17:54:33 +07:00
committed by intellij-monorepo-bot
parent 13f648a693
commit c5c09c693a
5 changed files with 36 additions and 2 deletions

View File

@@ -245,6 +245,11 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.AssertionError AssertionError(java.lang.Object)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.AssertionError AssertionError(java.lang.Object) 0'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
@@ -4018,6 +4023,9 @@
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.lang.Throwable java.lang.Throwable initCause(java.lang.Throwable)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="mutates" val="&quot;this&quot;"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.lang.Throwable void addSuppressed(java.lang.Throwable) 0'>

View File

@@ -567,6 +567,11 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.invoke.MemberName boolean referenceKindIsConsistentWith(int)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.invoke.MemberName boolean testAllFlags(int)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -1307,7 +1312,8 @@
</item>
<item name='java.lang.invoke.MethodHandleStatics java.lang.Error NYI()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;-&gt;fail&quot;"/>
<val name="value" val="&quot;-&gt;fail&quot;"/>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.invoke.MethodHandleStatics java.lang.Error uncaughtException(java.lang.Throwable)'>

View File

@@ -1,4 +1,19 @@
<root>
<item name='java.rmi.RemoteException RemoteException()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.rmi.RemoteException RemoteException(java.lang.String)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.rmi.RemoteException RemoteException(java.lang.String, java.lang.Throwable)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.rmi.RemoteException java.lang.Throwable getCause()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>