src/share/classes/com/sun/tools/javac/comp/Check.java

changeset 2168
119747cd9f25
parent 2157
963c57175e40
child 2187
4788eb38cac5
equal deleted inserted replaced
2167:d2fa3f7e964e 2168:119747cd9f25
3009 3009
3010 /** Is the annotation applicable to the symbol? */ 3010 /** Is the annotation applicable to the symbol? */
3011 boolean annotationApplicable(JCAnnotation a, Symbol s) { 3011 boolean annotationApplicable(JCAnnotation a, Symbol s) {
3012 Attribute.Array arr = getAttributeTargetAttribute(a.annotationType.type.tsym); 3012 Attribute.Array arr = getAttributeTargetAttribute(a.annotationType.type.tsym);
3013 Name[] targets; 3013 Name[] targets;
3014
3015 if (arr == null) { 3014 if (arr == null) {
3016 targets = defaultTargetMetaInfo(a, s); 3015 targets = defaultTargetMetaInfo(a, s);
3017 } else { 3016 } else {
3018 // TODO: can we optimize this? 3017 // TODO: can we optimize this?
3019 targets = new Name[arr.values.length]; 3018 targets = new Name[arr.values.length];
3026 targets[i] = e.value.name; 3025 targets[i] = e.value.name;
3027 } 3026 }
3028 } 3027 }
3029 for (Name target : targets) { 3028 for (Name target : targets) {
3030 if (target == names.TYPE) 3029 if (target == names.TYPE)
3031 { if (s.kind == TYP) return true; } 3030 { if (s.kind == TYP && !s.isAnonymous()) return true; }
3032 else if (target == names.FIELD) 3031 else if (target == names.FIELD)
3033 { if (s.kind == VAR && s.owner.kind != MTH) return true; } 3032 { if (s.kind == VAR && s.owner.kind != MTH) return true; }
3034 else if (target == names.METHOD) 3033 else if (target == names.METHOD)
3035 { if (s.kind == MTH && !s.isConstructor()) return true; } 3034 { if (s.kind == MTH && !s.isConstructor()) return true; }
3036 else if (target == names.PARAMETER) 3035 else if (target == names.PARAMETER)

mercurial