One of the great features of Kotlin is its interoperability with Java code. This allows you to easily call
'traditional' Java code from your Kotlin code, but it also helps you the other way around:
calling Kotlin code from Java.
Sometimes, a little extra work is needed to make some shiny Kotlin feature work with Java code. For example,
Kotlin supports default parameter values, which are not supported in Java. In this case, the @JvmOverloads
annotation
can be used to generate overloads for functions that contain parameters with default values.
This annotation does not only work on functions, but can also be applied on constructors. In this post I will explain how
to use this feature on the primary constructor, as it might be confusing where to place the annotation.
Continue reading →
If you’ve been working with Spring Security for a while, it should come as no surprise that from time to time, they deprecate the old, and guide you towards the new.
In 5.7.x such a change involves the often used WebSecurityConfigurerAdapter
.
In Spring Security 5.7.0-M2 we deprecated the WebSecurityConfigurerAdapter, as we encourage users to move towards a component-based security configuration.
Continue reading →
Wasm is secure through sandboxing and capability based design. What does this mean for networking?
And why has networking taken so long to be supported by WASI?
Continue reading →
We’re making an API to collect cats.
We’ll be using ZIO 2.0, and Caliban
Continue reading →
In this blogpost we will walk through setting up Renovate for use on GitLab.com.
Continue reading →
In a previous post we learned about the macros SV
, SVI
and SVD
that return a string representation of variables with their name and value. Groovy 4 also added the NP
and NPL
macros that we can use to inspect variables. Instead of returning a GString
instance these macros return a NamedValue
instance or a list of NamedValue
value instances. The NamedValue
class is a simple class with a property name
, containing the name of the variable, and property val
with the value of the variable. The macro NP
can be used when we have a single variable and result is a single NamedValue
instance. An the macro NVL
can be used with multiple variables. The result is a list of NamedValue
instances where each instance represent a variable passed as argument to NVL
.
Continue reading →
It was Paul’s first conference ever,
a little nervous he went from home.
Hopped on a train and entered the building,
stepped so in the unknown.
Continue reading →
Groovy 4 added some built-in macros that we can use in our code. A macro is code that will create new code. It does this by manipulating the Abstract Syntax Tree (AST) before the code is compiled. So when we use a macro, the macro will change the AST and those changes will be compiled. The three built-in macros SV
, SVI
and SVD
can create a GString
instance with the names and values of the variables that are passed as argument. This can be very useful to create some meaningful debugging statements. Normally we would have to type in the variable name ourselves followed by the value. Now with these macros we don’t have to type the variable as the macro will add that to the AST for us.
Continue reading →
DataWeave has a nice language feature called literal types. Literal types are types with a single predefined values and can be defined using a String
, Number
or Boolean
value. So the value of a literal type is a fixed value. We can combine multiple literal types into a new type using a union type to define an enumaration in DataWeave. The enumaration can only be one of the literal types used to define it.
Together with overloaded functions literal types are very useful. We can define a function where one of the input arguments is a literal type to define specific behaviour based on the literal type. Then we can overload the function for other literal types with different behaviour. DataWeave will make sure the correct function is called based on the value of the input argument and how it matches to the literal type value.
Continue reading →
Groovy supports ranges for a long time. But Groovy 4 adds a new feature for ranges and that is the support for open (exclusive) ranges at the beginning of a range. Open means the number that defines the range is not part of the actual range result and we must use the less-than character (<
). This is also referred to as exclusive, where the value is excluded from the range. When a range is closed the value is included, also called inclusive. Before Groovy 4 we could already define the end of the range to be exclusive or inclusive, but now we can also define the beginning of the range to be exclusive.
Continue reading →