You could use a lambda instead of a boolean and the duplicated functions, i.e.

    public static void main(String[] args) throws Exception {
        if (args[0].equals("Logger")) {
            testIfLeaking(TestLoggerWeakRefLeak::getLogger);
        } else {
testIfLeaking(TestLoggerWeakRefLeak::getAnonymousLogger);
        }
    }

    private static void testIfLeaking(Runnable getLogger) {
        ...
        getLogger.run();
        ...
    }

Erik

Yekaterina Kantserova skrev 2014-12-16 16:57:
Hi,

Could I please have a review of this fix.

bug: https://bugs.openjdk.java.net/browse/JDK-6977426
webrev: http://cr.openjdk.java.net/~ykantser/6977426/webrev.00/

java/util/logging/LoggerWeakRefLeak.sh and java/util/logging/AnonLoggerWeakRefLeak.sh are merged and rewritten in java. sun/tools/common/CommonTests.sh is removed because it doesn't test the product but sun/tool/common library functionality.

Thanks,
Katja

Reply via email to