Scala Programming Language
  1. Scala Programming Language
  2. SI-6162

Annotation to warn/deprecate about subclassing a class

    Details

      Description

      Currently there is only @deprecated, which warns about every usage of an element with that annotation.

      The idea is to add an annotation which does apply to classes and warns about sub-classing the annotated class, but not the usage.

      Use cases for this annotations is the communication of specific intents to users of the class:

      • Plans to make a non-final class final.
      • Anticipated changes to protected members.
      • Frameworks require a class to be non-final, but sub-classing it should be avoided.

      Todo:

      • Add an annotation
      • Check for the annotation during compilation
      • Tests

      See https://groups.google.com/d/topic/scala-internals/mvs3yQh1I_k/discussion for further discussion.

        Issue Links

          Activity

          Hide
          Simon Ochsenreither added a comment -

          Paul wants to have the same functionality for overriding members.

          Show
          Simon Ochsenreither added a comment - Paul wants to have the same functionality for overriding members.
          Show
          Simon Ochsenreither added a comment - Merged in https://github.com/scala/scala/commit/4f696fe22f273aa0c3fa6d86c788904ae88fab3b .
          Show
          Adriaan Moors added a comment - https://github.com/scala/scala/pull/1284

            People

            • Assignee:
              Simon Ochsenreither
              Reporter:
              Simon Ochsenreither
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development