Skip to content

Commit

Permalink
Repro for missing constructor in compiled java classes
Browse files Browse the repository at this point in the history
  • Loading branch information
yigit committed Jan 28, 2021
1 parent 1189677 commit 3c43627
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.google.devtools.ksp.processor

import com.google.devtools.ksp.getClassDeclarationByName
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.symbol.*

Expand All @@ -33,6 +34,7 @@ class AllFunctionsProcessor : AbstractTestProcessor() {

override fun process(resolver: Resolver) {
resolver.getAllFiles().map { it.accept(visitor, Unit) }
resolver.getClassDeclarationByName("JavaWithConstructorInLib")!!.accept(visitor, Unit)
}

inner class AllFunctionsVisitor : KSVisitorVoid() {
Expand Down
30 changes: 30 additions & 0 deletions compiler-plugin/testData/api/allFunctions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
// class: KotlinInterfaceWithProperty
// <init>(): C
// <init>(): JavaImplOfKotlinInterface
// <init>(kotlin.Int): JavaWithConstructor
// <init>(kotlin.Int): JavaWithConstructorInLib
// a
// aFromC
// aFromC
Expand All @@ -33,6 +35,8 @@
// class: Data
// class: Foo
// class: JavaImplOfKotlinInterface
// class: JavaWithConstructor
// class: JavaWithConstructorInLib
// component1(): kotlin.String
// contains(kotlin.Number): kotlin.Boolean
// containsAll(kotlin.collections.Collection): kotlin.Boolean
Expand All @@ -42,13 +46,17 @@
// equals(kotlin.Any): kotlin.Boolean
// equals(kotlin.Any): kotlin.Boolean
// equals(kotlin.Any): kotlin.Boolean
// equals(kotlin.Any): kotlin.Boolean
// equals(kotlin.Any): kotlin.Boolean
// forEach(java.util.function.Consumer): kotlin.Unit
// get(kotlin.Int): kotlin.Number
// hashCode(): kotlin.Int
// hashCode(): kotlin.Int
// hashCode(): kotlin.Int
// hashCode(): kotlin.Int
// hashCode(): kotlin.Int
// hashCode(): kotlin.Int
// hashCode(): kotlin.Int
// indexOf(kotlin.Number): kotlin.Int
// isEmpty(): kotlin.Boolean
// iterator(): kotlin.collections.Iterator
Expand All @@ -60,6 +68,8 @@
// lastIndexOf(kotlin.Number): kotlin.Int
// listIterator(): kotlin.collections.ListIterator
// listIterator(kotlin.Int): kotlin.collections.ListIterator
// method1(kotlin.Int): kotlin.Unit
// method1(kotlin.Int): kotlin.Unit
// parallelStream(): java.util.stream.Stream
// size
// spliterator(): java.util.Spliterator
Expand All @@ -70,9 +80,23 @@
// toString(): kotlin.String
// toString(): kotlin.String
// toString(): kotlin.String
// toString(): kotlin.String
// toString(): kotlin.String
// x
// x
// END
// MODULE: lib
// FILE: JavaWithConstructorInLib.java
class JavaWithConstructorInLib {
JavaWithConstructorInLib(int constructorArg1) {
}
void method1(int arg1) {}
}
// FILE: KotlinInLib.kt
class KotlinClassInLib(constructorArg1:Int) {
fun method1(arg1: Int) {}
}
// MODULE: mainModule(lib)
// FILE: a.kt
abstract class Foo : C(), List<out Number> {
override fun javaListFun(): List<Int> {
Expand Down Expand Up @@ -126,4 +150,10 @@ class JavaImplOfKotlinInterface implements KotlinInterfaceWithProperty {
}
public void setX(int value) {
}
}
// FILE: JavaWithConstructor.java
class JavaWithConstructor {
JavaWithConstructor(int constructorArg1) {
}
void method1(int arg1) {}
}

0 comments on commit 3c43627

Please sign in to comment.