Writing our own compiler plugin for serialization using Kotlin

Serialization and deserialization - are two sides of the same mechanism for storing (persisting) of objects or sending these objects over the network. There are a lot of different formats used for serialization. In general they can be split into two main groups: binary protocols (pickle, protobuf and many other) and protocols with a string representation like json, toml, yaml, csv, e.t.c. We know a lot of different libraries for the serialization in Java, but in Kotlin it was decided to create a common framework for the serialization called kotlinx.serialization. Let’s have a look how this framework works and try to write our own serializer.

Tricky Java puzzlers (part1)

In a modern world the developer spends 80% of his time on Code Reading. So it is extremely important for him to read the code from the “whiteboard”. Understanding of the code written by some other author can be more important than to write your own code. That’s why on interviews to “good” companies or on Java certification exam you could be asked to read simple snippets of code and tell what is the code doing. Solving such puzzlers is also useful for your daily routine as this helps you to understand the code more quickly and refreshes your knowledge of core language specifics. And the last but not the least - finally it is fun and trains your brain! So I have collected such puzzlers for you: some of them were created by me, some of them were taken from interviews, and some were taken from the Java OCA exam. Enjoy it! Read the code below and answer what is this code doing.

Writting maven plugin using Kotlin.

If you are a Java developer you must be familiar with maven - a widely used Java build system. Maven has simple and reliable execution lifecycle: it runs several consecutive phases (like compile, test, package or deploy), and during each phase a set of plugins can be run, for example javac via maven-compiler-plugin during phase ‘compile’.

For a particular plugin one declares a <plugin> section in pom.xml, and each plugin can have several executions. Each execution is bound to a particular phase of build lifecycle, and it may include several goals. Goal is a particular action the plugin can execute, for example compile source code or run tests or check code style.

We are developing diktat - an automatic kotlin code style checker and formatter, which is intended to be used as CI/CD tool that constantly checks quality of code that developers are adding to their projects. To provide a convenient way to run it for all developers we support run from CLI and are preparing to release a dedicated maven plugin to run diktat directly from maven.