On 3/22/25 19:37, Matthias Bläsing wrote: > Hi, > > Am Samstag, dem 22.03.2025 um 20:27 +0200 schrieb Ioannis Torounoglou: >> One small addition, from my today tests, is that agent is not working with >> OpenJDK 24. >> The java_desktop_clipboard_patch_17plus.jar is working... > without the "why" please lets not jump to conclusions. This might be > just an asm incompatibility. And Neil already mentioned, that the JDK24 > classfile api might be an alternative.
Tried to find an easy way how to verify that the generated bytecode is correct. The easiest proof would be to confirm that the transformed code matches the patch. I took the compiled classfile of java_desktop_clipboard_patch_17plus.jar I previously build as reference and dumped the bytecode with javap - this became the golden file. Now I started using the classfile API to generate the same javap opcode output line by line, essentially translating the reference bytecode into the classfile api builder pattern. dev loop: add a few opcodes, press play, compare dumped output with reference. A big part of this can be done without knowing how anything works due to the fact that javac is doing all the work. Except some edge cases like LambdaMetafactory, try-catch labels and their exception table entries etc - so it isn't completely trivial. However, once both javap outputs match: it must be correct. Wondering if a tool already exists which transforms bytecode into API calls. If it does - well, at least I taught me the new Classfile API a bit with this excursion. Wanted to write the interception and injection parts too but ran out of time unfortunately. (a typo in the lambda meta factory setup code alone costed me >1h) https://github.com/mbien/agentclippy This would reduce my worries about the agent approach a little bit since it would be based on from javac compiled code, would not fail on upstream JDKs and if put into a multi release jar it would disable itself below JDK 24. best regards, -mbien > > I'll have a look, but won't be able to make it before mid next week. > > Greetings > > Matthias > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org > For additional commands, e-mail: dev-h...@netbeans.apache.org > > For further information about the NetBeans mailing lists, visit: > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org For additional commands, e-mail: dev-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists