changeset 48526:38872bed90e0

8195970: Crash passing null to a VarHandle Reviewed-by: mchung, alanb
author psandoz
date Fri, 26 Jan 2018 09:35:15 -0800
parents 2d9dad1b821a
children fcf730c7373b
files src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template test/jdk/java/lang/invoke/VarHandles/generate-vh-tests.sh
diffstat 18 files changed, 1374 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template	Thu Jan 25 14:47:27 2018 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -534,7 +534,7 @@
 
         @ForceInline
         static $type$ get(ByteBufferHandle handle, Object obb, int index) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
 #if[floatingPoint]
             $rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -551,7 +551,7 @@
 
         @ForceInline
         static void set(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
 #if[floatingPoint]
             UNSAFE.put$RawType$Unaligned(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -569,7 +569,7 @@
 
         @ForceInline
         static $type$ getVolatile(ByteBufferHandle handle, Object obb, int index) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.get$RawType$Volatile(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -578,7 +578,7 @@
 
         @ForceInline
         static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             UNSAFE.put$RawType$Volatile(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -587,7 +587,7 @@
 
         @ForceInline
         static $type$ getAcquire(ByteBufferHandle handle, Object obb, int index) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.get$RawType$Acquire(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -596,7 +596,7 @@
 
         @ForceInline
         static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             UNSAFE.put$RawType$Release(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -605,7 +605,7 @@
 
         @ForceInline
         static $type$ getOpaque(ByteBufferHandle handle, Object obb, int index) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.get$RawType$Opaque(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -614,7 +614,7 @@
 
         @ForceInline
         static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             UNSAFE.put$RawType$Opaque(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -624,7 +624,7 @@
 
         @ForceInline
         static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return UNSAFE.compareAndSet$RawType$(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -633,7 +633,7 @@
 
         @ForceInline
         static $type$ compareAndExchange(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.compareAndExchange$RawType$(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -643,7 +643,7 @@
 
         @ForceInline
         static $type$ compareAndExchangeAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.compareAndExchange$RawType$Acquire(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -653,7 +653,7 @@
 
         @ForceInline
         static $type$ compareAndExchangeRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.compareAndExchange$RawType$Release(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -663,7 +663,7 @@
 
         @ForceInline
         static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return UNSAFE.weakCompareAndSet$RawType$Plain(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -672,7 +672,7 @@
 
         @ForceInline
         static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return UNSAFE.weakCompareAndSet$RawType$(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -681,7 +681,7 @@
 
         @ForceInline
         static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return UNSAFE.weakCompareAndSet$RawType$Acquire(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -690,7 +690,7 @@
 
         @ForceInline
         static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return UNSAFE.weakCompareAndSet$RawType$Release(
                     UNSAFE.getObject(bb, BYTE_BUFFER_HB),
                     address(bb, indexRO(bb, index)),
@@ -699,7 +699,7 @@
 
         @ForceInline
         static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.getAndSet$RawType$(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -709,7 +709,7 @@
 
         @ForceInline
         static $type$ getAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.getAndSet$RawType$Acquire(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -719,7 +719,7 @@
 
         @ForceInline
         static $type$ getAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             return convEndian(handle.be,
                               UNSAFE.getAndSet$RawType$Release(
                                       UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -731,7 +731,7 @@
 
         @ForceInline
         static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndAdd$RawType$(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -744,7 +744,7 @@
 
         @ForceInline
         static $type$ getAndAddAcquire(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndAdd$RawType$Acquire(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -757,7 +757,7 @@
 
         @ForceInline
         static $type$ getAndAddRelease(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndAdd$RawType$Release(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -785,7 +785,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseOr(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseOr$RawType$(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -798,7 +798,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseOrRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseOr$RawType$Release(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -811,7 +811,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseOrAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseOr$RawType$Acquire(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -837,7 +837,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseAnd(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseAnd$RawType$(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -850,7 +850,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseAndRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseAnd$RawType$Release(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -863,7 +863,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseAndAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseAnd$RawType$Acquire(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -890,7 +890,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseXor$RawType$(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -903,7 +903,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseXorRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseXor$RawType$Release(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
@@ -916,7 +916,7 @@
 
         @ForceInline
         static $type$ getAndBitwiseXorAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
-            ByteBuffer bb = (ByteBuffer) obb;
+            ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
             if (handle.be == BE) {
                 return UNSAFE.getAndBitwiseXor$RawType$Acquire(
                         UNSAFE.getObject(bb, BYTE_BUFFER_HB),
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
                                 "read write", bav, vh, h -> testArrayReadWrite(bas, h),
                                 true));
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null array", bav, vh, h -> testArrayNPE(bas, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -163,6 +166,9 @@
                         }
 
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null buffer", bav, vh, h -> testArrayNPE(bbs, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -192,6 +198,88 @@
     }
 
 
+    static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        byte[] array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            char x = (char) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            char x = (char) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            char x = (char) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            char x = (char) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+
+
+    }
+
+    static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        ByteBuffer array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            char x = (char) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            char x = (char) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            char x = (char) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            char x = (char) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+
+
+    }
+
     static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = bs.s;
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
                                 "read write", bav, vh, h -> testArrayReadWrite(bas, h),
                                 true));
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null array", bav, vh, h -> testArrayNPE(bas, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -163,6 +166,9 @@
                         }
 
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null buffer", bav, vh, h -> testArrayNPE(bbs, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -192,6 +198,174 @@
     }
 
 
+    static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        byte[] array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            double x = (double) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double x = (double) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            double x = (double) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            double x = (double) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            double r = (double) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double r = (double) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double r = (double) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            double o = (double) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+
+    }
+
+    static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        ByteBuffer array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            double x = (double) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double x = (double) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            double x = (double) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            double x = (double) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            double r = (double) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double r = (double) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double r = (double) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            double o = (double) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+
+    }
+
     static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = bs.s;
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
                                 "read write", bav, vh, h -> testArrayReadWrite(bas, h),
                                 true));
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null array", bav, vh, h -> testArrayNPE(bas, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -163,6 +166,9 @@
                         }
 
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null buffer", bav, vh, h -> testArrayNPE(bbs, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -192,6 +198,174 @@
     }
 
 
+    static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        byte[] array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            float x = (float) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float x = (float) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            float x = (float) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            float x = (float) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            float r = (float) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float r = (float) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float r = (float) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            float o = (float) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+
+    }
+
+    static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        ByteBuffer array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            float x = (float) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float x = (float) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            float x = (float) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            float x = (float) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            float r = (float) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float r = (float) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float r = (float) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            float o = (float) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+
+    }
+
     static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = bs.s;
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
                                 "read write", bav, vh, h -> testArrayReadWrite(bas, h),
                                 true));
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null array", bav, vh, h -> testArrayNPE(bas, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -163,6 +166,9 @@
                         }
 
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null buffer", bav, vh, h -> testArrayNPE(bbs, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -192,6 +198,266 @@
     }
 
 
+    static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        byte[] array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            int x = (int) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int x = (int) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            int x = (int) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            int x = (int) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            int r = (int) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int r = (int) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int r = (int) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndAdd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
+        });
+    }
+
+    static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        ByteBuffer array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            int x = (int) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int x = (int) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            int x = (int) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            int x = (int) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            int r = (int) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int r = (int) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int r = (int) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndAdd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
+        });
+    }
+
     static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = bs.s;
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
                                 "read write", bav, vh, h -> testArrayReadWrite(bas, h),
                                 true));
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null array", bav, vh, h -> testArrayNPE(bas, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -163,6 +166,9 @@
                         }
 
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null buffer", bav, vh, h -> testArrayNPE(bbs, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -192,6 +198,266 @@
     }
 
 
+    static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        byte[] array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            long x = (long) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long x = (long) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            long x = (long) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            long x = (long) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            long r = (long) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long r = (long) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long r = (long) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndAdd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
+        });
+    }
+
+    static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        ByteBuffer array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            long x = (long) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long x = (long) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            long x = (long) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            long x = (long) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            long r = (long) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long r = (long) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long r = (long) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndAdd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
+        });
+    }
+
     static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = bs.s;
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
                                 "read write", bav, vh, h -> testArrayReadWrite(bas, h),
                                 true));
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null array", bav, vh, h -> testArrayNPE(bas, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -163,6 +166,9 @@
                         }
 
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null buffer", bav, vh, h -> testArrayNPE(bbs, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -192,6 +198,88 @@
     }
 
 
