2011-10-19 23 views
0

當我嘗試使用最新的grails snapshoot編譯附帶的groovy類時,出現以下異常。我今天關閉了構建服務器。例外中的關鍵評論是:如果這不是你自己的行爲,請將此錯誤報告給轉換的作者。Grails/Groovy變換異常

例外:

/u01/workspace/grails/grails-spring-social-core/grails-app/domain/grails/plugins/springsocial/UserConnection.groovy:-1: 變換使用一個包含ClassNode grails.plugins.springsocial.UserConnection的泛型爲 方法public static grails.plugins.springsocial.UserConnection create(){...}
直接。你不想這樣做。請創建一個新的 ClassNode引用舊的ClassNode,並使用舊的ClassNode而不是舊的ClassNode 。否則,編譯器將在OpenJDK中的TypeResolver中創建可能的NullPointerException異常描述符和一個潛在的NullPointerException異常。如果這不是您自己的做法,請將此錯誤報告給變換的作者。

所以這看起來像一對報告的grails錯誤,但他們被解僱作爲插件中的錯誤。這是Grails問題還是Groovy問題?

這就是說這可能是一個常規錯誤...但這是我的頭。

http://comments.gmane.org/gmane.comp.lang.groovy.devel/26130

是什麼這個根本原因?這又是一個與Grails轉換有關的問題還是這是一個常規編譯器異常?以下是我正在編譯的類:

package grails.plugins.springsocial 

import groovy.transform.EqualsAndHashCode 

@EqualsAndHashCode(includeFields=true) 
class UserConnection implements Serializable { 

    String userId 
    String providerId 
    String providerUserId 
    String displayName 
    String profileUrl 
    String imageUrl 
    String accessToken 
    String secret 
    String refreshToken 
    Long rank 
    Long expireTime 

    static constraints = { 
     userId nullable: false 
     providerId nullable: false 
     providerUserId nullable: false 
     displayName nullable: true 
     profileUrl nullable: true 
     imageUrl nullable: true 
     accessToken nullable: false 
     secret nullable: true 
     refreshToken nullable: true 
     rank nullable: false 
     expireTime nullable: true 
    } 

    static mapping = { 
     table "UserConnection" 
     version false 

     id composite:['userId', 'providerId', 'providerUserId'] 

     userId column:'userId',length:64 
     providerId column:'providerId',length:128 
     providerUserId column:'providerUserId',length:128 
     displayName column:'displayName' 
     profileUrl column:'profileUrl' 
     imageUrl column:'imageUrl' 
     accessToken column:'accessToken' 
     secret column:'secret' 
     refreshToken column:'refreshToken' 
     rank column:'rank' 
     expireTime column:'expireTime' 
    } 
} 

感謝您的幫助!

+0

什麼版本的Grails? 'EqualsAndHashCode'只在Groovy 1.8.0以後纔出現,而Grails 1.3.7在Groovy 1.7以上呢? –

+0

構建服務器的最新2.0版本。這是一個1.8.3常規問題。我降級到1.8.2以獲得這個結果。 – chrislovecnm

回答

0

這最終成爲Groovy 1.8.3問題。我降級到1.8.2,不再有問題。