3
Good afternoon
I’m using play 2.5.4 with java 8 V01.08.91 And when using some java 8 Features as the 'Optional' class with ifPresent, isPresent or get methods the following error is displayed when compiling java classes
"java.lang.ClassCastException: javassist.bytecode.InterfaceMethodrefInfo cannot be cast to javassist.bytecode.MethodrefInfo"
Specifically, this is the excerpt from the code that the problem:
Optional<AppMobileWrapper> lastSend = appsWrapper.stream()
.max(Comparator.comparing(f -> f.changeDate));
lastSend.ifPresent(appMobileWrapper -> {
returnWrapper.lastDate = DateUtils.currentDateNoTimeZoneString(appMobileWrapper.changeDate);
});
I’ve tried everything, I’m hours away looking for a solution. My play version is up-to-date, updated java version, environment variables are ok and I even tried to add the updated javassist dependency to sbt dependencies and it still doesn’t work at all. Someone went through this trouble?
I already tried that, and it didn’t solve ;/
– Rodrigo Wippel
i added "org.javassist" % "javassist" % "3.20.0-GA" to my plugins.sbt and it worked. But really I didn’t understand the difference to what I already do, today I have a file .scala separated with all the dependencies of my project, I care in my build sbt. and concentrate on building the projects, and that didn’t work when I added the javassist.&#Can you explain to me the difference between plugins.sbt pro build sbt.?
– Rodrigo Wippel
@Rodrigowippel sees this as a schizophrenia of sbt :)
project/plugins.sbt
is used to define the plugins and their dependencies. In my case (and it looks like yours too) thejavassist
would be a dependency of a sbt plugin used only at compile time. What I don’t understand is why we need to declare this dependency manually, since our project (declared inbuild.sbt
) does not depend directly on it.– algorix
That’s right! Anyway, thanks for the help!
– Rodrigo Wippel