Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8179531

JShell: fails to provide bytecode for dynamically created lambdas

    Details

    • Subcomponent:
    • Resolved In Build:
      b169
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        When using something like Oracle Coherence to perform "remote lambda" execution with JShell, we hit an error where by Coherence can't introspect the remote lambda, possibly because it's "synthetically created"?

        (Java HotSpot(TM) 64-Bit Server VM (build 9-ea+162, mixed mode)

        eg:
        jshell> people.computeIfPresent("Brian", (k, v) -> "Oliver");
        | java.lang.IllegalStateException thrown: ClassFile for the remote
        lambda could not be introspected.
        jdk.jshell.execution.DefaultLoaderDelegate$RemoteClassLoader@91161c7.getResource
        <mailto:jdk.jshell.execution.DefaultLoaderDelegate$RemoteClassLoader@91161c7.getresource>
        <mailto:jdk.jshell.execution.DefaultLoaderDelegate$RemoteClassLoader@91161c7.getresource>(REPL/$JShell$22.class)
        unexpectedly returned null
        | at RemotableSupport.createRemoteConstructor
        (RemotableSupport.java:82)
        | at Lambdas.ensureRemotable (Lambdas.java:205)
        | at RemoteConstructor.<init> (RemoteConstructor.java:66)
        | at RemotableSupport.createRemoteConstructor
        (RemotableSupport.java:93)
        | at Lambdas.ensureRemotable (Lambdas.java:205)
        | at ExternalizableHelper.replace (ExternalizableHelper.java:4813)
        | at ExternalizableHelper.serializeInternal
        (ExternalizableHelper.java:2799)
        | at ExternalizableHelper.toBinary (ExternalizableHelper.java:283)
        | at PartitionedCache$ConverterValueToBinary.convert
        (PartitionedCache.CDB:3)
        | at PartitionedCache$ViewMap.toBinary (PartitionedCache.CDB:17)
        | at PartitionedCache$ViewMap.invoke (PartitionedCache.CDB:31)
        | at SafeNamedCache.invoke$Router (SafeNamedCache.CDB:1)
        | at SafeNamedCache.invoke (SafeNamedCache.CDB:5)
        | at NearCache.invoke (NearCache.java:465)
        | at InvocableMap.computeIfPresent (InvocableMap.java:268)
        | at SessionNamedCache.computeIfPresent
        (SessionNamedCache.java:445)
        | at (#11:1)

        Here's the steps to reproduce:

        Here's steps to reproduce.

        1. Grab a copy of the most recent Coherence 12.2.1-2-0 release jar.

        2. In a new terminal, start a Coherence Server using the jar (just one
        server will do)

        java -Djava.net.preferIPv4Stack=true -Dcoherence.localhost=127.0.0.1
        -jar coherence-12.2.1-2-0.jar

        3. In another terminal, start JShell

        jshell -R-Djava.net.preferIPv4Stack=true
        -R-Dcoherence.localhost=127.0.0.1 --class-path coherence-12.2.1-2-0.jar

        4. Issue the following requests in JShell.

        import com.tangosol.net
        import com.tangosol.util.*;
        Session session = Session.create();
        NamedCache<String, String> people = session.getCache("people");
        people.put("Brian", "Oliver");
        people.get("Brian");
        people.size();
        people.clear();
        people.size();
        people.put("Brian", "Oliver");
        people.put("Robert", "Field");
        people.put("Mark", "Reinhold");
        people.put("Brian", "Goetz");
        people.forEach((k, v) -> System.out.println(v));
        people.computeIfPresent("Brian", (k, v) -> "Oliver");

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jlahoda Jan Lahoda
                  Reporter:
                  boliver Brian Oliver (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: