• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TypeParameter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.TypeParameter的典型用法代码示例。如果您正苦于以下问题:Java TypeParameter类的具体用法?Java TypeParameter怎么用?Java TypeParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypeParameter类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了TypeParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generateBuilderMethod

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public MethodDeclaration generateBuilderMethod(boolean isStatic, String builderMethodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long) pS << 32 | pE;
	
	MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) type.top().get()).compilationResult);
	out.selector = builderMethodName.toCharArray();
	out.modifiers = ClassFileConstants.AccPublic;
	if (isStatic) out.modifiers |= ClassFileConstants.AccStatic;
	out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	out.returnType = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.typeParameters = copyTypeParams(typeParams, source);
	AllocationExpression invoke = new AllocationExpression();
	invoke.type = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.statements = new Statement[] {new ReturnStatement(invoke, pS, pE)};
	
	out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) type.get()).scope);
	return out;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:19,代码来源:HandleBuilder.java


示例2: generateBuilderMethod

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public MethodDeclaration generateBuilderMethod(String builderMethodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long) pS << 32 | pE;
	
	MethodDeclaration out = new MethodDeclaration(
			((CompilationUnitDeclaration) type.top().get()).compilationResult);
	out.selector = builderMethodName.toCharArray();
	out.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
	out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	out.returnType = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.typeParameters = copyTypeParams(typeParams, source);
	AllocationExpression invoke = new AllocationExpression();
	invoke.type = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.statements = new Statement[] {new ReturnStatement(invoke, pS, pE)};
	
	out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) type.get()).scope);
	return out;
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:19,代码来源:HandleBuilder.java


