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

Interface resolution does not throw an IllegalAccessError.

    XMLWordPrintable

Details

    • 1.2fcs
    • sparc
    • solaris_2.4
    • Verified

    Description



      Name: akC45999 Date: 06/02/98



      The Java VM spec chapter 5.4.3a Class and Interface Resolution reads:
      ...
      7.Finally, access permissions to C are checked:
               If D does not have permission to access C, class or interface resolution throws an
               IllegalAccessError.

      But the attached test shows that interface case don't throw an IllegalAccessError
      when a superinterfaces is not accessible.

      --------------------------------- AlienInterface.jasm

      package res;

      interface AlienInterface
      {
      } // end Class AlienInterface

      --------------------------------- TestClass.jasm

      class TestClass implements res/AlienInterface {}

      --------------------------------- resolveClass00704.java

      import java.io.PrintStream;

      public class resolveClass00704 {

        public static int run(String argv[], PrintStream out) {

      try{
      Class.forName("TestClass");
      out.println("No exception");
      return 2;
      } catch (IllegalAccessError e) {
      return 0;
      } catch (Throwable e) {
      out.println("Unexpected exception " + e);
      return 2;
      }
        }

        public static void main(String argv[]) {
      System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
      }

      ------------------------------------- dotest
      #!/bin/sh

      javac -d . *.java
      jasm -d . *.jasm
      java -verify resolveClass00704
      echo res=$?
      ----------------------------------------
      Running the test:

      novo36% dotest
      No exception
      res=97

      ======================================================================

      ======================================================================

      Attachments

        Activity

          People

            sliangsunw Sheng Liang (Inactive)
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: