Android lint中的误报检查LinkedHashMap.remove()

时间:2017-05-31 11:57:06

标签: java android kotlin lint android-lint

lint结果html中的问题 enter image description here

通过lint为问题生成html部分

<div class="warningslist">
    <span class="location">
    <a href="../../src/main/java/com/tourlandish/chronos/base/InMemoryCache.kt">../../src/main/java/com/tourlandish/chronos/base/InMemoryCache.kt</a>:40</span>
: <span class="message">Call requires API level 24 (current min is 21): 
<code>java.util.LinkedHashMap#remove</code></span><br /><pre class="errorlines">

    <span class="lineno"> 37 </span>        override <span 
    class="keyword">fun</span> get(key: String): CachedItem? {
    <span class="lineno"> 38 </span>            <span 
    class="keyword">val</span> value = <span 
    class="keyword">super</span>.get(key) ?: <span 
    class="keyword">return</span> <span class="keyword">null</span>
    <span class="lineno"> 39 </span>            <span 
    class="keyword">if</span> (value.isExpired()) {
    <span class="caretline"><span class="lineno"> 40 </span>                
    <span class="error">remove</span>(key)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
    <span class="lineno"> 41 </span>                <span 
    class="keyword">return</span> <span class="keyword">null</span>
    <span class="lineno"> 42 </span>            }
    <span class="lineno"> 43 </span>            <span 
    class="keyword">return</span> value
    </pre>

</div>

但是,继承自LinkedHashMap.remove()的{​​{1}}已添加到API级别1 according to the Android Documentation

android-lint是否需要一些额外的配置才能与kotlin一起使用,或者它是android-lint中的一个错误,我们必须将其压缩直到修复?

0 个答案:

没有答案