Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4129928

Class.getModifiers() throws IllegalAccessError in presence of inner classes

XMLWordPrintable



      Name: laC46010 Date: 04/17/98



      The method Class.getModifiers() throws IllegalAccessError if the Class
      instance represents class which contains nested classes (JDK1.2beta4A).
      If the class declares nested class with public or protected access, than the
      Class.getModifiers() is executed correctly.
      If the class declares nested class which local to the block or has private
      or default access, than IllegalAccessError will be thrown.

      An example below produces the following output:
      -----------------output------------------
      > java -fullversion
      java full version "JDK-1.2beta4-A"
      > java Test
      java.lang.IllegalAccessError: try to access class Test$NestedClass from class java/lang/Class
              at java.lang.Class.getModifiers(Native Method)
              at Test.main(Compiled Code)
      ---------------Test.java-----------------
      class Test {
          class NestedClass{
          }
          public static void main(String argv[]) {
              Class c = Test.class;
              int k = c.getModifiers();
              System.out.println("OK. ");
          }
      }
      -----------------------------------------
      Hook 5(hook5):
      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: