Fri, 28 Jan 2011 16:54:18 -0800
7015530: Reiterate API specializations in javax.lang.model.elment subinterfaces
Reviewed-by: jjg
1.1 --- a/src/share/classes/javax/lang/model/element/Element.java Fri Jan 28 12:36:34 2011 +0000 1.2 +++ b/src/share/classes/javax/lang/model/element/Element.java Fri Jan 28 16:54:18 2011 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2005, 2011, 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 @@ -159,18 +159,26 @@ 1.11 Set<Modifier> getModifiers(); 1.12 1.13 /** 1.14 - * Returns the simple (unqualified) name of this element. 1.15 - * The name of a generic type does not include any reference 1.16 - * to its formal type parameters. 1.17 - * For example, the simple name of the type element 1.18 - * {@code java.util.Set<E>} is {@code "Set"}. 1.19 - * If this element represents an unnamed package, an empty name is 1.20 - * returned. If it represents a constructor, the name "{@code 1.21 - * <init>}" is returned. If it represents a static initializer, 1.22 - * the name "{@code <clinit>}" is returned. If it represents an 1.23 - * anonymous class or instance initializer, an empty name is 1.24 + * Returns the simple (unqualified) name of this element. The 1.25 + * name of a generic type does not include any reference to its 1.26 + * formal type parameters. 1.27 + * 1.28 + * For example, the simple name of the type element {@code 1.29 + * java.util.Set<E>} is {@code "Set"}. 1.30 + * 1.31 + * If this element represents an unnamed {@linkplain 1.32 + * PackageElement#getSimpleName package}, an empty name is 1.33 * returned. 1.34 * 1.35 + * If it represents a {@linkplain ExecutableElement#getSimpleName 1.36 + * constructor}, the name "{@code <init>}" is returned. If it 1.37 + * represents a {@linkplain ExecutableElement#getSimpleName static 1.38 + * initializer}, the name "{@code <clinit>}" is returned. 1.39 + * 1.40 + * If it represents an {@linkplain TypeElement#getSimpleName 1.41 + * anonymous class} or {@linkplain ExecutableElement#getSimpleName 1.42 + * instance initializer}, an empty name is returned. 1.43 + * 1.44 * @return the simple name of this element 1.45 */ 1.46 Name getSimpleName(); 1.47 @@ -182,9 +190,18 @@ 1.48 * <li> If this element is one whose declaration is lexically enclosed 1.49 * immediately within the declaration of another element, that other 1.50 * element is returned. 1.51 - * <li> If this is a top-level type, its package is returned. 1.52 - * <li> If this is a package, {@code null} is returned. 1.53 - * <li> If this is a type parameter, {@code null} is returned. 1.54 + * 1.55 + * <li> If this is a {@linkplain TypeElement#getEnclosingElement 1.56 + * top-level type}, its package is returned. 1.57 + * 1.58 + * <li> If this is a {@linkplain 1.59 + * PackageElement#getEnclosingElement package}, {@code null} is 1.60 + * returned. 1.61 + 1.62 + * <li> If this is a {@linkplain 1.63 + * TypeParameterElement#getEnclosingElement type parameter}, 1.64 + * {@code null} is returned. 1.65 + 1.66 * </ul> 1.67 * 1.68 * @return the enclosing element, or {@code null} if there is none
2.1 --- a/src/share/classes/javax/lang/model/element/ExecutableElement.java Fri Jan 28 12:36:34 2011 +0000 2.2 +++ b/src/share/classes/javax/lang/model/element/ExecutableElement.java Fri Jan 28 16:54:18 2011 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -97,4 +97,17 @@ 2.11 * @return the default value, or {@code null} if none 2.12 */ 2.13 AnnotationValue getDefaultValue(); 2.14 + 2.15 + /** 2.16 + * Returns the simple name of a constructor, method, or 2.17 + * initializer. For a constructor, the name {@code "<init>"} is 2.18 + * returned, for a static initializer, the name {@code "<clinit>"} 2.19 + * is returned, and for an anonymous class or instance 2.20 + * initializer, an empty name is returned. 2.21 + * 2.22 + * @return the simple name of a constructor, method, or 2.23 + * initializer 2.24 + */ 2.25 + @Override 2.26 + Name getSimpleName(); 2.27 }
3.1 --- a/src/share/classes/javax/lang/model/element/PackageElement.java Fri Jan 28 12:36:34 2011 +0000 3.2 +++ b/src/share/classes/javax/lang/model/element/PackageElement.java Fri Jan 28 16:54:18 2011 -0800 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -48,6 +48,16 @@ 3.11 Name getQualifiedName(); 3.12 3.13 /** 3.14 + * Returns the simple name of this package. For an unnamed 3.15 + * package, an empty name is returned 3.16 + * 3.17 + * @return the simple name of this package or an empty name if 3.18 + * this is an unnamed package 3.19 + */ 3.20 + @Override 3.21 + Name getSimpleName(); 3.22 + 3.23 + /** 3.24 * Returns {@code true} is this is an unnamed package and {@code 3.25 * false} otherwise. 3.26 * 3.27 @@ -56,4 +66,13 @@ 3.28 * @jls3 7.4.2 Unnamed Packages 3.29 */ 3.30 boolean isUnnamed(); 3.31 + 3.32 + /** 3.33 + * Returns {@code null} since a package is not enclosed by another 3.34 + * element. 3.35 + * 3.36 + * @return {@code null} 3.37 + */ 3.38 + @Override 3.39 + Element getEnclosingElement(); 3.40 }
4.1 --- a/src/share/classes/javax/lang/model/element/TypeElement.java Fri Jan 28 12:36:34 2011 +0000 4.2 +++ b/src/share/classes/javax/lang/model/element/TypeElement.java Fri Jan 28 16:54:18 2011 -0800 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -105,6 +105,19 @@ 4.11 */ 4.12 Name getQualifiedName(); 4.13 4.14 + 4.15 + /** 4.16 + * Returns the simple name of this type element. 4.17 + * 4.18 + * For an anonymous class, an empty name is returned. 4.19 + * 4.20 + * @return the simple name of this class or interface, 4.21 + * an empty name for an anonymous class 4.22 + * 4.23 + */ 4.24 + @Override 4.25 + Name getSimpleName(); 4.26 + 4.27 /** 4.28 * Returns the direct superclass of this type element. 4.29 * If this type element represents an interface or the class 4.30 @@ -132,4 +145,16 @@ 4.31 * if there are none 4.32 */ 4.33 List<? extends TypeParameterElement> getTypeParameters(); 4.34 + 4.35 + 4.36 + /** 4.37 + * Returns the package of a top-level type and returns the 4.38 + * immediately lexically enclosing element for a {@linkplain 4.39 + * NestingKind#isNested nested} type. 4.40 + * 4.41 + * @return the package of a top-level type, the immediately 4.42 + * lexically enclosing element for a nested type 4.43 + */ 4.44 + @Override 4.45 + Element getEnclosingElement(); 4.46 }
5.1 --- a/src/share/classes/javax/lang/model/element/TypeParameterElement.java Fri Jan 28 12:36:34 2011 +0000 5.2 +++ b/src/share/classes/javax/lang/model/element/TypeParameterElement.java Fri Jan 28 16:54:18 2011 -0800 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -62,4 +62,12 @@ 5.11 * there are none 5.12 */ 5.13 List<? extends TypeMirror> getBounds(); 5.14 + 5.15 + /** 5.16 + * Returns {@code null}. 5.17 + * 5.18 + * @return {@code null} 5.19 + */ 5.20 + @Override 5.21 + Element getEnclosingElement(); 5.22 }
6.1 --- a/src/share/classes/javax/lang/model/element/VariableElement.java Fri Jan 28 12:36:34 2011 +0000 6.2 +++ b/src/share/classes/javax/lang/model/element/VariableElement.java Fri Jan 28 16:54:18 2011 -0800 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -28,17 +28,16 @@ 6.11 import javax.lang.model.type.TypeMirror; 6.12 import javax.lang.model.util.Elements; 6.13 6.14 - 6.15 /** 6.16 * Represents a field, {@code enum} constant, method or constructor 6.17 - * parameter, local variable, or exception parameter. 6.18 + * parameter, local variable, resource variable, or exception 6.19 + * parameter. 6.20 * 6.21 * @author Joseph D. Darcy 6.22 * @author Scott Seligman 6.23 * @author Peter von der Ahé 6.24 * @since 1.6 6.25 */ 6.26 - 6.27 public interface VariableElement extends Element { 6.28 6.29 /**