提交 abd92b89 编写于 作者: D darcy

7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces

Reviewed-by: jjg
上级 5ad5d5af
/* /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -159,18 +159,26 @@ public interface Element { ...@@ -159,18 +159,26 @@ public interface Element {
Set<Modifier> getModifiers(); Set<Modifier> getModifiers();
/** /**
* Returns the simple (unqualified) name of this element. * Returns the simple (unqualified) name of this element. The
* The name of a generic type does not include any reference * name of a generic type does not include any reference to its
* to its formal type parameters. * formal type parameters.
* For example, the simple name of the type element *
* {@code java.util.Set<E>} is {@code "Set"}. * For example, the simple name of the type element {@code
* If this element represents an unnamed package, an empty name is * java.util.Set<E>} is {@code "Set"}.
* returned. If it represents a constructor, the name "{@code *
* <init>}" is returned. If it represents a static initializer, * If this element represents an unnamed {@linkplain
* the name "{@code <clinit>}" is returned. If it represents an * PackageElement#getSimpleName package}, an empty name is
* anonymous class or instance initializer, an empty name is
* returned. * returned.
* *
* If it represents a {@linkplain ExecutableElement#getSimpleName
* constructor}, the name "{@code <init>}" is returned. If it
* represents a {@linkplain ExecutableElement#getSimpleName static
* initializer}, the name "{@code <clinit>}" is returned.
*
* If it represents an {@linkplain TypeElement#getSimpleName
* anonymous class} or {@linkplain ExecutableElement#getSimpleName
* instance initializer}, an empty name is returned.
*
* @return the simple name of this element * @return the simple name of this element
*/ */
Name getSimpleName(); Name getSimpleName();
...@@ -182,9 +190,18 @@ public interface Element { ...@@ -182,9 +190,18 @@ public interface Element {
* <li> If this element is one whose declaration is lexically enclosed * <li> If this element is one whose declaration is lexically enclosed
* immediately within the declaration of another element, that other * immediately within the declaration of another element, that other
* element is returned. * element is returned.
* <li> If this is a top-level type, its package is returned. *
* <li> If this is a package, {@code null} is returned. * <li> If this is a {@linkplain TypeElement#getEnclosingElement
* <li> If this is a type parameter, {@code null} is returned. * top-level type}, its package is returned.
*
* <li> If this is a {@linkplain
* PackageElement#getEnclosingElement package}, {@code null} is
* returned.
* <li> If this is a {@linkplain
* TypeParameterElement#getEnclosingElement type parameter},
* {@code null} is returned.
* </ul> * </ul>
* *
* @return the enclosing element, or {@code null} if there is none * @return the enclosing element, or {@code null} if there is none
......
/* /*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -97,4 +97,17 @@ public interface ExecutableElement extends Element, Parameterizable { ...@@ -97,4 +97,17 @@ public interface ExecutableElement extends Element, Parameterizable {
* @return the default value, or {@code null} if none * @return the default value, or {@code null} if none
*/ */
AnnotationValue getDefaultValue(); AnnotationValue getDefaultValue();
/**
* Returns the simple name of a constructor, method, or
* initializer. For a constructor, the name {@code "<init>"} is
* returned, for a static initializer, the name {@code "<clinit>"}
* is returned, and for an anonymous class or instance
* initializer, an empty name is returned.
*
* @return the simple name of a constructor, method, or
* initializer
*/
@Override
Name getSimpleName();
} }
/* /*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -47,6 +47,16 @@ public interface PackageElement extends Element, QualifiedNameable { ...@@ -47,6 +47,16 @@ public interface PackageElement extends Element, QualifiedNameable {
*/ */
Name getQualifiedName(); Name getQualifiedName();
/**
* Returns the simple name of this package. For an unnamed
* package, an empty name is returned
*
* @return the simple name of this package or an empty name if
* this is an unnamed package
*/
@Override
Name getSimpleName();
/** /**
* Returns {@code true} is this is an unnamed package and {@code * Returns {@code true} is this is an unnamed package and {@code
* false} otherwise. * false} otherwise.
...@@ -56,4 +66,13 @@ public interface PackageElement extends Element, QualifiedNameable { ...@@ -56,4 +66,13 @@ public interface PackageElement extends Element, QualifiedNameable {
* @jls3 7.4.2 Unnamed Packages * @jls3 7.4.2 Unnamed Packages
*/ */
boolean isUnnamed(); boolean isUnnamed();
/**
* Returns {@code null} since a package is not enclosed by another
* element.
*
* @return {@code null}
*/
@Override
Element getEnclosingElement();
} }
/* /*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -105,6 +105,19 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable ...@@ -105,6 +105,19 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable
*/ */
Name getQualifiedName(); Name getQualifiedName();
/**
* Returns the simple name of this type element.
*
* For an anonymous class, an empty name is returned.
*
* @return the simple name of this class or interface,
* an empty name for an anonymous class
*
*/
@Override
Name getSimpleName();
/** /**
* Returns the direct superclass of this type element. * Returns the direct superclass of this type element.
* If this type element represents an interface or the class * If this type element represents an interface or the class
...@@ -132,4 +145,16 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable ...@@ -132,4 +145,16 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable
* if there are none * if there are none
*/ */
List<? extends TypeParameterElement> getTypeParameters(); List<? extends TypeParameterElement> getTypeParameters();
/**
* Returns the package of a top-level type and returns the
* immediately lexically enclosing element for a {@linkplain
* NestingKind#isNested nested} type.
*
* @return the package of a top-level type, the immediately
* lexically enclosing element for a nested type
*/
@Override
Element getEnclosingElement();
} }
/* /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -62,4 +62,12 @@ public interface TypeParameterElement extends Element { ...@@ -62,4 +62,12 @@ public interface TypeParameterElement extends Element {
* there are none * there are none
*/ */
List<? extends TypeMirror> getBounds(); List<? extends TypeMirror> getBounds();
/**
* Returns {@code null}.
*
* @return {@code null}
*/
@Override
Element getEnclosingElement();
} }
/* /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -28,17 +28,16 @@ package javax.lang.model.element; ...@@ -28,17 +28,16 @@ package javax.lang.model.element;
import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements; import javax.lang.model.util.Elements;
/** /**
* Represents a field, {@code enum} constant, method or constructor * Represents a field, {@code enum} constant, method or constructor
* parameter, local variable, or exception parameter. * parameter, local variable, resource variable, or exception
* parameter.
* *
* @author Joseph D. Darcy * @author Joseph D. Darcy
* @author Scott Seligman * @author Scott Seligman
* @author Peter von der Ah&eacute; * @author Peter von der Ah&eacute;
* @since 1.6 * @since 1.6
*/ */
public interface VariableElement extends Element { public interface VariableElement extends Element {
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册