Skip to content

Commit

Permalink
fix: add xlint and file.encoding to Java (#2471)
Browse files Browse the repository at this point in the history
Co-authored-by: weather-tracker <[email protected]>
Co-authored-by: Amin Yahyaabadi <[email protected]>

* Adding back '-J-Dfile.encoding=UTF-8' for javac so its warning messages are printed in UTF-8
as well as its source files are treated as UTF-8 encoding.
* Adding back -Xlint for reporting detailed warning messages for compilers
* removing quotation marks around file.encoding and UTF-8 for java command, 
since java command does not understand quotation marks when it is not removed by the shell 
(cmd.exe won't interpret that)

update for issue #1166
  • Loading branch information
mhatano authored May 13, 2021
1 parent 9143300 commit e730f08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/grammars/java.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function JavaArgs(filepath, context) {
const className = GrammarUtils.Java.getClassName(context)
const classPackages = GrammarUtils.Java.getClassPackage(context)
const tempFolder = GrammarUtils.createTempFolder("jar-")
const cmd = `javac -encoding UTF-8 -sourcepath '${sourcePath}' -d '${tempFolder}' '${filepath}' && java -D'file.encoding'='UTF-8' -cp '${tempFolder}' ${classPackages}${className}`
const cmd = `javac -encoding UTF-8 -J-Dfile.encoding=UTF-8 -Xlint -sourcepath '${sourcePath}' -d '${tempFolder}' '${filepath}' && java -Dfile.encoding=UTF-8 -cp '${tempFolder}' ${classPackages}${className}`
return GrammarUtils.formatArgs(cmd)
}

Expand Down

0 comments on commit e730f08

Please sign in to comment.