Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some Scala 3 warnings #1240

Open
xuwei-k opened this issue Jun 13, 2021 · 8 comments
Open

fix some Scala 3 warnings #1240

xuwei-k opened this issue Jun 13, 2021 · 8 comments

Comments

@xuwei-k
Copy link
Member

xuwei-k commented Jun 13, 2021

[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/main/scala/scalikejdbc/AutoSession.scala:20:41 
[warn] 20 |  override private[scalikejdbc] lazy val connectionAttributes
[warn]    |                                         ^
[warn]    |error overriding value connectionAttributes in trait DBSession of type scalikejdbc.DBConnectionAttributes;
[warn]    |  lazy value connectionAttributes of type scalikejdbc.DBConnectionAttributes may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/main/scala/scalikejdbc/AutoSession.scala:45:41 
[warn] 45 |  override private[scalikejdbc] lazy val connectionAttributes
[warn]    |                                         ^
[warn]    |error overriding value connectionAttributes in trait DBSession of type scalikejdbc.DBConnectionAttributes;
[warn]    |  lazy value connectionAttributes of type scalikejdbc.DBConnectionAttributes may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/main/scala/scalikejdbc/DBSession.scala:984:41 
[warn] 984 |  override private[scalikejdbc] lazy val connectionAttributes
[warn]     |                                         ^
[warn]     |error overriding value connectionAttributes in trait DBSession of type scalikejdbc.DBConnectionAttributes;
[warn]     |  lazy value connectionAttributes of type scalikejdbc.DBConnectionAttributes may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/main/scala/scalikejdbc/ReadOnlyAutoSession.scala:20:41 
[warn] 20 |  override private[scalikejdbc] lazy val connectionAttributes
[warn]    |                                         ^
[warn]    |error overriding value connectionAttributes in trait DBSession of type scalikejdbc.DBConnectionAttributes;
[warn]    |  lazy value connectionAttributes of type scalikejdbc.DBConnectionAttributes may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/main/scala/scalikejdbc/ReadOnlyAutoSession.scala:45:41 
[warn] 45 |  override private[scalikejdbc] lazy val connectionAttributes
[warn]    |                                         ^
[warn]    |error overriding value connectionAttributes in trait DBSession of type scalikejdbc.DBConnectionAttributes;
[warn]    |  lazy value connectionAttributes of type scalikejdbc.DBConnectionAttributes may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/main/scala/scalikejdbc/config/StandardTypesafeConfig.scala:10:11 
[warn] 10 |  lazy val config: Config = ConfigFactory.load()
[warn]    |           ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/main/scala/scalikejdbc/config/TypesafeConfigReaderWithEnv.scala:15:20 
[warn] 15 |  override lazy val config: Config = {
[warn]    |                    ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-interpolation/src/main/scala/scalikejdbc/SQLSyntaxSupportFeature.scala:506:13 
[warn] 506 |    lazy val delimiterForResultName: String =
[warn]     |             ^
[warn]     |error overriding value delimiterForResultName in trait SQLSyntaxProvider of type String;
[warn]     |  lazy value delimiterForResultName of type String may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/test/scala/scalikejdbc/config/TypesafeConfigReaderSpec.scala:11:22 
[warn] 11 |    override lazy val config: Config =
[warn]    |                      ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/test/scala/scalikejdbc/config/TypesafeConfigReaderSpec.scala:16:22 
[warn] 16 |    override lazy val config: Config = ConfigFactory.load("empty.conf")
[warn]    |                      ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/test/scala/scalikejdbc/config/TypesafeConfigReaderSpec.scala:20:22 
[warn] 20 |    override lazy val config: Config =
[warn]    |                      ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/test/scala/scalikejdbc/config/TypesafeConfigReaderSpec.scala:25:22 
[warn] 25 |    override lazy val config: Config =
[warn]    |                      ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/test/scala/scalikejdbc/config/TypesafeConfigReaderSpec.scala:30:22 
[warn] 30 |    override lazy val config: Config =
[warn]    |                      ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E164] Declaration Migration Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-config/src/test/scala/scalikejdbc/config/TypesafeConfigReaderSpec.scala:35:22 
[warn] 35 |    override lazy val config: Config =
[warn]    |                      ^
[warn]    |error overriding value config in trait TypesafeConfig of type com.typesafe.config.Config;
[warn]    |  lazy value config of type com.typesafe.config.Config may not override a non-lazy value
[warn] -- [E029] Pattern Match Exhaustivity Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-syntax-support-macro/src/main/scala-3/scalikejdbc/EntityUtil.scala:41:10 
[warn] 41 |          case (ValDef(name, typeTree, _), index) =>
[warn]    |          ^
[warn]    |          match may not be exhaustive.
[warn]    |
[warn]    |          It would fail on pattern case: (_: TypeDef, _)
[warn] -- [E123] Syntax Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/test/scala/scalikejdbc/LoanPatternSpec.scala:27:28 
[warn] 27 |    LoanPattern.isInstanceOf[Singleton] should equal(true)
[warn]    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[warn]    |The highlighted type test will always succeed since the scrutinee type scalikejdbc.LoanPattern.type is a subtype of Object
[warn] -- [E123] Syntax Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/test/scala/scalikejdbc/ThreadLocalDBSpec.scala:21:30 
[warn] 21 |    ThreadLocalDB.isInstanceOf[Singleton] should equal(true)
[warn]    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[warn]    |The highlighted type test will always succeed since the scrutinee type scalikejdbc.ThreadLocalDB.type is a subtype of Object
@seratch seratch added this to the version 4.1.x milestone Jun 13, 2021
@seratch seratch added the core label Jun 13, 2021
@seratch
Copy link
Member

seratch commented Jun 13, 2021

Thanks for flagging this.

may not override a non-lazy value

I'm a bit sad to see this is no longer allowed.

@seratch seratch modified the milestones: version 4.1.x, version 4.0.x Jun 13, 2021
@seratch
Copy link
Member

seratch commented Jun 13, 2021

hmm, changing the behavior in a major release may be more appropriate. Perhaps, we should have the change in v4.0.

@seratch
Copy link
Member

seratch commented Jul 3, 2021

We won't fix all of these warnings but I will make a pull request that fixes some before releasing the next RC version.

@seratch
Copy link
Member

seratch commented Jul 4, 2021

I won't apply any changes in 4.0x. The reasons are:

  • scala.reflect.Selectable.reflectiveSelectable does not exist in Scala 2.13
  • Removing any of the lazy val in core / config breaks behavioral compatibility

@seratch seratch modified the milestones: version 4.0.x, version 4.1.x Jul 4, 2021
@xuwei-k
Copy link
Member Author

xuwei-k commented Jul 6, 2021

scala.reflect.Selectable.reflectiveSelectable does not exist in Scala 2.13

👍

Removing any of the lazy val in core / config breaks behavioral compatibility

@seratch
Copy link
Member

seratch commented Jul 6, 2021

Thanks for the pull request!

@xuwei-k
Copy link
Member Author

xuwei-k commented Sep 3, 2021

[warn] -- [E123] Syntax Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-core/src/test/scala/scalikejdbc/LoanPatternSpec.scala:27:28
[warn] 27 | LoanPattern.isInstanceOf[Singleton] should equal(true)
[warn] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[warn] |The highlighted type test will always succeed since the scrutinee type scalikejdbc.LoanPattern.type is a subtype of Object

@xuwei-k
Copy link
Member Author

xuwei-k commented Mar 12, 2022

[warn] -- Deprecation Warning: /home/runner/work/scalikejdbc/scalikejdbc/scalikejdbc-syntax-support-macro/src/main/scala-3/scalikejdbc/EntityUtil.scala:16:13
[warn] | report.throwError(
[warn] | ^^^^^^^^^^^^^^^^^
[warn] |method throwError in trait reportModule is deprecated since 3.1.0: Use errorAndAbort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants