Replace with explicit "get" inspection enabled by default but is reported only for functions explicitly marked with "operator"
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import java.util.List;
|
||||
|
||||
public abstract class JavaMethods implements List<String> {
|
||||
@Override
|
||||
public String get(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int get(String s, int p) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+9
@@ -61,4 +61,13 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get'</problem_class>
|
||||
<description>Replace 'get' call with index operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>javaMethods.kt</file>
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="javaMethods.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get'</problem_class>
|
||||
<description>Replace 'get' call with index operator</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// DISABLE-ERRORS
|
||||
// IS_APPLICABLE: false
|
||||
import JavaMethods
|
||||
|
||||
fun foo(javaClass: JavaMethods) {
|
||||
val v1 = javaClass.get(1)
|
||||
val v2 = javaClass.get("a", 1)
|
||||
}
|
||||
Reference in New Issue
Block a user