Groovy Cookbook

How to remove any class annotation with Groovy compiler configuration script?

One of the most interesting Groovy features is its ability to configure advanced compiler[1] options using DSL script. It becomes handy when you want to apply some global modifications to all Groovy classes. (For instance, you want to add @CompileStatic annotation to all classes, without applying changes to the source code). In most cases, you want to add something to the existing source code, e.g., classes imports or useful annotations, but what if we want to remove one annotation or another?

Read more →

Ratpack Cookbook

Ratpack on GraalVM - how to start?

The journey inside the exciting world of GraalVM continues. Today I would like to share with you results of running Ratpack on GraalVM experiment. You are going to learn how to build a native binary of a simple "Hello, World!" Ratpack application. In the end we are going to run some benchmarks to see if running GraalVM executable produces better results than running JAR on a regular Oracle JDK.

Read more →

Programmer's Bookshelf

Deep Work - book review

This is the second blog post in "Programmer’s Bookshelf" category, and today I would like to share with you my opinion on the "Deep Work" book by Cal Newport. It’s not about programming, but it’s still beneficial to any software developer out there.

Read more →

Groovy Cookbook

JUnit Assume.assumeNotNull(obj) throws NullPointerException in Groovy - what's wrong?

Ignoring some of the unit tests when given conditions are not satisfied is a handy feature of a JUnit framework. I guess you have used many times constructions like Assume.assumeTrue(expr) or Assume.assumeNotNull(expr) in your test code. Today I would like to show you one pretty interesting corner case when the usage of Assume.assumeNotNull(expr) throws NPE in the unit test written in Groovy.

Read more →

Groovy Cookbook

List of combinations from a list of lists in Groovy

Groovy has many useful functions built-in, and one of them is Iterable.combinations() that takes aggregated collections and finds all combinations of items. However, if we take a look its source code, we will find out that it was implemented using very imperative approach (nested for-loops + some if-statement). In this blog post I will show you how to implement the same function using Groovy and tail-recursion algorithm. Enjoy!

Read more →