/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Utility methods for operating on program elements.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own
* risk. This code and its internal interfaces are subject to change
* or deletion without notice.</b></p>
*/
return instance;
}
/**
* Public for use only by JavacProcessingEnvironment
*/
}
/**
* Use a new context. May be called from outside to update
* internal state for a new annotation-processing round.
*/
}
/**
* An internal-use utility that creates a reified annotation.
*/
if (!annoType.isAnnotation())
throw new IllegalArgumentException("Not an annotation type: "
+ annoType);
return null;
}
/**
* An internal-use utility that creates a reified annotation.
* This overloaded version take annotation inheritance into account.
*/
break;
break;
}
return result;
}
return syms.unnamedPackage;
: null;
}
: null;
}
/**
* Returns a symbol given the type's or packages's canonical name,
* or null if the name isn't found.
*/
// First check cache.
try {
: null;
} catch (CompletionFailure e) {
return null;
}
}
return null;
if (sourcefile == null)
return null;
}
return null;
if (sourcefile == null)
return null;
return null;
}
AnnotationValue v) {
// TODO: better accuracy in getSourcePosition(... AnnotationValue)
return getSourcePosition(e, a);
}
/**
* Returns the tree for an annotation given the annotated element
* and the element's own tree. Returns null if the tree cannot be found.
*/
}
}
}
}
}
return null;
}
/**
* Returns the tree for an annotation given a list of annotations
* in which to search (recursively) and their corresponding trees.
* Returns null if the tree cannot be found.
*/
return match;
}
}
return null;
}
/**
* Returns the tree for an annotation given an Attribute to
* search (recursively) and its corresponding tree.
* Returns null if the tree cannot be found.
*/
}
}
return;
}
}
}
}
return;
}
}
}
}
}
}
}
}
/**
* Scans for a JCAssign node with a LHS matching a given
* symbol, and returns its RHS. Does not scan nested JCAnnotations.
*/
class TS extends TreeScanner {
t.accept(this);
}
public void visitAnnotation(JCAnnotation t) {
if (t == tree)
}
public void visitAssign(JCAssign t) {
}
}
}
}
/**
* Returns the tree node corresponding to this element, or null
* if none can be found.
*/
}
// Our doc comment is contained in a map in our toplevel,
// indexed by our tree. Find our enter environment, which gives
// us our toplevel. It also gives us a tree that contains our
// tree: walk it to find our tree. This is painful.
return null;
return null;
}
}
}
}
AnnotationMirror a) {
for (ExecutableElement ex :
}
}
return valmap;
}
/**
* {@inheritDoc}
*/
addMembers(scope, t);
return new FilteredMemberList(scope);
}
// where
{
&& overrides((ExecutableElement)overrider.sym, (ExecutableElement)e.sym, (TypeElement)type.asElement())) {
continue members;
}
}
}
}
}
/**
* Returns all annotations of an element, whether
* inherited or directly present.
*
* @param e the element being examined
* @return all annotations of the element
*/
break;
}
}
}
}
return annos;
}
/**
* Tests whether an annotation type is @Inherited.
*/
return true;
}
return false;
}
/**
* Tests whether a list of annotations contains an annotation
* of a given type.
*/
return true;
}
return false;
}
// Fields only hide fields; methods only methods; types only types.
// Names must match. Nothing hides itself (just try it).
return false;
}
// Only static methods can hide other methods.
// Methods only hide methods with matching signatures.
return false;
}
}
// Hider must be in a subclass of hidee's class.
// Note that if M1 hides M2, and M2 hides M3, and M3 is accessible
// in M1's class, then M1 and M2 both hide M3.
return false;
}
// Hidee must be accessible in hider's class.
// The method isInheritedIn is poorly named: it checks only access.
}
// not reflexive as per JLS
// we don't care if ridee is static, though that wouldn't
// compile
// Symbol.overrides assumes the following
// check access and signatures; don't check return types
}
}
/**
* Print a representation of the elements to the given writer in
* the specified order. The main purpose of this method is for
* diagnostics. The exact format of the output is <em>not</em>
* specified and is subject to change.
*
* @param w the writer to print the output to
* @param elements the elements to print
*/
}
}
/**
* Returns the tree node and compilation unit corresponding to this
* element, or null if they can't be found.
*/
return null;
return null;
}
/**
* Returns the best approximation for the tree node and compilation unit
* corresponding to the given element, annotation and value.
* If the element is null, null is returned.
* If the annotation is null or cannot be found, the tree node and
* compilation unit for the element is returned.
* If the annotation value is null or cannot be found, the tree node and
* compilation unit for the annotation is returned.
*/
if (e == null)
return null;
if (elemTreeTop == null)
return null;
if (a == null)
return elemTreeTop;
return elemTreeTop;
// 6388543: if v != null, we should search within annoTree to find
// the tree matching v. For now, we ignore v and return the tree of
// the annotation.
}
/**
* Returns a symbol's enter environment, or null if it has none.
*/
// Get enclosing class of sym, or sym itself if it is a class
// or package.
: (PackageSymbol) sym;
: null;
}
/**
* Returns an object cast to the specified type.
* @throws NullPointerException if the object is {@code null}
* @throws IllegalArgumentException if the object is of the wrong type
*/
if (! clazz.isInstance(o))
throw new IllegalArgumentException(o.toString());
}
}