[9] RFR (M): 8050052: Small cleanups in java.lang.invoke code (original) (raw)

David Holmes david.holmes at oracle.com
Mon Jul 14 05:03:34 UTC 2014


On 12/07/2014 3:56 AM, Remi Forax wrote:

On 07/11/2014 06:18 PM, Vladimir Ivanov wrote: http://cr.openjdk.java.net/~vlivanov/8050052/webrev.00 https://bugs.openjdk.java.net/browse/JDK-8050052 I've found myself writing the very same code as MethodHandleStatics.uncaughException several times and I wonder if it should not be an instance method of Throwable. Something like: public E rethrow(Function<? super Throwable, ?_ _extends E> uncaughtHandler) { if (this instanceof RuntimeException) { throw (RuntimeException)this; } if (this instanceof Error) { throw (Error)this; } return uncaughtHandler.apply(this);

Rethrowing is one thing but what is this uncaughtHandler supposed to be doing?

At this level you expect all these exceptions to be "uncaught" and propagate up.

David

}

in that case, throw uncaughtException(ex) can be replaced by throw ex.rethrow(::newInternalError); cheers, Rémi

Numerous small code cleanups in java.lang.invoke package. Testing: jtreg, nashorn, octane w/ "-ea -esa" and COMPILETHRESHOLD={0,30}. Reviewed-by: vlivanov, ? Contributed-by: john.r.rose at oracle.com Thanks! Best regards, Vladimir Ivanov


mlvm-dev mailing list mlvm-dev at openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev



More information about the core-libs-dev mailing list