only stub default constructor when compiling against .java source files

This commit is contained in:
Kevin Bierhoff
2020-03-09 11:33:20 -07:00
committed by Alexander Udalov
parent c83860187c
commit 7448761dfd
19 changed files with 90 additions and 2 deletions
@@ -159,6 +159,7 @@ class MockKotlinClassifier(override val classId: ClassId,
override val methods get() = shouldNotBeCalled()
override val fields get() = shouldNotBeCalled()
override val constructors get() = shouldNotBeCalled()
override fun hasDefaultConstructor() = shouldNotBeCalled()
override val annotations get() = shouldNotBeCalled()
override val isDeprecatedInJavaDoc get() = shouldNotBeCalled()
override fun findAnnotation(fqName: FqName) = shouldNotBeCalled()
@@ -73,6 +73,8 @@ class FakeSymbolBasedClass(
override val constructors: Collection<JavaConstructor> get() = emptyList()
override fun hasDefaultConstructor() = false
override val innerClassNames: Collection<Name> get() = emptyList()
override val virtualFile: VirtualFile? by lazy {
@@ -133,6 +133,8 @@ class SymbolBasedClass(
.filter { it.kind == ElementKind.CONSTRUCTOR }
.map { SymbolBasedConstructor(it as ExecutableElement, this, javac) }
override fun hasDefaultConstructor() = false // default constructors are explicit in symbols
override val innerClassNames: Collection<Name>
get() = innerClasses.keys
@@ -134,6 +134,8 @@ class TreeBasedClass(
TreeBasedConstructor(constructor as JCTree.JCMethodDecl, compilationUnit, this, javac)
}
override fun hasDefaultConstructor() = !isInterface && constructors.isEmpty()
override val innerClassNames: Collection<Name>
get() = innerClasses.keys