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

Missing escapes for single quote marks in compiler.properties

XMLWordPrintable

    • b03
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      jdk-20+26-151-g3aa4070d4ca


      A DESCRIPTION OF THE PROBLEM :
      The source file compiler.properties contains the English message bundle for compiler warnings, errors, etc.

      Since the strings in this file are format strings, any single quotes must be escaped by doubling them.

      An example of a properly encoded entry is:

      compiler.err.cant.assign.val.to.this=\
          cannot assign to ''this''

      There are three entries that appear to be not escaped when they should be. These are:

      compiler.err.dc.no.tag.name=\
         no tag name after '@'

      compiler.warn.leaks.not.accessible.not.required.transitive=\
         {0} {1} in module {2} is not indirectly exported using 'requires transitive'

      compiler.err.cant.inherit.from.sealed=\
          class is not allowed to extend sealed class: {0} \
          (as it is not listed in its 'permits' clause)

      The (fairly harmless) result is that the single quote marks are missing from the compiler output.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Generate any of the warnings or errors and notice they are missing single quote marks.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      B.java:1: error: class is not allowed to extend sealed class: A (as it is not listed in its 'permits' clause)

      ACTUAL -
      B.java:1: error: class is not allowed to extend sealed class: A (as it is not listed in its permits clause)


      ---------- BEGIN SOURCE ----------
      $ cat > A.java
      public sealed class A {
      }

      $ cat > B.java
      public class B extends A {
      }

      $ javac A.java B.java
      A.java:1: error: sealed class must have subclasses
      public sealed class A {
                    ^
      B.java:1: error: class is not allowed to extend sealed class: A (as it is not listed in its permits clause)
      public class B extends A {
             ^
      2 errors

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
      index 13c3099c790..ef2409641e4 100644
      --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
      +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
      @@ -3337,7 +3337,7 @@ compiler.err.dc.no.content=\
           no content
       
       compiler.err.dc.no.tag.name=\
      - no tag name after '@'
      + no tag name after ''@''
       
       compiler.err.dc.no.url=\
           no URL
      @@ -3601,7 +3601,7 @@ compiler.warn.leaks.not.accessible.unexported=\
           {0} {1} in module {2} is not exported
       # 0: kind name, 1: symbol, 2: symbol
       compiler.warn.leaks.not.accessible.not.required.transitive=\
      - {0} {1} in module {2} is not indirectly exported using 'requires transitive'
      + {0} {1} in module {2} is not indirectly exported using ''requires transitive''
       # 0: kind name, 1: symbol, 2: symbol
       compiler.warn.leaks.not.accessible.unexported.qualified=\
           {0} {1} in module {2} may not be visible to all clients that require this module
      @@ -3663,7 +3663,7 @@ compiler.err.sealed.class.must.have.subclasses=\
       # 0: symbol
       compiler.err.cant.inherit.from.sealed=\
           class is not allowed to extend sealed class: {0} \
      - (as it is not listed in its 'permits' clause)
      + (as it is not listed in its ''permits'' clause)
       
       # 0: symbol
       compiler.err.class.in.unnamed.module.cant.extend.sealed.in.diff.package=\


      FREQUENCY : always


        1. A.java
          0.0 kB
        2. B.java
          0.0 kB

            acobbs Archie Cobbs
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: