Lines 10-16
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.internal.core; |
11 |
package org.eclipse.jdt.internal.core; |
12 |
|
12 |
|
13 |
import org.eclipse.jdt.core.*; |
13 |
import org.eclipse.jdt.core.IClassFile; |
|
|
14 |
import org.eclipse.jdt.core.IMember; |
15 |
import org.eclipse.jdt.core.ISourceRange; |
16 |
import org.eclipse.jdt.core.ITypeParameter; |
17 |
import org.eclipse.jdt.core.JavaModelException; |
18 |
import org.eclipse.jdt.core.Signature; |
19 |
import org.eclipse.jdt.core.SourceRange; |
14 |
import org.eclipse.jdt.core.compiler.CharOperation; |
20 |
import org.eclipse.jdt.core.compiler.CharOperation; |
15 |
|
21 |
|
16 |
public class TypeParameter extends SourceRefElement implements ITypeParameter { |
22 |
public class TypeParameter extends SourceRefElement implements ITypeParameter { |
Lines 18-29
Link Here
|
18 |
static final ITypeParameter[] NO_TYPE_PARAMETERS = new ITypeParameter[0]; |
24 |
static final ITypeParameter[] NO_TYPE_PARAMETERS = new ITypeParameter[0]; |
19 |
|
25 |
|
20 |
protected String name; |
26 |
protected String name; |
21 |
|
27 |
protected String signature; |
|
|
28 |
|
22 |
public TypeParameter(JavaElement parent, String name) { |
29 |
public TypeParameter(JavaElement parent, String name) { |
23 |
super(parent); |
30 |
super(parent); |
24 |
this.name = name; |
31 |
this.name = name; |
25 |
} |
32 |
} |
26 |
|
33 |
|
|
|
34 |
public TypeParameter(JavaElement parent, String name, String signature) { |
35 |
this(parent, name); |
36 |
this.signature = signature; |
37 |
} |
38 |
|
27 |
public boolean equals(Object o) { |
39 |
public boolean equals(Object o) { |
28 |
if (!(o instanceof TypeParameter)) return false; |
40 |
if (!(o instanceof TypeParameter)) return false; |
29 |
return super.equals(o); |
41 |
return super.equals(o); |
Lines 33-38
Link Here
|
33 |
TypeParameterElementInfo info = (TypeParameterElementInfo) getElementInfo(); |
45 |
TypeParameterElementInfo info = (TypeParameterElementInfo) getElementInfo(); |
34 |
return CharOperation.toStrings(info.bounds); |
46 |
return CharOperation.toStrings(info.bounds); |
35 |
} |
47 |
} |
|
|
48 |
|
49 |
public String[] getBoundsSignature() throws JavaModelException { |
50 |
|
51 |
String[] boundSignatures = null; |
52 |
boolean isResolved = (this.parent instanceof BinaryMember); |
53 |
|
54 |
TypeParameterElementInfo info = (TypeParameterElementInfo) this.getElementInfo(); |
55 |
char[][] bounds = info.bounds; |
56 |
|
57 |
if (bounds == null) { |
58 |
boundSignatures = CharOperation.NO_STRINGS; |
59 |
} else { |
60 |
int boundsLength = bounds.length; |
61 |
boundSignatures = new String[boundsLength]; |
62 |
for (int j = 0; j < boundsLength; j++) { |
63 |
boundSignatures[j] = new String(Signature.createCharArrayTypeSignature(bounds[j], isResolved)); |
64 |
} |
65 |
} |
66 |
return boundSignatures; |
67 |
} |
68 |
|
69 |
|
70 |
public String getSignature() throws JavaModelException { |
71 |
return new String(Signature.createTypeParameterSignature(this.getElementName(), getBoundsSignature())); |
72 |
} |
36 |
|
73 |
|
37 |
public IMember getDeclaringMember() { |
74 |
public IMember getDeclaringMember() { |
38 |
return (IMember) getParent(); |
75 |
return (IMember) getParent(); |