Class SystemUtil

java.lang.Object
org.checkerframework.javacutil.SystemUtil

public final class SystemUtil extends Object
This file contains basic utility functions.
  • Field Details

    • dotSplitter

      public static final com.google.common.base.Splitter dotSplitter
      A splitter that splits on periods. The result contains no empty strings.
    • commaSplitter

      public static final com.google.common.base.Splitter commaSplitter
      A splitter that splits on commas. The result contains no empty strings.
    • colonSplitter

      public static final com.google.common.base.Splitter colonSplitter
      A splitter that splits on colons. The result contains no empty strings.
    • pathSeparatorSplitter

      public static final com.google.common.base.Splitter pathSeparatorSplitter
      A splitter that splits on File.pathSeparator. The result contains no empty strings.
    • jreVersion

      public static final int jreVersion
      The major version number of the Java runtime (JRE), such as 17, 21, or 25.
  • Method Details

    • getPathsProperty

      public static final List<String> getPathsProperty(String propName)
      Like System.getProperty, but splits on the path separator and never returns null.
      Parameters:
      propName - a system property name
      Returns:
      the paths in the system property; might be an empty list
    • available

      public static @Nullable Integer available(InputStream is)
      Calls InputStream.available(), but returns null instead of throwing an IOException.
      Parameters:
      is - an input stream
      Returns:
      is.available(), or null if that throws an exception
    • getReleaseValue

      public static @Nullable String getReleaseValue(ProcessingEnvironment env)
      Returns the release value passed to the compiler or null if release was not passed.
      Parameters:
      env - the ProcessingEnvironment
      Returns:
      the release value or null if none was passed
    • getToolsJar

      public static @Nullable String getToolsJar()
      Returns the pathname to the tools.jar file, or null if it does not exist. Returns null on Java 9 and later.
      Returns:
      the pathname to the tools.jar file, or null