Libera #java

Symptoms and Solutions

I casually watch a lot of forums related to Java: IRC, of course, and Discord, and Slack, and Reddit. On Reddit, on r/java, there’re some occasionally quite interesting projects offered for consideration; they’re usually pet projects for the authors, and that’s healthy and useful for everyone. However, there’s also a low hum of … tooling. Two really interesting projects showed up recently, for example, that avoided standard tooling: one used PowerShell...

4 minute(s) read

Locale-specific numbers

One of our channel members mentioned a failure in parsing “-1” to an int given a Locale. That’s … fascinating, actually, as I (dreamreal) was unaware of any numbering systems under which that would fail. So, as any programmer would, I wanted a program to show me the locales for which “-1” wasn’t the proper representation for “negative one.” Being a programmer, I … immediately ran to an AI (Claude, specifically) and had it generate...

5 minute(s) read

List.remove() oddities

From reddit’s r/java, a user observed that List.remove(Object) removes the first object whose equals() method returns true. Thus, if two objects have object equality with each other, but you wish to remove the second, you’re going to have to find it and return it with the indexed version of remove(int) instead of the remove(Object) call.yawkat observed that you can use Collection.removeIf() (which List inherits) and get...

1 minute(s) read

Calling a Superclass’ Method

A user on #java asked how one might invoke a method of a superclass recently, and received some general answers that more or less were right, but weren’t technically correct. Maldivia pointed out that you would use method handles, which is sort of the gist of the (incorrect) answers given. The attempt was made to invoke the method via getDeclaredMethod(), which does not work. The way to do it is to use MethodHandles.lookup...

2 minute(s) read

Java Multiline Properties

A channel member asked if there was a way to do multiline properties in Java, and if so, how was leading whitespace handled? The answers are, respectively, “yes,” and “pretty much as you’d hope it was.” The multiline character for Java properties is, as one might expect from every other programming language’s usage, the \ character, and the Properties.load() method will trim all leading whitespace from the property value. Here’s a sample...

1 minute(s) read

We’ve officially moved to Libera.chat.

It’s official: ##java has moved to libera.chat, and along the way changed its name from ##java to #java. We tried not to do this, we really did. But with a gap in trust between IRC channels and IRC staff, it was bound to happen. So what did happen? Well, we’ve been trying to refer people to the channel blog (this site!) regularly so they could keep up with what was going on...

3 minute(s) read

Announcement about Migration Away From Freenode

This is an account from one op, based on casual observation. It is offered without lots of logs, and hopefully without emotion; your mileage and understanding may differ, but this view seems to be pretty consistent with what we know, so chances are it’s close to true if not factually true. So what happened to Freenode to make us consider migration? Basically, an ircop sold the domain for freenode to a VPN provider, who...

4 minute(s) read

Hibernate Ignores Entity Listeners

I switched a codebase from EclipseLink as JPA provider to Hibernate and found out that with Hibernate you can not use inheritance in event listener classes. The JPA specs do not go into much detail on this topic so JPA providers are bound to handle this different from one another. I separated my entity listeners from my entities even though it is possible to add methods annotated with e.g. @PostPersist directly in the entity...

3 minute(s) read

Old Podcast Episodes

The old Episodes of the javachannel podcast are now available on archive.org.

1 minute(s) read

WebMvcConfigurationSupport Mangles ISO8601 Timestamps in Spring Boot

I was working on a test in my Spring-Boot app and noticed that the timestamps in JSON output were sometimes formatted incorrectly. Luckily I was able to identify the issue and fix it. During an integration test I noticed that an expected JSON output of "2019-08-26T08:22:21Z" was actually 1566807741.000000000 even though in other tests in my application the automatic conversion from java.time.Instant to an ISO8601-formatted string...

3 minute(s) read