### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core
Index: model/org/eclipse/jdt/core/ITypeParameter.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java,v
retrieving revision 1.10
diff -u -r1.10 ITypeParameter.java
--- model/org/eclipse/jdt/core/ITypeParameter.java 27 Jun 2008 16:04:01 -0000 1.10
+++ model/org/eclipse/jdt/core/ITypeParameter.java 24 Feb 2010 06:03:00 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,6 +42,23 @@
String[] getBounds() throws JavaModelException;
/**
+ * Returns the signatures for this type parameter's bounds. The type parameter may have
+ * been declared as part of a type or a method. The signatures represent only the individual
+ * bounds and do not include the type variable name or the extends
keyword.
+ *
+ * The signatures may be either unresolved (for source types) or resolved (for binary types). + * See {@link Signature} for details. + *
+ * + * @return the signatures for the bounds of this formal type parameter + * @throws JavaModelException + * if this element does not exist or if an exception occurs while accessing its corresponding resource. + * @see Signature + * @since 3.6 + */ + String[] getBoundsSignatures() throws JavaModelException; + + /** * Returns the declaring member of this type parameter. This can be either anIType
* or an IMethod
.
*
Index: model/org/eclipse/jdt/internal/core/ClassFileInfo.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java,v
retrieving revision 1.47
diff -u -r1.47 ClassFileInfo.java
--- model/org/eclipse/jdt/internal/core/ClassFileInfo.java 11 Feb 2010 20:16:08 -0000 1.47
+++ model/org/eclipse/jdt/internal/core/ClassFileInfo.java 24 Feb 2010 06:03:00 -0000
@@ -296,16 +296,17 @@
for (int i = 0, typeParameterCount = typeParameterSignatures.length; i < typeParameterCount; i++) {
char[] typeParameterSignature = typeParameterSignatures[i];
char[] typeParameterName = Signature.getTypeVariable(typeParameterSignature);
+ CharOperation.replace(typeParameterSignature, '/', '.');
char[][] typeParameterBoundSignatures = Signature.getTypeParameterBounds(typeParameterSignature);
int boundLength = typeParameterBoundSignatures.length;
char[][] typeParameterBounds = new char[boundLength][];
for (int j = 0; j < boundLength; j++) {
typeParameterBounds[j] = Signature.toCharArray(typeParameterBoundSignatures[j]);
- CharOperation.replace(typeParameterBounds[j], '/', '.');
}
TypeParameter typeParameter = new TypeParameter(parent, new String(typeParameterName));
TypeParameterElementInfo info = new TypeParameterElementInfo();
info.bounds = typeParameterBounds;
+ info.boundsSignatures = typeParameterBoundSignatures;
typeParameterHandles.add(typeParameter);
// ensure that 2 binary methods with the same signature but with different return types have different occurence counts.
Index: model/org/eclipse/jdt/internal/core/TypeParameter.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameter.java,v
retrieving revision 1.15
diff -u -r1.15 TypeParameter.java
--- model/org/eclipse/jdt/internal/core/TypeParameter.java 27 Aug 2009 15:27:02 -0000 1.15
+++ model/org/eclipse/jdt/internal/core/TypeParameter.java 24 Feb 2010 06:03:00 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,7 +33,35 @@
TypeParameterElementInfo info = (TypeParameterElementInfo) getElementInfo();
return CharOperation.toStrings(info.bounds);
}
-
+
+ public String[] getBoundsSignatures() throws JavaModelException {
+
+ String[] boundSignatures = null;
+ TypeParameterElementInfo info = (TypeParameterElementInfo) this.getElementInfo();
+
+ // For a binary type or method, the signature is already available from the .class file.
+ // No need to construct again
+ if (this.parent instanceof BinaryMember) {
+ char[][] boundsSignatures = info.boundsSignatures;
+ if (boundsSignatures == null || boundsSignatures.length == 0) {
+ return CharOperation.NO_STRINGS;
+ }
+ return CharOperation.toStrings(info.boundsSignatures);
+ }
+
+ char[][] bounds = info.bounds;
+ if (bounds == null || bounds.length == 0) {
+ return CharOperation.NO_STRINGS;
+ }
+
+ int boundsLength = bounds.length;
+ boundSignatures = new String[boundsLength];
+ for (int i = 0; i < boundsLength; i++) {
+ boundSignatures[i] = new String(Signature.createCharArrayTypeSignature(bounds[i], false));
+ }
+ return boundSignatures;
+ }
+
public IMember getDeclaringMember() {
return (IMember) getParent();
}
Index: model/org/eclipse/jdt/internal/core/TypeParameterElementInfo.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameterElementInfo.java,v
retrieving revision 1.7
diff -u -r1.7 TypeParameterElementInfo.java
--- model/org/eclipse/jdt/internal/core/TypeParameterElementInfo.java 7 Mar 2009 01:08:07 -0000 1.7
+++ model/org/eclipse/jdt/internal/core/TypeParameterElementInfo.java 24 Feb 2010 06:03:00 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,4 +28,9 @@
* The bounds names of this type parameter.
*/
public char[][] bounds;
+
+ /*
+ * The bounds' signatures for this type parameter.
+ */
+ public char[][] boundsSignatures;
}
#P org.eclipse.jdt.core.tests.model
Index: src/org/eclipse/jdt/core/tests/model/ClassFileTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassFileTests.java,v
retrieving revision 1.48
diff -u -r1.48 ClassFileTests.java
--- src/org/eclipse/jdt/core/tests/model/ClassFileTests.java 10 Nov 2009 16:53:05 -0000 1.48
+++ src/org/eclipse/jdt/core/tests/model/ClassFileTests.java 24 Feb 2010 06:03:21 -0000
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -60,7 +60,7 @@
" X