示例3: createTypeParameter

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
protected TypeParameter createTypeParameter(char[] typeParameterName, char[][] typeParameterBounds, int start, int end) {

		TypeParameter parameter = new TypeParameter();
		parameter.name = typeParameterName;
		parameter.sourceStart = start;
		parameter.sourceEnd = end;
		if (typeParameterBounds != null) {
			int length = typeParameterBounds.length;
			if (length > 0) {
				parameter.type = createTypeReference(typeParameterBounds[0], start, end);
				if (length > 1) {
					parameter.bounds = new TypeReference[length-1];
					for (int i = 1; i < length; i++) {
						TypeReference bound = createTypeReference(typeParameterBounds[i], start, end);
						bound.bits |= ASTNode.IsSuperType;
						parameter.bounds[i-1] = bound;
					}
				}
			}
		}
		return parameter;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:TypeConverter.java


示例4: getTypeParameterBounds

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
protected char[][] getTypeParameterBounds(TypeParameter typeParameter) {
	TypeReference firstBound = typeParameter.type;
	TypeReference[] otherBounds = typeParameter.bounds;
	char[][] typeParameterBounds = null;
	if (firstBound != null) {
		if (otherBounds != null) {
			int otherBoundsLength = otherBounds.length;
			char[][] boundNames = new char[otherBoundsLength+1][];
			boundNames[0] = CharOperation.concatWith(firstBound.getParameterizedTypeName(), '.');
			for (int j = 0; j < otherBoundsLength; j++) {
				boundNames[j+1] =
					CharOperation.concatWith(otherBounds[j].getParameterizedTypeName(), '.');
			}
			typeParameterBounds = boundNames;
		} else {
			typeParameterBounds = new char[][] { CharOperation.concatWith(firstBound.getParameterizedTypeName(), '.')};
		}
	} else {
		typeParameterBounds = CharOperation.NO_CHAR_CHAR;
	}

	return typeParameterBounds;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:SourceElementNotifier.java


示例5: getTypeParameterInfos

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
private TypeParameterInfo[] getTypeParameterInfos(TypeParameter[] typeParameters) {
	if (typeParameters == null) return null;
	int typeParametersLength = typeParameters.length;
	TypeParameterInfo[] result = new TypeParameterInfo[typeParametersLength];
	for (int i = 0; i < typeParametersLength; i++) {
		TypeParameter typeParameter = typeParameters[i];
		char[][] typeParameterBounds = getTypeParameterBounds(typeParameter);
		ISourceElementRequestor.TypeParameterInfo typeParameterInfo = new ISourceElementRequestor.TypeParameterInfo();
		typeParameterInfo.declarationStart = typeParameter.declarationSourceStart;
		typeParameterInfo.declarationEnd = typeParameter.declarationSourceEnd;
		typeParameterInfo.name = typeParameter.name;
		typeParameterInfo.nameSourceStart = typeParameter.sourceStart;
		typeParameterInfo.nameSourceEnd = typeParameter.sourceEnd;
		typeParameterInfo.bounds = typeParameterBounds;
		result[i] = typeParameterInfo;
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:SourceElementNotifier.java


示例6: attach

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
void attach(TypeParameter[] parameters, int startPos) {
	if(this.methodDeclaration.modifiers != ClassFileConstants.AccDefault) return;

	int lastParameterEnd = parameters[parameters.length - 1].sourceEnd;

	Parser parser = parser();
	Scanner scanner = parser.scanner;
	if(Util.getLineNumber(this.methodDeclaration.declarationSourceStart, scanner.lineEnds, 0, scanner.linePtr)
			!= Util.getLineNumber(lastParameterEnd, scanner.lineEnds, 0, scanner.linePtr)) return;

	if(parser.modifiersSourceStart > lastParameterEnd
			&& parser.modifiersSourceStart < this.methodDeclaration.declarationSourceStart) return;

	if (this.methodDeclaration instanceof MethodDeclaration) {
		((MethodDeclaration)this.methodDeclaration).typeParameters = parameters;
		this.methodDeclaration.declarationSourceStart = startPos;
	} else if (this.methodDeclaration instanceof ConstructorDeclaration){
		((ConstructorDeclaration)this.methodDeclaration).typeParameters = parameters;
		this.methodDeclaration.declarationSourceStart = startPos;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:RecoveredMethod.java


示例7: consumeTypeParameter1WithExtendsAndBounds

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
protected void consumeTypeParameter1WithExtendsAndBounds() {
	//TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList1
	int additionalBoundsLength = this.genericsLengthStack[this.genericsLengthPtr--];
	TypeReference[] bounds = new TypeReference[additionalBoundsLength];
	this.genericsPtr -= additionalBoundsLength;
	System.arraycopy(this.genericsStack, this.genericsPtr + 1, bounds, 0, additionalBoundsLength);
	TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
	typeParameter.type = superType;
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
	superType.bits |= ASTNode.IsSuperType;
	typeParameter.bounds = bounds;
	for (int i = 0, max = bounds.length; i < max; i++) {
		TypeReference bound = bounds[i];
		bound.bits |= ASTNode.IsSuperType;
		typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:Parser.java


示例8: consumeTypeParameterHeader

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
protected void consumeTypeParameterHeader() {
	//TypeParameterHeader ::= TypeAnnotationsopt Identifier
	TypeParameter typeParameter = new TypeParameter();
	int length;
	if ((length = this.typeAnnotationLengthStack[this.typeAnnotationLengthPtr--]) != 0) {
		System.arraycopy(
				this.typeAnnotationStack,
				(this.typeAnnotationPtr -= length) + 1,
				typeParameter.annotations = new Annotation[length],
				0,
				length);
		typeParameter.bits |= ASTNode.HasTypeAnnotations;
	}
	long pos = this.identifierPositionStack[this.identifierPtr];
	final int end = (int) pos;
	typeParameter.declarationSourceEnd = end;
	typeParameter.sourceEnd = end;
	final int start = (int) (pos >>> 32);
	typeParameter.declarationSourceStart = start;
	typeParameter.sourceStart = start;
	typeParameter.name = this.identifierStack[this.identifierPtr--];
	this.identifierLengthPtr--;
	pushOnGenericsStack(typeParameter);

	this.listTypeParameterLength++;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:Parser.java


示例9: consumeTypeParameterWithExtendsAndBounds

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
protected void consumeTypeParameterWithExtendsAndBounds() {
	//TypeParameter ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList
	int additionalBoundsLength = this.genericsLengthStack[this.genericsLengthPtr--];
	TypeReference[] bounds = new TypeReference[additionalBoundsLength];
	this.genericsPtr -= additionalBoundsLength;
	System.arraycopy(this.genericsStack, this.genericsPtr + 1, bounds, 0, additionalBoundsLength);
	TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
	TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
	typeParameter.type = superType;
	typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations);
	superType.bits |= ASTNode.IsSuperType;
	typeParameter.bounds = bounds;
	typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
	for (int i = 0, max = bounds.length; i < max; i++) {
		TypeReference bound = bounds[i];
		bound.bits |= ASTNode.IsSuperType;
		typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:Parser.java


示例10: buildTypeVariables

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
private void buildTypeVariables() {

	    SourceTypeBinding sourceType = this.referenceContext.binding;
		TypeParameter[] typeParameters = this.referenceContext.typeParameters;
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=324850, If they exist at all, process type parameters irrespective of source level.
		if (typeParameters == null || typeParameters.length == 0) {
		    sourceType.setTypeVariables(Binding.NO_TYPE_VARIABLES);
		    return;
		}
		sourceType.setTypeVariables(Binding.NO_TYPE_VARIABLES); // safety

		if (sourceType.id == TypeIds.T_JavaLangObject) { // handle the case of redefining java.lang.Object up front
			problemReporter().objectCannotBeGeneric(this.referenceContext);
			return;
		}
		sourceType.setTypeVariables(createTypeVariables(typeParameters, sourceType));
		sourceType.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ClassScope.java


示例11: visit

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public boolean visit(TypeParameter typeParameter, BlockScope scope) {
	this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier);
	if (typeParameter.type != null) {
		this.scribe.space();
		this.scribe.printNextToken(TerminalTokens.TokenNameextends, true);
		this.scribe.space();
		typeParameter.type.traverse(this, scope);
	}
	final TypeReference[] bounds = typeParameter.bounds;
	if (bounds != null) {
		this.scribe.printNextToken(TerminalTokens.TokenNameAND, this.preferences.insert_space_before_and_in_type_parameter);
		if (this.preferences.insert_space_after_and_in_type_parameter) {
			this.scribe.space();
		}
		int boundsLength = bounds.length;
		for (int i = 0; i < boundsLength - 1; i++) {
			bounds[i].traverse(this, scope);
			this.scribe.printNextToken(TerminalTokens.TokenNameAND, this.preferences.insert_space_before_and_in_type_parameter);
			if (this.preferences.insert_space_after_and_in_type_parameter) {
				this.scribe.space();
			}
		}
		bounds[boundsLength - 1].traverse(this, scope);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:27,代码来源:CodeFormatterVisitor.java


示例12: buildTypeVariables

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
private void buildTypeVariables() {

	    SourceTypeBinding sourceType = this.referenceContext.binding;
		TypeParameter[] typeParameters = this.referenceContext.typeParameters;
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=324850, If they exist at all, process type parameters irrespective of source level.
		if (typeParameters == null || typeParameters.length == 0) {
		    sourceType.typeVariables = Binding.NO_TYPE_VARIABLES;
		    return;
		}
		sourceType.typeVariables = Binding.NO_TYPE_VARIABLES; // safety

		if (sourceType.id == TypeIds.T_JavaLangObject) { // handle the case of redefining java.lang.Object up front
			problemReporter().objectCannotBeGeneric(this.referenceContext);
			return;
		}
		sourceType.typeVariables = createTypeVariables(typeParameters, sourceType);
		sourceType.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:19,代码来源:ClassScope.java


示例13: copyTypeParams

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
/**
 * You can't share TypeParameter objects or bad things happen; for example, one 'T' resolves differently
 * from another 'T', even for the same T in a single class file. Unfortunately the TypeParameter type hierarchy
 * is complicated and there's no clone method on TypeParameter itself. This method can clone them.
 */
public static TypeParameter[] copyTypeParams(TypeParameter[] params, ASTNode source) {
	if (params == null) return null;
	TypeParameter[] out = new TypeParameter[params.length];
	int idx = 0;
	for (TypeParameter param : params) {
		TypeParameter o = new TypeParameter();
		setGeneratedBy(o, source);
		o.annotations = param.annotations;
		o.bits = param.bits;
		o.modifiers = param.modifiers;
		o.name = param.name;
		o.type = copyType(param.type, source);
		o.sourceStart = param.sourceStart;
		o.sourceEnd = param.sourceEnd;
		o.declarationEnd = param.declarationEnd;
		o.declarationSourceStart = param.declarationSourceStart;
		o.declarationSourceEnd = param.declarationSourceEnd;
		if (param.bounds != null) {
			TypeReference[] b = new TypeReference[param.bounds.length];
			int idx2 = 0;
			for (TypeReference ref : param.bounds) b[idx2++] = copyType(ref, source);
			o.bounds = b;
		}
		out[idx++] = o;
	}
	return out;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:33,代码来源:EclipseHandlerUtil.java


示例14: namePlusTypeParamsToTypeReference

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public static TypeReference namePlusTypeParamsToTypeReference(char[] typeName, TypeParameter[] params, long p) {
	if (params != null && params.length > 0) {
		TypeReference[] refs = new TypeReference[params.length];
		int idx = 0;
		for (TypeParameter param : params) {
			TypeReference typeRef = new SingleTypeReference(param.name, p);
			refs[idx++] = typeRef;
		}
		return new ParameterizedSingleTypeReference(typeName, refs, 0, p);
	}
	
	return new SingleTypeReference(typeName, p);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:EclipseHandlerUtil.java


示例15: makeBuilderClass

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public EclipseNode makeBuilderClass(boolean isStatic, EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) {
	TypeDeclaration parent = (TypeDeclaration) tdParent.get();
	TypeDeclaration builder = new TypeDeclaration(parent.compilationResult);
	builder.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	builder.modifiers |= ClassFileConstants.AccPublic;
	if (isStatic) builder.modifiers |= ClassFileConstants.AccStatic;
	builder.typeParameters = copyTypeParams(typeParams, source);
	builder.name = builderClassName.toCharArray();
	builder.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return injectType(tdParent, builder);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:12,代码来源:HandleBuilder.java


示例16: makeBuilderClass

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public EclipseNode makeBuilderClass(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) {
	TypeDeclaration parent = (TypeDeclaration) tdParent.get();
	TypeDeclaration builder = new TypeDeclaration(parent.compilationResult);
	builder.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	builder.modifiers |= ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
	builder.typeParameters = copyTypeParams(typeParams, source);
	builder.name = builderClassName.toCharArray();
	builder.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return injectType(tdParent, builder);
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:11,代码来源:HandleBuilder.java


示例17: visit

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
@Override
public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) {
	Annotation[] annotations = constructorDeclaration.annotations;
	if (annotations != null) {
		MethodBinding constructorBinding = constructorDeclaration.binding;
		if (constructorBinding == null) {
			return false;
		}
		((SourceTypeBinding) constructorBinding.declaringClass).resolveTypesFor(constructorBinding);
		this.resolveAnnotations(
				constructorDeclaration.scope,
				annotations,
				constructorBinding);
	}
	
	TypeParameter[] typeParameters = constructorDeclaration.typeParameters;
	if (typeParameters != null) {
		int typeParametersLength = typeParameters.length;
		for (int i = 0; i < typeParametersLength; i++) {
			typeParameters[i].traverse(this, constructorDeclaration.scope);
		}
	}
	
	Argument[] arguments = constructorDeclaration.arguments;
	if (arguments != null) {
		int argumentLength = arguments.length;
		for (int i = 0; i < argumentLength; i++) {
			arguments[i].traverse(this, constructorDeclaration.scope);
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:AnnotationDiscoveryVisitor.java


示例18: CompletionOnMethodTypeParameter

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public CompletionOnMethodTypeParameter(TypeParameter[] typeParameters, CompilationResult compilationResult){
	super(compilationResult);
	this.selector = CharOperation.NO_CHAR;
	this.typeParameters = typeParameters;
	this.sourceStart = typeParameters[0].sourceStart;
	this.sourceEnd = typeParameters[typeParameters.length - 1].sourceEnd;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:CompletionOnMethodTypeParameter.java


示例19: getTypeParameterBounds

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
protected char[][] getTypeParameterBounds(TypeParameter typeParameter) {
	TypeReference firstBound = typeParameter.type;
	TypeReference[] otherBounds = typeParameter.bounds;
	char[][] typeParameterBounds = null;
	if (firstBound != null) {
		if (otherBounds != null) {
			int otherBoundsLength = otherBounds.length;
			char[][] boundNames = new char[otherBoundsLength+1][];
			int boundCount = 0;
			if (!CompletionUnitStructureRequestor.hasEmptyName(firstBound, this.assistNode)) {
				boundNames[boundCount++] = CharOperation.concatWith(firstBound.getParameterizedTypeName(), '.');
			}
			for (int j = 0; j < otherBoundsLength; j++) {
				TypeReference otherBound = otherBounds[j];
				if (!CompletionUnitStructureRequestor.hasEmptyName(otherBound, this.assistNode)) {
					boundNames[boundCount++] =
						CharOperation.concatWith(otherBound.getParameterizedTypeName(), '.');
				}
			}

			if (boundCount == 0) {
				boundNames = CharOperation.NO_CHAR_CHAR;
			} else if (boundCount < otherBoundsLength + 1){
				System.arraycopy(boundNames, 0, boundNames = new char[boundCount][], 0, boundCount);
			}
			typeParameterBounds = boundNames;
		} else {
			if (!CompletionUnitStructureRequestor.hasEmptyName(firstBound, this.assistNode)) {
				typeParameterBounds = new char[][] { CharOperation.concatWith(firstBound.getParameterizedTypeName(), '.')};
			} else {
				typeParameterBounds = CharOperation.NO_CHAR_CHAR;
			}
		}
	} else {
		typeParameterBounds = CharOperation.NO_CHAR_CHAR;
	}

	return typeParameterBounds;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:40,代码来源:CompletionElementNotifier.java


示例20: visit

import org.eclipse.jdt.internal.compiler.ast.TypeParameter; //导入依赖的package包/类
public boolean visit(TypeParameter typeParameter, BlockScope scope) {
	if (typeParameter.annotations != null) {
		formatInlineAnnotations(typeParameter.annotations, false);
	}
	this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier);
	if (typeParameter.type != null) {
		this.scribe.space();
		this.scribe.printNextToken(TerminalTokens.TokenNameextends, true);
		this.scribe.space();
		typeParameter.type.traverse(this, scope);
	}
	final TypeReference[] bounds = typeParameter.bounds;
	if (bounds != null) {
		this.scribe.printNextToken(TerminalTokens.TokenNameAND, this.preferences.insert_space_before_and_in_type_parameter);
		if (this.preferences.insert_space_after_and_in_type_parameter) {
			this.scribe.space();
		}
		int boundsLength = bounds.length;
		for (int i = 0; i < boundsLength - 1; i++) {
			bounds[i].traverse(this, scope);
			this.scribe.printNextToken(TerminalTokens.TokenNameAND, this.preferences.insert_space_before_and_in_type_parameter);
			if (this.preferences.insert_space_after_and_in_type_parameter) {
				this.scribe.space();
			}
		}
		bounds[boundsLength - 1].traverse(this, scope);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:CodeFormatterVisitor.java



注:本文中的org.eclipse.jdt.internal.compiler.ast.TypeParameter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EventManager类代码示例发布时间:2022-05-23
下一篇:
Java IDataTypeFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap