marklister / scala-totp-auth

scala implementation of RFC 6238; Supports base32 & hex.
29 stars 7 forks source link

Deprecation warning (and compile error) when compiling with scalac 2.10.1 #1

Closed rcadena closed 11 years ago

rcadena commented 11 years ago

When trying to compile the project by setting scalaVersion := 2.10.1 I get this compiler error:

[error] (snipped path)/scala-totp-auth/src/main/scala/TOTPSecret.scala:82: overloaded method constructor TOTPSecret with alternatives:
[error]   (b32Digits: Int)org.catch22.totp.auth.TOTPSecret <and>
[error]   (bytes: Array[Byte])org.catch22.totp.auth.TOTPSecret <and>
[error]   (bigInteger: java.math.BigInteger)org.catch22.totp.auth.TOTPSecret
[error]  cannot be applied to (scala.math.BigInt)
[error]     new TOTPSecret(BigInt(hex,16))
[error]     ^

I also get this deprecation warning:

[warn] (snipped path)/scala-totp-auth/src/main/scala/TOTPSecret.scala:28: inheritance from class BigInt in package math is deprecated: This class will me made final.

The warning is from the change in 2.10 to make BigInt final (see https://issues.scala-lang.org/browse/SI-6162 and http://www.scala-lang.org/api/current/index.html#scala.math.BigInt).

I saw in the comments in TOTPSecret.scala the reason for subclassing BigInt. A different design might use an implicit def to tack on a toBase32 method to BigInt and instead turn TOTPSecret into a generator of BigInts that are tokens.

marklister commented 11 years ago

Thanks for reporting! Commit 8c96cfb should fix this.