Kotlin command-line syntax

The translation of Kotlin code is similar to the translation of Java code. To translate Kotlin code, all types defined in a library that are referenced in the code must have a corresponding definition in the source code, a class file, or a JAR file. Include all source files on the OpenText SAST command line.

The basic command-line syntax to translate Kotlin code is shown in the following example:

sourceanalyzer –b <build_id> -cp <classpath> [<translation_options>] <files>

where

  • -cp <classpath> specifies the class path to use for the Kotlin source code.

    Include all JAR dependencies normally used to build the project. Separate multiple paths with semicolons (Windows) or colons (non-Windows).

    OpenText SAST loads classes in the order they appear in the class path. If there are multiple classes with the same name in the list, OpenText SAST uses the first loaded class. In the following example, if both A.jar and B.jar include a class called MyData.class, OpenText SAST uses the MyData.class from A.jar.

    sourceanalyzer –cp "A.jar:B.jar" myfile.kt

    OpenText strongly recommends that you avoid using duplicate classes with the -cp option.

For descriptions of all the available Kotlin-specific command-line options, see Kotlin Command-Line Options.