permanently hidden warning in scala application

后端 未结 10 2158
臣服心动
臣服心动 2021-01-31 14:25

I get the following warning whenever I start my Scala application:

WARN - imported `SVNProperties\' is permanently hidden by definition of object SVNProperties in packag

相关标签:
10条回答
  • 2021-01-31 15:14

    I had a main class with name Server and I was creating a jetty server in the main class in the following way.

     import org.eclipse.jetty.server.Server
    
     var server:Server=new Server()
    

    I got the below warn on running sbt run

     > [warn] /home/xxx/xxx/xxx/src/main/scala/com/xxx/xxx/main/Server.scala:3:
    
    > imported `Server' is permanently hidden by definition of object Server in package main
        [warn] import org.eclipse.jetty.server.Server
        [warn]                                 ^
        [warn] one warning found
    

    I renamed my main class and the warning disappeared.

    0 讨论(0)
  • 2021-01-31 15:16

    If you are using Scala Eclipse IDE you can do :

    Project > Clean...

    After that all the warning will be removed.

    0 讨论(0)
  • 2021-01-31 15:25

    I got this by having circular dependencies. Both my classes were using each other on accident.

    0 讨论(0)
  • 2021-01-31 15:25

    If the warning comes from importing a class with the same name, you can always use import renaming.

    package domain
    
    case class Company (...
    

    package models
    
    import domain.{Company => _Company}
    
    object Company extends SkinnyCRUDMapper[_Company] {
    
    0 讨论(0)
提交回复
热议问题