Skip to content

Support @static annotation to create static fields or methods. #4581

Open
@scabug

Description

@scabug

Having the @static annotation would fill one feature of the JVM not possible in Scala.

For practicality, it will help in these cases:

  1. Some libraries require a static field. In particular, the android SDK requires classes implementing the Parceable interface to have a CREATOR static field

  2. It will allow to create utility methods that are available "idiomatically" from Java code

I know that theoretically one can create a compiler plugin to do this. But there are few people that know how to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions