Jump to content
Excelsior Forums

peter__lawrey

Members
  • Content count

    0
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About peter__lawrey

  • Rank
    Newbie
  • Birthday 01/01/01
  1. getEnclosingClass() returns null

    In the following example, this program prints with Sun JDK 6u7 however with Jet 6.4 it prints Is there a recommended way to get the enclosing class? This is needed for Enum.valueOf(enclosingClass, text) to work. You cannot use the MyEnum.YES.getClass() for example. public class EnumTestMain { public static void main(String... args) throws ClassNotFoundException { Class yesClass = MyEnum.YES.getClass(); System.out.println("The enclosing class is " + yesClass.getEnclosingClass()); } public enum MyEnum { YES { public String getName() { return "Yes!"; }}; public abstract String getName(); } }
×