Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-529

Java codegen fails to escape eligible Unicode escapes

XMLWordPrintable

      https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.3 specifies processing of Unicode escapes which happens before the source is being parsed. Most notably it contains the following:

       

      If an eligible \ is followed by u, or more than one u, and the last u is not followed by four hexadecimal digits, then a compile-time error occurs.
                  

      This is very easily triggered by a model like:

       

      module def {
        namespace def;
        prefix def;
      
        leaf def {
          type string;
          default "\\u@\\h\\M% ";
        }
      }

      where the snippet emitted for javadoc purposes will end up containing what looks like an eligible escape:

      /**
       *
       * <p>
       * This class represents the following YANG schema fragment defined in module <b>def</b>
       * <pre>
       * module def {
       *   namespace def;
       *   prefix def;
       *   leaf def {
       *     type string;
       *     default "\u@\h\M% ";
       *   }
       * }
       * </pre>
       *
       */
      

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: