| Summary: | Xtend validation and JvmArrayType implementation issue | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Serano Colameo <serano.colameo> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sebastian.zarnekow, sven.efftinge |
| Version: | 2.1.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
I cannot reproduce this with the latest head. I created an empty class containing the method you mentioned. Works for me. (In reply to comment #1) > I cannot reproduce this with the latest head. > I created an empty class containing the method you mentioned. Works for me. ok, but we work with the official released version and not with the "latest from head". did you try with the official release as well? /serano (In reply to comment #2) > (In reply to comment #1) > > I cannot reproduce this with the latest head. > > I created an empty class containing the method you mentioned. Works for me. > > ok, but we work with the official released version and not with the "latest > from head". > > did you try with the official release as well? > > /serano btw, this works fine: def String getName(JvmArrayType jvmArrayType) { return (jvmArrayType as JvmArrayTypeImpl).identifier } please use DomainmodelJvmModelInferrer.xtend to reproduce the same behavior. /serano here another sample code to reproduce:
package org.eclipse.xtext.example.domainmodel.jvmmodel
import com.google.inject.Inject
import org.eclipse.xtext.common.types.JvmArrayType
import org.eclipse.xtext.common.types.JvmDeclaredType
import org.eclipse.xtext.example.domainmodel.domainmodel.Entity
import org.eclipse.xtext.naming.IQualifiedNameProvider
import org.eclipse.xtext.util.IAcceptor
import org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder
import org.eclipse.xtext.common.types.impl.JvmArrayTypeImpl
class Test {
@Inject extension JvmTypesBuilder
@Inject extension IQualifiedNameProvider
def test(Entity e, IAcceptor<JvmDeclaredType> acceptor) {
acceptor.accept(
e.toClass( e.fullyQualifiedName ) [
documentation = e.documentation
]
)
}
def String getName(JvmArrayType jvmArrayType) {
// enable for validation error:
return jvmArrayType.identifier
// enable this statement and it works:
// return (jvmArrayType as JvmArrayTypeImpl).identifier
}
}
Serano, you are right, there was a bug in 2.1.1 However, it is already fixed for 2.2 Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
Build Identifier: Xtext/Xtend 2.1.1.v201111141332 in xtext 2.1.1. this xtend snipped does not work anymore: def String getName(JvmArrayType jvmArrayType) { return jvmArrayType.identifier } The validation says: Couldn't resolve reference to JvmIdentifiableElement 'identifier' although the "identifier" member appears in the code completion dialog. There are two implementation for JvmArrayType: - JvmArrayTypeImpl - JvmArrayTypeImplCustom When we debug the code JvmArrayTypeImplCustom is instantiated and there is a method getIdentifier. However, it's really confusing now how to use this stuff.... /serano Reproducible: Always Steps to Reproduce: 1. create DomainModell example 2. put this snippet in the DomainmodelJvmModelInferrer.xtend def String getName(JvmArrayType jvmArrayType) { return jvmArrayType.identifier } 3.