Introduced AggressiveHardCodedPurity under registry key (IDEA-CR-21434)

New key = java.annotations.inference.aggressive.hardcoded.purity (true
by default). Implies purity for Object.toString(), Iterable.iterator(),
Iterator.hasNext() and this-changing Iterator.next(). Parameter-changing
 mode supported for hardcoded purity.
This commit is contained in:
Tagir Valeev
2017-05-30 17:38:23 +07:00
parent adb5d93cee
commit 82da560c31
10 changed files with 237 additions and 67 deletions
@@ -1278,6 +1278,11 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.Iterable java.util.Iterator&lt;T&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.lang.Long Long(java.lang.String) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -917,6 +917,11 @@
<item name='java.util.Calendar void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collection java.util.Iterator&lt;E&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.Collections Collections()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -1063,6 +1068,9 @@
</annotation>
</item>
<item name='java.util.Collections java.util.Enumeration&lt;T&gt; enumeration(java.util.Collection&lt;T&gt;)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collections java.util.Iterator&lt;E&gt; singletonIterator(E)'>
@@ -1378,6 +1386,9 @@
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collections.CheckedCollection java.util.Iterator&lt;E&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collections.CheckedCollection void typeCheck(java.lang.Object) 0'>
@@ -1503,6 +1514,9 @@
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collections.CheckedMap.CheckedEntrySet java.util.Iterator&lt;java.util.Map.Entry&lt;K,V&gt;&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collections.CheckedMap.CheckedEntrySet.CheckedEntry CheckedEntry(java.util.Map.Entry&lt;K,V&gt;, java.lang.Class&lt;T&gt;)'>
@@ -1926,6 +1940,11 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.Collections.SetFromMap java.util.Iterator&lt;E&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.Collections.SetFromMap void readObject(java.io.ObjectInputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -2017,6 +2036,11 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.Collections.SynchronizedCollection java.util.Iterator&lt;E&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.Collections.SynchronizedCollection void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -2201,6 +2225,9 @@
</annotation>
</item>
<item name='java.util.Collections.UnmodifiableCollection java.util.Iterator&lt;E&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collections.UnmodifiableCollection void clear()'>
@@ -2334,6 +2361,9 @@
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet java.util.Iterator&lt;java.util.Map.Entry&lt;K,V&gt;&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableEntry UnmodifiableEntry(java.util.Map.Entry&lt;? extends K,? extends V&gt;)'>
@@ -3076,6 +3106,11 @@
</annotation>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Iterator boolean hasNext()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.LinkedHashMap LinkedHashMap(java.util.Map&lt;? extends K,? extends V&gt;) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -3146,6 +3181,11 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.List java.util.Iterator&lt;E&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.Locale Locale(java.lang.String) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -3357,6 +3397,11 @@
<item name='java.util.Random void writeObject(java.io.ObjectOutputStream) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='java.util.Set java.util.Iterator&lt;E&gt; iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.TreeMap K firstKey()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -51,6 +51,11 @@
<item name='org.apache.commons.collections.ExtendedProperties java.lang.String unescape(java.lang.String) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.collections.ExtendedProperties java.util.Iterator getKeys()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.collections.ExtendedProperties org.apache.commons.collections.ExtendedProperties convertProperties(java.util.Properties) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -1543,6 +1543,11 @@
<item name='org.apache.commons.lang.CharSet CharSet(java.lang.String[]) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.lang.CharSet boolean contains(char)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.lang.CharSet boolean equals(java.lang.Object) 0'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
@@ -3315,7 +3320,8 @@
</item>
<item name='org.apache.commons.lang.StringUtils java.lang.String join(java.util.Collection, char)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;null,_-&gt;null&quot;"/>
<val name="value" val="&quot;null,_-&gt;null&quot;"/>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
@@ -3324,7 +3330,8 @@
</item>
<item name='org.apache.commons.lang.StringUtils java.lang.String join(java.util.Collection, java.lang.String)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;null,_-&gt;null&quot;"/>
<val name="value" val="&quot;null,_-&gt;null&quot;"/>
<val name="pure" val="true"/>
</annotation>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
@@ -4137,9 +4144,19 @@
<item name='org.apache.commons.lang.Validate void noNullElements(java.lang.Object[], java.lang.String) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.lang.Validate void noNullElements(java.util.Collection)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.lang.Validate void noNullElements(java.util.Collection) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='org.apache.commons.lang.Validate void noNullElements(java.util.Collection, java.lang.String)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.commons.lang.Validate void noNullElements(java.util.Collection, java.lang.String) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
@@ -90,6 +90,11 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.velocity.anakia.NodeList java.util.Iterator iterator()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.velocity.anakia.NodeList java.util.List getList()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -23,6 +23,26 @@
<item name='org.apache.velocity.app.event.EventCartridge boolean removeEventHandler(org.apache.velocity.app.event.EventHandler) 0'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='org.apache.velocity.app.event.EventCartridge java.util.Iterator getIncludeEventHandlers()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.velocity.app.event.EventCartridge java.util.Iterator getInvalidReferenceEventHandlers()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.velocity.app.event.EventCartridge java.util.Iterator getMethodExceptionEventHandlers()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.velocity.app.event.EventCartridge java.util.Iterator getNullSetEventHandlers()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
</annotation>
</item>
<item name='org.apache.velocity.app.event.EventCartridge java.util.Iterator getReferenceInsertionEventHandlers()'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>