Java Code Examples for org.eclipse.jdt.internal.compiler.lookup.TypeBinding#leafComponentType()
The following examples show how to use
org.eclipse.jdt.internal.compiler.lookup.TypeBinding#leafComponentType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ASTNode.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private static TypeBinding mergeAnnotationsIntoType(BlockScope scope, AnnotationBinding[] se8Annotations, long se8nullBits, Annotation se8NullAnnotation, TypeReference typeRef, TypeBinding existingType) { if (existingType == null || !existingType.isValidBinding()) return existingType; TypeReference unionRef = typeRef.isUnionType() ? ((UnionTypeReference) typeRef).typeReferences[0] : null; // for arrays: @T X[] SE7 associates @T to the type, but in SE8 it affects the leaf component type long prevNullBits = existingType.leafComponentType().tagBits & TagBits.AnnotationNullMASK; if (se8nullBits != 0 && prevNullBits != se8nullBits && ((prevNullBits | se8nullBits) == TagBits.AnnotationNullMASK)) { scope.problemReporter().contradictoryNullAnnotations(se8NullAnnotation); } TypeBinding oldLeafType = (unionRef == null) ? existingType.leafComponentType() : unionRef.resolvedType; AnnotationBinding [][] goodies = new AnnotationBinding[typeRef.getAnnotatableLevels()][]; goodies[0] = se8Annotations; // @T X.Y.Z local; ==> @T should annotate X TypeBinding newLeafType = scope.environment().createAnnotatedType(oldLeafType, goodies); if (unionRef == null) { typeRef.resolvedType = existingType.isArrayType() ? scope.environment().createArrayType(newLeafType, existingType.dimensions(), existingType.getTypeAnnotations()) : newLeafType; } else { unionRef.resolvedType = newLeafType; unionRef.bits |= HasTypeAnnotations; } return typeRef.resolvedType; }
Example 2
Source File: ConstantPool.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public int literalIndex(TypeBinding binding) { TypeBinding typeBinding = binding.leafComponentType(); if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { Util.recordNestedType(this.classFile, typeBinding); } return literalIndex(binding.signature()); }
Example 3
Source File: ConstantPool.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public int literalIndexForType(final TypeBinding binding) { TypeBinding typeBinding = binding.leafComponentType(); if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) { Util.recordNestedType(this.classFile, typeBinding); } return this.literalIndexForType(binding.constantPoolName()); }
Example 4
Source File: AnnotationMethodDeclaration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void resolveStatements() { super.resolveStatements(); if (this.arguments != null) { this.scope.problemReporter().annotationMembersCannotHaveParameters(this); } if (this.typeParameters != null) { this.scope.problemReporter().annotationMembersCannotHaveTypeParameters(this); } if (this.extendedDimensions != 0) { this.scope.problemReporter().illegalExtendedDimensions(this); } if (this.binding == null) return; TypeBinding returnTypeBinding = this.binding.returnType; if (returnTypeBinding != null) { // annotation methods can only return base types, String, Class, enum type, annotation types and arrays of these checkAnnotationMethodType: { TypeBinding leafReturnType = returnTypeBinding.leafComponentType(); if (returnTypeBinding.dimensions() <= 1) { // only 1-dimensional array permitted switch (leafReturnType.erasure().id) { case T_byte : case T_short : case T_char : case T_int : case T_long : case T_float : case T_double : case T_boolean : case T_JavaLangString : case T_JavaLangClass : break checkAnnotationMethodType; } if (leafReturnType.isEnum() || leafReturnType.isAnnotationType()) break checkAnnotationMethodType; } this.scope.problemReporter().invalidAnnotationMemberType(this); } if (this.defaultValue != null) { MemberValuePair pair = new MemberValuePair(this.selector, this.sourceStart, this.sourceEnd, this.defaultValue); pair.binding = this.binding; pair.resolveTypeExpecting(this.scope, returnTypeBinding); this.binding.setDefaultValue(org.eclipse.jdt.internal.compiler.lookup.ElementValuePair.getValue(this.defaultValue)); } else { // let it know it does not have a default value so it won't try to find it this.binding.setDefaultValue(null); } } }