Am 23.07.2011 22:35, schrieb Mario Torre:
2011/7/23 Ulf Zibis<[email protected]>:
Hi,
couldn't you use ReflectiveOperationException instead?
That's a good point, right.
Additionally you could better profit from generics:
Yeah, but I don't want to change more than needed.
Hm, but is your change *needed* at all?
And again more simple just use (no need for try...catch):
public RenderingEngine run() {
String reClass =
System.getProperty("sun.java2d.renderer");
if ("sun.dc.DuctusRenderingEngine".equals(reClass)) {
return new sun.dc.DuctusRenderingEngine();
}
for (RenderingEngine re : ServiceLoader.loadInstalled(
RenderingEngine.class)) {
if (re.getClass().getName().equals(reClass)) {
return re;
}
}
return null;
}
-Ulf
Again, I don't want to change more than needed. In this case, however,
I miss your point; as far as I know sun.dc.DuctusRenderingEngine()
cannot be instantiated, is not part of the OpenJDK distribution, so
this would not work on OpenJDK.
In build b104 it's part of OpenJDK distribution.
Just try it in your build. ;-)
-Ulf
Cheers,
Mario