Summary: This document provides information about the extension providing support for Kotlin Programming Language.

Extension ID

com.castsoftware.kotlin

What's new?

Please see Kotlin 1.0 - Release Notes for more information.

Description

In what situation should you install this extension?

If your application contains Kotlin source code and you want to view these object types and their links with other objects, then you should install this extension. All files with the .kt extension are analyzed.

Kotlin code and Java code may coexist in the same application, and a Kotlin method may call a Java method, and inversely. If a JEE analysis is defined for the Application, call links from Kotlin methods to Java methods should be created. But links from Java methods to Kotlin methods are not supported yet: this is a limitation.

Function Point, Quality and Sizing support

This extension provides the following support:

Function Points
(transactions)

(tick)

Quality and Sizing(tick)

AIP Core compatibility

This extension is compatible with:

AIP Core releaseSupported
8.3.x(tick)

Supported DBMS servers

This extension is compatible with the following DBMS servers:

DBMSSupported
CSS / PostgreSQL(tick)

Supported Kotlin versions

This extension is compatible with the following Kotlin versions:

Kotlin versions1.x

Prerequisites

(tick)An installation of any compatible release of AIP Core (see table above)

Download and installation instructions

The extension will be automatically downloaded and installed in AIP Console when at least one .kt file is delivered for analysis. You can also manually install the extension using the Application - Extensions interface. When installed, follow the instructions below to run a new analysis/snapshot to generate new results:

Source code discovery

A discoverer is provided with the extension to automatically detect Kotlin code: one Kotlin project will be discovered for the package's root folder when at least one .kt file is detected in the root folder or any sub-folders, resulting in a corresponding Universal Technology Analysis Unit:

What results can you expect?

Once the analysis/snapshot generation has completed, you can view the results in the normal manner.

CAST Enlighten


Kotlin code which calls java code:

Supported frameworks

The following libraries are supported for Web Service HTTP calls:

Once the Kotlin extension analysis is finished, the analyzer will output the final number of web service calls created.

Retrofit

import retrofit2.http.GET
import retrofit2.http.POST
interface ApiInterfaces {
@GET("v2/Contacts")
fun getContacts(): Call<CrmContacts>

@POST("v2/Contacts")
fun addContact(): Call<AddResponse>
}

This code produces Web Service HTTP calls

Spring http operation (since version 1.0.3-funcrel)

import org.springframework.stereotype.Controller
import org.springframework.validation.BindingResult
import org.springframework.web.bind.WebDataBinder
import org.springframework.web.bind.annotation.*

interface ApiInterfaces {
@Controller
class VisitController(val visits: VisitRepository, val pets: PetRepository) {
    // Spring MVC calls method loadPetWithVisit(...) before initNewVisitForm is called
    @GetMapping("/owners/*/pets/{petId}/visits/new")
    fun initNewVisitForm(@PathVariable("petId") petId: Int, model: Map<String, Any>): String
            = "pets/createOrUpdateVisitForm"
}

This code produces Web Service HTTP operations. Supported annotations are:

Spring beans (since version 1.0.3-funcrel)

The following code:

import pkg.queue.StandaloneBxCleanup
import org.springframework.context.annotation.AnnotationConfigApplicationContext
        
fun main(args: Array<String>) {
    val standaloneBxCleanup = app.getBean(StandaloneBxCleanup::class.java)
	standaloneBxCleanup.cleanupBxData()
}


package pkg.queue
        
@Component
class StandaloneBxCleanup(@Autowired val parseProcApiFactory: ProcApiFactory,
                          @Autowired val bxCleanerFactory: BxCleanerFactory,
                          @Autowired val cleanupExecutorService: ExecutorService) {
    fun cleanupBxData() {
	}
}

will generate the following links when analyzed:

The following code:

import pkg.queue.BillQueueProcessor
import org.springframework.context.annotation.AnnotationConfigApplicationContext
        
fun main(args: Array<String>) {
    val billQueueProcessor= app.getBean(BillQueueProcessor::class.java)
	Thread(billQueueProcessor).start()
}


package pkg.queue
        
@Component
class BillQueueProcessor(@Autowired val parseProcApiFactory: ProcApiFactory,
                          @Autowired val bxCleanerFactory: BxCleanerFactory,
                          @Autowired val cleanupExecutorService: ExecutorService) {
    override fun run() {
	}
}

will generate the following links when analyzed:

Spring jdbc (since version 1.0.3-funcrel)

Only links to database procedures are supported. The following code:

package pkg.db.proc

import org.springframework.jdbc.`object`.StoredProcedure

class BxCleanupBillList(jdbcTemplate: JdbcTemplate) :
        StoredProcedure(jdbcTemplate, "best.pkg_bb_bill_load.bbl_get_bx_cleanup_bills") {
        
    fun getBxCleanupBills(): List<Long> {
        val outputParams = execute()
        return outputParams[cv1Param] as List<Long>
    }
}

will generate the following links when analyzed:


Objects

The following objects are displayed in CAST Enlighten:

 Icon

Description

Kotlin file

Kotlin anonymous class

Kotlin class / Kotlin generic class / Kotlin JVM class / Kotlin JVM generic class

Kotlin function / Kotlin JVM method

Kotlin generic interface / Kotlin interface

Kotlin instantiated class

Kotlin lambda

Kotlin method

Kotlin Module

Kotlin object

Kotlin Get HttpRequest Service

Kotlin Post HttpRequest Service

Kotlin Delete HttpRequest Service

Kotlin Put HttpRequest Service

Kotlin Web service Get Operation

Kotlin Web service Post Operation

Kotlin Web service Put Operation

Kotlin Web service Delete Operation

Structural rules

The following structural rules are provided:

1.0.5-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.5-funcrel
1.0.4-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.4-funcrel
1.0.3-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.3-funcrel
1.0.2-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.2-funcrel
1.0.1-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.1-funcrel
1.0.0-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.0-funcrel
1.0.0-beta3https://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.0-beta3
1.0.0-beta2https://technologies.castsoftware.com/rules?sec=srs_kotlin&ref=||1.0.0-beta2

You can also find a global list here: https://technologies.castsoftware.com/rules?sec=t_1030000&ref=||.

Known Limitations