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

jlink with many modules fail

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 11, 14.0.1
    • tools
    • generic
    • generic

      Copied from https://mail.openjdk.java.net/pipermail/jigsaw-dev/2020-May/014513.html

      A modular [bach-demo-99] I generated to check my build tool
      against, failed to create a custom runtime image using jlink
      via itsToolProvider-based service entry-point.

      The project consists of 100 module descriptors. No other Java
      source files (for classes and interfaces) are part of that demo.
      Each descriptor ball${i}n declares a "requires ball${j}n;" with j
      set to a number from 0 to i-1 ... in words, all lower modules.

      javac compiles this project with problems.

      Arguments passed to jlink (as an array of string) reads:

      jlink
        --add-modules ball27n,ball43n,ball88n,[...],ball77n,ball93n
        --module-path .bach\workspace\modules
        --output .bach\workspace\image
        --compress 2
        --no-header-files
        --no-man-pages

      The error message reads:

      jdk.internal.org.objectweb.asm.MethodTooLargeException: Method too large:
      jdk/internal/module/SystemModules$all.moduleDescriptors
      ()[Ljava/lang/module/ModuleDescriptor;

      Is there a limitation of supported modules that can be linked?
      Is the module graph of this conceived project too far out of scope?

      [ bach-demo-99]:
      https://github.com/sormuras/bach/blob/master/src/bach/bach-demo-99.jsh

      Kasper Nielsen wrote:
      JLink generates a "system modules" aggregate class that contains information on every system module. Unfortunately, it does so in a single method. So you are hitting the 64KB limit of methods because you have too many modules with too much info. I would create a bug.

      Rémi Forax wrote:
      It's a bug in the implementation,
      jlink pre-resolve the module graph and encodes it in a generated classfile.
      The fact that that classfile can have a method too big was overlooked.

            Unassigned Unassigned
            cstein Christian Stein
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: