Skip to content

Fix annotation default target warnings in enum constructors#602

Open
gioalex07 wants to merge 1 commit intoVREMSoftwareDevelopment:mainfrom
gioalex07:fix/annotation-default-target-param
Open

Fix annotation default target warnings in enum constructors#602
gioalex07 wants to merge 1 commit intoVREMSoftwareDevelopment:mainfrom
gioalex07:fix/annotation-default-target-param

Conversation

@gioalex07
Copy link
Copy Markdown

Summary

  • Add explicit @param: target to @StringRes, @DrawableRes and @ColorRes annotations on enum constructor parameters.
  • Resolves Kotlin compiler warning KT-73255 across 5 files.
  • No logic changes.

What does this implement/fix?

Kotlin 2.x introduced a warning when @StringRes, @DrawableRes or @ColorRes are applied to enum constructor
parameters without an explicit annotation target. In a future release, these annotations will be applied to both
the parameter and the backing field by default. This change opts in to the parameter-only behavior explicitly
using the @param: target, silencing the warning and future-proofing the code.

Affected files:

  • wifi/band/WiFiBand.kt@param:StringRes
  • wifi/model/Strength.kt@param:DrawableRes, @param:ColorRes
  • wifi/model/WiFiSecurity.kt@param:DrawableRes, @param:StringRes
  • wifi/model/WiFiStandard.kt@param:StringRes (x2)
  • wifi/model/WiFiWidth.kt@param:StringRes

Does this close any issues?

  • N/A (compiler warning cleanup)

How was this tested?

  • Platform: WSL2 / AlmaLinux 9
  • Build variant: debug
  • Toolchain: JDK 21 (Zulu), Gradle 9.3.1, Android SDK 36, Kotlin 2.3.0

Add explicit @param: target to @stringres, @DrawableRes and @ColorRes
annotations on enum constructor parameters to suppress KT-73255 warnings.
Kotlin 2.x will apply these annotations to both parameter and field by
default in a future release; this change opts in to the parameter-only
behavior explicitly.

Affected files: WiFiBand, Strength, WiFiSecurity, WiFiStandard, WiFiWidth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant