Kapt: Add flag to keep KDoc comments in stubs
Currently, KaptGenerateStubsTask may not generate KDoc comments correctly. See KT-43593 for more details. This commit provides a Kapt flag called `kapt.keep.kdoc.comments.in.stubs` to control whether KDoc comments will be included in the generated stubs. This flag is currently enabled by default to keep the existing behavior and avoid breaking existing users. Users who don't need KDoc comments in stubs but are hitting KT-43593 can disable the flag. Whether this flag will be disabled by default later is to be determined. Bug: https://youtrack.jetbrains.com/issue/KT-43593 (Note that this commit only provides a workaround, it doesn't actually fix the bug.) Test: (Ir)ClassFileToSourceStubConverterTestGenerated#testCommentsRemoved
This commit is contained in:
committed by
nataliya.valtman
parent
dcda47b502
commit
e2521718dd
@@ -0,0 +1,67 @@
|
||||
// !KEEP_KDOC_COMMENTS_IN_STUBS
|
||||
/** Test. */
|
||||
class Test {
|
||||
/** method(). */
|
||||
fun method() {}
|
||||
|
||||
/** method(int). */
|
||||
fun method(a: Int) {}
|
||||
|
||||
/** method(String). */
|
||||
fun method(a: String) {}
|
||||
|
||||
/** prop. */
|
||||
const val prop: String = ""
|
||||
|
||||
/** prop2. */
|
||||
@Anno
|
||||
val prop2: String = ""
|
||||
|
||||
/** prop3. */
|
||||
var prop3: String
|
||||
/** get. */ get() = ""
|
||||
/** set. */ set(v) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test2
|
||||
* Multiline
|
||||
* documentation.
|
||||
*/
|
||||
class Test2(val a: String)
|
||||
|
||||
class Test3 /** constructor. */ protected constructor(val a: String)
|
||||
|
||||
/** Obj. */
|
||||
object Obj
|
||||
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Anno
|
||||
|
||||
/* simple comment. */
|
||||
class Test4 {
|
||||
// method simple comment
|
||||
fun method() {}
|
||||
}
|
||||
|
||||
enum class EnumError {
|
||||
One {
|
||||
override fun doIt() = ""
|
||||
|
||||
class OneOne {
|
||||
/** Documentation for 'test'. */
|
||||
fun test() {}
|
||||
}
|
||||
},
|
||||
Two {
|
||||
/** Documentation for 'doIt'. */
|
||||
override fun doIt() = ""
|
||||
};
|
||||
|
||||
abstract fun doIt(): String
|
||||
}
|
||||
|
||||
/**
|
||||
* `/* Failure */`
|
||||
*/
|
||||
interface TestComponent
|
||||
@@ -0,0 +1,153 @@
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
@java.lang.annotation.Target(value = {})
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
@kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.PROPERTY})
|
||||
public abstract @interface Anno {
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public enum EnumError {
|
||||
/*public static final*/ One /* = new EnumError() */,
|
||||
/*public static final*/ Two /* = new EnumError() */;
|
||||
|
||||
EnumError() {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public abstract java.lang.String doIt();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public final class Obj {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public static final Obj INSTANCE = null;
|
||||
|
||||
private Obj() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public final class Test {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String prop = "";
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String prop2 = "";
|
||||
|
||||
public Test() {
|
||||
super();
|
||||
}
|
||||
|
||||
public final void method() {
|
||||
}
|
||||
|
||||
public final void method(int a) {
|
||||
}
|
||||
|
||||
public final void method(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String a) {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getProp2() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Anno()
|
||||
@java.lang.Deprecated()
|
||||
public static void getProp2$annotations() {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getProp3() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final void setProp3(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String v) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public final class Test2 {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String a = null;
|
||||
|
||||
public Test2(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String a) {
|
||||
super();
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getA() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public final class Test3 {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String a = null;
|
||||
|
||||
protected Test3(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String a) {
|
||||
super();
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getA() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public final class Test4 {
|
||||
|
||||
public Test4() {
|
||||
super();
|
||||
}
|
||||
|
||||
public final void method() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public abstract interface TestComponent {
|
||||
}
|
||||
Reference in New Issue
Block a user