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

obscure error message for bad 'provides'

    • b122
    • Verified

      A service implementation type must be a subtype of the corresponding service interface type.

      javac checks for this, and while the error message is not wrong, it is not as helpful as it could be.

      $ cat play/service/src/m/module-info.java
      module m {
          uses java.lang.String;
          provides java.lang.String with java.io.File;
      }

      $ ./build/linux-x86_64-normal-server-release/images/jdk/bin/javac -d play/service/modules !$
      ./build/linux-x86_64-normal-server-release/images/jdk/bin/javac -d play/service/modules play/service/src/m/module-info.java
      play/service/src/m/module-info.java:3: error: incompatible types: File cannot be converted to String
          provides java.lang.String with java.io.File;
                                                ^
      1 error


      A more obvious message would be to say the the service implementation type must be a subtype of the service interface type.

            vromero Vicente Arturo Romero Zaldivar
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: