我正在使用run.ceylon运行锡兰打字机项目中的锡兰打字机,这正是类型车臣/src/main/main.java的锡兰版本。
这个项目应该是自己打打字机。
它编译时没有错误,但在运行时不能加载依赖项以进行类型选择。
文件: source/com/example/withmodule/module.ceylon
native("jvm")
module com.example.withmodule "1.0" {
import com.redhat.ceylon.typechecker "1.3.0" ;
//import com.redhat.ceylon.module-resolver "1.3.0";
}文件: source/com/example/withmodule/run.ceylon
import java.io{File}
import com.redhat.ceylon.cmr.api{RepositoryManager}
import com.redhat.ceylon.cmr.ceylon{CeylonUtils}
import com.redhat.ceylon.compiler.typechecker{TypeCheckerBuilder}
import com.redhat.ceylon.compiler.typechecker.io.cmr.impl{LeakingLogger}
shared void run(){
value args = ["/absolutepath/ceylon-1.3.0/source/"];
RepositoryManager repositoryManager =
CeylonUtils.repoManager()
.systemRepo("/absolutepath/ceylon-1.3.0/repo")
.logger( LeakingLogger())
.buildManager();
TypeCheckerBuilder tcb =
TypeCheckerBuilder()
.setRepositoryManager(repositoryManager)
.verbose(true)
.statistics(true);
for (String path in args) {
tcb.addSrcDirectory( File(path));
}
tcb.typeChecker.process();
}它编译时没有错误。
但是,当运行时,它会产生错误:
error [package not found in imported modules: 'com.redhat.ceylon.cmr.api' (add module import to module descriptor of 'com.example.withmodule')] at 2:7-2:31 of com/example/withmodule/withmodule.ceylon
error [package not found in imported modules: 'com.redhat.ceylon.cmr.ceylon' (add module import to module descriptor of 'com.example.withmodule')] at 3:7-3:34 of com/example/withmodule/withmodule.ceylon
error [package not found in imported modules: 'com.redhat.ceylon.compiler.typechecker' (add module import to module descriptor of 'com.example.withmodule')] at 4:7-4:44 of com/example/withmodule/withmodule.ceylon
error [package not found in imported modules: 'com.redhat.ceylon.compiler.typechecker.io.cmr.impl' (add module import to module descriptor of 'com.example.withmodule')] at 5:7-5:56 of com/example/withmodule/withmodule.ceylon这对我来说没有任何意义,因为编译和打字之前就已经成功了。
这是一个新的锡兰1.3.0下载,没有安装,只需从解压缩的.tar.gz运行。
打字员需要什么额外的信息,而这是他们没有得到的?
发布于 2016-10-13 08:15:59
因此,这里的问题是,我们在测试运行程序typechecker/src/main/Main.java中使用的打字机只能理解锡兰源代码中定义的内容。它无法读取编译后的Java .jar归档文件,并且无法对照该存档中的类来检查您的锡兰源代码。
因此,为了能够键入依赖于Java二进制文件的锡兰代码,您需要更多的基础设施,包括我们所称的“模型加载器”,它负责构建.class二进制es的Ceylonic模型。在锡兰生态系统中有许多不同的模型加载器--一个用于javac,一个用于Eclipse,一个用于IntelliJ,一个用于Java反射,一个用于Dart,一个用于类型记录,一个用于JS--它们都非常特定于特定的编译环境。
因此,对不依赖于javac、IntelliJ、Eclipse等的锡兰打字机的测试没有任何形式的Java特性。您的代码可以成功地键入在锡兰源代码中定义的代码,包括依赖于锡兰模块的代码,这些代码包含由锡兰编译器生成的.src存档,但它不能对.jar存档中定义的内容进行类型检查。
我希望这能帮上忙。
https://stackoverflow.com/questions/39997460
复制相似问题