Having recently looked at our Java UNO binding, it occurred to me that
another advantage of Java 7 would be that we could update our Java UNO base
classes to implement AutoCloseable, allowing try-with-resources to be used
to manage UNO reference counting precisely and delete unused objects as
soon as they go out of scope (just like the C++ binding does), instead of
the current finalize() methods which rely on the garbage collector and so
run much later if ever, or manually calling dispose() which needs to be
done in a finally block to be safe.

eg.

try (XPropertySet xCursorProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, mxDocCursor);) {
    Object value = xCursorProps.getPropertyValue("CharWeight");
}

instead of the current:

XPropertySet xCursorProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, mxDocCursor);
try {
    Object value = xCursorProps.getPropertyValue("CharWeight");
} finally {
    xCursorProps.dispose();
}

for which try blocks would also need to nest for multiple objects, unlike
with try-with-resources.

Damjan

On Wed, Nov 18, 2015 at 12:17 AM, Kay Schenk <kay.sch...@gmail.com> wrote:

> We seem to have a number of numer of Java related discussions of
> late. Here's another one -- the Java version we're using for builds.
>
> Java 6 went out of update status quite some time ago -- Feb. 2013 --
> and this is still being used for our Linux builds, and Windows
> builds if our current binaries are produced with the same
> configuration as the buildbot configurations.
>
> Java 7 reached end-of-life in April, 2015.
>
> Yesterday, I installed Java 8 -- openjdk version "1.8.0_65" -- on my
> CentOS 6.7 (32 bit) and built. Testing resulted in OK results for
> the little I did. I was concerned about the Base portion with the
> installed hsqldb but so far everything is OK.
>
> Is anyone else on other platforms using Java 8 for successful
> building and testing? Windows builders? Mac builders? Others? Given
> that in our next release, we will be out of the 4.1.x branch (I
> think), I would think we could jump up to Java 8. I would expect
> that our users would be on Java 8 already.
> --
> --------------------------------------------
> MzK
>
> “Somebody's gotta win, somebody's gotta lose.
>  Just don't fight about it.
>  Just try to get better."
>                        -- Yogi Berra
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
> For additional commands, e-mail: dev-h...@openoffice.apache.org
>
>

Reply via email to