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; }
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; }
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; }
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; }
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; }
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; } }
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); } }
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++; }
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); } }
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; }
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; }
public boolean visit(TypeParameter typeParameter, ClassScope 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; }
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; }
/** * 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; }
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); }
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); }
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); }
@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; }
@Override public boolean visit(TypeParameter typeParameter, ClassScope scope) { Annotation[] annotations = typeParameter.annotations; if (annotations != null) { TypeVariableBinding binding = typeParameter.binding; if (binding == null) { return false; } this.resolveAnnotations(scope.referenceContext.initializerScope, annotations, binding); } return false; }
@Override public boolean visit(TypeParameter typeParameter, BlockScope scope) { Annotation[] annotations = typeParameter.annotations; if (annotations != null) { TypeVariableBinding binding = typeParameter.binding; if (binding == null) { return false; } // when we get here, it is guaranteed that class type parameters are connected, but method type parameters may not be. MethodBinding methodBinding = (MethodBinding) binding.declaringElement; ((SourceTypeBinding) methodBinding.declaringClass).resolveTypesFor(methodBinding); this.resolveAnnotations(scope, annotations, binding); } return false; }
@Override public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { Annotation[] annotations = methodDeclaration.annotations; if (annotations != null) { MethodBinding methodBinding = methodDeclaration.binding; if (methodBinding == null) { return false; } ((SourceTypeBinding) methodBinding.declaringClass).resolveTypesFor(methodBinding); this.resolveAnnotations( methodDeclaration.scope, annotations, methodBinding); } TypeParameter[] typeParameters = methodDeclaration.typeParameters; if (typeParameters != null) { int typeParametersLength = typeParameters.length; for (int i = 0; i < typeParametersLength; i++) { typeParameters[i].traverse(this, methodDeclaration.scope); } } Argument[] arguments = methodDeclaration.arguments; if (arguments != null) { int argumentLength = arguments.length; for (int i = 0; i < argumentLength; i++) { arguments[i].traverse(this, methodDeclaration.scope); } } return false; }
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; }
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; }
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; }
public boolean visit(TypeParameter typeParameter, ClassScope 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; }
public int match(TypeParameter node, MatchingNodeSet nodeSet) { int level = IMPOSSIBLE_MATCH; for (int i = 0, length = this.patternLocators.length; i < length; i++) { int newLevel = this.patternLocators[i].match(node, nodeSet); if (newLevel > level) { if (newLevel == ACCURATE_MATCH) return ACCURATE_MATCH; level = newLevel; } } return level; }
protected void consumeTypeHeaderNameWithTypeParameters() { // ClassHeaderName ::= ClassHeaderName1 TypeParameters // InterfaceHeaderName ::= InterfaceHeaderName1 TypeParameters TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr]; // consume type parameters int length = this.genericsLengthStack[this.genericsLengthPtr--]; this.genericsPtr -= length; System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeDecl.typeParameters = new TypeParameter[length], 0, length); typeDecl.bodyStart = typeDecl.typeParameters[length-1].declarationSourceEnd + 1; this.listTypeParameterLength = 0; if (this.currentElement != null) { // is recovering if (this.currentElement instanceof RecoveredType) { RecoveredType recoveredType = (RecoveredType) this.currentElement; recoveredType.pendingTypeParameters = null; this.lastCheckPoint = typeDecl.bodyStart; } else { this.lastCheckPoint = typeDecl.bodyStart; this.currentElement = this.currentElement.add(typeDecl, 0); this.lastIgnoredToken = -1; } } }
protected void consumeTypeParameter1WithExtends() { //TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType1 TypeReference superType = (TypeReference) this.genericsStack[this.genericsPtr--]; this.genericsLengthPtr--; TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr]; typeParameter.declarationSourceEnd = superType.sourceEnd; typeParameter.type = superType; superType.bits |= ASTNode.IsSuperType; typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations); this.genericsStack[this.genericsPtr] = typeParameter; }
protected void consumeTypeParameterWithExtends() { //TypeParameter ::= TypeParameterHeader 'extends' ReferenceType TypeReference superType = getTypeReference(this.intStack[this.intPtr--]); TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr]; typeParameter.declarationSourceEnd = superType.sourceEnd; typeParameter.type = superType; typeParameter.bits |= (superType.bits & ASTNode.HasTypeAnnotations); superType.bits |= ASTNode.IsSuperType; }
public void duplicateTypeParameterInType(TypeParameter typeParameter) { this.handle( IProblem.DuplicateTypeVariable, new String[] { new String(typeParameter.name)}, new String[] { new String(typeParameter.name)}, typeParameter.sourceStart, typeParameter.sourceEnd); }
public void invalidUsageOfTypeParameters(TypeParameter firstTypeParameter, TypeParameter lastTypeParameter) { this.handle( IProblem.InvalidUsageOfTypeParameters, NoArgument, NoArgument, firstTypeParameter.declarationSourceStart, lastTypeParameter.declarationSourceEnd); }
public void invalidUsageOfTypeParametersForAnnotationDeclaration(TypeDeclaration annotationTypeDeclaration) { TypeParameter[] parameters = annotationTypeDeclaration.typeParameters; int length = parameters.length; this.handle( IProblem.InvalidUsageOfTypeParametersForAnnotationDeclaration, NoArgument, NoArgument, parameters[0].declarationSourceStart, parameters[length - 1].declarationSourceEnd); }
public void invalidUsageOfTypeParametersForEnumDeclaration(TypeDeclaration annotationTypeDeclaration) { TypeParameter[] parameters = annotationTypeDeclaration.typeParameters; int length = parameters.length; this.handle( IProblem.InvalidUsageOfTypeParametersForEnumDeclaration, NoArgument, NoArgument, parameters[0].declarationSourceStart, parameters[length - 1].declarationSourceEnd); }