< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java

Print this page

        

@@ -69,10 +69,13 @@
 
     @Override
     public GuardedInvocation getGuardedInvocation(final LinkRequest request, final LinkerServices linkerServices) throws Exception {
         final Object self = request.getReceiver();
         final CallSiteDescriptor desc = request.getCallSiteDescriptor();
+        if (self == null || !canLinkTypeStatic(self.getClass())) {
+            return null;
+        }
 
         GuardedInvocation inv;
         if (self instanceof JSObject) {
             inv = lookup(desc, request, linkerServices);
             inv = inv.replaceMethods(linkerServices.filterInternalObjects(inv.getInvocation()), inv.getGuard());

@@ -80,11 +83,11 @@
             // guard to make sure the Map or Bindings does not turn into JSObject later!
             final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices);
             inv = new GuardedInvocation(beanInv.getInvocation(),
                 NashornGuards.combineGuards(beanInv.getGuard(), NashornGuards.getNotJSObjectGuard()));
         } else {
-            throw new AssertionError(); // Should never reach here.
+            throw new AssertionError("got instanceof: " + self.getClass()); // Should never reach here.
         }
 
         return Bootstrap.asTypeSafeReturn(inv, linkerServices, desc);
     }
 
< prev index next >