My quick take is:
For starters: OMG.  Hats off to xxDark!  What a great piece of dogged detective 
work and engineering!
I would start with the java agent approach to get a better handle on how 
fragile it is.  It only needs to live until the JDK fix propogates (which could 
take years, sadly)
“cryptic” doesn’t bother me if it’s documented.
If someone has the time and energy to have the conversations with Apache Legal, 
that sould happen in parallel.
If the java agent fix is too fragile, we can switch paths.
I’m so glad I don’t use Windows

> On Mar 22, 2025, at 11:14 AM, Eirik Bakke <eba...@ultorg.com.invalid> wrote:
> 
> This new thread continues the discussion from 
> https://github.com/apache/netbeans/discussions/7051#discussioncomment-12587201
> Summary:
> * On Windows, Cut and Paste between NetBeans and external applications has 
> been unreliable. ( https://github.com/apache/netbeans/issues/3962 )
> * With NB25, as a side effect of SecurityManager changes, the problem occurs 
> much more frequently, but is also easier to reproduce. (E.g. with the code 
> posted by bradvido at 
> https://github.com/apache/netbeans/issues/3962#issuecomment-1664507172 , or 
> simple manual cut/pasting to/from Notepad.)
> * Through heroic investigation efforts, user xxDark has tracked the problem 
> down to a JDK bug, and developed a patch. He has submitted an OpenJDK bug and 
> opened a PR against OpenJDK ( https://github.com/openjdk/jdk/pull/23736 ). 
> But getting this fixed in OpenJDK may take a long time, and meanwhile 
> NetBeans will lose Windows users.
> * The patch can be applied from NetBeans, however, by supplying a special JAR 
> and JVM parameter on startup. There are two ways to do this: Either using the 
> "javaagent" developed at https://github.com/xxDark/clipboard-agent , which 
> patches bytecode on the fly, or by providing a compiled, patched version of 
> the entire sun/awt/windows/WClipboard.java class using the "patch-module" 
> argument to the JVM.
> * We have tested both the "javaagent" approach and the "patch-module" 
> approach, and they both seem to work.
> * The downside of the "javaagent" approach is that bytecode patching code is 
> cryptic and fragile.
> * The downside of the "patch-module" approach is that WClipboard.java is 
> GPL2CP and would need external publishing and special clearance from Apache 
> Legal to be included in NetBeans (like we did for nb-javac; see 
> https://issues.apache.org/jira/browse/LEGAL-563 ).
> 
> The main remaining questions seems to be:
> 1) Do we ship a fix to the bug from officially released NetBeans binaries, 
> i.e. the ZIP that is hosted on netbeans.apache.org?
> 2) If yes, do we take the javaagent or the patch-module approach?
> 
> -- Eirik
> 

Reply via email to