RFR: 8355611: Get rid of SurfaceManagerFactory [v2]

Sergey Bylokhov serb at openjdk.org
Sat Apr 26 03:49:46 UTC 2025


On Fri, 25 Apr 2025 14:19:54 GMT, Nikita Gubarkov <ngubarkov at openjdk.org> wrote:

>> `SurfaceManagerFactory` just checks a given `GraphicsConfiguration` against multiple types via `instanceof`, it has 3 platform-specific implementations, which rely on an ugly injection process.
>> 
>> There is no reason to have this class at all, we could just let `GraphicsConfiguration` create a compatible `SurfaceManager` instead.
>> 
>> This would reduce coupling without having to collect all surface manager types in a single place (without real need to do so).
>> And this would also remove dependency on the class initialization sequence by getting rid of the injection process.
>
> Nikita Gubarkov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixup! 8355611: Get rid of SurfaceManagerFactory

src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java line 38:

> 36: 
> 37: public class XRGraphicsConfig extends X11GraphicsConfig implements
> 38:         SurfaceManager.ProxiedGraphicsConfig, SurfaceManager.Factory {

Note that we have inconsistency here:
* For X11 the SurfaceManager.Factory is added to the parent X11GraphicsConfig and to the child XRGraphicsConfig.
* For glx the SurfaceManager.Factory is added to the parent OGLGraphicsConfig and is not added to the child CGLGraphicsConfig/GLXGraphicsConfig.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24875#discussion_r2061141505


More information about the client-libs-dev mailing list