AbstractMethodError in 3.0.0
Closed this issue · 3 comments
Hello,
I have a script that throws an AbstractMethodError when using Diffson 3.0.0, yet it works perfectly with version 2.2.1
../meta-db-setup/apply-patch.amm variables.json my.patch.json master
Compiling /home/ludo/Projects/HBP/reference/meta-db-setup/apply-patch.amm
java.lang.AbstractMethodError
jawn.CharBasedParser.parseString(CharBasedParser.scala:90)
jawn.CharBasedParser.parseString$(CharBasedParser.scala:87)
jawn.StringParser.parseString(StringParser.scala:15)
jawn.Parser.rparse(Parser.scala:428)
jawn.Parser.parse(Parser.scala:337)
jawn.SyncParser.parse(SyncParser.scala:24)
jawn.SupportParser.$anonfun$parseFromString$1(SupportParser.scala:15)
jawn.SupportParser.parseFromString(SupportParser.scala:15)
jawn.SupportParser.parseFromString$(SupportParser.scala:14)
io.circe.jawn.CirceSupportParser$.parseFromString(CirceSupportParser.scala:7)
io.circe.jawn.JawnParser.parse(JawnParser.scala:16)
gnieh.diffson.CirceInstance$provider$.parseJson(CirceInstance.scala:158)
gnieh.diffson.CirceInstance$provider$.parseJson(CirceInstance.scala:132)
gnieh.diffson.JsonPatchSupport$JsonPatch$.parse(JsonPatchSupport.scala:55)
ammonite.$file.$up.meta$minusdb$minussetup.apply$minuspatch$.main(apply-patch.amm:11)
ammonite.$file.$up.meta$minusdb$minussetup.apply$minuspatch$$routes$.$anonfun$apply$3(apply-patch.amm:23)
ammonite.main.Router$EntryPoint.invoke(Router.scala:135)
My script:
#!/usr/bin/env amm
import $ivy.`org.gnieh::diffson-circe:2.2.1`, gnieh.diffson.circe._
import $ivy.`com.lihaoyi::ammonite-ops:1.0.0`, ammonite.ops._
@main
def main(targetJsonFile: String = "variables.json", patchFile: String = "my.patch.json"): Unit = {
val mipVariables = read! pwd/RelPath("../mip-cde-meta-db-setup/variables.json")
val rawPatch = read! pwd/patchFile
val patch = JsonPatch.parse(rawPatch)
val patchedVariables = patch(mipVariables)
write(pwd/targetJsonFile, patchedVariables.toString)
}
Tested with Ammonite 1.0.0 and Ammonite 1.1.0
Hi,
Circe regularly breaks binary compatiblity. Diffson 3.0.0 depends on circe 0.9.3 and 2.2.1 depends on circe 0.8.0. It looks like this may be the problem here. Usually this means that you (transitively) depends on two different versions of circe or that you execute code compiled with another version than the runtime dependency. I don’t know if ammonite caches the compiled version of the scripts. If yes, there must be a way to clean it and recompile it.
@satabin you are right, cleaning Ammonite cache (rm -rf ~/.ammonite/cache) removes this issue.
Sorry for the noise.
No problem :)