View | Details | Raw Unified | Return to bug 246594 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/core/ITypeParameter.java (+29 lines)
Lines 42-47 Link Here
42
	String[] getBounds() throws JavaModelException;
42
	String[] getBounds() throws JavaModelException;
43
43
44
	/**
44
	/**
45
	 * Returns the signature for this type parameter. The signature may either 
46
	 * be unresolved (for source types) or resolved (for binary types). 
47
	 *  
48
	 * @return the signature for this formal type parameter
49
	 * @throws JavaModelException if this element doesn't exist or if an exception
50
	 * 			occurs while accessing its corresponding resource.
51
	 * @see Signature
52
	 * @since 3.6
53
	 */
54
	String getSignature() throws JavaModelException;
55
	
56
	/**
57
	 * Returns the signatures for the bounds of this type parameter. If this 
58
	 * type has no bounds, returns an empty <code>String</code>
59
	 * <p>
60
	 * The bounds signatures may be either unresolved (for source types) or 
61
	 * resolved (for binary types). See {@link Signature} for details.
62
	 * </p>
63
	 *
64
	 * @return the bounds signatures of this type parameter in the order 
65
	 * 			declared in the source or class file, an empty array if none
66
	 * @exception JavaModelException if this element does not exist or if an
67
	 *      exception occurs while accessing its corresponding resource.
68
	 * @see Signature
69
	 * @since 3.6
70
	 */	
71
	String[] getBoundsSignature() throws JavaModelException;
72
	
73
	/**
45
	 * Returns the declaring member of this type parameter. This can be either an <code>IType</code>
74
	 * Returns the declaring member of this type parameter. This can be either an <code>IType</code>
46
	 * or an <code>IMethod</code>.
75
	 * or an <code>IMethod</code>.
47
	 * <p>
76
	 * <p>
(-)model/org/eclipse/jdt/internal/core/TypeParameter.java (-3 / +40 lines)
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();

Return to bug 246594