Generic AST parsing library for kotlin multiplatform

Overview

License Release

kotlinx.ast

kotlinx.ast is a generic AST (Abstract Syntax Tree) parsing library, Kotlin is currently the only supported language. The library is designed that other languages can be easily added. kotlinx.ast does not use the Kotlin Compiler for parsing, it is using ANTLR (the Kotlin variant: https://github.com/Strumenta/antlr-kotlin) using the official Kotlin Grammar (https://kotlinlang.org/docs/reference/grammar.html).

One Component is Klass, a collection of language independent data classes used to represent and easily access the AST.

Status

The Project is in an early stage, but it is already possible to parse Kotlin code. Bug Reports, Feature Requests and Pull Requests are very welcome.

kotlinx.ast is a multiplatform project, but currently, JVM is the only supported target. Support for JS and native is planned.

antlr-java, antlr-optimized and antlr-kotlin are supported on the JVM. Multiplatform support (Kotlin Native and Kotlin JavaScript) for antlr-kotlin is planned. Because antlr-java and antlr-optimized are JVM-only, support for other platforms is not possible.

Prior art

kastree is using the kotlin compiler for parsing, it can only parse kotlin files. JS and native support is not possible. 'kastree` is currently not under active development.

Example

This Kotlin Code:

@Annotation1("abc")
// line comment between annotations
@Annotation2("\${123}")
fun parse() {}

will be parsed as:

PackageHeader()
importList
KlassDeclaration(fun parse)
  KlassAnnotation(Annotation1)
    KlassArgument()
      KlassString
        "abc"
  KlassAnnotation(Annotation2)
    KlassArgument()
      KlassString
        Escape("\$")
        "{123}"

There are more examples in directory testdata.

  • Files named "*.kt.txt" contains the kotlin source to parse
  • Files named "*.raw.txt" contains the parsed raw kotlin AST as defined by the official Kotlin Grammar
  • Files named "*.summary.txt" contains the AST summary

Open Tasks

There are some parts missing, for example the importList is not converted into an easy-to-use data class

Overview

Currently, there are some libraries that are part of kotlinx.ast:

  • kotlinx.ast:common contains the code that can later be reused by other grammar parsers
  • kotlinx.ast:common-test contains the dependencies to test frameworks, used by kotlinx.ast unit tests
  • kotlinx.ast:parser-antlr-java contains the shared code required to parse grammars using the official antlr4 JVM implementation.
  • kotlinx.ast:parser-antlr-kotlin contains the shared code required to parse grammars using antlr-kotlin
  • kotlinx.ast:parser-antlr-optimized contains the shared code required to parse grammars using the optimized fork of antlr.
  • kotlinx.ast:grammar-kotlin-parser-common contains the shared code required to parse kotlin source
  • kotlinx.ast:grammar-kotlin-parser-antlr-java provides a kotlin ast parsed using antlr-java
  • kotlinx.ast:grammar-kotlin-parser-antlr-kotlin provides a kotlin ast parsed using antlr-kotlin
  • kotlinx.ast:grammar-kotlin-parser-test contains the test data used by the kotlin parsers
  • kotlinx.ast:grammar-antlr4-parser-common contains the shared code required to parse antlr4 grammar files
  • kotlinx.ast:grammar-antlr4-parser-antlr-java provides an antlr4 grammar ast parser using antlr-java
  • kotlinx.ast:grammar-antlr4-parser-test contains the test data used by the antlr4 grammar parsers

External Dependencies

antlr-kotlin

  • ${Versions.antlrKotlinGroup}:antlr-kotlin-runtime:${Versions.antlrKotlin} is required at runtime to be able to parse kotlin code into an AST when using kotlinx.ast:grammar-kotlin-parser-antlr-kotlin.

antlr-java

  • org.antlr:antlr4:${Versions.antlrJava} is required at runtime to be able to parse kotlin code into an AST when using kotlinx.ast:grammar-kotlin-parser-antlr-java.

antlr-optimized

  • com.tunnelvisionlabs:antlr4:${Versions.antlrOptimized} is required at runtime to be able to parse kotlin code into an AST when using kotlinx.ast:grammar-kotlin-parser-antlr-optimized. NOTE: antlr-optimized is a drop-in replacement of antlr-java. Both jars provide the same API, namely the package org.antlr.v4, so you can't use both at the same time. kotlinx.ast:parser-antlr-optimized depends on kotlinx.ast:parser-antlr-java, both provide the same kotlinx.ast API. The difference is that parser-antlr-optimized will exclude the dependency to org.antlr:antlr4 and instead include com.tunnelvisionlabs:antlr4. The generated code of these two libraries is not equal, therefore two different grammar modules are required:
  • kotlinx.ast:parser-antlr-java
  • kotlinx.ast:parser-antlr-optimized (the generated code is linked, for the case that you want to compare it)

(Versions can be found here: Versions.kt)

How to use kotlinx.ast

There is a small example to get started:

Using with Gradle

kotlinx.ast is accessible on Maven & Gradle through Jitpack. In jitpack basically you can use every commit or tag as a version number. You can find recent versions on the Jitpack page for kotlinx.ast.

You have to add this line to settings.gradle.kts: (otherwise, the jars are not resolved):

// Enables KotlinMultiplatform publication and resolving (in dependencies)
enableFeaturePreview("GRADLE_METADATA")

You have to add Jitpack to build.gradle.kts:

repositories {
  maven("https://jitpack.io")
}

Add the dependency to kotlinx.ast into your project:

kotlin {
    jvm()

    sourceSets {
        val commonMain by getting {
            dependencies {
                // please look at https://jitpack.io/#drieks/antlr-kotlin to find the latest version
                api("com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin:0123456789")
            }
        }
    }
}

If you don't use kotlin-multiplatform add this line:

// please look at https://jitpack.io/#drieks/antlr-kotlin to find the latest version
implementation("com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin:0123456789")

Or, if you prefer to use the antlr-java parser (JVM only):

// please look at https://jitpack.io/#drieks/antlr-kotlin to find the latest version
implementation("com.github.kotlinx.ast:grammar-kotlin-parser-antlr-java:0123456789")

The latest version can be be seen in the Jitpack-Badge at the top of this page.

Comments
  • How to get the entire AST instead of just the summary?

    How to get the entire AST instead of just the summary?

    Hi!

    The title says it basically. How do you get the entire AST, with DefaultAstNodes converted to the Klass Data classes, from a kotlinfile. In the example the following function is invoked:

    kotlinFile.summary()
    

    This function does not include the body of a function for example. I tried to create my own function:

    kotlinFile.complete()
    
    private val completeTreeMap: TreeMap = DefaultTreeMap(
        annotationsMapper,
        declarationsMapper,
        expressionsMapper.flattenNames("functionDeclaration"),
        globalsMapper,
        kotlinDefaultMapper,
        modifierMapper,
        stringMapper,
        typesMapper
    )
    
    fun List<Ast>.complete(): AstResult<List<Ast>> {
        return completeTreeMap.treeMap(this)
    }
    
    fun Ast.complete(): AstResult<List<Ast>> {
        return listOf(this).complete()
    }
    

    I tried to change the Mappers in the DefaultTreeMap, but couldn't get a configuration to be able to visit the statements in the body of functions.

    Hopefully this is enough information to be able to resolve my problem.

    Thanks in advance!

    opened by ToineHulshof 10
  • java.lang.ArrayIndexOutOfBoundsException during parsing

    java.lang.ArrayIndexOutOfBoundsException during parsing

    Hi! I tried to parse a very simple file: class Sample (private val propertyA: String)

    using the code from example

    fun main() {
        val source = AstSource.File(
            "src/jvmMain/kotlin/sample/Sample.kt"
        )
        val kotlinFile = KotlinGrammarAntlrKotlinParser.parseKotlinFile(source)
        kotlinFile.summary()
            .onSuccess { astList ->
                astList.forEach(Ast::print)
            }.onFailure { errors ->
                errors.forEach(::println)
            }
    }
    

    And got such error

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 170
    	at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinAstParserImpl.toAstTerminal(AntlrKotlinAstParserImpl.kt:27)
    	at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinAstParserImpl.parse(AntlrKotlinAstParserImpl.kt:82)
    	at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinAstParserImpl.parse(AntlrKotlinAstParserImpl.kt:75)
    	at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinAstParserImplKt.antlrKotlinParser(AntlrKotlinAstParserImpl.kt:138)
    	at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinAstParserImplKt.antlrKotlinParser(AntlrKotlinAstParserImpl.kt:98)
    	at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinParser.parse(AntlrKotlinParser.kt:20)
    	at kotlinx.ast.grammar.kotlin.common.KotlinGrammarParser$DefaultImpls.parseKotlinFile(KotlinGrammarParser.kt:9)
    	at kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParser.parseKotlinFile(KotlinGrammarAntlrKotlinParser.kt:10)
    	at sample.MainKt.main(Main.kt:14)
    	at sample.MainKt.main(Main.kt)
    
    opened by VitaSokolova 9
  • java.lang.NoClassDefFoundError: Could not initialize class kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParser

    java.lang.NoClassDefFoundError: Could not initialize class kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParser

    My project is a Gradle Plugin that parses Kotlin code to generate flat files.

    I am trying to replace kastree with this library, but i encounter the captioned error when I run my plugin in another project. My code works fine within my Gradle plugin project and my tests though. I suppose this is a missing transitive dependency problem, but I can't figure out what is missing exactly.

    In my Gradle plugin project I have the following dep:

    api 'com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin-jvm:a96e681f90'
    

    Note that the Gradle project uses subprojects. The parsing is implemented in one of the subproject, and the Gradle plugin project has an implementation dependency on that subproject. I also tried with an api dependency to no avail.

    Should i add a runtime dependency on the kotlin parser ?

    question feedback 
    opened by ghost 7
  • Function with generic parameter with optional breaks the parsing

    Function with generic parameter with optional breaks the parsing

    Example below will crash when calling summary() i.e. KotlinAstParser.parseKotlinFile(source).summary() throws java.lang.UnsupportedOperationException: Empty collection can't be reduced..

    Parsing the code below, with the String? in a generic, leads to a new structure and summary() does not work anymore.

    package com.example.test
    
    class TestClass {
        fun function(record: Map<String?, String>) {
        }
    }
    
    opened by martinflorek 7
  • ParseCancellationException - string interpolated functions

    ParseCancellationException - string interpolated functions

    Hi, I'm not sure that is it ast library issue but I've got following file:

    package com.example.app.ui
    
    internal class FeatureFragment :
        BaseFragment<FeatureViewModel, FeatureFragmentBinding>() {
    
        private fun handleViewStateChanges(viewState: FeatureViewModel.ViewState): Unit =
            with(
                requireBinding
            ) {
                dateRangePropertyView.text =
                    "${monthDayYearDateFormat.format(viewState.dateRange.startDate)} - ${
                        monthDayYearDateFormat.format(viewState.dateRange.endDate)
                    }"
            }
    }
    

    I'm testing the file as usual:

    kotlinFile.summary(attachRawAst = false)
        .onSuccess { astList ->
            astList.forEach(Ast::print)
        }.onFailure { errors ->
            errors.forEach(::println)
        }
    

    and parser throws an exception:

    Exception in thread "main" org.antlr.v4.kotlinruntime.misc.ParseCancellationException at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinErrorListener.syntaxError(AntlrKotlinErrorListener.kt:17) at org.antlr.v4.kotlinruntime.ProxyErrorListener.syntaxError(ProxyErrorListener.kt:34) at org.antlr.v4.kotlinruntime.Parser.notifyErrorListeners(Parser.kt:564) at org.antlr.v4.kotlinruntime.DefaultErrorStrategy.reportUnwantedToken(DefaultErrorStrategy.kt:376) at org.antlr.v4.kotlinruntime.DefaultErrorStrategy.sync(DefaultErrorStrategy.kt:271) at kotlinx.ast.grammar.kotlin.target.antlr.kotlin.generated.KotlinParser.kotlinFile(KotlinParser.kt:1108) at kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParserExtractor$extractor$1.invoke(KotlinGrammarAntlrKotlinParserAstParserType.kt:18) at kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParserExtractor$extractor$1.invoke(KotlinGrammarAntlrKotlinParserAstParserType.kt:9) at kotlinx.ast.common.AstParserExtractor$DefaultImpls.extract(AstParserExtractor.kt:5) at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinParserExtractor$DefaultImpls.extract(AntlrKotlinParserExtractor.kt) at kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParserExtractor.extract(KotlinGrammarAntlrKotlinParserAstParserType.kt:9) at kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParserExtractor.extract(KotlinGrammarAntlrKotlinParserAstParserType.kt:9) at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinAstParserImplKt.antlrKotlinParser(AntlrKotlinAstParserImpl.kt:165) at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinAstParserImplKt.antlrKotlinParser(AntlrKotlinAstParserImpl.kt:121) at kotlinx.ast.parser.antlr.kotlin.AntlrKotlinParser.parse(AntlrKotlinParser.kt:20) at kotlinx.ast.grammar.kotlin.common.KotlinGrammarParser$DefaultImpls.parseKotlinFile(KotlinGrammarParser.kt:9) at kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParser.parseKotlinFile(KotlinGrammarAntlrKotlinParser.kt:10) at org.jetbrains.kotlin.idea.scratch.generated.ScratchFileRunnerGenerated$ScratchFileRunnerGenerated.(tmp.kt:22) at org.jetbrains.kotlin.idea.scratch.generated.ScratchFileRunnerGenerated.main(tmp.kt:33)

    The problem has to be the line break after ${ because, without that lines, the execution goes smooth

                dateRangePropertyView.text =
                    "${monthDayYearDateFormat.format(viewState.dateRange.startDate)} - ${
                        monthDayYearDateFormat.format(viewState.dateRange.endDate)
                    }"
    

    Library version

    com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin-jvm:a96e681f90

    bug feedback 
    opened by arkadiuszpalka 6
  • Constructor parameters and properties defined in constructor

    Constructor parameters and properties defined in constructor

    The parser now handles "escaped" characters inside annotations' values but I have found another missing node.

    The AST does not contain constructor parameters and properties declared in constructor e.g.:

    class TestClass(
        @Value("test value")
        private val propertyA: String
    )
    
    opened by martinflorek 6
  • Best way to add new keywords like in the Spock test

    Best way to add new keywords like in the Spock test

    Hi I would like to add some additional keyword (labels) knows from Spock library: Given, When, Then, Expect, And. These labels would be enabled only when junit test class is annotated with my custom annotation for instance @BddScenario.

    I think that currently is not possible or maybe I am wrong?

    opened by CamilYed 4
  • KotlinGrammarAntlrKotlinParser very slow for files with json-strings

    KotlinGrammarAntlrKotlinParser very slow for files with json-strings

    Creating a file like this:

    package testpackage.
    
    val LARGE_JSON = """
         <very large json with 77000 lines>
    """
    

    Running

    val source = AstSource.String("", stringSource)
    val kotlinFile = KotlinGrammarAntlrKotlinParser.parseKotlinFile(source)
    

    takes very long on a file like this. If I replace the JSON in the string with base64, it will be much faster. Does the grammar somehow inspect the braces inside the templating?

    opened by fab1an 4
  • Nullable types are not parsed correctly

    Nullable types are not parsed correctly

    I'm parsing the following Kotlin code kotlinx.ast and the KotlinGrammarAntlrKotlinParser. But weirdly, I have some nullable types which are not marked as nullable.

    package foo.bar
    class Spam {
        fun doSomething(i: Int, s: String?, l : List<String>) {}
    } 
    

    Here's what I get when printing the AST nodes

    PackageHeader(foo.bar)
    importList
    KlassDeclaration(object Spam)
    PackageHeader(foo.bar)
    importList
    KlassDeclaration(class Spam)
      classBody
        KlassDeclaration(fun doSomething)
          KlassDeclaration(parameter i Int)
          KlassDeclaration(parameter s String)
          KlassDeclaration(parameter l List<String>)
    

    I'm using version c35b50fa44 from JitPack :

    implementation("com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin-jvm:c35b50fa44")
    
    opened by xgouchet 4
  • Unable to use example class, because I am unable to import classes

    Unable to use example class, because I am unable to import classes

    Hi, Please help in what I am doing wrong I am unable to use this AstSource

    Dependencies used -

        implementation 'com.github.drieks.antlr-kotlin:antlr-kotlin-runtime-jvm:b09d76328'
        implementation 'com.github.drieks.antlr-kotlin:antlr-kotlin-runtime:b09d76328'
        api("com.github.kotlinx.ast:grammar-kotlin-parser-antlr-kotlin:b09d76328")
    

    Sample code -

        val source = AstSource.File(
            "grammar-kotlin-parser-antlr-kotlin/src/jvmTest/kotlin/kotlinx/ast/example/ExampleMain.kt"
        )
        val kotlinFile = KotlinGrammarAntlrKotlinParser.parseKotlinFile(source)
        kotlinFile.summary(attachRawAst = false)
            .onSuccess { astList ->
                astList.forEach(Ast::print)
            }.onFailure { errors ->
                errors.forEach(::println)
            }
    }
    

    Error - Unable to import class - AstSource

    opened by rahullohra2903 4
  • How to recursively print the structure of Ast

    How to recursively print the structure of Ast

    Hi, thanks for the work!

    I am fresh to Kotlin, and I want to convert a Kotlin file to AST.

    Here is my Kotlin file:

    package com.kickstarter.libs.utils
    
    import android.content.Context
    import android.net.Uri
    import androidx.browser.customtabs.CustomTabsIntent
    import androidx.core.content.ContextCompat
    import com.kickstarter.R
    
    object UrlUtils {
    
        private const val KEY_REF = "ref"
    
        fun appendPath(baseUrl: String, path: String): String {
            val uriBuilder = Uri.parse(baseUrl).buildUpon()
            uriBuilder.appendEncodedPath(path)
    
            return uriBuilder.build().toString()
        }
    
        fun appendQueryParameter(baseUrl: String, key: String, value: String): String {
            val uriBuilder = Uri.parse(baseUrl).buildUpon()
            uriBuilder.appendQueryParameter(key, value)
    
            return uriBuilder.build().toString()
        }
    
        fun appendRefTag(baseUrl: String, tag: String): String {
            return appendQueryParameter(baseUrl, KEY_REF, tag)
        }
    
        fun baseCustomTabsIntent(context: Context): CustomTabsIntent {
            val builder = CustomTabsIntent.Builder()
    
            builder.setShowTitle(true)
            builder.setToolbarColor(ContextCompat.getColor(context, R.color.primary))
    
            return builder.build()
        }
    
        fun refTag(url: String): String? {
            return Uri.parse(url).getQueryParameter(KEY_REF)
        }
    }
    
    

    Here is the test code:

    package kotlinx.ast.example
    
    import kotlinx.ast.common.AstSource
    import kotlinx.ast.common.ast.Ast
    import kotlinx.ast.common.print
    import kotlinx.ast.grammar.kotlin.common.summary
    import kotlinx.ast.grammar.kotlin.target.antlr.kotlin.KotlinGrammarAntlrKotlinParser
    
    fun main() {
        val source = AstSource.File(
                "gen.kotlin/src/main/resources/2.kt.txt"
        )
        val kotlinFile = KotlinGrammarAntlrKotlinParser.parseKotlinFile(source)
        kotlinFile.summary(attachRawAst = false)
                .onSuccess { astList ->
                    astList.forEach(Ast::print)
                }.onFailure { errors ->
                    errors.forEach(::println)
                }
    }
    

    And here is the result, which only prints the top-level ones:

    PackageHeader(com.kickstarter.libs.utils)
    importList
      Import(android.content.Context)
      Import(android.net.Uri)
      Import(androidx.browser.customtabs.CustomTabsIntent)
      Import(androidx.core.content.ContextCompat)
      Import(com.kickstarter.R)
    KlassDeclaration(object UrlUtils)
    
    

    However, I found that the children for the top-level object AST is empty, then how to print the whole structure of the file?

    opened by Symbolk 3
  • Bump multiplatform from Versions.kotlin to 1.8.0

    Bump multiplatform from Versions.kotlin to 1.8.0

    Bumps multiplatform from Versions.kotlin to 1.8.0.

    Release notes

    Sourced from multiplatform's releases.

    Kotlin 1.8.0

    Changelog

    Analysis API

    • KT-50255 Analysis API: Implement standalone mode for the Analysis API

    Analysis API. FIR

    • KT-54292 Symbol Light classes: implement PsiVariable.computeConstantValue for light field
    • KT-54293 Analysis API: fix constructor symbol creation when its accessed via type alias

    Android

    • KT-53342 TCS: New AndroidSourceSet layout for multiplatform
    • KT-53013 Increase AGP compile version in KGP to 4.1.3
    • KT-54013 Report error when using deprecated Kotlin Android Extensions compiler plugin
    • KT-53709 MPP, Android SSL2: Conflicting warnings for androidTest/kotlin source set folder

    Backend. Native. Debug

    • KT-53561 Invalid LLVM module: "inlinable function call in a function with debug info must have a !dbg location"

    Compiler

    New Features

    • KT-52817 Add @JvmSerializableLambda annotation to keep old behavior of non-invokedynamic lambdas
    • KT-54460 Implementation of non-local break and continue
    • KT-53916 Support Xcode 14 and new Objective-C frameworks in Kotlin/Native compiler
    • KT-32208 Generate method annotations into bytecode for suspend lambdas (on invokeSuspend)
    • KT-53438 Introduce a way to get SourceDebugExtension attribute value via JVMTI for profiler and coverage

    Performance Improvements

    • KT-53347 Get rid of excess allocations in parser
    • KT-53689 JVM: Optimize equality on class literals
    • KT-53119 Improve String Concatenation Lowering

    Fixes

    • KT-53465 Unnecessary checkcast to array of reified type is not optimized since Kotlin 1.6.20
    • KT-49658 NI: False negative TYPE_MISMATCH on nullable type with when
    • KT-48162 NON_VARARG_SPREAD isn't reported on *toTypedArray() call
    • KT-43493 NI: False negative: no compilation error "Operator '==' cannot be applied to 'Long' and 'Int'" is reported in builder inference lambdas
    • KT-54393 Change in behavior from 1.7.10 to 1.7.20 for java field override.
    • KT-55357 IllegalStateException when reading a class that delegates to a Java class with a definitely-not-null type with a flexible upper bound
    • KT-55068 Kotlin Gradle DSL: No mapping for symbol: VALUE_PARAMETER SCRIPT_IMPLICIT_RECEIVER on JVM IR backend
    • KT-51284 SAM conversion doesn't work if method has context receivers
    • KT-48532 Remove old JVM backend

    ... (truncated)

    Changelog

    Sourced from multiplatform's changelog.

    1.8.0

    Analysis API

    • KT-50255 Analysis API: Implement standalone mode for the Analysis API

    Analysis API. FIR

    • KT-54292 Symbol Light classes: implement PsiVariable.computeConstantValue for light field
    • KT-54293 Analysis API: fix constructor symbol creation when its accessed via type alias

    Android

    • KT-53342 TCS: New AndroidSourceSet layout for multiplatform
    • KT-53013 Increase AGP compile version in KGP to 4.1.3
    • KT-54013 Report error when using deprecated Kotlin Android Extensions compiler plugin
    • KT-53709 MPP, Android SSL2: Conflicting warnings for androidTest/kotlin source set folder

    Backend. Native. Debug

    • KT-53561 Invalid LLVM module: "inlinable function call in a function with debug info must have a !dbg location"

    Compiler

    New Features

    • KT-52817 Add @JvmSerializableLambda annotation to keep old behavior of non-invokedynamic lambdas
    • KT-54460 Implementation of non-local break and continue
    • KT-53916 Support Xcode 14 and new Objective-C frameworks in Kotlin/Native compiler
    • KT-32208 Generate method annotations into bytecode for suspend lambdas (on invokeSuspend)
    • KT-53438 Introduce a way to get SourceDebugExtension attribute value via JVMTI for profiler and coverage

    Performance Improvements

    • KT-53347 Get rid of excess allocations in parser
    • KT-53689 JVM: Optimize equality on class literals
    • KT-53119 Improve String Concatenation Lowering

    Fixes

    • KT-53465 Unnecessary checkcast to array of reified type is not optimized since Kotlin 1.6.20
    • KT-49658 NI: False negative TYPE_MISMATCH on nullable type with when
    • KT-48162 NON_VARARG_SPREAD isn't reported on *toTypedArray() call
    • KT-43493 NI: False negative: no compilation error "Operator '==' cannot be applied to 'Long' and 'Int'" is reported in builder inference lambdas
    • KT-54393 Change in behavior from 1.7.10 to 1.7.20 for java field override.
    • KT-55357 IllegalStateException when reading a class that delegates to a Java class with a definitely-not-null type with a flexible upper bound
    • KT-55068 Kotlin Gradle DSL: No mapping for symbol: VALUE_PARAMETER SCRIPT_IMPLICIT_RECEIVER on JVM IR backend
    • KT-51284 SAM conversion doesn't work if method has context receivers
    • KT-48532 Remove old JVM backend
    • KT-55065 Kotlin Gradle DSL: Reflection cannot find class data for lambda, produced by JVM IR backend

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies java 
    opened by dependabot[bot] 0
  • Is it possible to insert an element?

    Is it possible to insert an element?

    I am just coming from https://github.com/cretz/kastree as it points me to here.

    Bascially what I want to do is to insert a new element. kastree can modify the node, but does not seem to be able to insert a node. So I came here and take a look. Loos like this library can only parse but cannot insert an element? https://github.com/kotlinx/ast/issues/43

    opened by zeroarst 0
  • Bump logback-classic from 1.2.10 to 1.4.5

    Bump logback-classic from 1.2.10 to 1.4.5

    Bumps logback-classic from 1.2.10 to 1.4.5.

    Commits
    • 34a6efc preparfe release 1.4.5
    • 0d3ac63 fix LOGBACK-1698, [Nested appenders are not allowed] warning using SiftingApp...
    • a64b8d4 make jakarta.servlet-api as both provided and optional
    • 114b3de bump slf4j version
    • 1df6662 fix LOGBACK-1706
    • ea165fb fix LOGBACK-1703
    • 9e07bd0 fix LOGBACK-1703
    • a871e9f minor edits in README.md
    • 7dc0ce5 Merge pull request #605 from Zardoz89/patch-1
    • 7130dfe README.md MUST inform about Java & Jackarta EE support
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies java 
    opened by dependabot[bot] 0
  • Publish somewhere different than jitpack.io

    Publish somewhere different than jitpack.io

    Due to unreliability of jitpack.io repository (https://github.com/jitpack/jitpack.io/issues/5239) I wanted to ask if it is possible to publish somewhere else, like maven central or anything. Our builds are constantly failing due to this.

    opened by fhoner 5
  • Bump gradle/wrapper-validation-action from 1.0.4 to 1.0.5

    Bump gradle/wrapper-validation-action from 1.0.4 to 1.0.5

    Bumps gradle/wrapper-validation-action from 1.0.4 to 1.0.5.

    Release notes

    Sourced from gradle/wrapper-validation-action's releases.

    v1.0.5

    Gradle Wrapper Validation

    • Update dependencies for Node 16 (#53)
    • Update dependencies with security vulnerabilities (#67)
    • Update various other dependencies (#45, #47, #48, #54)
    Commits
    • 55e685c Dependencies
    • f232d2e Merge branch 'master' into releases/v1
    • 9aa31f2 Merge pull request #67 from gradle/dd/update-deps
    • 5d6ea91 Extend timeout for Jest tests
    • db7df1f Update dependencies with vulnerabilities
    • 859c332 Merge pull request #53 from KengoTODA/node-16
    • d0ffc95 ci: install node v16 instead of v12
    • 6793660 Merge remote-tracking branch 'upstream/master' into node-16
    • 781fa15 Merge pull request #54 from gradle/dependabot/npm_and_yarn/ansi-regex-5.0.1
    • 7606dd0 Bump ansi-regex from 5.0.0 to 5.0.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 0
Releases(v0.1.0)
  • v0.1.0(Nov 28, 2021)

    What's Changed

    • add GitHub Actions workflow (ci.yml) by @sullis in https://github.com/kotlinx/ast/pull/6
    • Support for Kotlin 1.4.x by @drieks in https://github.com/kotlinx/ast/pull/20
    • ci: Java matrix 8, 11, 15 by @sullis in https://github.com/kotlinx/ast/pull/14
    • enable Gradle wrapper validation by @sullis in https://github.com/kotlinx/ast/pull/23
    • enable Dependabot v2 by @sullis in https://github.com/kotlinx/ast/pull/24
    • Bump actions/checkout from v1 to v2.3.4 by @dependabot in https://github.com/kotlinx/ast/pull/25
    • Gradle 6.7.1 by @sullis in https://github.com/kotlinx/ast/pull/26
    • Gradle 6.8 by @sullis in https://github.com/kotlinx/ast/pull/27
    • Bump gradle/wrapper-validation-action from 1 to 1.0.3 by @dependabot in https://github.com/kotlinx/ast/pull/40
    • Bump actions/setup-java from 1 to 2 by @dependabot in https://github.com/kotlinx/ast/pull/39
    • Bump gradle/wrapper-validation-action from 1.0.3 to 1.0.4 by @dependabot in https://github.com/kotlinx/ast/pull/41
    • Bump logback-classic from 1.2.3 to 1.2.5 by @dependabot in https://github.com/kotlinx/ast/pull/47
    • Bump logback-classic from 1.2.5 to 1.2.6 by @dependabot in https://github.com/kotlinx/ast/pull/49
    • Bump actions/checkout from 2.3.4 to 2.4.0 by @dependabot in https://github.com/kotlinx/ast/pull/52
    • Bump logback-classic from 1.2.6 to 1.2.7 by @dependabot in https://github.com/kotlinx/ast/pull/53
    • Kotlin 1.6 by @drieks in https://github.com/kotlinx/ast/pull/54
    • Create gradle-publish.yml by @drieks in https://github.com/kotlinx/ast/pull/55

    New Contributors

    • @sullis made their first contribution in https://github.com/kotlinx/ast/pull/6
    • @drieks made their first contribution in https://github.com/kotlinx/ast/pull/20
    • @dependabot made their first contribution in https://github.com/kotlinx/ast/pull/25

    Full Changelog: https://github.com/kotlinx/ast/commits/v0.1.0

    Source code(tar.gz)
    Source code(zip)
Owner
null
Kotlin multiplatform bounded open/closed generic intervals.

Kotlin Multiplatform Bounded Open/Closed Generic Intervals Represent closed, open, or half-open, bounded intervals in Kotlin and perform common operat

Steven Jeuris 2 Sep 28, 2022
KtRssReader is a Kotlin library for parsing RSS feed.

KtRssReader is a Kotlin library for parsing RSS feed.

Ivan 78 Dec 19, 2022
Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in Kotlin with Jetpack Compose and a backed in Kotlin hosted on AppEngine.

Conferences4Hall Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in K

Gérard Paligot 98 Dec 15, 2022
A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android

Blue-Falcon A Bluetooth "Cross Platform" Kotlin Multiplatform library for iOS, Android, MacOS, Raspberry Pi and Javascript. Bluetooth in general has t

Andrew Reed 220 Dec 28, 2022
Dependency Injection library for Kotlin Multiplatform, support iOS and Android

Multiplatform-DI library for Kotlin Multiplatform Lightweight dependency injection framework for Kotlin Multiplatform application Dependency injection

Anna Zharkova 32 Nov 10, 2022
Kotlin multiplatform library template.

template-kmp-library Kotlin multiplatform library template. Has a baseline setup for a multiplatform library supporting all kotlin targets except andr

Martynas Petuška 51 Nov 21, 2022
Server Sent Events (SSE) client multiplatform library made with Kotlin and backed by coroutines

OkSSE OkSSE is an client for Server Sent events protocol written in Kotlin Multiplatform. The implementation is written according to W3C Recommendatio

BioWink GmbH 39 Nov 4, 2022
A local storage management library for Kotlin Multiplatform Mobile iOS and android

A local storage management library for Kotlin Multiplatform Mobile iOS and android Features iOS and Android local storage in one interface Provides ge

LINE 20 Oct 30, 2022
Kotlin multiplatform library template

template-kmp-library Kotlin multiplatform library template. Has a baseline setup for a multiplatform library supporting all kotlin targets except depr

Jamie Astley 0 Dec 6, 2021
Kotlin Multiplatform (KMP) library for reading resources in tests

kotlinx-resources Kotlin Multiplatform (KMP) plugin and library that add support for reading resources in tests. The plugin and a library work in tand

Gonçalo Silva 29 Dec 27, 2022
Kotlinx-murmurhash - Kotlin Multiplatform (KMP) library for hashing using MurmurHash

kotlinx-murmurhash Kotlin Multiplatform (KMP) library for MurmurHash, a non-cryp

Gonçalo Silva 23 Dec 27, 2022
Semantic Versioning library for Kotlin Multiplatform.

kotlin-semver Semantic Versioning library for Kotlin Multiplatform. It implements the full semantic version 2.0.0 specification and provides ability t

Peter Csajtai 33 Dec 29, 2022
NSErrorKt - A Kotlin Multiplatform Library to improve NSError interop

NSErrorKt A Kotlin Multiplatform Library to improve NSError interop. WARNING: Th

Rick Clephas 30 Nov 23, 2022
A Kotlin multiplatform unit testing library inspired by / similar to Google Truth.

Truthish A testing API inspired by Google Truth but rewritten in Kotlin from the ground up, so it can be used in Kotlin multiplatform projects. For ex

Varabyte 70 Nov 2, 2022
A library for working with URIs in Kotlin Multiplatform

Uri KMP Most of this work is derived from AOSP's Uri: Uri.java UriCodec.java UriTest.java UriCodecTest.java Gradle Groovy repositories { mavenCentra

Eliezer Graber 10 Jan 4, 2023
A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and okio

Store A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisatio

Isuru Rajapakse 98 Jan 3, 2023
Opinionated Redux-like implementation backed by Kotlin Coroutines and Kotlin Multiplatform Mobile

CoRed CoRed is Redux-like implementation that maintains the benefits of Redux's core idea without the boilerplate. No more action types, action creato

Kittinun Vantasin 28 Dec 10, 2022
An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile.

An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile. 项目架构主要分为原生系统层、Android/iOS业务SDK层、KMM SDK层、KMM业务逻辑SDK层、iOS sdkfra

libill 4 Nov 20, 2022
Dependency Injection library for Compose Multiplatform, Koin wrapper.

?? Cokoin Injection library for Compose (Multiplatform and Jetpack), Koin wrapper. It uses @Composable functions to configure KoinContext and Scopes.

Bruno Wieczorek 57 Dec 29, 2022