List of usage examples for org.eclipse.jdt.core Signature createTypeParameterSignature
public static String createTypeParameterSignature(String typeParameterName, String[] boundSignatures)
From source file:com.codenvy.ide.ext.java.server.internal.core.NamedMember.java
License:Open Source License
protected String getKey(IMethod method, boolean forceOpen) throws JavaModelException { StringBuffer key = new StringBuffer(); // declaring class String declaringKey = getKey((IType) method.getParent(), forceOpen); key.append(declaringKey);/*from ww w. j a v a 2s . c o m*/ // selector key.append('.'); String selector = method.getElementName(); key.append(selector); // type parameters if (forceOpen) { ITypeParameter[] typeParameters = method.getTypeParameters(); int length = typeParameters.length; if (length > 0) { key.append('<'); for (int i = 0; i < length; i++) { ITypeParameter typeParameter = typeParameters[i]; String[] bounds = typeParameter.getBounds(); int boundsLength = bounds.length; char[][] boundSignatures = new char[boundsLength][]; for (int j = 0; j < boundsLength; j++) { boundSignatures[j] = Signature.createCharArrayTypeSignature(bounds[j].toCharArray(), method.isBinary()); CharOperation.replace(boundSignatures[j], '.', '/'); } char[] sig = Signature.createTypeParameterSignature( typeParameter.getElementName().toCharArray(), boundSignatures); key.append(sig); } key.append('>'); } } // parameters key.append('('); String[] parameters = method.getParameterTypes(); for (int i = 0, length = parameters.length; i < length; i++) key.append(parameters[i].replace('.', '/')); key.append(')'); // return type if (forceOpen) key.append(method.getReturnType().replace('.', '/')); else key.append('V'); return key.toString(); }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.SourceIndexerRequestor.java
License:Open Source License
private void enterClass(TypeInfo typeInfo) { // eliminate possible qualifications, given they need to be fully resolved again if (typeInfo.superclass != null) { typeInfo.superclass = getSimpleName(typeInfo.superclass); // add implicit constructor reference to default constructor this.indexer.addConstructorReference(typeInfo.superclass, 0); }//from w ww.j ava 2s . c o m if (typeInfo.superinterfaces != null) { for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++) { typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); } } char[][] typeNames; if (this.methodDepth > 0) { // set specific ['0'] value for local and anonymous to be able to filter them typeNames = ONE_ZERO_CHAR; } else { typeNames = enclosingTypeNames(); } char[][] typeParameterSignatures = null; if (typeInfo.typeParameters != null) { int typeParametersLength = typeInfo.typeParameters.length; typeParameterSignatures = new char[typeParametersLength][]; for (int i = 0; i < typeParametersLength; i++) { ISourceElementRequestor.TypeParameterInfo typeParameterInfo = typeInfo.typeParameters[i]; typeParameterSignatures[i] = Signature.createTypeParameterSignature(typeParameterInfo.name, typeParameterInfo.bounds == null ? CharOperation.NO_CHAR_CHAR : typeParameterInfo.bounds); } } this.indexer.addClassDeclaration(typeInfo.modifiers, this.packageName, typeInfo.name, typeNames, typeInfo.superclass, typeInfo.superinterfaces, typeParameterSignatures, typeInfo.secondary); addDefaultConstructorIfNecessary(typeInfo); pushTypeName(typeInfo.name); }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.SourceIndexerRequestor.java
License:Open Source License
private void enterInterface(TypeInfo typeInfo) { // eliminate possible qualifications, given they need to be fully resolved again if (typeInfo.superinterfaces != null) { for (int i = 0, length = typeInfo.superinterfaces.length; i < length; i++) { typeInfo.superinterfaces[i] = getSimpleName(typeInfo.superinterfaces[i]); }/*w ww . j a v a 2 s . c om*/ } char[][] typeNames; if (this.methodDepth > 0) { typeNames = ONE_ZERO_CHAR; } else { typeNames = enclosingTypeNames(); } char[][] typeParameterSignatures = null; if (typeInfo.typeParameters != null) { int typeParametersLength = typeInfo.typeParameters.length; typeParameterSignatures = new char[typeParametersLength][]; for (int i = 0; i < typeParametersLength; i++) { ISourceElementRequestor.TypeParameterInfo typeParameterInfo = typeInfo.typeParameters[i]; typeParameterSignatures[i] = Signature.createTypeParameterSignature(typeParameterInfo.name, typeParameterInfo.bounds); } } this.indexer.addInterfaceDeclaration(typeInfo.modifiers, this.packageName, typeInfo.name, typeNames, typeInfo.superinterfaces, typeParameterSignatures, typeInfo.secondary); addDefaultConstructorIfNecessary(typeInfo); pushTypeName(typeInfo.name); }
From source file:com.codenvy.ide.ext.java.server.internal.core.SourceMethod.java
License:Open Source License
/** * @see org.eclipse.jdt.core.IMethod#getTypeParameterSignatures() * @since 3.0/*from www .java 2 s . com*/ * @deprecated */ public String[] getTypeParameterSignatures() throws JavaModelException { ITypeParameter[] typeParameters = getTypeParameters(); int length = typeParameters.length; String[] typeParameterSignatures = new String[length]; for (int i = 0; i < length; i++) { TypeParameter typeParameter = (TypeParameter) typeParameters[i]; TypeParameterElementInfo info = (TypeParameterElementInfo) typeParameter.getElementInfo(); char[][] bounds = info.bounds; if (bounds == null) { typeParameterSignatures[i] = Signature.createTypeParameterSignature(typeParameter.getElementName(), CharOperation.NO_STRINGS); } else { int boundsLength = bounds.length; char[][] boundSignatures = new char[boundsLength][]; for (int j = 0; j < boundsLength; j++) { boundSignatures[j] = Signature.createCharArrayTypeSignature(bounds[j], false); } typeParameterSignatures[i] = new String(Signature.createTypeParameterSignature( typeParameter.getElementName().toCharArray(), boundSignatures)); } } return typeParameterSignatures; }