I extend a HashMap in my code but I don’t use the Node class directly. If I compile it with Java 7 it works. I use Gradle version 2.2.1 and use “compile localGroovy()” to reference the Groovy SDK. I don’t know if that has anything to do. Any ideas why is it hardcoding the Java 8 HashMap implementation? Would making my Map a .java instead of a .groovy help? Do I need to force a version of groovy?
I need to fix this ASAP since the version 2.1.0 is already in Maven central and I require to publish a fixed 2.1.1 for my users.
I’m pretty sure this is a Groovy problem, that we won’t be able to resolve. Can you please provide a full stacktrace (obtained by running with ‘-S’, not ‘-s’) so we can verify?
I was able to fix this by not extending nor implementing the Map interface. I made a wrapper instead with a map as a member. So basically yeah, referencing any class that was touched in Java 8 can give trouble. It might be a groovy issue but correct me if I’m wrong, if use the ‘sourceCompatibility’, ‘targetCompatibility’ and ‘options.bootClasspath’ all pointing to Java 7, shouldn’t the byte code generated by compatible with Java 7 and not reference Java 8 classes/methods? this is what I have in build.gradle:
Notice the noverify flag that I have to set because otherwise the tests fail with a verification error. I’m completely lost as to what gradle does internally to compile and run with Java 8 JDK but keeping Java 7 compatible if that happens at all. Maybe Groovy is adding a dependency on Java 8?
Thanks for looking into this, I’ll see if I can get you the stack trace.