Scala Programming Language
  1. Scala Programming Language
  2. SI-1430

IllegalAccessError for package-private super-interface

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Misc Compiler
    • Labels:
      None

      Description

      package test1;
      interface Foo {
         public void foo();
      }
      public interface Bar extends Foo {
         public void bar();
      }
      

      and Scala

      package test2
      class Baz(x: Bar) {
        x.foo
      }
      

      Scalac generates bytecode referencing `Foo.foo` instead of the most specific `Bar.foo`, which results in an `IllegalAccessError` at runtime.

        Activity

        Hide
        Commit Message Bot added a comment -

        (extempore in r26078) Fix for erroneous bytecode generation.

        A remedy for an IllegalAccessError where generated bytecode
        referred to an inaccessible type. Closes SI-1430.

        Bonus materials:

        • tore out all the invokedynamic support. The shipped jdk7
          implementation shows limited resemblance to the one this was written
          against; the code mostly serves to distract. (I think I could get
          invokedynamic working pretty quickly, except that it would
          mean having a codebase for java7 and one for 5-6, which is not a yak
          I wish to shave today.)
        • gave NullClass and NothingClass objects of their own, which
          allowed a nice polymorphic simplification of isSubClass, plus a
          couple other streamlinings.
        Show
        Commit Message Bot added a comment - (extempore in r26078 ) Fix for erroneous bytecode generation. A remedy for an IllegalAccessError where generated bytecode referred to an inaccessible type. Closes SI-1430 . Bonus materials: tore out all the invokedynamic support. The shipped jdk7 implementation shows limited resemblance to the one this was written against; the code mostly serves to distract. (I think I could get invokedynamic working pretty quickly, except that it would mean having a codebase for java7 and one for 5-6, which is not a yak I wish to shave today.) gave NullClass and NothingClass objects of their own, which allowed a nice polymorphic simplification of isSubClass, plus a couple other streamlinings.
        Hide
        Paolo G. Giarrusso added a comment -

        In the above example, it's intended that Bar extends Foo, isn't it? I'm asking because this is related to SI-7253.

        Show
        Paolo G. Giarrusso added a comment - In the above example, it's intended that Bar extends Foo , isn't it? I'm asking because this is related to SI-7253 .
        Hide
        Paul Phillips added a comment -

        Oh, yes, indeed it makes no sense without Bar extending Foo.

        Show
        Paul Phillips added a comment - Oh, yes, indeed it makes no sense without Bar extending Foo.
        Hide
        Paul Phillips added a comment -

        I updated it.

        Show
        Paul Phillips added a comment - I updated it.

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Iulian Dragos
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development