Java 8 Compatibility

89 views
Skip to first unread message

Frank Diehl

unread,
Jun 29, 2020, 11:13:48 AM6/29/20
to Daikon discuss
Is it possible, that Daikon is not fully Java 8 Compatible.

I have a Problem when using DynComp. I a, trying to run it on the classes of the following project:
https://github.com/netopyr/wurmloch-crdt which uses Java 8 Lambda's and i think that  maybe Daikon or rather its instrumentation tool/java agentm 'dcomp_premain' has a problem with lambdas.

The error i am getting from DynComp is:
Exception in thread "main" java.lang.AbstractMethodError: com.netopyr.wurmloch.store.AbstractCrdtStore$$Lambda$7/1011204018.accept(Ljava/lang/Object;Ljava/lang/DCompMarker;)V
at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onNext(FlowableDoOnEach.java:83)
at io.reactivex.processors.PublishProcessor$PublishSubscription.onNext(PublishProcessor.java:283)
at io.reactivex.processors.PublishProcessor.onNext(PublishProcessor.java:198)
at com.netopyr.wurmloch.store.AbstractCrdtStore.register(AbstractCrdtStore.java:136)
at com.netopyr.wurmloch.store.AbstractCrdtStore.createGSet(AbstractCrdtStore.java:113)
at com.netopyr.wurmloch.store.LocalCrdtStore.createGSet(LocalCrdtStore.java:7)
at crdtTest.gset.Gset.main(Gset.java:24)


I've written a small Program which uses Classes from the Project i mentioned earlier so i can use Daikon on that Program:

import com.netopyr.wurmloch.crdt.GSet;
import com.netopyr.wurmloch.store.LocalCrdtStore;
import sun.reflect.CallerSensitive;


public class Gset {
    
    @CallerSensitive
public static void main(String[] args) {
        try{
        // create two CrdtStores and connect them
        final LocalCrdtStore crdtStore1 = new LocalCrdtStore("store1");

        final LocalCrdtStore crdtStore2 = new LocalCrdtStore("store2");
        crdtStore1.connect(crdtStore2);

        // create a G-Set and find the according replica in the second store
        final GSet<String> replica1 = crdtStore1.createGSet("ID_1");
        final GSet<String> replica2 = crdtStore2.<String>findGSet("ID_1").get();

        // add one entry to each replica
        replica1.add("apple");
        replica2.add("banana");
        // disconnect the stores simulating a network issue, offline mode etc.
        crdtStore1.disconnect(crdtStore2);

        // add one entry to each replica
        replica1.add("strawberry");
        replica2.add("pear");
        // reconnect the stores
        crdtStore1.connect(crdtStore2);

        replica1.iterator().forEachRemaining(el -> System.out.printf("%s",el));
        }catch(Error e){
            throw e;
        }
    }
}

I already tried debugging it, but stopped for now, as Daikon has to  spawn another Virtual Machine in which the Java agent can do it's thing, which is then not attached to the debugger i am using, but i wanted to ask if anyone has seen this error before? Is it common with Daikon? Are there any known Solutions for it? 
Or is Daikon currently not supporting Java 8?  Although i already found this issue https://github.com/codespecs/daikon/issues/36 which suggests otherwise.

Some more information:
When Running Chicory on the same Program, it also throws an Exception, maybe this helps in resolving this issue:

Exception in thread "main" java.lang.AssertionError: applySubscript should have elements to use in Field{this}[Field{CompletableCache}[Field{completable}[Field{operators}[Field{internal}[Field{reactivex}[io]]]]]]
at daikon.VarInfoName.applySubscript(VarInfoName.java:1998)
at daikon.VarInfo.make_subscript(VarInfo.java:4112)
at daikon.derive.binary.SequenceScalarSubscript.makeVarInfo(SequenceScalarSubscript.java:106)
at daikon.derive.Derivation.getVarInfo(Derivation.java:80)
at daikon.PptTopLevel.derive(PptTopLevel.java:867)
at daikon.PptTopLevel.create_derived_variables(PptTopLevel.java:1493)
at daikon.Daikon.init_ppt(Daikon.java:1787)
at daikon.FileIO.read_data_trace_record(FileIO.java:1574)
at daikon.FileIO.read_data_trace_file(FileIO.java:1434)
at daikon.FileIO.read_data_trace_files(FileIO.java:973)
at daikon.FileIO.read_data_trace_files(FileIO.java:955)
at daikon.Daikon.process_data(Daikon.java:2256)
at daikon.Daikon.mainHelper(Daikon.java:773)
at daikon.Daikon.main(Daikon.java:658)

