JavaLand, 50% Off J9MS, Stack-Walking

CodeFX Weekly #12 — 31stof March 2017

Hi everyone,

this week I was at JavaLand and my book got early-access-published, which involved me in some marketing work, so I didn’t write or code as much. I hence don’t have so much to tell, so this will be a short one.

I send this newsletter out every Friday. Yes, as an actual email. Subscribe!


So JavaLand… it not only sounds like a theme park, it actually happens in one! In Phantasialand close to Cologne, Germany, to be precise. I was a little under the weather but otherwise it was a lot of fun! As mentioned a few weeks ago I rarely go to talks anymore and try to spend about half the day working, which worked out so-and-so.

One of the few talks I watched were those by Sander Mak about Jigsaw. He’s writing O’Reilly’s book about the module system (with Paul Bakker) and it’s always good to know what the competition’s doing. (I wanted to link to the book but something’s wrong with my editor and I can’t paste it. Weird, right?)

As expected, I didn’t learn many new things there but I also went to Rustam Mehmandarov’s talk about Bash command line tricks and got away with a few details I want to start using. Here are my notes on history-related tricks:

  • sudo !! to su-do the last command
  • !<str>:p prints the last command starting with str
  • !?<str>:p prints the last command containing str
  • drop the :p and the command gets executed (danger zone!)
  • ESC+. inserts the last parameter
  • !^ gets replaced by the last command's first argument
  • !$ gets replaced by the last command's last argument
  • !* gets replaced by the last command's argument list

My talk was about JUnit 5 and there’s nothing new in there. Later I gave a Nighthacking interview, though, and there I showed the new API for writing parameterized tests that is going to be in the next milestone (expected April 1st). This is a highly anticipated feature and from what little I saw so far I think it came out great!

By the way, if you enjoy me yapping, at Voxxed Days Zürich I interviewed Sam Brannen, one of the principal developers of JUnit 5.

Back to JavaLand, where beyond talks and interviews I had many interesting conversations with lots of different people and thoroughly enjoyed myself. One thing annoyed me, though, and that is that no expenses are covered. I mean, I do have fun but the conference is not exactly for free, right? Participants, sponsors, exhibitors, they all pay. And then there’s no money to at least cover travel expenses of the people that make this thing a conference? The food was great, though.

The Java 9 Module System

The big news this week is that The Java 9 Module System meap’ed, meaning it is now available as part of Manning’s early access program. Looking at that page, it feels ridiculous that I have anything to do with that… most of the time I’m just a shmock sitting at his desk in his PJs. Do that long enough, though, and the result is a book. Apparently.

If you consider buying it, now is a good time. With the code mlparlog you’ll get 50% off! (Until April 6th.) Convinced? Then, go buy it!

A side benefit of the book being available is that it makes sense to publish some of its content on the blog (with a banner to buy it of course). This means I can finally publish some posts again! At the moment I have no time to write regularly but lifting and reworking sections from the book will work out just fine. I think I will start right away on Monday with optional dependencies…

Speaking of Java 9, if you don’t already have enough of it, I created a list of good resources that get you started.

Stack-Walking API

Last week I wanted to check whether a specific module is present and ended up with this code:

The reason to pass the caller in was that it could be from a different layer than the one containing ModuleUtils and I am pretty sure that that can be a problem. I wondered whether the brand new stack-walking API could help out and I think it can:

Neat. At least until I have another method in ModuleUtils forwarding to isModulePresent(String) because thengetCallerClass() returns ModuleUtils.class. No so neat after all.

But fear not, Stack Walker, Texas Ranger, has us covered:

Much better.

(I just found out that when getModule() returns the unnamed module, which happens when it is called from code on the class path, getLayer() returns null and the method results in an NPE. Why the fuck does it not return Optional? Bleh!)

Lib of the Week

Pro is “a Java 9 compatible build tool” by Remi Forax, the well-known JDK hacker. The byline is “No need to be a maven to be able to use a build tool”. Ooh, burn! The rest of the description goes as follows:

With the introduction of modules in Java 9, creating modules/jars is easier and new applications will tend to have many more smaller modules that it was previously the case. The build model of Maven is not well suited to describe this new world.

I don’t think anything production-ready is going to come from the project but I want to have a look at its internals and see what it does differently then Maven and what I can learn form that about Remi’s perception of modules.


And that was that. I didn’t even collect many funny links this week…

so long … Nicolai

PS: Don’t forget to subscribe or recommend! :)