KEEP icon indicating copy to clipboard operation
KEEP copied to clipboard

Opt-in into API implementation

Open qwwdfsad opened this issue 2 years ago • 3 comments

This issue is for discussion of the proposal to introduce @SubclassOptInRequired annotation in Kotlin to provide a mechanism to require opt-in for API implementation only.

Proposal PR https://github.com/Kotlin/KEEP/pull/319

qwwdfsad avatar Aug 15 '22 16:08 qwwdfsad

This seems like it can be achieved today without adding new primitives:

interface DontSubclassMe {
  @MyExperimentalApi
  fun areYouSureYouWantToSubclassMe()

  fun theRealMethods()
}

nreid260 avatar Jan 06 '23 16:01 nreid260

Any reason why OptInRequired was used in the name instead of RequiresOptIn? The latter seems to be more in line with the existing annotation. Suggestions:

  • SubclassRequiresOptIn
  • RequiresOptInForSubclass
  • (RequiresSubclassOptIn)

The first two suggestions share the same term (RequiresOptIn) with the existing annotation which is beneficial for code completion and using the same term also helps to remember the name.

iTob191 avatar Jun 23 '23 11:06 iTob191