Hi Staffan,

Looks good.

Though I do wonder how the matching logic works such that the superclass is considered. I suppose it is a "feature" to match on X and all subclasses of X, but probably should be a way to match on exactly X not subclasses. Anyway just idle thoughts. :)

Thanks,
David

On 16/08/2016 4:15 AM, Staffan Larsen wrote:
All,

Please review this fix for a test that starting failing after recent changes to 
java.lang.invoke.

The test instructs jdb to break on all exceptions matching "java.lang.I*" (that's a 
capital 'i'). The semantics of that operation actually means "break on all exceptions which 
have a class name or superclass name matching this string".

Some of the recent changes in java.lang.invoke now causes the code to throw numerous 
java.lang.NoSuchMethodErrors. This is a subclass of 
java.lang.IncompatibleClassChangeError, which matches "java.lang.I*".

The net result is that jdb will break on a lot more places (all the 
NoSuchMethodError exceptions) than the test expects and the test fails.

We can work around this in the test by changing this line:

   cmd catch all java.lang.I*

to the following two lines:

   cmd catch all java.lang.Il*
   cmd catch all java.lang.Ind*

This will still match the exception types the test is looking for 
(IllegalArgumentException, IllegalMonitorStateException, and 
IndexOutOfBoundsException), but it will not match IncompatibleClassChangeError.

Thanks,
/Staffan


diff --git a/test/com/sun/jdi/CatchPatternTest.sh 
b/test/com/sun/jdi/CatchPatternTest.sh
--- a/test/com/sun/jdi/CatchPatternTest.sh
+++ b/test/com/sun/jdi/CatchPatternTest.sh
@@ -87,7 +87,12 @@
    cmd stop in ${classname}.partTwo
    runToBkpt
    cmd ignore uncaught java.lang.Throwable
-   cmd catch all java.lang.I*
+   # Instead of matching java.lang.I* we use two more specific
+   # patterns here. The reason is to avoid matching 
IncompatibleClassChangeError
+   # (or the subclass NoSuchMethodError) thrown by the
+   # java.lang.invoke infrastructure.
+   cmd catch all java.lang.Il*
+   cmd catch all java.lang.Ind*
    cmd cont
    cmd cont
    cmd cont

Reply via email to