2015/12/1 10:26 -0800, javali...@cbfiddle.com:
> The following is a workaround that I recently added to my code:
> 
> OGLRenderQueue rq = OGLRenderQueue.getInstance();
> rq.lock();
> 
> try {
>     // my code here
> } finally {
>     rq.unlock();
> }
> 
> It is a workaround for a lack of synchronization in the AWT, a bug
> that was reported 18 months ago.

Bug number, please?  Did you suggest a patch?

> Is it the position of the jigsaw team that I should not do this?

If you must do this then you should be aware that you're doing it and,
more importantly, users of your code should be aware that you're doing
it on their behalf.

> Is it the position of the jigsaw team that it is acceptable for
> someone in my position to somehow inform and convince every
> application developer who knowingly or unknowingly uses a library to
> change the command line arguments in their build configuration so that
> this workaround will run? (And later, presumably, get them all to
> remove the command line argument when the workaround is no longer
> needed?)

Yes.  The users of your library are, knowingly or (usually) not, in an
inherently dangerous position.  Their own libraries or applications now
depend upon undocumented and unsupported internals of the JDK, which are
subject to change at any time and for any reason.  If they have to use
a command-line flag to enable such hacks then they are more likely to
recognize the danger, so they can judge the risk and plan accordingly.

I do think it's worth exploring alternative ways to break encapsulation
which are more compact, more narrowly scoped, and yet give modules that
really need to do that some additional flexibility.  One idea we've
considered is a command-line option to grant a module the power to break
whatever encapsulation boundaries it needs to, via the API.  That way a
user would just need to grant your module this power on the command line
rather than be concerned in any way with the specific modules/packages
your code needs to break into, and also you, over time, can update your
library to change or minimize the amount of encapsulation that it
breaks.

- Mark

Reply via email to