Skip to content

Instantly share code, notes, and snippets.

View chrisdennis's full-sized avatar

Chris Dennis chrisdennis

View GitHub Profile
@chrisdennis
chrisdennis / jdk_toolchain.xslt
Created February 12, 2020 15:56
Maven Toolchain XML Goodness
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/plist">
<toolchains>
<xsl:for-each select="array/dict">
<toolchain>
<type>jdk</type>
<provides>
<version>
#!/bin/bash
function install {
rm -Rf ~/Library/Java/JavaVirtualMachines/jdk-10.jdk
echo -n "Installing..." && cp -R build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-10.jdk ~/Library/Java/JavaVirtualMachines/ && echo "done"
}
force_build=false
while getopts f opt; do
case $opt in
Hi Chris,
Prior to this changeset: https://bugs.openjdk.java.net/browse/JDK-6924259 Hotspot had hardcoded assumptions about the field offsets of the various fields in java.lang.String. This means if you add fields to the String class which cause the class layouting logic to move the existing fields around you will break the JVM. The changeset above moves the JVM to instead compute these offsets at runtime from the real String class layout. The associated bug shows what version this has been back ported to: https://bugs.openjdk.java.net/browse/JDK-6924259. I've not tested anything but I'm pretty sure that @shipilev's example would have worked in a JVM prior to this change anyway since the single boolean didn't shift any of the existing fields. Either way, use a recent JVM and all should be fine. Use an older JVM and mucho breakage can result.
Chris (@tall_chris)