Gabriel Glodean’s Post

View profile for Gabriel Glodean

Java developer with 11 years of experience, mostly backend. Interested in JVM internals, APIs, and microservices.

I discovered a minor bug in the Java compiler. While the code is valid according to the specification, the Java 25 compiler produces an invalid class file. The issue arises because the lambda code is placed in a static private method of the class, which latter is called by creating with invoke dynamic of a functional delegate. If the method name's availability is tampered with, it can result in bad bytecode, with 2 static method with the same signature being generated. I raised this bug with Java, which can be found here: https://lnkd.in/dKQN9-8Q. Two points of interest regarding this issue are: 1. This behavior started occurring from Java 24 onwards. 2. Prior to Java 24, the compiler would fail, which was an appropriate response. This differs from the approach taken with Anonymous inner classes, where a similar counter mechanism is used, but the counter is increased silently, allowing the code to function correctly. #Java #Java25 #Javac

  • graphical user interface, text, application, email

To view or add a comment, sign in

Explore content categories