+    static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        byte[] array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            short x = (short) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            short x = (short) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            short x = (short) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            short x = (short) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+
+
+    }
+
+    static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        ByteBuffer array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            short x = (short) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            short x = (short) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            short x = (short) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            short x = (short) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+
+
+    }
+
     static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = bs.s;
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java	Fri Jan 26 09:35:15 2018 -0800
@@ -2906,4 +2906,3 @@
         }
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java	Fri Jan 26 09:35:15 2018 -0800
@@ -3252,4 +3252,3 @@
         }
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java	Fri Jan 26 09:35:15 2018 -0800
@@ -3252,4 +3252,3 @@
         }
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java	Fri Jan 26 09:35:15 2018 -0800
@@ -2400,4 +2400,3 @@
 
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java	Fri Jan 26 09:35:15 2018 -0800
@@ -2400,4 +2400,3 @@
 
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java	Fri Jan 26 09:35:15 2018 -0800
@@ -3252,4 +3252,3 @@
         }
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java	Fri Jan 26 09:35:15 2018 -0800
@@ -3252,4 +3252,3 @@
         }
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java	Fri Jan 26 09:35:15 2018 -0800
@@ -3252,4 +3252,3 @@
         }
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java	Fri Jan 26 09:35:15 2018 -0800
@@ -2054,4 +2054,3 @@
 
     }
 }
