Impl for javax.lang.model API
Jonathan Gibbons
jonathan.gibbons at oracle.com
Tue Feb 19 20:28:43 PST 2013
On 02/19/2013 06:07 PM, Jonathan Gibbons wrote:
> Werner,
>
> I have an initial impl of the new javax.lang.model API, and some
> initial tests.
>
> One test is failing: given an ExecutableType, the list returned by
> getParameterTypes is not returning parameters types with type
> annotations, when I think it should. In particular, a toString() of
> the ExecutableType does not indicate any type-annotated parameters,
> although it does show type annotations on the return type and thrown
> types.
>
> What is the best way to proceed here? Should I push the "work so far"
> to the type-annotations forest for you to investigate?
>
> -- Jon
>
>
Werner,
Here is some corroborative detail, using DPrinter ...
The method in question is
public int m1(@TA(4) float a) throws Exception { return 0; }
The first section, labeled "element", is a dump of the ExecutableElement
for this method. In this element, the VarSymbol for the first parameter
indeed shows the annotation. See element> params> 0> type.
The second section, labeled "type", is a dump of the ExecutableType of
the method. The args of the type do not contain any annotations. See
type > argtypes > 0.
So, the question is, would you expect to see the annotations here?
-- Jon
element: MethodSymbol,0x10--kindname.method,METHOD m1 #14d8af3
flags: 0x1--public
completer: #null
owner: BasicAnnoTests
type: (float)int
erasure: #null
params: [1]
0: VarSymbol,0x4--kindname.variable,PARAMETER a #4e276f
flags: 0x200000000--parameter
completer: #null
owner: m1(float)
type: (@BasicAnnoTests.TA(4) :: float)
erasure: #null
pos: 9845
adm: -1
data: #null
annotations: #193563d
attributes: [0]
type_attributes: [1]
0: TypeCompound
position: [METHOD_FORMAL_PARAMETER, param_index = 0, pos =
9839]
synthesized: false
values: [1]
0: Pair[value(),4]
type: BasicAnnoTests.TA
savedParameterNames: #null
annotations: #e37ebf
attributes: [1]
0: Compound
synthesized: false
values: [3]
0: Pair[posn(),1]
1: Pair[annoType(),BasicAnnoTests.TA.class]
2: Pair[expect(),"4"]
type: BasicAnnoTests.Test
type_attributes: [1]
0: TypeCompound
position: [METHOD_FORMAL_PARAMETER, param_index = 0, pos = 9839]
synthesized: false
values: [1]
0: Pair[value(),4]
type: BasicAnnoTests.TA
type: MethodType,METHOD,EXECUTABLE #b96509
tsym: Method
constValue: #null
annotations: [0]
argtypes: [1]
0: Type,FLOAT,FLOAT #15eb0cd
tsym: float
constValue: #null
annotations: [0]
restype: Type,INT,INT #f328e5
tsym: int
constValue: #null
annotations: [0]
thrown: [1]
0: ClassType,CLASS,DECLARED #1eead82
tsym: java.lang.Exception
constValue: #null
annotations: [0]
outer: <none>
typarams: [0]
allparams: #null
supertype: java.lang.Throwable
interfaces: [0]
allinterfaces: #null
More information about the type-annotations-dev
mailing list