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

jshell tool: Edit Pad should be in its own module

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b144
    • Verification:
      Not verified

      Description

      It is a module anomaly to reference Desktop from core JDK tools. Edit Pad needs to be moved out of the jshell tool.

      Paul Sandoz writes --
      One approach for an out of the box solution is to split out the editor functionality into a separate module and for jshell to define a service provider interface. Thereby on a full JDK distribution you can the same functionality but on a more minimal distribution it is not present. A lesser solution is to provide the service provider interface and an example implementation that is not distributed, thereby teaching institutions could still use that.

      Robert Field writes --
      That would certainly be doable. If the critical concern is module boundaries. But that exposes the Edit Pad to use outside of jshell -- is that an issue?

      Mark writes --
      You can prevent undue exposure by defining the service type in the
      jdk.jshell module and exporting its containing package only to the
      new module that contains Edit Pad, something like this:

          module jdk.jshell {
              exports jdk.jshell.editor.spi to jdk.internal.editpad;
              ...
          }

          module jdk.internal.editpad {
              requires java.desktop;
              requires jdk.jshell;
              provides jdk.jshell.editor.spi.Editor
                  with jdk.internal.editpad.EditorProvider;
          }

        Attachments

          Activity

            People

            Assignee:
            rfield Robert Field
            Reporter:
            rfield Robert Field
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: