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

jextract source genarator generates non-compilable classes with naming clashes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • repo-panama
    • repo-panama
    • tools
    • generic
    • generic

    Description

      Example:

      File: stat.h
      struct stat {
         ...
      }

      jextract generates stat.java for header and "stat" inside it

      // header interface
      interface stat {
          ...
         // interface for struct stat
         static interface stat extends Struct<stat> {... }
      }

      The above is not valid code.
      https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.1

      "It is a compile-time error if a class has the same simple name as any of its enclosing classes or interfaces. "

      Another name clash case:

      /usr/include/sys/_types directory is mapped to usr.include.sys._types package. But there is a header called /usr/include/sys/_types.java which is mapped to header interface named usr.include.sys._types. i.e., a package and a class with the same fully qualified name. And that does not compile as well.

      Attachments

        Issue Links

          Activity

            People

              sundar Sundararajan Athijegannathan
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: