Unimporting in Scala

前端 未结 1 988
温柔的废话
温柔的废话 2020-12-30 02:08

I heard recently some advice to \"unimport an implicit conversion from Predef\" - I presume that this means it is possible to unimport unwanted classes

相关标签:
1条回答
  • 2020-12-30 02:37

    Use the import alias feature but rename the "unwanted class" to "_". Since "_" can not be accessed in Scala code as a classname, it hides the renamed class from unqualified access.

    import java.awt.{List => _, _}
    
    0 讨论(0)
提交回复
热议问题