Jump to content
Excelsior Forums


  • Content count

  • Joined

  • Last visited


Community Reputation

0 Neutral

About peter__lawrey

  • Rank
  • Birthday 01/01/1
  1. peter__lawrey

    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(); } }