package-info.java compiled name

Florian Weimer fweimer at redhat.com
Wed Aug 3 07:31:44 UTC 2022


* Andrey Turbanov:

> Hello.
> We found confusing behaviour of javac, when it compiles package-info.java
> On Windows name of compiled _inteface_ contains backslashes:
>
> client>javap package-info.class
> Compiled from "package-info.java"
> interface some\org\client\package-info {
> }

It seems that the class file is not generated by javac:

  Incorrect internal string format in generated package-info.class files
  on Windows
  <https://issues.apache.org/jira/browse/MCOMPILER-485>

  “Unfortunately, the binary class file is incorrectly generated using
  Java's file toString() which uses a platform dependent file separator
  character: on Windows, these Strings contain a backslash.  See this
  line[1] which passes the platform-dependent file name (minus the root
  path and .java extension) to the ClassWriter.”

  [1]https://github.com/gnodet/maven-compiler-plugin/blob/8521ef8fdd12cc0b85c1ace17114ed3d3ffd0b0c/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java#L1356

Thanks,
Florian



More information about the compiler-dev mailing list