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

Revert changes to $ substitution performed as part of nashorn integration



    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • None
    • 8
    • infrastructure
    • None
    • b80
    • 8
    • b84


      Basically if a make variable expands to contain a filename for a nested class (ie one with $ in it) then you need to escape the $ so that make doesn't treat it as a meta-character. And because $ is also the shell meta-character you end up needing a double escape of the form \$$$$, depending on how that variables gets used in targets/pre-reqs/recipes.

      Prior to the nashorn change ListPathsSafely didn't do any $ escaping and any explicit reference to a nested class file, such as:


      in the makefile, had to use the \$$$$. And everything worked fine.

      What nashorn introduced was .java files with $ in their name:

       > dir ../nashorn/src/jdk/nashorn/internal/scripts/
      total 16
      drwxr-xr-x 2 daholme uucp 4096 Feb 26 01:26 .
      drwxr-xr-x 8 daholme uucp 4096 Feb 26 01:26 ..
      -rw-r--r-- 1 daholme uucp 2027 Feb 26 01:26 JO$.java
      -rw-r--r-- 1 daholme uucp 1322 Feb 26 01:26 JS$.java

      so when ListPathsSafely was used together with a src directory to expand into a set of source files, there was no $ escaping and so the $ got dropped from the name, and so the nashorn build failed.

      So the escaping was added to ListPathsSafely. But not the full \$$$$ as the need for that depends upon exactly how the make variable is used. For Java compilation commands ListPathSafely only had to do a simpler $ -> $$ escape sequence.

      But this means that anything explicitly escaped with \$$$$ and passed to ListPathsSafely was now broken as there were too many escapes. This is what broke the profiles builds. So to fix that we had to reduce the number of escapes in the explicitly named files ie:


      so that after processing by ListPathsSafely it was back to the full \$$$$ form.

      That would have been the end of it, except not all uses of nested class file names get passed through ListPathsSafely. Those that do not still need the \$$$$ escape, while those that do need only \$$. Hence we have the problem that when writing the name of such a file you have to know how it is going to be used - which is not a very maintainable solution.


      It was determined that the use of $ in .java file names was not necessary in nashorn and that usage has now been removed - JDK-8009379. Consequently we can revert the change introduced by nashorn in:


      and revert the subsequent fix-ups done under



        Issue Links



              dholmes David Holmes
              dholmes David Holmes
              0 Vote for this issue
              4 Start watching this issue