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

A module with exports flag other than ACC_SYNTHETIC or ACC_MANDATED should be rejected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • 20
    • core-libs
    • None

      mod/pkg/X.java ->
      public class X {
          public static void main(String[] args) {
              System.out.println("Module mod's pkg.X.main");
          }
      }

      mod/module-info.java ->
      module mod {
              exports pkg;
      }

      javac -d mod/module-info.java mod/pkg/X.java
      java -p mod -m mod/pkg.X --> "Module mod's pkg.X.main" (Works as expected)

      Now check the mod's exports flag:
      java --jar <asmtools.jar> jdec mod/module-info.class > mod/module-info.jcod
      Observe 'requires' table jcod line:48 is 0x0000. This value is neither ACC_MANDATED (0x8000) nor ACC_SYNTHETIC (0x1000).

      As per jvms 4.7.25. The Module Attribute (assertion ids: jvms-4.7.25-300-D-I.1-B-A & jvms-4.7.25-300-D-I.1-B-B), above illustrated example should throw error.

      Even if javac has produced erroneous class file, this should be rejected at VM.

            alanb Alan Bateman
            pgundarlahal Prashanthram Gundarlahally
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: