小编Eug*_*bun的帖子

为什么Scala编译器不允许使用默认参数重载方法?

虽然可能存在这样的方法过载可能变得模糊的有效情况,但为什么编译器不允许在编译时和运行时都不模糊的代码?

例:

// This fails:
def foo(a: String)(b: Int = 42) = a + b
def foo(a: Int)   (b: Int = 42) = a + b

// This fails, too. Even if there is no position in the argument list,
// where the types are the same.
def foo(a: Int)   (b: Int = 42) = a + b
def foo(a: String)(b: String = "Foo") = a + b

// This is OK:
def foo(a: String)(b: Int) = a + b …
Run Code Online (Sandbox Code Playgroud)

methods default scala overloading

132
推荐指数
4
解决办法
3万
查看次数

在jar导出期间,manifest.mf被eclipse覆盖

我想用eclipse制作一个可执行的jar存档.所以在我的项目中我创建了文件src/META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Main-Class: MainClass
Class-Path: .

但是当我导出我的java eclipse项目时eclipse警告我以下消息:

"JAR导出已完成警告.有关其他信息,请参阅详细信息.myproject/src/META-INF/MANIFEST.MF已替换为生成的MANIFEST.MF,不再位于JAR中."

当我在eclipse中导出我的项目时,任何人都知道如何避免这种情况?

eclipse export jar manifest.mf executable-jar

7
推荐指数
1
解决办法
7244
查看次数

将Scala AST转换为源代码

给定一个Scala AST,有没有办法生成Scala源代码?

我正在研究通过解析/分析其他Scala源来自动生成Scala源的方法.任何提示将不胜感激!

scala abstract-syntax-tree

6
推荐指数
1
解决办法
1384
查看次数