On Mon, 22 Jun 2026 19:09:36 GMT, Man Cao <[email protected]> wrote: >> I think you mean smaller Java code, not smaller bytecode, the bytecode >> generated by javac is identical if you use an import static or not. > > I mean bytecode. With the static import, the `Class.getReflectionFactory()` > method is entirely removed, resulting a 47-byte reduction of `Class.class`: > > Size of `jdk/modules/java.base/java/lang/Class.class`: > - With import static and method removal: 52936 > - Without: 52983
You get the same simplification using a standard import instead of using a **static** import. By replacing the call to `getReflectionFactory()` by `ReflectionFactory.getReflectionFactory()`. Using less bytecodes come from reusing an existing code nor the fact that the import is 'static'. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31591#discussion_r3455259411
