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

Public API for java 8 DataFlavor fields do not have @since tag

XMLWordPrintable

    • b100

      Java 8 has introduced some new fields for DataFlavor, without @since 1.8 tag in javadoc.

      Often developer does not have Java 1.6, but a customer has an old java version.
      When a developer uses a public API, they should be sure that it will work on a customer's computer, without runtime errors.

      Document Location
      =================
      https://docs.oracle.com/javase/8/docs/api/java/awt/datatransfer/DataFlavor.html
      public static DataFlavor selectionHtmlFlavor
      public static DataFlavor fragmentHtmlFlavor
      public static DataFlavor allHtmlFlavor

      What is wrong
      =============
      Add @since tag where needed

      Sample code:
      =============

      public class DND {
          public static void main(String[] args) {
              System.out.println(java.awt.datatransfer.DataFlavor.allHtmlFlavor);
          }
      }

      C:\test>"C:\Program Files\Java\jdk1.8.0_51\bin\javac.exe" -source 1.6 -target 1.6 DND.java
      warning: [options] bootstrap class path not set in conjunction with -source 1.6
      1 warning


      C:\test>"C:\Program Files\Java\jdk1.6.0_45\bin\java.exe" DND
      Exception in thread "main" java.lang.NoSuchFieldError: allHtmlFlavor
             at DND.main(DND.java:5)

            aivanov Alexey Ivanov
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: