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.
TopLevelFunction
function as first class citizenExtSimpleService
example of adding functionality (method) into existing class (problems can occur with separate compilation)FactorialTailRec
tail recursion exampleNullableNonNullableReturnTypeExample
example that shows nullable and notNullable types with?
in the endWhenExample
potentially more powerful instrument than java switch statementTransaction
kotlin data POJO example.data
notation generates equals and hashcode, costructor generation,val
- readonly properties, so only getters will be generated destructing and equality declaration exampleDollar
shows- 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
DollarProgression
progression implementation with internal visibility modifier to be visible inside moduleVarArgExample
shows vararg parameters exampleDelegation
example of Delegation pattern alternative to InheritanceSealedExample
feature of closing functionality inside sealed class. Not possible to extend class hierarchy from outside. Plus companion object example, cause there is no static membersvariance
examples of Producer/Consumer pattern to make safe casts and assignmentsSpringExampleTest
integration with spring frameworkObservableTest
observable feature example (kind of value changed listener)Mapping
mapping from Map to class fields exampleDeprecatedTest
example 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