private void checkAndSetModifiersForVariable(LocalVariableBinding varBinding) { int modifiers = varBinding.modifiers; if ((modifiers & ExtraCompilerModifiers.AccAlternateModifierProblem) != 0 && varBinding.declaration != null){ problemReporter().duplicateModifierForVariable(varBinding.declaration, this instanceof MethodScope); } int realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag; int unexpectedModifiers = ~ClassFileConstants.AccFinal; if ((realModifiers & unexpectedModifiers) != 0 && varBinding.declaration != null){ problemReporter().illegalModifierForVariable(varBinding.declaration, this instanceof MethodScope); } varBinding.modifiers = modifiers; }
public void checkAndSetModifiers() { int realModifiers = this.modifiers & ExtraCompilerModifiers.AccJustFlag; int expectedModifiers = ClassFileConstants.ACC_OPEN | ClassFileConstants.ACC_SYNTHETIC; if ((realModifiers & ~(expectedModifiers)) != 0) { this.scope.problemReporter().illegalModifierForModule(this); realModifiers &= expectedModifiers; } int effectiveModifiers = ClassFileConstants.AccModule | realModifiers; this.modifiers = this.binding.modifiers = effectiveModifiers; }
public TypeBinding reportError(BlockScope scope) { //=====error cases======= this.constant = Constant.NotAConstant; if (this.binding instanceof ProblemFieldBinding) { scope.problemReporter().invalidField(this, (FieldBinding) this.binding); } else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) { scope.problemReporter().invalidType(this, (TypeBinding) this.binding); } else { scope.problemReporter().unresolvableReference(this, this.binding); } return null; }
private void reportResourceLeak(FakedTrackingVariable trackingVar, ASTNode location, int nullStatus) { if (location != null) trackingVar.recordErrorLocation(location, nullStatus); else trackingVar.reportError(problemReporter(), null, nullStatus); }
@Override public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, int ttlForFieldCheck) { if ((this.resolvedType.tagBits & TagBits.AnnotationNullable) != 0) { scope.problemReporter().arrayReferencePotentialNullReference(this); return true; } else { return super.checkNPE(scope, flowContext, flowInfo, ttlForFieldCheck); } }
public void resolveUsing(BlockScope givenScope) { if ((this.bits & UndocumentedEmptyBlock) != 0) { givenScope.problemReporter().undocumentedEmptyBlock(this.sourceStart, this.sourceEnd); } // this optimized resolve(...) is sent only on none empty blocks this.scope = givenScope; if (this.statements != null) { for (int i = 0, length = this.statements.length; i < length; i++) { this.statements[i].resolve(this.scope); } } }
public void resolveUsing(BlockScope givenScope) { if ((this.bits & UndocumentedEmptyBlock) != 0) { givenScope.problemReporter().undocumentedEmptyBlock(this.sourceStart, this.sourceEnd); } // this optimized resolve(...) is sent only on none empty blocks this.scope = givenScope; if (this.statements != null) { for (int i = 0, length = this.statements.length; i < length; i++) { this.statements[i].resolve(this.scope); } } }
public void resolveUsing(BlockScope givenScope) { if ((this.bits & UndocumentedEmptyBlock) != 0) { givenScope.problemReporter().undocumentedEmptyBlock(this.sourceStart, this.sourceEnd); } // this optimized resolve(...) is sent only on none empty blocks this.scope = givenScope; if (this.statements != null) { for (int i = 0, length = this.statements.length; i < length; i++) { this.statements[i].resolve(this.scope); } } }
public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) { if ((this.resolvedType.tagBits & TagBits.AnnotationNullable) != 0) { scope.problemReporter().arrayReferencePotentialNullReference(this); return true; } else { return super.checkNPE(scope, flowContext, flowInfo); } }
public void resolveUsing(BlockScope givenScope) { if ((this.bits & UndocumentedEmptyBlock) != 0) { givenScope.problemReporter().undocumentedEmptyBlock(this.sourceStart, this.sourceEnd); } // this optimized resolve(...) is sent only on none empty blocks this.scope = givenScope; if (this.statements != null) { for (int i = 0, length = this.statements.length; i < length; i++) { this.statements[i].resolve(this.scope); } } }
void checkAssignment(BlockScope scope, TypeBinding lhsType, TypeBinding rhsType) { FieldBinding leftField = getLastField(this.lhs); if (leftField != null && rhsType != TypeBinding.NULL && (lhsType.kind() == Binding.WILDCARD_TYPE) && ((WildcardBinding)lhsType).boundKind != Wildcard.SUPER) { scope.problemReporter().wildcardAssignment(lhsType, rhsType, this.expression); } else if (leftField != null && !leftField.isStatic() && leftField.declaringClass != null /*length pseudo field*/&& leftField.declaringClass.isRawType()) { scope.problemReporter().unsafeRawFieldAssignment(leftField, rhsType, this.lhs); } else if (rhsType.needsUncheckedConversion(lhsType)) { scope.problemReporter().unsafeTypeConversion(this.expression, rhsType, lhsType); } }
void checkAssignment(BlockScope scope, TypeBinding lhsType, TypeBinding rhsType) { FieldBinding leftField = getLastField(this.lhs); if (leftField != null && rhsType != TypeBinding.NULL && (lhsType.kind() == Binding.WILDCARD_TYPE) && ((WildcardBinding)lhsType).boundKind != Wildcard.SUPER) { scope.problemReporter().wildcardAssignment(lhsType, rhsType, this.expression); } else if (leftField != null && !leftField.isStatic() && leftField.declaringClass != null /*length pseudo field*/&& leftField.declaringClass.isRawType()) { scope.problemReporter().unsafeRawFieldAssignment(leftField, rhsType, this.lhs); } else if (rhsType.needsUncheckedConversion(lhsType)) { scope.problemReporter().unsafeTypeConversion(this.expression, rhsType, lhsType); } }
static void checkAnnotationTarget(Annotation annotation, BlockScope scope, ReferenceBinding annotationType, int kind, Binding recipient, long tagBitsToRevert) { // check (meta)target compatibility if (!annotationType.isValidBinding()) { // no need to check annotation usage if missing return; } if (! isAnnotationTargetAllowed(annotation, scope, annotationType, kind)) { scope.problemReporter().disallowedTargetForAnnotation(annotation); if (recipient instanceof TypeBinding) ((TypeBinding)recipient).tagBits &= ~tagBitsToRevert; } }
public TypeBinding resolveType(BlockScope scope) { // compute the real value, which must range its type's range this.resolvedType = literalType(scope); // in case of error, constant did remain null computeConstant(); if (this.constant == null) { scope.problemReporter().constantOutOfRange(this, this.resolvedType); this.constant = Constant.NotAConstant; } return this.resolvedType; }
public TypeBinding resolveType(BlockScope scope) { this.constant = Constant.NotAConstant; ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType(); if (!checkAccess(scope, enclosingReceiverType)) return null; if (enclosingReceiverType.id == T_JavaLangObject) { scope.problemReporter().cannotUseSuperInJavaLangObject(this); return null; } return this.resolvedType = enclosingReceiverType.superclass(); }
public static void checkContainingAnnotationTargetAtUse(Annotation repeatingAnnotation, BlockScope scope, TypeBinding containerAnnotationType, TypeBinding repeatingAnnotationType) { // check (meta)target compatibility if (!repeatingAnnotationType.isValidBinding()) { // no need to check annotation usage if missing return; } if (! isAnnotationTargetAllowed(repeatingAnnotation, scope, containerAnnotationType, repeatingAnnotation.recipient.kind())) { scope.problemReporter().disallowedTargetForContainerAnnotation(repeatingAnnotation, containerAnnotationType); } }
void checkLabelValidity(BlockScope scope) { // check if label was already defined above FlowContext current = this.getLocalParent(); while (current != null) { char[] currentLabelName; if (((currentLabelName = current.labelName()) != null) && CharOperation.equals(currentLabelName, this.labelName)) { scope.problemReporter().alreadyDefinedLabel(this.labelName, this.associatedNode); } current = current.getLocalParent(); } }
void checkLabelValidity(BlockScope scope) { // check if label was already defined above FlowContext current = this.getLocalParent(); while (current != null) { char[] currentLabelName; if (((currentLabelName = current.labelName()) != null) && CharOperation.equals(currentLabelName, this.labelName)) { scope.problemReporter().alreadyDefinedLabel(this.labelName, this.associatedNode); } current = current.getLocalParent(); } }
public TypeBinding resolveType(BlockScope scope) { this.constant = Constant.NotAConstant; if (!checkAccess(scope.methodScope())) return null; ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType(); if (enclosingReceiverType.id == T_JavaLangObject) { scope.problemReporter().cannotUseSuperInJavaLangObject(this); return null; } return this.resolvedType = enclosingReceiverType.superclass(); }
void checkLabelValidity(BlockScope scope) { // check if label was already defined above FlowContext current = this.getLocalParent(); while (current != null) { char[] currentLabelName; if (((currentLabelName = current.labelName()) != null) && CharOperation.equals(currentLabelName, this.labelName)) { scope.problemReporter().alreadyDefinedLabel(this.labelName, this.associatedNode); } current = current.getLocalParent(); } }