1.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Mon Jan 21 01:27:42 2013 -0500 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Mon Feb 04 18:08:53 2013 -0500 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -84,7 +84,15 @@ 1.11 * method to make sure that the class symbol is loaded. 1.12 */ 1.13 public List<Attribute.Compound> getRawAttributes() { 1.14 - return annotations.getAttributes(); 1.15 + return annotations.getDeclarationAttributes(); 1.16 + } 1.17 + 1.18 + /** An accessor method for the type attributes of this symbol. 1.19 + * Attributes of class symbols should be accessed through the accessor 1.20 + * method to make sure that the class symbol is loaded. 1.21 + */ 1.22 + public List<Attribute.TypeCompound> getRawTypeAttributes() { 1.23 + return annotations.getTypeAttributes(); 1.24 } 1.25 1.26 /** Fetch a particular annotation from a symbol. */ 1.27 @@ -450,11 +458,19 @@ 1.28 * This is the implementation for {@code 1.29 * javax.lang.model.element.Element.getAnnotationMirrors()}. 1.30 */ 1.31 - public final List<Attribute.Compound> getAnnotationMirrors() { 1.32 + public final List<? extends AnnotationMirror> getAnnotationMirrors() { 1.33 return getRawAttributes(); 1.34 } 1.35 1.36 /** 1.37 + * TODO: Should there be a {@code 1.38 + * javax.lang.model.element.Element.getTypeAnnotationMirrors()}. 1.39 + */ 1.40 + public final List<Attribute.TypeCompound> getTypeAnnotationMirrors() { 1.41 + return getRawTypeAttributes(); 1.42 + } 1.43 + 1.44 + /** 1.45 * @deprecated this method should never be used by javac internally. 1.46 */ 1.47 @Deprecated 1.48 @@ -462,6 +478,11 @@ 1.49 return JavacElements.getAnnotation(this, annoType); 1.50 } 1.51 1.52 + // This method is part of the javax.lang.model API, do not use this in javac code. 1.53 + public <A extends java.lang.annotation.Annotation> A[] getAnnotations(Class<A> annoType) { 1.54 + return JavacElements.getAnnotations(this, annoType); 1.55 + } 1.56 + 1.57 // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList 1.58 public java.util.List<Symbol> getEnclosedElements() { 1.59 return List.nil(); 1.60 @@ -790,6 +811,12 @@ 1.61 return super.getRawAttributes(); 1.62 } 1.63 1.64 + @Override 1.65 + public List<Attribute.TypeCompound> getRawTypeAttributes() { 1.66 + if (completer != null) complete(); 1.67 + return super.getRawTypeAttributes(); 1.68 + } 1.69 + 1.70 public Type erasure(Types types) { 1.71 if (erasure_field == null) 1.72 erasure_field = new ClassType(types.erasure(type.getEnclosingType()), 1.73 @@ -1228,7 +1255,8 @@ 1.74 case Flags.PRIVATE: 1.75 return false; 1.76 case Flags.PUBLIC: 1.77 - return true; 1.78 + return !this.owner.isInterface() || 1.79 + (flags_field & STATIC) == 0; 1.80 case Flags.PROTECTED: 1.81 return (origin.flags() & INTERFACE) == 0; 1.82 case 0: 1.83 @@ -1242,6 +1270,18 @@ 1.84 } 1.85 } 1.86 1.87 + @Override 1.88 + public boolean isInheritedIn(Symbol clazz, Types types) { 1.89 + switch ((int)(flags_field & Flags.AccessFlags)) { 1.90 + case PUBLIC: 1.91 + return !this.owner.isInterface() || 1.92 + clazz == owner || 1.93 + (flags_field & STATIC) == 0; 1.94 + default: 1.95 + return super.isInheritedIn(clazz, types); 1.96 + } 1.97 + } 1.98 + 1.99 /** The implementation of this (abstract) symbol in class origin; 1.100 * null if none exists. Synthetic methods are not considered 1.101 * as possible implementations. 1.102 @@ -1369,7 +1409,7 @@ 1.103 return defaultValue; 1.104 } 1.105 1.106 - public List<VarSymbol> getParameters() { 1.107 + public List<VarSymbol> getParameters() { 1.108 return params(); 1.109 } 1.110