plexus-compiler
plexus-compiler copied to clipboard
Fix detecting java version for JDK 1.8
As I said in #420, you should probably go from last to first line: you could inject a javac prefix (I don't say these are real use case):
# with java 21
$ JAVA_TOOL_OPTIONS="-Duser.language=en -Dfoobar='"$'\n'"javac 1.8.0_462"$'\n'"'" javac -version > /dev/null
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en -Dfoobar='
javac 1.8.0_462
'
The code that's responsible for those messages does not escape anything: https://github.com/openjdk/jdk/blob/400a83da893f5fc285a175b63a266de21e93683c/src/hotspot/share/runtime/arguments.cpp#L3160