JDK-4030374 - Java Issue Tracker
Feb 5, 1997 ... ... code for inner class constructors in the wrong order. Therefore ... Object.class. The synthetic static helper method class$() generated ...
Feb 5, 1997 ... ... code for inner class constructors in the wrong order. Therefore ... Object.class. The synthetic static helper method class$() generated ...
The behaviour can even be "cloaked" by using java.util.regex classes: Matcher.group() etc. which seem to use substring internally for String extraction. This way it's nearly impossible to detect the memory leak. This behaviour is totally independent of OS, Java Version, VM type etc.
Extracting the library related issue from 6460346. In ObjectOutputStream the HandleTable class grows its internal arrays by always doubling the length and adding one. This will overflow well short of the physical maximum length of Integer.MAX_VALUE.
static String formatter(Object o) { String formatted = "unknown"; if (o instanceof Integer i) {.First and foremost, this approach allows coding errors to remain hidden because we have used an overly general control construct.