In a legacy application that I'm debugging I have
import _root_.net.liftweb.mapper._;
import _root_.java.math.MathContext
class User
extends LongKeyedMapper[User]
with IdPK
{
import User._;
def getSingleton = User;
object name extends MappedString(this, 80);
}
object User
extends User
with LongKeyedMetaMapper[User]
{
override def fieldOrder = List(id, name);
}
which quite literally follows https://exploring.liftweb.net/master/index-8.html.
The code used to compile (using Maven), but now when I'm trying to recompile it years later (and with a newer JDK version) it fails with a strange type error:
[ERROR] ...User.scala:21: error: type mismatch;
[INFO] found : ....User.id.type (with underlying type object ....User.id)
[INFO] required: net.liftweb.mapper.MappedField[_ >: String with scala.Long, ....User]{def jdbcFriendly(field: String): java.lang.Comparable[_ >: java.lang.String with java.
lang.Long <: java.io.Serializable] with java.io.Serializable; def dbFieldClass: java.lang.Class[_ >: String with scala.Long] with java.lang.reflect.GenericDeclaration}
[INFO] override def fieldOrder = List(id, name);
[INFO] ^
And a similar error for name
. To me the types seem to be right, as Mapped...
classes extend MappedField
(https://liftweb.net/api/26/api/#net.liftweb.mapper.MappedString).
Versions:
Any suggestions or ideas what might have gone wrong?
With the help of @MateuszKubuszok (comments) I managed to compile the project. Indeed the solution was to use JDK7, with some fiddling:
An older, pristine Apache Maven installation was needed. I used 3.8.8. The one that came with Debian was version 3.6.3, but packaged on a newer Java version, and so it was failing with:
Unsupported major.minor version 52.0
(See also https://stackoverflow.com/a/11432195/1333025 .)
JDK7 needed manually adding the public key of https://repo.maven.apache.org/ to "$JAVA_HOME"/jre/lib/security/cacerts
(https://stackoverflow.com/a/73927521/1333025).