From e730f08d2cc8954a6562fef4e905776585074b63 Mon Sep 17 00:00:00 2001 From: Manami Hatano Date: Thu, 13 May 2021 16:40:34 +0900 Subject: [PATCH] fix: add xlint and file.encoding to Java (#2471) Co-authored-by: weather-tracker <34795700+weather-tracker@users.noreply.github.com> Co-authored-by: Amin Yahyaabadi * 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 --- lib/grammars/java.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/grammars/java.js b/lib/grammars/java.js index eac62878..de50aaf8 100644 --- a/lib/grammars/java.js +++ b/lib/grammars/java.js @@ -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) }