Currently, the project only checks kotlin-reflect for JDK 1.6 compatibility. The check is necessary to make sure applications using kotlin-reflect can run on older Android devices.
Run from the root directory of the kotlin project:
./gradlew :tools:jdk-api-validator:test
Successful completion of the test task means the checked libraries are compatible with JDK 1.6 API. In case of failure, the exact location and name of the violating API references are logged as error.
An example of validation error:
[ERROR] /kotlin/libraries/reflect/build/libs/kotlin-reflect-1.9.255-SNAPSHOT.jar:kotlin/reflect/jvm/internal/ComputableClassValue.class:47: Undefined reference: void ClassValue.<init>()
If the violating reference can be desugared by R8 or its execution is prevented on Android platform, the error can be suppressed. See suppressAnnotations and undefinedReferencesToIgnore in JdkApiUsageTest.kt. Otherwise, the API should be avoided.
To check if an API can be desugared by R8:
BackportedMethodList entry point, e.g., java -cp r8-8.0.40.jar com.android.tools.r8.BackportedMethodList.Also, you can get the list of backported methods the downloaded version supports for a given Android API level:
$ java -cp r8-8.0.40.jar com.android.tools.r8.BackportedMethodList --help Usage: BackportedMethodList [options] Options are: --output <file> # Output result in <file>. --min-api <number> # Minimum Android API level for the application --desugared-lib <file> # Desugared library configuration (JSON from the # configuration) --lib <file> # The compilation SDK library (android.jar) --version # Print the version of BackportedMethodList. --help # Print this message.