jextract should quote string literals

XMLWordPrintable

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

      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

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

              Created:
              Updated:
              Resolved: