Skip to content

NonConstantResouceID results in build errors #19427

Description

@07jasjeet

Problem

So, the codebase has multiple instances where Resource IDs are directly used in places where only final objects can be used. This introduces compile-time errors as Resource IDs are not final anymore in newer versions. (Ref) These instances are:

  1. const vals (constant values) are being assigned with Resource IDs.
  2. Also using Resource IDs in switch case statements results in the same.

Proposed Solution

  1. Remove const and annotate the field with @JvmField which results in generated bytecode being similar to latter. (Cross-Verified Ref).
  2. Replace switch with if-else where resource IDs are used. (Ref)

This proposed solution works on my machine AS Giraffe 2022.3.1 Patch 1 and would gladly open a PR if required.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions