Kapt: Add DUMP_DEFAULT_PARAMETER_VALUES flag (KT-29355)
Put initializers on fields when corresponding primary constructor parameters have a default value specified. The new behavior is available under the new 'DUMP_DEFAULT_PARAMETER_VALUES' flag. Note that this doesn't affect regular functions with default parameter values, as well as primary constructor parameters without a 'val' or 'var' keyword.
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
package error;
|
||||
|
||||
public final class NonExistentClass {
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package test;
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface Anno {
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package test;
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
@Anno()
|
||||
public final class User {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final java.lang.String name = "John";
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public final java.lang.String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public User(@org.jetbrains.annotations.NotNull()
|
||||
java.lang.String name, int age) {
|
||||
super();
|
||||
}
|
||||
|
||||
public User() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// DUMP_DEFAULT_PARAMETER_VALUES
|
||||
|
||||
package test
|
||||
|
||||
@Anno
|
||||
class User(val name: String = "John", age: Int = 18)
|
||||
|
||||
internal annotation class Anno
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user