A project that shows Kotlin language features that differ from java (https://kotlinlang.org/)
- Static Analysis QA Checks
- Project structure
- Building project
- Libraries
- Logging configuration
- Code coverage
- Kotlin features
- Ideas to try
Jacoco/cobertura code coverage, pmd, checkstyle, enforcer, findbugs
Each sub project follows the structure Maven project that consists of the following parts:
- Kotlin main classes are under (
src/main/kotlin) with different classes with kotlin features. - Test extensions for executing tests (
src/test/kotlin) that show kotlin features and run during the build
mvn clean package
Libraries:
- kotlin
Standard output is used
Coveralls and Cobertura are not good with generated code, so Delegates example with ObservableValue and VarArgExample were excluded from coverage.
TopLevelFunctionfunction as first class citizenExtSimpleServiceexample of adding functionality (method) into existing class (problems can occur with separate compilation)FactorialTailRectail recursion exampleNullableNonNullableReturnTypeExampleexample that shows nullable and notNullable types with?in the endWhenExamplepotentially more powerful instrument than java switch statementTransactionkotlin data POJO example.datanotation generates equals and hashcode, costructor generation,val- readonly properties, so only getters will be generated destructing and equality declaration exampleDollarshows- Operator overrides.
- Operator overloading
- Equals and hashcode override_operators
- Try/catch expression values
- Copy value
- Referential and structural equals
- Destructuring object
- Inlining by locking example // coverage tool does not cover inline functions
- Infix function
- Null check do
- Closure
- Dollar Range implementation
DollarProgressionprogression implementation with internal visibility modifier to be visible inside moduleVarArgExampleshows vararg parameters exampleDelegationexample of Delegation pattern alternative to InheritanceSealedExamplefeature of closing functionality inside sealed class. Not possible to extend class hierarchy from outside. Plus companion object example, cause there is no static membersvarianceexamples of Producer/Consumer pattern to make safe casts and assignmentsSpringExampleTestintegration with spring frameworkObservableTestobservable feature example (kind of value changed listener)Mappingmapping from Map to class fields exampleDeprecatedTestexample of kotlin deprecation and tooling of Intellij idea for deprecation
- From reference https://kotlinlang.org/docs/reference/
- Kotlin conf 2017 https://www.youtube.com/playlist?list=PLQ176FUIyIUY6UK1cgVsbdPYA3X5WLam5