SystemUtil
and deleted some unused methods.@Deprecated public class PluginUtil extends Object
CheckerMain
.Modifier and Type | Class and Description |
---|---|
static class |
PluginUtil.CheckerProp
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
static String |
CHECKER_QUAL_PATH_OPT
Deprecated.
Option name for specifying an alternative checker-qual.jar location.
|
static String |
JAVAC_PATH_OPT
Deprecated.
Option name for specifying an alternative javac.jar location.
|
static String |
JDK_PATH_OPT
Deprecated.
Option name for specifying an alternative jdk.jar location.
|
Constructor and Description |
---|
PluginUtil()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static String |
escapeQuotesAndSlashes(String toEscape)
Deprecated.
|
static String |
fileArgToStr(File fileArg)
Deprecated.
|
static List<String> |
getBooleanProp(Map<PluginUtil.CheckerProp,Object> props,
PluginUtil.CheckerProp prop,
String cmdLineArg)
Deprecated.
If prop is in props, return a 1-element list containing
cmdLineArg . |
static boolean |
getBooleanSystemProperty(String key)
Deprecated.
Return true if the system property is set to "true".
|
static boolean |
getBooleanSystemProperty(String key,
boolean defaultValue)
Deprecated.
Return its boolean value if the system property is set.
|
static List<String> |
getCmd(@Nullable String executable,
@Nullable File javacPath,
@Nullable File jdkPath,
File srcFofn,
String processors,
String checkerHome,
String javaHome,
File classPathFofn,
String bootClassPath,
Map<PluginUtil.CheckerProp,Object> props,
PrintStream out,
boolean procOnly,
String outputDirectory)
Deprecated.
Build a javac command.
|
static List<String> |
getCmdArgsOnly(File javacPath,
File jdkPath,
File srcFofn,
String processors,
String checkerHome,
String javaHome,
File classpathFofn,
String bootClassPath,
Map<PluginUtil.CheckerProp,Object> props,
PrintStream out,
boolean procOnly,
String outputDirectory)
Deprecated.
|
static List<String> |
getCmdArgsOnly(File srcFofn,
String processors,
String checkerHome,
String javaHome,
File classpathFofn,
String bootClassPath,
Map<PluginUtil.CheckerProp,Object> props,
PrintStream out,
boolean procOnly,
String outputDirectory)
Deprecated.
|
static String |
getJavaCommand(String javaHome,
PrintStream out)
Deprecated.
|
static String |
getJdkJarName()
Deprecated.
Determine the version of the JRE that we are currently running and select a jdkX.jar where X
is the version of Java that is being run (e.g.
|
static String |
getJdkJarPrefix()
Deprecated.
Determine the version of the JRE that we are currently running and select a jdkX where X is
the version of Java that is being run (e.g.
|
static int |
getJreVersion()
Deprecated.
Returns the major JRE version.
|
static @Nullable String |
getReleaseValue(ProcessingEnvironment env)
Deprecated.
Returns the release value passed to the compiler or null if release was not passed.
|
static List<String> |
getStringProp(Map<PluginUtil.CheckerProp,Object> props,
PluginUtil.CheckerProp prop,
String cmdLineArgStart,
String... extras)
Deprecated.
Returns a list of command-line arguments: one that sets the given property, plus everything
in extras.
|
static boolean |
isWindows()
Deprecated.
|
static String |
join(CharSequence delimiter,
@Nullable Iterable<?> values)
Deprecated.
Returns a new String composed of the string representations of the elements joined together
with a copy of the specified delimiter.
|
static <T> String |
join(CharSequence delimiter,
T[] objs)
Deprecated.
Returns a new String composed of the string representations of the elements joined together
with a copy of the specified delimiter.
|
static String |
joinLines(@Nullable Iterable<? extends Object> v)
Deprecated.
Concatenate the string representations of the objects, placing the system-specific line
separator between them.
|
static <T> String |
joinLines(T... a)
Deprecated.
Concatenate the string representations of the objects, placing the system-specific line
separator between them.
|
static List<String> |
readFile(File argFile)
Deprecated.
Return a list of Strings, one per line of the file.
|
static List<File> |
toFiles(List<String> fileNames)
Deprecated.
Convert a list of strings (file names) to a list of files.
|
static List<String> |
toJavaOpts(List<String> opts)
Deprecated.
|
static String |
wrapArg(String classpath)
Deprecated.
|
static void |
writeFile(File destination,
List<String> contents)
Deprecated.
Write the strings to the file, one per line.
|
static void |
writeFofn(File destination,
File... files)
Deprecated.
Takes a list of files and writes it as a "File of file names" (i.e.
|
static void |
writeFofn(File destination,
List<File> files)
Deprecated.
Takes a list of files and writes it as a "File of file names" (i.e.
|
static File |
writeTmpCpFile(String prefix,
boolean deleteOnExit,
String classpath)
Deprecated.
|
static File |
writeTmpFile(String prefix,
String suffix,
boolean deleteOnExit,
List<String> args)
Deprecated.
Write the strings to a temporary file.
|
static File |
writeTmpFofn(String prefix,
String suffix,
boolean deleteOnExit,
List<File> files)
Deprecated.
|
static File |
writeTmpSrcFofn(String prefix,
boolean deleteOnExit,
List<File> files)
Deprecated.
|
public static final String CHECKER_QUAL_PATH_OPT
public static final String JAVAC_PATH_OPT
public static final String JDK_PATH_OPT
public static List<File> toFiles(List<String> fileNames)
fileNames
- a list of file namespublic static void writeFofn(File destination, List<File> files) throws IOException
destination
- the fofn file we are writing. This file will contain newline separated
list of absolute file paths.files
- the files to write to the destination fileIOException
public static void writeFofn(File destination, File... files) throws IOException
destination
- the fofn file we are writing. This file will contain newline separated
list of absolute file paths.files
- the files to write to the destination fileIOException
public static File writeTmpFofn(String prefix, String suffix, boolean deleteOnExit, List<File> files) throws IOException
IOException
public static File writeTmpFile(String prefix, String suffix, boolean deleteOnExit, List<String> args) throws IOException
deleteOnExit
- if true, delete the file on program exitIOException
public static void writeFile(File destination, List<String> contents) throws IOException
IOException
public static List<String> readFile(File argFile) throws IOException
argFile
- argument fileIOException
- when reading the argFilepublic static <T> String join(CharSequence delimiter, T[] objs)
T
- the type of array elementsdelimiter
- the delimiter that separates each elementobjs
- the values whose string representations to join togetherpublic static String join(CharSequence delimiter, @Nullable Iterable<?> values)
delimiter
- the delimiter that separates each elementvalues
- the values whose string representations to join together@SafeVarargs public static <T> String joinLines(T... a)
T
- the type of array elementsa
- array of values to concatenatepublic static String joinLines(@Nullable Iterable<? extends Object> v)
v
- list of values to concatenatepublic static List<String> getStringProp(Map<PluginUtil.CheckerProp,Object> props, PluginUtil.CheckerProp prop, String cmdLineArgStart, String... extras)
prop
- the property to look up in propscmdLineArgStart
- the command-line argument that introduces proppublic static List<String> getBooleanProp(Map<PluginUtil.CheckerProp,Object> props, PluginUtil.CheckerProp prop, String cmdLineArg)
cmdLineArg
. Otherwise, return
a 0-element list.public static boolean getBooleanSystemProperty(String key)
key
- system property to checkpublic static boolean getBooleanSystemProperty(String key, boolean defaultValue)
key
- system property to checkdefaultValue
- value to use if the property is not setkey
or defaultValue
if key
is not setpublic static File writeTmpSrcFofn(String prefix, boolean deleteOnExit, List<File> files) throws IOException
IOException
public static File writeTmpCpFile(String prefix, boolean deleteOnExit, String classpath) throws IOException
IOException
public static boolean isWindows()
public static String getJavaCommand(String javaHome, PrintStream out)
public static List<String> getCmd(@Nullable String executable, @Nullable File javacPath, @Nullable File jdkPath, File srcFofn, String processors, String checkerHome, String javaHome, File classPathFofn, String bootClassPath, Map<PluginUtil.CheckerProp,Object> props, PrintStream out, boolean procOnly, String outputDirectory)
public static List<String> getCmdArgsOnly(File srcFofn, String processors, String checkerHome, String javaHome, File classpathFofn, String bootClassPath, Map<PluginUtil.CheckerProp,Object> props, PrintStream out, boolean procOnly, String outputDirectory)
public static List<String> getCmdArgsOnly(File javacPath, File jdkPath, File srcFofn, String processors, String checkerHome, String javaHome, File classpathFofn, String bootClassPath, Map<PluginUtil.CheckerProp,Object> props, PrintStream out, boolean procOnly, String outputDirectory)
public static int getJreVersion()
This is different from the version passed to the compiler via --release; use getReleaseValue(ProcessingEnvironment)
to get that version.
Extract the major version number from the "java.version" system property. Two possible formats are considered. Up to Java 8, from a version string like `1.8.whatever`, this method extracts 8. Since Java 9, from a version string like `11.0.1`, this method extracts 11.
public static String getJdkJarPrefix()
public static String getJdkJarName()
public static @Nullable String getReleaseValue(ProcessingEnvironment env)
env
- the ProcessingEnvironment