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

The values of non-static final fields are printed for the -constants option

XMLWordPrintable

    • b04
    • Not verified

        Compile and get javap's output for any class that contains final fields with "-constants" option, e.g.
        class SimpleClass {
            public final String FINAL_CONSTANT = "Lorem ipsum dolor sit amet...";
            public static String STATIC_CONSTANT = "Lorem ipsum dolor sit amet...";
            public static final String STATIC_FINAL_CONSTANT = "Lorem ipsum dolor sit amet...";
        }

        The output message contains the value of the non-static final field:
        ....
          public final java.lang.String FINAL_CONSTANT = "Lorem ipsum dolor sit amet...";
          public static java.lang.String STATIC_CONSTANT;
          public static final java.lang.String STATIC_FINAL_CONSTANT = "Lorem ipsum dolor sit amet...";
        ....
        According to the help message only the "static final" constant values should be included ("-constants Show static final constants")

              jjg Jonathan Gibbons
              ogb Oleg Barbashov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: