生成错误:错误!源集中的阶段“指令选择”中的异常

时间:2019-02-28 17:51:14

标签: spring grails groovy

我创建了一个名为Curr_Stud_Info.groovy的域类

package ads2

import gorm.logical.delete.LogicalDelete

class Curr_Stud_Info implements LogicalDelete{

    static constraints = {
        current_std nullable: false
        division nullable: false
        roll_no nullable: false
    }

    static belongsTo = [student : Student]
    static mapping = {student column: id}   //this is needed only  in belongs to methods for giving relationship  to different column

    Integer current_std
    Character division
    Integer roll_no    
}

在构建该项目期间,我的规范文件Curr_Stud_InfoSpec.groovy出现了错误

package ads2

import grails.testing.gorm.DomainUnitTest
import spock.lang.Specification

class Curr_Stud_InfoSpec extends Specification implements DomainUnitTest<Curr_Stud_Info> {

    def setup() {
    }

    def cleanup() {
    }

    void "test something"() {
        expect:"fix me"
            true == false
    }
}

这是grails生成的。 错误是

  

错误:Groovyc:编译ads2.ads2.test的测试时:错误!例外   在源单元的“指令选择”阶段   '/home/pathpanchal/PROJECT/ads2/ads2/src/test/groovy/ads2/Curr_Stud_InfoSpec.groovy'   类型为null。最有可能您让转换重用了现有的   具有泛型信息的ClassNodes,现在被错误地使用   上下文。在   org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:125)     在   org.codehaus.groovy.vmplugin.v5.Java5.configureTypeArguments(Java5.java:186)     在   org.codehaus.groovy.vmplugin.v5.Java5.configureParameterizedType(Java5.java:166)     在   org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:117)     在   org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:439)     在   org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:370)     在   org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)     在   org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:375)     在   org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:981)     在   org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:961)     在   org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.getResultType(StaticTypeCheckingVisitor.java:3717)     在   org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:716)     在   org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)     在   org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)     在   org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)     在   org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)     在   org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)     在   org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)     在   org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1963)     在   org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)     在   org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2318)     在   org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2277)     在   org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethod(StaticCompilationVisitor.java:224)     在   org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:80)     在   org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:152)     在   org.codehaus.groovy.transform.ASTTransformationVisitor $ 2.call(ASTTransformationVisitor.java:196)     在   org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)     在   org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)     在   org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)     在   org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)     在   org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)     在   org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:119)     在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)在   org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:90)     在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)在   org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:160)     在   org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda $ runGroovyc $ 0(InProcessGroovyc.java:89)     在java.util.concurrent.FutureTask.run(FutureTask.java:266)在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     在   java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)     在java.lang.Thread.run(Thread.java:748)

我不知道为什么会发生此错误以及如何解决它?

0 个答案:

没有答案