Resolve compiler warnings (#200)

* Fix: resolve compiler warnings
* Fix: supress warnings about internal api usage
See https://stackoverflow.com/a/19553686/6238618
This commit is contained in:
Andy Li
2020-04-09 23:39:09 +08:00
committed by GitHub
parent 07525f101e
commit c1020d1534
3 changed files with 11 additions and 4 deletions

View File

@@ -12,6 +12,13 @@ apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = '1.7' sourceCompatibility = '1.7'
targetCompatibility = '1.7' targetCompatibility = '1.7'
compileJava {
// Suppress warnings about internal api usage - https://stackoverflow.com/a/19553686/6238618
options.fork = true
options.forkOptions.executable = 'javac'
options.compilerArgs << '-XDignore.symbol.file'
}
repositories { repositories {
jcenter() jcenter()
mavenCentral() mavenCentral()

View File

@@ -64,7 +64,7 @@ public class WinProcess {
private static boolean processHasGetPid() { private static boolean processHasGetPid() {
try { try {
if (Process.class.getMethod("pid", null) != null) { if (Process.class.getMethod("pid") != null) {
return true; return true;
} }
} }
@@ -75,7 +75,7 @@ public class WinProcess {
private static long getPid(Process process) { private static long getPid(Process process) {
try { try {
return (long) Process.class.getMethod("pid", null).invoke(process, null); return (long) Process.class.getMethod("pid").invoke(process);
} }
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
} }

View File

@@ -21,8 +21,8 @@ package com.sheepit.client.standalone;
import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.CmdLineParser;
import static org.kohsuke.args4j.ExampleMode.REQUIRED;
import org.kohsuke.args4j.Option; import org.kohsuke.args4j.Option;
import org.kohsuke.args4j.OptionHandlerFilter;
import java.io.File; import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
@@ -126,7 +126,7 @@ public class Worker {
System.err.println("Usage: "); System.err.println("Usage: ");
parser.printUsage(System.err); parser.printUsage(System.err);
System.err.println(); System.err.println();
System.err.println("Example: java " + this.getClass().getName() + " " + parser.printExample(REQUIRED)); System.err.println("Example: java " + this.getClass().getName() + " " + parser.printExample(OptionHandlerFilter.REQUIRED));
return; return;
} }