What is best way to get reference of JvmAnnotationType in inference? [message #904208] |
Tue, 28 August 2012 02:19 |
|
JvmTypesBuilder seems not to support JvmAnnotationType.
So I created it myself:
val annoType = createJvmAnnotationType =>[
it.packageName = "java.lang"
it.simpleName = "SuppressWarnings"
]
var annoTypeRef = createJvmAnnotationReference => [
annotation = annoType
values += createJvmStringAnnotationValue => [
values += "all"
]
]
It causes dangle problem, because this reference is not contained by resource.
I tried to inspect, but it seems to I am wandering so deep and internal mechanism.
Can anyone suggest best approach?
|
|
|
|
Re: What is best way to get reference of JvmAnnotationType in inference? [message #904295 is a reply to message #904286] |
Tue, 28 August 2012 07:28 |
|
I think I did not explain my problem correctly.
I'm writing a JVM model inferrer,
I want to add an annotation(@SuppressWarning("all")) to my inferred type.
JvmTypesBuilder xtend extensions provides newTypeRef() method to create or reuse JvmTypeReference easily.
But it supports only against of JVMGenericType, not JvmAnnotationType.
So I tried to create JvmAnnotationReferernce by myself.
val annoType = createJvmAnnotationType =>[
it.packageName = "java.lang"
it.simpleName = "SuppressWarnings"
]
var annoTypeRef = createJvmAnnotationReference => [
annotation = annoType
values += createJvmStringAnnotationValue => [
values += "all"
]
]
in above code, annoTypeRef is not contained by any resource, because I didn't. (because I don't know which resource is appropriate)
So inferring causes an error log which reports isolated model from resourceset problem.
I tried to inspect JVMTypesBuilder and TypeReferences,
It's to complex to me,
So I think that I may going wrong way or too deep.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02749 seconds