Java 8 introduced JSR-308, which added new annotation capabilities to the Java language. Most importantly: Type annotations. It is now possible to design monsters like the below: https://twitter.com/lukaseder/status/711612663202238464 The code displayed in that tweet really compiles. Every type can be annotated now, in order to enhance the type system in any custom way. Why, you … Continue reading JSR-308 and the Checker Framework Add Even More Typesafety to jOOQ 3.9
10 SQL Tricks That You Didn’t Think Were Possible
Listicles like these do work - not only do they attract attention, if the content is also valuable (and in this case it is, trust me), the article format can be extremely entertaining. This article will bring you 10 SQL tricks that many of you might not have thought were possible. The article is a … Continue reading 10 SQL Tricks That You Didn’t Think Were Possible
The Parameterless Generic Method Antipattern
A very interesting question was posted to Stack Overflow and reddit just recently about Java generics. Consider the following method: <X extends CharSequence> X getCharSequence() { return (X) "hello"; } While the unsafe cast seems a bit wonky, and you might guess there's something wrong here, you can still go ahead and compile the following … Continue reading The Parameterless Generic Method Antipattern
jOOQ Tuesdays: Ming-Yee Iu Gives Insight into Language Integrated Querying
Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other month where we interview someone we find exciting in our industry from a jOOQ perspective. This includes people who work with SQL, Java, Open Source, and a variety of other related topics. We have the pleasure … Continue reading jOOQ Tuesdays: Ming-Yee Iu Gives Insight into Language Integrated Querying
Would We Still Criticise Checked Exceptions, If Java had a Better try-catch Syntax?
In the context of a previous blog post about JUnit 5, Maaartinus, one of our readers, has brought up a very interesting idea: The only problem with try-catch is its verbosity, which is something I can live with (IMHO a lone catch would do better, the implicit try would apply to all preceding code in … Continue reading Would We Still Criticise Checked Exceptions, If Java had a Better try-catch Syntax?
Using jOOQ’s ExecuteListener to Prevent Write Operations on a Connection
Security is important, especially on the data access layer. Most commercial databasese allow for fine-grained privilege control using database access grants. For instance, you would be restricting access from a user to a certain set of tables (or even better: views), via GRANT statements: GRANT SELECT ON table TO user; With this fine-grained access control, … Continue reading Using jOOQ’s ExecuteListener to Prevent Write Operations on a Connection
Using SQL to Calculate the Popularity (on Stack Overflow) of Derby, H2, and HSQLDB
Few people know about this very very awesome feature of the Stack Exchange platform. The Stack Exchange Data Explorer To be found here: http://data.stackexchange.com As you may know, much of the Stack Exchange platform runs on SQL Server (interesting architecture details here: http://stackexchange.com/performance), and the team has had the courtesy of making a lot of … Continue reading Using SQL to Calculate the Popularity (on Stack Overflow) of Derby, H2, and HSQLDB
10 Features I Wish Java Would Steal From the Kotlin Language
This article is overdue. After the hype around the release of Kotlin 1.0 has settled, let's have a serious look at some Kotlin language features that we should have in Java as well. In this article, I'm not going to wish for unicorns. But there are some low hanging fruit (as far as I naively … Continue reading 10 Features I Wish Java Would Steal From the Kotlin Language
Watch Out For Recursion in Java 8’s [Primitive]Stream.iterate()
An interesting question by Tagir Valeev on Stack Overflow has recently caught my attention. To keep things short (read the question for details), while the following code works: public static Stream<Long> longs() { return Stream.iterate(1L, i -> 1L + longs().skip(i - 1L) .findFirst() .get()); } longs().limit(5).forEach(System.out::println); printing 1 2 3 4 5 The following, similar … Continue reading Watch Out For Recursion in Java 8’s [Primitive]Stream.iterate()
Time for some Funky SQL: Prefix Sum Calculation
This Stack Overflow question has yet again nerd-sniped me [finding the] maximum element in the array that would result from performing all M operations Here's the question by John that was looking for a Java solution: With an array of N elements which are initialized to 0. we are given a sequence of M operations … Continue reading Time for some Funky SQL: Prefix Sum Calculation
