321 List<Attribute.TypeCompound> typeAnnotations = typeAnnos.toList(); |
321 List<Attribute.TypeCompound> typeAnnotations = typeAnnos.toList(); |
322 |
322 |
323 if (type == null) { |
323 if (type == null) { |
324 // When type is null, put the type annotations to the symbol. |
324 // When type is null, put the type annotations to the symbol. |
325 // This is used for constructor return annotations, for which |
325 // This is used for constructor return annotations, for which |
326 // no appropriate type exists. |
326 // we use the type of the enclosing class. |
|
327 type = sym.getEnclosingElement().asType(); |
|
328 |
|
329 // Declaration annotations are always allowed on constructor returns. |
|
330 // Therefore, use typeAnnotations instead of onlyTypeAnnos. |
|
331 type = typeWithAnnotations(typetree, type, typeAnnotations, typeAnnotations); |
|
332 // Note that we don't use the result, the call to |
|
333 // typeWithAnnotations side-effects the type annotation positions. |
|
334 // This is important for constructors of nested classes. |
|
335 |
327 sym.appendUniqueTypeAttributes(typeAnnotations); |
336 sym.appendUniqueTypeAttributes(typeAnnotations); |
328 return; |
337 return; |
329 } |
338 } |
330 |
339 |
331 // type is non-null and annotations are added to that type |
340 // type is non-null and annotations are added to that type |