I've been getting these Issues on Mac os X As well as on Linux and have tried the Distribution Version 5.8.2. Also i tried pulling the latest source from the Repository, but got the same Results.

Oh and running the Program outside of Daikon works as expected.

With kind regards


Mark Roberts

unread,
Jul 1, 2020, 11:17:47 AM7/1/20
to Daikon discuss
I was able to download and build wurmloch-crdt-0.1.0.jar without difficulty, but I get errors when trying to compile your sample program.  Seems to be some additional jars are required:

javac -cp wurmloch-crdt-0.1.0.jar Gset.java
Gset.java:3: warning: CallerSensitive is internal proprietary API and may be removed in a future release
import sun.reflect.CallerSensitive;
                  ^
Gset.java:8: warning: CallerSensitive is internal proprietary API and may be removed in a future release
    @CallerSensitive
     ^
Gset.java:15: error: cannot access Publisher
        crdtStore1.connect(crdtStore2);
                  ^
  class file for org.reactivestreams.Publisher not found
Gset.java:19: error: cannot access Option
        final GSet<String> replica2 = crdtStore2.<String>findGSet("ID_1").get();
                                                ^
  class file for javaslang.control.Option not found
2 errors
2 warnings

Can you please supply your exact compile and run commands?

Thanks,
Mark

Frank Diehl

unread,
Jul 3, 2020, 11:53:41 AM7/3/20
to Daikon discuss
Thanks for your Reply,
wurmloch-crdt has some dependencies, in my project i was using Maven to resolve them.

This is My part of my Maven File:
  <modelVersion>4.0.0</modelVersion>

  <groupId>crdtTest</groupId>
  <artifactId>crdt</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>crdt</name>

  <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
  
  <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
  <compilerargs>
<arg>-g:source,lines,vars</arg>
  </compilerargs>
  <source>1.8</source>
  <target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

  <dependencies>
            <dependency>
            <groupId>com.netopyr.wurmloch</groupId>
            <artifactId>wurmloch-crdt</artifactId>
            <version>0.1.0</version>
        </dependency>
  </dependencies>
</project>


If you dont want to get these files with maven here are the dependencies you need:
  • org.reactivestreams:reactive-streams:1.0.0
  • io.reactivex.rxjava2:rxjava:2.0.5
  • org.apache.commons:commons-lang3:3.5
  • io.javaslang:javaslang:2.0.5
 So in your case you would put the jars in one Folder, than Compile with:
javac -cp .:wurmloch-crdt-0.1.0.jar:commons-lang3-3.5.jar:javaslang-2.0.5.jar:reactive-streams-1.0.0.jar:rxjava-2.0.5.jar -g Gset.java

and than run with:
java -cp .:wurmloch-crdt-0.1.0.jar:commons-lang3-3.5.jar:javaslang-2.0.5.jar:reactive-streams-1.0.0.jar:rxjava-2.0.5.jar Gset


Mark Roberts

unread,
Jul 6, 2020, 5:54:23 PM7/6/20
to Daikon discuss
Thank you - I was able to build and run the Gset program.   When running under DynComp I got a similar error to yours; however, when running under Chicory it ran without error and produced a reasonable looking dtrace file.  I shall investigate the DynComp failure.

Frank Diehl

unread,
Jul 20, 2020, 12:08:43 PM7/20/20
to Daikon discuss
Thank yiou for your Response and sorry that it took me so long to answer.
If i can be of any help in your investigation please ask, although i have to say that i do not know much about the inner workings of daikon yet.

In the meantime i will just try to not use any lambdas in the Programs i run through Daikon.

Michael Ernst

unread,
Jul 20, 2020, 12:11:54 PM7/20/20
to daikon-discuss
The bug is now fixed: https://github.com/codespecs/daikon/commit/bad7069b969d0bdd8f1cd1a34b5c62c4dc1c03c3
So, you should be able to use lambdas.  (You will need to build Daikon from sources, or we can make a release.)

Please let us know if you encounter any more problems.  We appreciate the bug reports.

Mike

--
You received this message because you are subscribed to the Google Groups "Daikon discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to daikon-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/daikon-discuss/3be8742b-2b49-402b-b0be-902fed51fcaco%40googlegroups.com.

Mark Roberts

unread,
Jul 20, 2020, 12:26:14 PM7/20/20
to Daikon discuss
I think you might have confused two recent trouble reports.  #207 was a stack map problem cause by old Java class files.  The issue here is AbstractMethod exceptions caused by the DynComp handling of Lambda expressions which I am still working on.
Reply all
Reply to author
Forward
0 new messages