You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Sergio del Amo (JIRA)" <ji...@apache.org> on 2018/12/06 18:28:00 UTC
[jira] [Created] (GROOVY-8912) Cannot cast object ... with class
'java.lang.Class' to class 'groovy.lang.GroovyObject'
Sergio del Amo created GROOVY-8912:
--------------------------------------
Summary: Cannot cast object ... with class 'java.lang.Class' to class 'groovy.lang.GroovyObject'
Key: GROOVY-8912
URL: https://issues.apache.org/jira/browse/GROOVY-8912
Project: Groovy
Issue Type: Bug
Affects Versions: 2.5.4
Reporter: Sergio del Amo
This code
{{MetaProperty idProp = getJavaClass().getMetaClass().getMetaProperty(GormProperties.IDENTITY)}}
throws the next error:
{{org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'class grails.gorm.tests.path.domain.Person' with class 'java.lang.Class' to class 'groovy.lang.GroovyObject' at org.grails.datastore.gorm.neo4j.GraphPersistentEntity.initialize(GraphPersistentEntity.groovy:89) at org.grails.datastore.mapping.model.AbstractMappingContext.initializePersistentEntity(AbstractMappingContext.java:352) at org.grails.datastore.mapping.model.AbstractMappingContext.addPersistentEntities(AbstractMappingContext.java:283) at org.grails.datastore.gorm.neo4j.Neo4jMappingContext.<init>(Neo4jMappingContext.java:108) at org.grails.datastore.gorm.neo4j.Neo4jDatastore.createMappingContext(Neo4jDatastore.java:385) at org.grails.datastore.gorm.neo4j.Neo4jDatastore.<init>(Neo4jDatastore.java:163) at org.grails.datastore.gorm.neo4j.Neo4jDatastore.<init>(Neo4jDatastore.java:250) at org.grails.datastore.gorm.neo4j.Neo4jDatastore.<init>(Neo4jDatastore.java:272) at org.grails.datastore.gorm.neo4j.Neo4jDatastore.<init>(Neo4jDatastore.java:282) at org.grails.datastore.gorm.neo4j.Neo4jDatastore.<init>(Neo4jDatastore.java:320) at grails.gorm.tests.path.PathSpec.$spock_initializeSharedFields(PathSpec.groovy:16)}}
But this is ok:
{{Class clazz = getJavaClass()}}
{{MetaClass metaClass = clazz.getMetaClass()}}
{{MetaProperty idProp = metaClass.getMetaProperty(GormProperties.IDENTITY)}}
{\{ GormProperties.IDENTITY is String defined in an interface in a .java file. }}
*Steps to reproduce:.*
You can find a link to the commit here:
[https://github.com/grails/gorm-neo4j/commit/70a6321b902377303b762cc2cdb9e3f2c9a4b794]
Cloning the repo, reverting that commit and execute:
./gradlew --stacktrace grails-datastore-gorm-neo4j:test --tests grails.gorm.tests.path.PathSpec
and compilation fails
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)