创建AST时出错

时间:2016-12-18 21:02:59

标签: rascal

我收到下面的错误,给出nullpointerexception的方法是:

public java set[M3] createM3sFromFiles(set[loc] files, bool errorRecovery = false, list[loc] sourcePath = [], list[loc] classPath = [], str javaVersion = "1.7");  

我的代码在smallSQL项目上正确执行,但在hsqldb上没有。

我的工作流程如下:

  1. 我将原始文件加载到内存中
  2. 删除评论
  3. 将所有已处理的文件保存在1个tempdir
  4. 尝试使用createM3FromDirectory构建M3
  5. 为单个文件创建AST
  6. 我能让它工作的唯一方法是删除"包xxx.yyy;"处理已处理的源文件。这对我来说没有任何意义,任何想法为什么它在使用smallSQL而不是hsqldb?如果我检查一些类文件,我可以看到它们都是为Java SE 8编译的。如果我测试一些单独的文件,它就不起作用,即使源非常简单(几个字段&(g /多个)埃特斯)

    当我使用仍包含评论的原始文件时,它确实有效。 (通过编辑eclipse.ini文件修复内存不足异常后)。但是它给了我一些错误,它无法在地图中找到关键字。我很确定密钥会被添加,可能是地图变得太大而因此显示出错误的行为?

    |std:///lang/java/m3/Core.rsc|(2548,246,<70,0>,<72,161>): Java("NullPointerException","")
        at org.rascalmpl.library.lang.java.m3.internal.SourceConverter.getParent(|unknown:///SourceConverter.java|(0,0,<324,0>,<324,0>))
        at org.rascalmpl.library.lang.java.m3.internal.SourceConverter.generatePackageDecls(|unknown:///SourceConverter.java|(0,0,<319,0>,<319,0>))
        at org.rascalmpl.library.lang.java.m3.internal.SourceConverter.generatePackageDecls(|unknown:///SourceConverter.java|(0,0,<319,0>,<319,0>))
        at org.rascalmpl.library.lang.java.m3.internal.SourceConverter.generatePackageDecls(|unknown:///SourceConverter.java|(0,0,<319,0>,<319,0>))
        at org.rascalmpl.library.lang.java.m3.internal.SourceConverter.generatePackageDecls(|unknown:///SourceConverter.java|(0,0,<319,0>,<319,0>))
        at org.rascalmpl.library.lang.java.m3.internal.SourceConverter.visit(|unknown:///SourceConverter.java|(0,0,<344,0>,<344,0>))
        at org.eclipse.jdt.core.dom.PackageDeclaration.accept0(|unknown:///PackageDeclaration.java|(0,0,<219,0>,<219,0>))
        at org.eclipse.jdt.core.dom.ASTNode.accept(|unknown:///ASTNode.java|(0,0,<2711,0>,<2711,0>))
        at org.eclipse.jdt.core.dom.ASTNode.acceptChild(|unknown:///ASTNode.java|(0,0,<2759,0>,<2759,0>))
        at org.eclipse.jdt.core.dom.CompilationUnit.accept0(|unknown:///CompilationUnit.java|(0,0,<210,0>,<210,0>))
        at org.eclipse.jdt.core.dom.ASTNode.accept(|unknown:///ASTNode.java|(0,0,<2711,0>,<2711,0>))
        at org.rascalmpl.library.lang.java.m3.internal.JavaToRascalConverter.convert(|unknown:///JavaToRascalConverter.java|(0,0,<317,0>,<317,0>))
        at org.rascalmpl.library.lang.java.m3.internal.EclipseJavaCompiler.convertToM3(|unknown:///EclipseJavaCompiler.java|(0,0,<163,0>,<163,0>))
        at org.rascalmpl.library.lang.java.m3.internal.EclipseJavaCompiler.lambda$createM3sFromFiles$0(|unknown:///EclipseJavaCompiler.java|(0,0,<78,0>,<78,0>))
        at org.rascalmpl.library.lang.java.m3.internal.EclipseJavaCompiler$1.acceptAST(|unknown:///EclipseJavaCompiler.java|(0,0,<203,0>,<203,0>))
        at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(|unknown:///CompilationUnitResolver.java|(0,0,<1040,0>,<1040,0>))
        at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(|unknown:///CompilationUnitResolver.java|(0,0,<639,0>,<639,0>))
        at org.eclipse.jdt.core.dom.ASTParser.createASTs(|unknown:///ASTParser.java|(0,0,<993,0>,<993,0>))
        at org.rascalmpl.library.lang.java.m3.internal.EclipseJavaCompiler.buildCompilationUnits(|unknown:///EclipseJavaCompiler.java|(0,0,<200,0>,<200,0>))
        at org.rascalmpl.library.lang.java.m3.internal.EclipseJavaCompiler.createM3sFromFiles(|unknown:///EclipseJavaCompiler.java|(0,0,<76,0>,<76,0>))
        at sun.reflect.NativeMethodAccessorImpl.invoke0(|unknown:///NativeMethodAccessorImpl.java|(0,0,<0,0>,<0,0>))
        at createM3sFromFiles(|std:///lang/java/m3/Core.rsc|(4650,11,<108,226>,<108,237>))
        at main(|project://Opdracht%201/src/NewVersionMainModule.rsc|(2645,5398,<87,0>,<209,1>))
        at $root$(|prompt:///|(0,7,<1,0>,<1,7>))
    

0 个答案:

没有答案