< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
Print this page
if (s.kind == VAR &&
s.owner.kind != MTH)
return AnnotationType.DECLARATION;
} else if (e.value.name == names.METHOD) {
if (s.kind == MTH &&
! !s.isConstructor())
return AnnotationType.DECLARATION;
} else if (e.value.name == names.PARAMETER) {
if (s.kind == VAR &&
s.owner.kind == MTH &&
(s.flags() & Flags.PARAMETER) != 0)
if (s.kind == VAR &&
s.owner.kind != MTH)
return AnnotationType.DECLARATION;
} else if (e.value.name == names.METHOD) {
if (s.kind == MTH &&
! !s.isInitOrVNew())
return AnnotationType.DECLARATION;
} else if (e.value.name == names.PARAMETER) {
if (s.kind == VAR &&
s.owner.kind == MTH &&
(s.flags() & Flags.PARAMETER) != 0)
if (s.kind == PCK)
return AnnotationType.DECLARATION;
} else if (e.value.name == names.TYPE_USE) {
if (s.kind == TYP ||
s.kind == VAR ||
! (s.kind == MTH && !s.isConstructor() &&
!s.type.getReturnType().hasTag(TypeTag.VOID)) ||
! (s.kind == MTH && s.isConstructor()))
return AnnotationType.TYPE;
} else if (e.value.name == names.TYPE_PARAMETER) {
/* Irrelevant in this case */
// TYPE_PARAMETER doesn't aid in distinguishing between
// Type annotations and declaration annotations on an
if (s.kind == PCK)
return AnnotationType.DECLARATION;
} else if (e.value.name == names.TYPE_USE) {
if (s.kind == TYP ||
s.kind == VAR ||
! (s.kind == MTH && !s.isInitOrVNew() &&
!s.type.getReturnType().hasTag(TypeTag.VOID)) ||
! (s.kind == MTH && s.isInitOrVNew()))
return AnnotationType.TYPE;
} else if (e.value.name == names.TYPE_PARAMETER) {
/* Irrelevant in this case */
// TYPE_PARAMETER doesn't aid in distinguishing between
// Type annotations and declaration annotations on an
t.getEnclosingType() == Type.noType) {
return t.annotatedType(s);
} else {
ClassType ret = new ClassType(t.getEnclosingType().accept(this, s),
t.typarams_field, t.tsym,
! t.getMetadata());
ret.all_interfaces_field = t.all_interfaces_field;
ret.allparams_field = t.allparams_field;
ret.interfaces_field = t.interfaces_field;
ret.rank_field = t.rank_field;
ret.supertype_field = t.supertype_field;
t.getEnclosingType() == Type.noType) {
return t.annotatedType(s);
} else {
ClassType ret = new ClassType(t.getEnclosingType().accept(this, s),
t.typarams_field, t.tsym,
! t.getMetadata(), t.getFlavor());
ret.all_interfaces_field = t.all_interfaces_field;
ret.allparams_field = t.allparams_field;
ret.interfaces_field = t.interfaces_field;
ret.rank_field = t.rank_field;
ret.supertype_field = t.supertype_field;
}
MethodSymbol exsym = (MethodSymbol) TreeInfo.symbol(invocation.getMethodSelect());
final int type_index = invocation.typeargs.indexOf(tree);
if (exsym == null) {
throw new AssertionError("could not determine symbol for {" + invocation + "}");
! } else if (exsym.isConstructor()) {
return TypeAnnotationPosition
.constructorInvocationTypeArg(location.toList(),
currentLambda,
type_index,
invocation.pos);
}
MethodSymbol exsym = (MethodSymbol) TreeInfo.symbol(invocation.getMethodSelect());
final int type_index = invocation.typeargs.indexOf(tree);
if (exsym == null) {
throw new AssertionError("could not determine symbol for {" + invocation + "}");
! } else if (exsym.isInitOrVNew()) {
return TypeAnnotationPosition
.constructorInvocationTypeArg(location.toList(),
currentLambda,
type_index,
invocation.pos);
if (tree.sym == null) {
Assert.error("Visiting tree node before memberEnter");
}
if (sigOnly) {
if (!tree.mods.annotations.isEmpty()) {
! if (tree.sym.isConstructor()) {
final TypeAnnotationPosition pos =
TypeAnnotationPosition.methodReturn(tree.pos);
// Use null to mark that the annotations go
// with the symbol.
separateAnnotationsKinds(tree, tree, null, tree.sym, pos);
if (tree.sym == null) {
Assert.error("Visiting tree node before memberEnter");
}
if (sigOnly) {
if (!tree.mods.annotations.isEmpty()) {
! if (tree.sym.isInitOrVNew()) {
final TypeAnnotationPosition pos =
TypeAnnotationPosition.methodReturn(tree.pos);
// Use null to mark that the annotations go
// with the symbol.
separateAnnotationsKinds(tree, tree, null, tree.sym, pos);
< prev index next >