-
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Fri Jan 26 09:35:15 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -171,6 +171,9 @@
                                 "read write", bav, vh, h -> testArrayReadWrite(bas, h),
                                 true));
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null array", bav, vh, h -> testArrayNPE(bas, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -195,6 +198,9 @@
                         }
 
                         cases.add(new VarHandleSourceAccessTestCase(
+                                "null buffer", bav, vh, h -> testArrayNPE(bbs, h),
+                                false));
+                        cases.add(new VarHandleSourceAccessTestCase(
                                 "unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
                                 false));
                         cases.add(new VarHandleSourceAccessTestCase(
@@ -224,6 +230,278 @@
     }
 
 
+    static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        byte[] array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+#if[CAS]
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            $type$ r = ($type$) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ r = ($type$) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ r = ($type$) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+#end[CAS]
+
+#if[AtomicAdd]
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
+        });
+#end[AtomicAdd]
+
+#if[Bitwise]
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
+        });
+#end[Bitwise]
+    }
+
+    static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
+        VarHandle vh = vhs.s;
+        ByteBuffer array = null;
+        int ci = 1;
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.get(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.set(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.getVolatile(array, ci);
+        });
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.getAcquire(array, ci);
+        });
+
+        checkNPE(() -> {
+            $type$ x = ($type$) vh.getOpaque(array, ci);
+        });
+
+        checkNPE(() -> {
+            vh.setVolatile(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            vh.setOpaque(array, ci, VALUE_1);
+        });
+
+#if[CAS]
+        checkNPE(() -> {
+            boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            $type$ r = ($type$) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ r = ($type$) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ r = ($type$) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
+        });
+#end[CAS]
+
+#if[AtomicAdd]
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
+        });
+#end[AtomicAdd]
+
+#if[Bitwise]
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
+        });
+
+        checkNPE(() -> {
+            $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
+        });
+#end[Bitwise]
+    }
+
     static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = bs.s;
--- a/test/jdk/java/lang/invoke/VarHandles/generate-vh-tests.sh	Thu Jan 25 14:47:27 2018 +0000
+++ b/test/jdk/java/lang/invoke/VarHandles/generate-vh-tests.sh	Fri Jan 26 09:35:15 2018 -0800
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-javac -d . ../../../../../make/src/classes/build/tools/spp/Spp.java
+javac -d . ../../../../../../make/jdk/src/classes/build/tools/spp/Spp.java
 
 SPP=build.tools.spp.Spp