Unused object.

unusedButEntryPointMain for class was actually a wrong test: it didn't check anything, because objects are were not checked for unusedness before.
This commit is contained in:
Evgeny Gerashchenko
2015-01-21 21:36:57 +03:00
parent a797f4a328
commit 386854d73f
19 changed files with 105 additions and 12 deletions
@@ -1,5 +0,0 @@
object EntryPoint {
fun main(args: Array<String>) {
}
}
@@ -0,0 +1,34 @@
<problems>
<problem>
<file>unused.kt</file>
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/unused.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Object 'A' is never used</description>
</problem>
<problem>
<file>usedOnlyInside.kt</file>
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/usedOnlyInside.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Object 'A' is never used</description>
</problem>
<problem>
<file>usedInTextByShortName.kt</file>
<line>3</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/usedInTextByShortName.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Object 'UsedInTextByShortName' is never used</description>
</problem>
<problem>
<file>usedOnlyInImport.kt</file>
<line>3</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/usedOnlyInImport.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Object 'A' is never used</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection
@@ -0,0 +1 @@
object A
@@ -0,0 +1,11 @@
package entryPoint
// WITH_RUNTIME
import kotlin.platform.platformStatic
object EntryPoint {
platformStatic public fun main(args: Array<String>) {
}
}
@@ -0,0 +1,5 @@
object A
fun main(args: Array<String>) {
val x = A
}
@@ -0,0 +1,5 @@
class RandomJavaClass {
void f() {
foo.UsedInJava.INSTANCE$.bar();
}
}
@@ -0,0 +1,6 @@
package foo
object UsedInJava {
fun bar() {
}
}
@@ -0,0 +1,3 @@
package foo
object UsedInTextOnly
@@ -0,0 +1 @@
foo.UsedInTextOnly
@@ -0,0 +1,3 @@
package foo
object UsedInTextByShortName
@@ -0,0 +1 @@
UsedInTextByShortName
@@ -0,0 +1,3 @@
package foo
object UsedInXmlOnly
@@ -0,0 +1 @@
<a b="foo.UsedInXmlOnly"/>
@@ -0,0 +1,4 @@
import A
object A {
}
@@ -0,0 +1,9 @@
object A {
fun foo() {
A.bar()
}
fun bar() {
A.foo()
}
}