1/* 2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package com.sun.tools.javadoc.main; 27 28import com.sun.javadoc.*; 29import com.sun.tools.javac.code.Attribute; 30import com.sun.tools.javac.code.Attribute.TypeCompound; 31import com.sun.tools.javac.util.List; 32 33/** 34 * Implementation of <code>AnnotatedType</code>, which 35 * represents an annotated type. 36 * 37 * @author Mahmood Ali 38 * @since 1.8 39 */ 40@Deprecated 41public class AnnotatedTypeImpl 42 extends AbstractTypeImpl implements AnnotatedType { 43 44 AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type type) { 45 super(env, type); 46 } 47 48 /** 49 * Get the annotations of this program element. 50 * Return an empty array if there are none. 51 */ 52 @Override 53 public AnnotationDesc[] annotations() { 54 List<? extends TypeCompound> tas = type.getAnnotationMirrors(); 55 if (tas == null || 56 tas.isEmpty()) { 57 return new AnnotationDesc[0]; 58 } 59 AnnotationDesc res[] = new AnnotationDesc[tas.length()]; 60 int i = 0; 61 for (Attribute.Compound a : tas) { 62 res[i++] = new AnnotationDescImpl(env, a); 63 } 64 return res; 65 } 66 67 @Override 68 public com.sun.javadoc.Type underlyingType() { 69 return TypeMaker.getType(env, type, true, false); 70 } 71 72 @Override 73 public AnnotatedType asAnnotatedType() { 74 return this; 75 } 76 77 @Override 78 public String toString() { 79 return typeName(); 80 } 81 82 @Override 83 public String typeName() { 84 return this.underlyingType().typeName(); 85 } 86 87 @Override 88 public String qualifiedTypeName() { 89 return this.underlyingType().qualifiedTypeName(); 90 } 91 92 @Override 93 public String simpleTypeName() { 94 return this.underlyingType().simpleTypeName(); 95 } 96 97 @Override 98 public String dimension() { 99 return this.underlyingType().dimension(); 100 } 101 102 @Override 103 public boolean isPrimitive() { 104 return this.underlyingType().isPrimitive(); 105 } 106 107 @Override 108 public ClassDoc asClassDoc() { 109 return this.underlyingType().asClassDoc(); 110 } 111 112 @Override 113 public TypeVariable asTypeVariable() { 114 return this.underlyingType().asTypeVariable(); 115 } 116 117 @Override 118 public WildcardType asWildcardType() { 119 return this.underlyingType().asWildcardType(); 120 } 121 122 @Override 123 public ParameterizedType asParameterizedType() { 124 return this.underlyingType().asParameterizedType(); 125 } 126} 127