Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-513

Better EnumUtils

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0
    • lang.*
    • None

    Description

      Parametrize the getEnumMap() method with <E extends Enum<E>>. This narrows down the argument so that non-enums and null are rejected at compile time. Also, at its current state the EnumUtils should never be instantiated.

      EnumUtils.java
       public static Map<String, Enum<?>> getEnumMap(Class enumClass) 

      changes to:

      EnumUtils.java
       public static <E extends Enum<E>> Map<String, Enum<E>> getEnumMap(Class<E> enumClass) 

      Attachments

        1. EnumUtilsTest.patch
          1 kB
          Ivan Bilenjkij
        2. EnumUtils.patch
          2 kB
          Ivan Bilenjkij

        Activity

          People

            Unassigned Unassigned
            ibilenjkij Ivan Bilenjkij
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: