1 /* |
1 /* |
2 * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
25 |
25 |
26 package com.sun.tools.javadoc; |
26 package com.sun.tools.javadoc; |
27 |
27 |
28 |
28 |
29 import com.sun.javadoc.*; |
29 import com.sun.javadoc.*; |
30 |
|
31 import static com.sun.javadoc.LanguageVersion.*; |
|
32 |
30 |
33 import com.sun.tools.javac.code.Symbol.ClassSymbol; |
31 import com.sun.tools.javac.code.Symbol.ClassSymbol; |
34 import com.sun.tools.javac.code.Type; |
32 import com.sun.tools.javac.code.Type; |
35 import com.sun.tools.javac.util.List; |
33 import com.sun.tools.javac.util.List; |
36 |
34 |
67 } |
65 } |
68 |
66 |
69 /** |
67 /** |
70 * Return the ClassDoc of the erasure of this wildcard type. |
68 * Return the ClassDoc of the erasure of this wildcard type. |
71 */ |
69 */ |
|
70 @Override |
72 public ClassDoc asClassDoc() { |
71 public ClassDoc asClassDoc() { |
73 return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym); |
72 return env.getClassDoc((ClassSymbol)env.types.erasure(type).tsym); |
74 } |
73 } |
75 |
74 |
|
75 @Override |
76 public WildcardType asWildcardType() { |
76 public WildcardType asWildcardType() { |
77 return this; |
77 return this; |
78 } |
78 } |
79 |
79 |
|
80 @Override |
80 public String typeName() { return "?"; } |
81 public String typeName() { return "?"; } |
|
82 @Override |
81 public String qualifiedTypeName() { return "?"; } |
83 public String qualifiedTypeName() { return "?"; } |
|
84 @Override |
82 public String simpleTypeName() { return "?"; } |
85 public String simpleTypeName() { return "?"; } |
83 |
86 |
|
87 @Override |
84 public String toString() { |
88 public String toString() { |
85 return wildcardTypeToString(env, (Type.WildcardType)type, true); |
89 return wildcardTypeToString(env, (Type.WildcardType)type, true); |
86 } |
90 } |
87 |
91 |
88 |
92 |
94 static String wildcardTypeToString(DocEnv env, |
98 static String wildcardTypeToString(DocEnv env, |
95 Type.WildcardType wildThing, boolean full) { |
99 Type.WildcardType wildThing, boolean full) { |
96 if (env.legacyDoclet) { |
100 if (env.legacyDoclet) { |
97 return TypeMaker.getTypeName(env.types.erasure(wildThing), full); |
101 return TypeMaker.getTypeName(env.types.erasure(wildThing), full); |
98 } |
102 } |
99 StringBuffer s = new StringBuffer("?"); |
103 StringBuilder s = new StringBuilder("?"); |
100 List<Type> bounds = getExtendsBounds(wildThing); |
104 List<Type> bounds = getExtendsBounds(wildThing); |
101 if (bounds.nonEmpty()) { |
105 if (bounds.nonEmpty()) { |
102 s.append(" extends "); |
106 s.append(" extends "); |
103 } else { |
107 } else { |
104 bounds = getSuperBounds(wildThing); |
108 bounds = getSuperBounds(wildThing); |