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

jextract should quote string literals

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: repo-panama
    • Fix Version/s: None
    • Component/s: tools

      Description

      It is sometimes possible for jextract to be fooled by escape characters in strings - this is especially visible in macros which contains escape chars:

      $ cat foo.h
      #define STR "a\n"

      $ jextract --source foo.h

      $ javac --add-modules jdk.incubator.foreign foo_h.java
      warning: using incubating module(s): jdk.incubator.foreign
      ./foo_h$constants$0.java:14: error: unclosed string literal
          static final MemorySegment STR$SEGMENT_CONSTANT_ = CLinker.toCString("a
                                                                               ^
      ./foo_h$constants$0.java:15: error: unclosed string literal
      ");
      ^
      2 errors
      1 warning

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sundar Sundararajan Athijegannathan
              Reporter:
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: