public boolean shouldCheckAPILeaks(ReferenceBinding declaringClass, boolean memberIsPublic) { if (environment().useModuleSystem) return memberIsPublic && declaringClass.isPublic() && declaringClass.fPackage.isExported(); return false; } public void detectAPILeaks(ASTNode typeNode, TypeBinding type) {
public boolean shouldCheckAPILeaks(ReferenceBinding declaringClass, boolean memberIsPublic) { if (environment().useModuleSystem) return memberIsPublic && declaringClass.isPublic() && declaringClass.fPackage.isExported(); return false; } public void detectAPILeaks(ASTNode typeNode, TypeBinding type) {
static void createArgumentBindings(Argument[] arguments, MethodBinding binding, MethodScope scope) { boolean useTypeAnnotations = scope.environment().usesNullTypeAnnotations(); if (arguments != null && binding != null) { for (int i = 0, length = arguments.length; i < length; i++) { Argument argument = arguments[i]; binding.parameters[i] = argument.createBinding(scope, binding.parameters[i]); if (useTypeAnnotations) continue; // no business with SE7 null annotations in the 1.8 case. // createBinding() has resolved annotations, now transfer nullness info from the argument to the method: long argTypeTagBits = (argument.binding.tagBits & TagBits.AnnotationNullMASK); if (argTypeTagBits != 0) { if (binding.parameterNonNullness == null) { binding.parameterNonNullness = new Boolean[arguments.length]; binding.tagBits |= TagBits.IsNullnessKnown; } binding.parameterNonNullness[i] = Boolean.valueOf(argTypeTagBits == TagBits.AnnotationNonNull); } } } }
static void createArgumentBindings(Argument[] arguments, MethodBinding binding, MethodScope scope) { boolean useTypeAnnotations = scope.environment().usesNullTypeAnnotations(); if (arguments != null && binding != null) { for (int i = 0, length = arguments.length; i < length; i++) { Argument argument = arguments[i]; binding.parameters[i] = argument.createBinding(scope, binding.parameters[i]); if (useTypeAnnotations) continue; // no business with SE7 null annotations in the 1.8 case. // createBinding() has resolved annotations, now transfer nullness info from the argument to the method: long argTypeTagBits = (argument.binding.tagBits & TagBits.AnnotationNullMASK); if (argTypeTagBits != 0) { if (binding.parameterNonNullness == null) { binding.parameterNonNullness = new Boolean[arguments.length]; binding.tagBits |= TagBits.IsNullnessKnown; } binding.parameterNonNullness[i] = Boolean.valueOf(argTypeTagBits == TagBits.AnnotationNonNull); } } } }
static void createArgumentBindings(Argument[] arguments, MethodBinding binding, MethodScope scope) { boolean useTypeAnnotations = scope.environment().usesNullTypeAnnotations(); if (arguments != null && binding != null) { for (int i = 0, length = arguments.length; i < length; i++) { Argument argument = arguments[i]; binding.parameters[i] = argument.createBinding(scope, binding.parameters[i]); if (useTypeAnnotations) continue; // no business with SE7 null annotations in the 1.8 case. // createBinding() has resolved annotations, now transfer nullness info from the argument to the method: long argTypeTagBits = (argument.binding.tagBits & TagBits.AnnotationNullMASK); if (argTypeTagBits != 0) { if (binding.parameterNonNullness == null) { binding.parameterNonNullness = new Boolean[arguments.length]; binding.tagBits |= TagBits.IsNullnessKnown; } binding.parameterNonNullness[i] = Boolean.valueOf(argTypeTagBits == TagBits.AnnotationNonNull); } } } }
static void createArgumentBindings(Argument[] arguments, MethodBinding binding, MethodScope scope) { boolean useTypeAnnotations = scope.environment().usesNullTypeAnnotations(); if (arguments != null && binding != null) { for (int i = 0, length = arguments.length; i < length; i++) { Argument argument = arguments[i]; binding.parameters[i] = argument.createBinding(scope, binding.parameters[i]); if (useTypeAnnotations) continue; // no business with SE7 null annotations in the 1.8 case. // createBinding() has resolved annotations, now transfer nullness info from the argument to the method: long argTypeTagBits = (argument.binding.tagBits & TagBits.AnnotationNullMASK); if (argTypeTagBits != 0) { if (binding.parameterNonNullness == null) { binding.parameterNonNullness = new Boolean[arguments.length]; binding.tagBits |= TagBits.IsNullnessKnown; } binding.parameterNonNullness[i] = Boolean.valueOf(argTypeTagBits == TagBits.AnnotationNonNull); } } } }
static void createArgumentBindings(Argument[] arguments, MethodBinding binding, MethodScope scope) { boolean useTypeAnnotations = scope.environment().usesNullTypeAnnotations(); if (arguments != null && binding != null) { for (int i = 0, length = arguments.length; i < length; i++) { Argument argument = arguments[i]; binding.parameters[i] = argument.createBinding(scope, binding.parameters[i]); if (useTypeAnnotations) continue; // no business with SE7 null annotations in the 1.8 case. // createBinding() has resolved annotations, now transfer nullness info from the argument to the method: long argTypeTagBits = (argument.binding.tagBits & TagBits.AnnotationNullMASK); if (argTypeTagBits != 0) { if (binding.parameterNonNullness == null) { binding.parameterNonNullness = new Boolean[arguments.length]; binding.tagBits |= TagBits.IsNullnessKnown; } binding.parameterNonNullness[i] = Boolean.valueOf(argTypeTagBits == TagBits.AnnotationNonNull); } } } }
public void detectAPILeaks(ASTNode typeNode, TypeBinding type) { if (environment().useModuleSystem) {
public void detectAPILeaks(ASTNode typeNode, TypeBinding type) { if (environment().useModuleSystem) {
/** * Perform substitution with a {@link LocalTypeSubstitutor} on all types mentioned in the given method binding. */ boolean updateLocalTypesInMethod(MethodBinding method) { if (this.localTypes == null) return false; updateLocalTypesInMethod(method, new LocalTypeSubstitutor(this.localTypes), new NullSubstitution(this.scope.environment())); return true; }
private void updateLocalTypes() { if (this.descriptor == null || this.localTypes == null) return; LocalTypeSubstitutor substor = new LocalTypeSubstitutor(this.localTypes); NullSubstitution subst = new NullSubstitution(this.scope.environment()); updateLocalTypesInMethod(this.binding, substor, subst); updateLocalTypesInMethod(this.descriptor, substor, subst); this.resolvedType = substor.substitute(subst, this.resolvedType); this.expectedType = substor.substitute(subst, this.expectedType); }
private void createArgumentBindings(MethodBinding method) { // ensure nullness defaults are initialized at all enclosing levels: switch (this.nullnessDefaultInitialized) { case 0: getAnnotationTagBits(); // initialize //$FALL-THROUGH$ case 1: getPackage().isViewedAsDeprecated(); // initialize annotations this.nullnessDefaultInitialized = 2; } AbstractMethodDeclaration methodDecl = method.sourceMethod(); if (methodDecl != null) { if (method.parameters != Binding.NO_PARAMETERS) methodDecl.createArgumentBindings(); if ((findNonNullDefault(methodDecl.scope, methodDecl.scope.environment()) == NONNULL_BY_DEFAULT)) { method.fillInDefaultNonNullness(); } } } private void evaluateNullAnnotations(long annotationTagBits) {
public void resolve(ClassScope upperScope) { if (this.binding == null) { this.ignoreFurtherInvestigation = true; } try { bindArguments(); resolveReceiver(); bindThrownExceptions(); resolveAnnotations(this.scope, this.annotations, this.binding, this.isConstructor()); long sourceLevel = this.scope.compilerOptions().sourceLevel; if (sourceLevel < ClassFileConstants.JDK1_8) // otherwise already checked via Argument.createBinding validateNullAnnotations(this.scope.environment().usesNullTypeAnnotations()); resolveStatements(); // check @Deprecated annotation presence if (this.binding != null && (this.binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0 && (this.binding.modifiers & ClassFileConstants.AccDeprecated) != 0 && sourceLevel >= ClassFileConstants.JDK1_5) { this.scope.problemReporter().missingDeprecatedAnnotationForMethod(this); } } catch (AbortMethod e) { // ========= abort on fatal error ============= this.ignoreFurtherInvestigation = true; } }
public void resolve(ClassScope upperScope) { if (this.binding == null) { this.ignoreFurtherInvestigation = true; } try { bindArguments(); resolveReceiver(); bindThrownExceptions(); resolveJavadoc(); resolveAnnotations(this.scope, this.annotations, this.binding, this.isConstructor()); long sourceLevel = this.scope.compilerOptions().sourceLevel; if (sourceLevel < ClassFileConstants.JDK1_8) // otherwise already checked via Argument.createBinding validateNullAnnotations(this.scope.environment().usesNullTypeAnnotations()); resolveStatements(); // check @Deprecated annotation presence if (this.binding != null && (this.binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0 && (this.binding.modifiers & ClassFileConstants.AccDeprecated) != 0 && sourceLevel >= ClassFileConstants.JDK1_5) { this.scope.problemReporter().missingDeprecatedAnnotationForMethod(this); } } catch (AbortMethod e) { // ========= abort on fatal error ============= this.ignoreFurtherInvestigation = true; } }
public void resolve(ClassScope upperScope) { if (this.binding == null) { this.ignoreFurtherInvestigation = true; } try { bindArguments(); resolveReceiver(); bindThrownExceptions(); resolveJavadoc(); resolveAnnotations(this.scope, this.annotations, this.binding, this.isConstructor()); long sourceLevel = this.scope.compilerOptions().sourceLevel; if (sourceLevel < ClassFileConstants.JDK1_8) // otherwise already checked via Argument.createBinding validateNullAnnotations(this.scope.environment().usesNullTypeAnnotations()); resolveStatements(); // check @Deprecated annotation presence if (this.binding != null && (this.binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0 && (this.binding.modifiers & ClassFileConstants.AccDeprecated) != 0 && sourceLevel >= ClassFileConstants.JDK1_5) { this.scope.problemReporter().missingDeprecatedAnnotationForMethod(this); } } catch (AbortMethod e) { // ========= abort on fatal error ============= this.ignoreFurtherInvestigation = true; } }
public void resolve(ClassScope upperScope) { if (this.binding == null) { this.ignoreFurtherInvestigation = true; } try { bindArguments(); resolveReceiver(); bindThrownExceptions(); resolveJavadoc(); resolveAnnotations(this.scope, this.annotations, this.binding, this.isConstructor()); long sourceLevel = this.scope.compilerOptions().sourceLevel; if (sourceLevel < ClassFileConstants.JDK1_8) // otherwise already checked via Argument.createBinding validateNullAnnotations(this.scope.environment().usesNullTypeAnnotations()); resolveStatements(); // check @Deprecated annotation presence if (this.binding != null && (this.binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0 && (this.binding.modifiers & ClassFileConstants.AccDeprecated) != 0 && sourceLevel >= ClassFileConstants.JDK1_5) { this.scope.problemReporter().missingDeprecatedAnnotationForMethod(this); } } catch (AbortMethod e) { // ========= abort on fatal error ============= this.ignoreFurtherInvestigation = true; } }
public void resolve(ClassScope upperScope) { if (this.binding == null) { this.ignoreFurtherInvestigation = true; } try { bindArguments(); resolveReceiver(); bindThrownExceptions(); resolveJavadoc(); resolveAnnotations(this.scope, this.annotations, this.binding, this.isConstructor()); long sourceLevel = this.scope.compilerOptions().sourceLevel; if (sourceLevel < ClassFileConstants.JDK1_8) // otherwise already checked via Argument.createBinding validateNullAnnotations(this.scope.environment().usesNullTypeAnnotations()); resolveStatements(); // check @Deprecated annotation presence if (this.binding != null && (this.binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0 && (this.binding.modifiers & ClassFileConstants.AccDeprecated) != 0 && sourceLevel >= ClassFileConstants.JDK1_5) { this.scope.problemReporter().missingDeprecatedAnnotationForMethod(this); } } catch (AbortMethod e) { // ========= abort on fatal error ============= this.ignoreFurtherInvestigation = true; } }
TypeBinding fieldType = fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/); field.type = fieldType;
TypeBinding fieldType = fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/); field.type = fieldType;
TypeBinding fieldType = fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/); field.type = fieldType;