Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10845

Add type checking for enum constant constructor call

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-1
    • Static Type Checker
    • None

    Description

      Consider the following:

      @groovy.transform.TypeChecked
      enum E {
        FOO; // no error for missing argument
        E(String s) {
        }
      }
      

      Enum constant field FOO is initialized by static method call $INIT("FOO",0) which accepts Object[] as its argument(s). Thus no error is produced for the example but it fails at runtime.

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: