Class Diagrammer 2.2.0 Released

I intended to summarize the ongoing Java SE 9 updates of my open-source projects in Moving Projects to Java 9. However, Class Diagrammer 2.2.0 accumulated enough changes to merit a dedicated release post. You can find a summary in the What’s New file.

New Leading Option

First off, a couple of days ago I discovered another Java 9 incompatibility which is apparently due to a bugfix in AWT. (Most of the Class Diagrammer GUI is based on JavaFX but diagrams are drawn with AWT.) AWT used to ignore the recommended leading (interline spacing) of some fonts, including Adobe Myriad Pro which I use for my local diagram creation. Now AWT reports the correct non-zero leading for Myriad. This does look better, but thoroughly messed up the vertical layout of my diagrams since UML elements with a lot of members are now much taller.

At first I intended to just rearrange those diagrams but eventually I decided that this is a substantial compatibility issue, as future versions of AWT or some font files might still (or once more) report incorrect leading. So I added a new leading option to the “Display: Font” settings. By default the AWT-reported leading for the current font family and size is used, whatever that might be. But you can also override that and specify a custom value instead, starting from zero. That should permanently take care of this issue.

Other Java 9 Issues

Another minor Java 9 incompatibility concerns my JavaFX Spinner for Numbers code. See the added section at the bottom of that post for the changed ToolTip behavior. The new code also fixes an unrelated bug: a spinner’s TextField is now correctly reset to its default value when the user commits an empty field.

Modular JARs using the new Java 9 module system appear to be well-supported. The only small required change was to hide the file module-info.class which is now present in such JARs. Despite the suffix it’s not actually a class file, and causes an error when attempting to load it as one. Accessing module information through reflection on real classes is technically possible, in a similar way to packages, but I have not yet added that functionality. Maybe I will if the module system becomes popular with developers.

Various Changes

The sorting order of overloaded methods now prioritizes the parameter count, which seems more natural and readable than alphabetically sorting on parameter type names first. Also, JAR file handles are now properly released when a project is closed while Class Diagrammer keeps running.

Lastly, I updated all three JFree libraries that I use (FXGraphics2D, JFreeSVG, OrsonPDF) to their latest versions and also changed the links to their current GitHub locations.

Leave a Reply