org.pkl.thirdparty.kotlin.jvm.PurelyImplements.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pkl-tools Show documentation
Show all versions of pkl-tools Show documentation
Fat Jar containing pkl-cli, pkl-codegen-java, pkl-codegen-kotlin, pkl-config-java, pkl-core, pkl-doc, and their shaded third-party dependencies.
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.pkl.thirdparty.kotlin.jvm
/**
* Instructs the Kotlin compiler to treat annotated Java class as pure implementation of given Kotlin interface.
* "Pure" means here that each type parameter of class becomes non-platform type argument of that interface.
*
* Example:
*
* ```java
* class MyList extends AbstractList { ... }
* ```
*
* Methods defined in `MyList` use `T` as platform, i.e. it's possible to perform unsafe operation in Kotlin:
*
* ```kotlin
* MyList().add(null) // compiles
* ```
*
* ```java
* @PurelyImplements("org.pkl.thirdparty.kotlin.collections.MutableList")
* class MyPureList extends AbstractList { ... }
* ```
*
* Methods defined in `MyPureList` overriding methods in `MutableList` use `T` as non-platform types:
*
* ```kotlin
* MyPureList().add(null) // Error
* MyPureList().add(null) // Ok
* ```
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
public annotation class PurelyImplements(val value: String)
© 2015 - 2024 Weber Informatics LLC | Privacy Policy