Search code examples
javadesign-by-contract

Java Cofoja not working in eclipse


I tried to setup Cofoja in my eclipse project as described here. When I try to run my project with Cofoja I always get an IllegalArgumentException.

[com.google.java.contract:agent FATAL ERROR while instrumenting cofoja/Main (stack trace follows)]
java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at com.google.java.contract.core.agent.ContractClassFileTransformer.analyze(ContractClassFileTransformer.java:354)
    at com.google.java.contract.core.agent.ContractClassFileTransformer.transform(ContractClassFileTransformer.java:267)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

I have no idea what I did wrong with my setup or where the problem resides... And I'm also not sure whether to use Cofoja in a long-term project or not as it doesn't look very active to me. What is your thought on that?


Solution

  • I just got it working by compiling Cofoja myself. I think there might be a problem with java 8 and the provided jar files.