OpenJDK / valhalla / valhalla
changeset 54097:6ece319093a2 lworld
isSubstitutable should catch any error or runtime exception and let it pass through
Contributed-by: forax
author | mchung |
---|---|
date | Fri, 01 Feb 2019 15:08:39 -0800 |
parents | 91a3ebd000a3 |
children | b2f4bea2c7fa |
files | src/java.base/share/classes/java/lang/invoke/ValueBootstrapMethods.java |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/invoke/ValueBootstrapMethods.java Thu Jan 31 17:13:14 2019 +0100 +++ b/src/java.base/share/classes/java/lang/invoke/ValueBootstrapMethods.java Fri Feb 01 15:08:39 2019 -0800 @@ -225,6 +225,8 @@ try { Class<?> type = a.getClass(); return (boolean) valueEquals(type).invoke(type.cast(a), type.cast(b)); + } catch (Error|RuntimeException e) { + throw e; } catch (Throwable e) { throw new InternalError(e); } @@ -256,6 +258,8 @@ try { int hc = (int)hashers[i].invoke(o); return hashCombiner(v, hc); + } catch (Error|RuntimeException e) { + throw e; } catch (Throwable e) { throw new InternalError(e); } @@ -509,6 +513,8 @@ * @see Double#equals(Object) */ public static <T> boolean isSubstitutable(T a, Object b) { + if (VERBOSE) + System.out.println("substitutable " + a + " vs " + b); if (a == b) return true; if (a == null || b == null) return false; if (a.getClass() != b.getClass()) return false; @@ -516,6 +522,8 @@ try { Class<?> type = a.getClass().isValue() ? a.getClass().asValueType() : a.getClass(); return (boolean) substitutableInvoker(type).invoke(a, b); + } catch (Error|RuntimeException e) { + throw e; } catch (Throwable e) { if (VERBOSE) e.printStackTrace(); throw new InternalError(e);