Unused symbol: handle internal constructor used in Java #KT-27708 Fixed
This commit is contained in:
@@ -326,9 +326,9 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
|
||||
|
||||
private fun KtCallableDeclaration.canBeHandledByLightMethods(descriptor: DeclarationDescriptor?): Boolean {
|
||||
return when {
|
||||
descriptor is ConstructorDescriptor -> !descriptor.constructedClass.isInline
|
||||
hasModifier(KtTokens.INTERNAL_KEYWORD) -> false
|
||||
descriptor !is FunctionDescriptor -> true
|
||||
descriptor is ConstructorDescriptor -> !descriptor.constructedClass.isInline
|
||||
else -> !descriptor.hasInlineClassParameters()
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
public class User {
|
||||
public static void main(String[] args) {
|
||||
new WithInternalConstructor();
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
class WithInternalConstructor(val x: Int) {
|
||||
internal constructor() : this(42)
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
public class User {
|
||||
public static void main(String[] args) {
|
||||
new WithInternalConstructor();
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
class WithInternalConstructor(val x: Int) {
|
||||
internal <caret>constructor() : this(42)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"inspectionClass": "org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection",
|
||||
"problem": "none",
|
||||
"mainFile": "test.kt"
|
||||
}
|
||||
Generated
+5
@@ -93,4 +93,9 @@ public class MultiFileLocalInspectionTestGenerated extends AbstractMultiFileLoca
|
||||
public void testUnusedSymbol_inlineClassesImplInterface_InlineClassesImplInterface() throws Exception {
|
||||
runTest("idea/testData/multiFileLocalInspections/unusedSymbol/inlineClassesImplInterface/inlineClassesImplInterface.test");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedSymbol/internalConstructorUsedInJava/internalConstructorUsedInJava.test")
|
||||
public void testUnusedSymbol_internalConstructorUsedInJava_InternalConstructorUsedInJava() throws Exception {
|
||||
runTest("idea/testData/multiFileLocalInspections/unusedSymbol/internalConstructorUsedInJava/internalConstructorUsedInJava.test");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user