Files
kotlin-fork/compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt
T
Alexander Udalov 7e43000d9b JVM: do not lose default parameter values during enhancement
The change in signatureEnhancement.kt in 432f581cb2 was incorrect.
Contrary to its name, the removed method `hasDefaultValueInAnnotation`
checked not only if the enhancement annotation has default value (which
is what the removed feature was about), but also if the parameter itself
declares default value. This was mistakenly substituted by just `false`
on line 234. The correct change is to use the `declaresDefaultValue`
flag of the original parameter.

It's kind of weird though that in case there's a nullability annotation
on the whole package (like in KT-48316) type enhancement is being done
on everything, including annotation constructors, whose parameter types
can't have any enhancement information. Maybe this should be improved
independently.

 #KT-48316 Fixed
2021-09-07 19:05:48 +02:00

35 lines
558 B
Kotlin
Vendored

// FIR_IDENTICAL
// FILE: lib/NonNullApi.java
package lib;
import java.lang.annotation.*;
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierDefault;
@Target(ElementType.PACKAGE)
@Retention(RetentionPolicy.RUNTIME)
@Nonnull
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER})
public @interface NonNullApi {}
// FILE: lib/package-info.java
@NonNullApi
package lib;
// FILE: lib/A.java
package lib;
public @interface A {
Class value() default String.class;
}
// FILE: test.kt
import lib.A
@A
fun test() {}