private void check(XField xfield, ClassDescriptor annotation, boolean expectWarnings, int priority) { AnnotationValue expect = xfield.getAnnotation(annotation); if (expect == null) { return; } if (DEBUG) { System.out.println("*** Found " + annotation + " annotation on " + xfield); } FieldOrMethodDescriptor descriptor = xfield.getFieldDescriptor(); Collection<BugInstance> warnings = warningsByField.get(descriptor); check(expect, descriptor, warnings, expectWarnings, priority, descriptor.getClassDescriptor()); }
@Override public void visit(Field obj) { XField xField = getXField(); if(!xField.isStatic() && (xField.isPrivate() || xField.isFinal()) && xField.isReferenceType()) { allowedFields.add(xField.getFieldDescriptor()); } }
boolean samePackage = packageName.equals(extractPackage(xField.getFieldDescriptor().getSlashedClassName())); boolean initOnly = seen == Const.GETSTATIC || getClassName().equals(getClassConstantOperand()) && inStaticInitializer; boolean safeValue = seen == Const.GETSTATIC || emptyArrayOnTOS
private MethodCall getMethodCall(MethodDescriptor methodDescriptorOperand) { Item objItem = getStack().getStackItem(getNumberArguments(methodDescriptorOperand.getSignature())); if (isNew(objItem)) { return new MethodCall(methodDescriptorOperand, TARGET_NEW); } if (objItem.getRegisterNumber() == 0 && !getMethod().isStatic()) { return new MethodCall(methodDescriptorOperand, constructor ? TARGET_NEW : TARGET_THIS); } XField xField = objItem.getXField(); if (xField != null) { if (classInit && xField.isStatic() && xField.getClassDescriptor().getClassName().equals(getClassName())) { return new MethodCall(methodDescriptorOperand, TARGET_NEW); } if (!getMethodDescriptor().isStatic() && objItem.getFieldLoadedFromRegister() == 0 && allowedFields.contains(xField.getFieldDescriptor())) { fieldsModifyingMethods.add(getMethodDescriptor()); return new MethodCall(methodDescriptorOperand, xField.getFieldDescriptor()); } } return new MethodCall(methodDescriptorOperand, TARGET_OTHER); }
FieldAnnotation maskedFieldAnnotation = FieldAnnotation.fromFieldDescriptor(fld.getFieldDescriptor()); BugInstance bug = new BugInstance(this, "MF_CLASS_MASKS_FIELD", priority).addClass(this).addField(fa) .describe("FIELD_MASKING").addField(maskedFieldAnnotation).describe("FIELD_MASKED");
FieldStoreType property = database.getProperty(xfield.getFieldDescriptor()); if (property == null) { property = new FieldStoreType(); database.setProperty(xfield.getFieldDescriptor(), property);
FieldDescriptor fieldInfo = f.getFieldDescriptor(); String dottedClass = DeepSubtypeAnalysis.getComponentClass(fieldInfo.getSignature()); JavaClass fieldClass = Repository.lookupClass(dottedClass);
if (database != null) { FieldStoreType property = database.getProperty(xfield .getFieldDescriptor()); if (property != null) { loadType = property.getLoadType(loadType);
if (f != null && (SYSTEM_ERR.equals(f.getFieldDescriptor()) || SYSTEM_OUT.equals(f.getFieldDescriptor()))) { debuggingContext = true;
private void check(XField xfield, ClassDescriptor annotation, boolean expectWarnings, int priority) { AnnotationValue expect = xfield.getAnnotation(annotation); if (expect == null) { return; } if (DEBUG) { System.out.println("*** Found " + annotation + " annotation on " + xfield); } FieldOrMethodDescriptor descriptor = xfield.getFieldDescriptor(); Collection<BugInstance> warnings = warningsByField.get(descriptor); check(expect, descriptor, warnings, expectWarnings, priority, descriptor.getClassDescriptor()); }
@Override public void visit(Field obj) { XField xField = getXField(); if(!xField.isStatic() && (xField.isPrivate() || xField.isFinal()) && xField.isReferenceType()) { allowedFields.add(xField.getFieldDescriptor()); } }
boolean samePackage = packageName.equals(extractPackage(xField.getFieldDescriptor().getSlashedClassName())); boolean initOnly = seen == GETSTATIC || getClassName().equals(getClassConstantOperand()) && inStaticInitializer; boolean safeValue = seen == GETSTATIC || emptyArrayOnTOS
private MethodCall getMethodCall(MethodDescriptor methodDescriptorOperand) { Item objItem = getStack().getStackItem(getNumberArguments(methodDescriptorOperand.getSignature())); if (isNew(objItem)) { return new MethodCall(methodDescriptorOperand, TARGET_NEW); } if (objItem.getRegisterNumber() == 0 && !getMethod().isStatic()) { return new MethodCall(methodDescriptorOperand, constructor ? TARGET_NEW : TARGET_THIS); } XField xField = objItem.getXField(); if (xField != null) { if (classInit && xField.isStatic() && xField.getClassDescriptor().getClassName().equals(getClassName())) { return new MethodCall(methodDescriptorOperand, TARGET_NEW); } if (!getMethodDescriptor().isStatic() && objItem.getFieldLoadedFromRegister() == 0 && allowedFields.contains(xField.getFieldDescriptor())) { fieldsModifyingMethods.add(getMethodDescriptor()); return new MethodCall(methodDescriptorOperand, xField.getFieldDescriptor()); } } return new MethodCall(methodDescriptorOperand, TARGET_OTHER); }
FieldAnnotation maskedFieldAnnotation = FieldAnnotation.fromFieldDescriptor(fld.getFieldDescriptor()); BugInstance bug = new BugInstance(this, "MF_CLASS_MASKS_FIELD", priority).addClass(this).addField(fa) .describe("FIELD_MASKING").addField(maskedFieldAnnotation).describe("FIELD_MASKED");
FieldStoreType property = database.getProperty(xfield.getFieldDescriptor()); if (property == null) { property = new FieldStoreType(); database.setProperty(xfield.getFieldDescriptor(), property);
FieldDescriptor fieldInfo = f.getFieldDescriptor(); String dottedClass = DeepSubtypeAnalysis.getComponentClass(fieldInfo.getSignature()); JavaClass fieldClass = Repository.lookupClass(dottedClass);
if (((fld == null) || !fieldsWithAnnotations.contains(fld.getFieldDescriptor())) && (expectedItem.isNull())) { bugReporter.reportBug(new BugInstance(this, BugType.UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL.name(), NORMAL_PRIORITY) .addClass(this).addMethod(this).addSourceLine(this));
if (((fld == null) || !fieldsWithAnnotations.contains(fld.getFieldDescriptor())) && (expectedItem.isNull())) { bugReporter.reportBug(new BugInstance(this, BugType.UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL.name(), NORMAL_PRIORITY) .addClass(this).addMethod(this).addSourceLine(this));
if (database != null) { FieldStoreType property = database.getProperty(xfield .getFieldDescriptor()); if (property != null) { loadType = property.getLoadType(loadType);
if (f != null && (SYSTEM_ERR.equals(f.getFieldDescriptor()) || SYSTEM_OUT.equals(f.getFieldDescriptor()))) { debuggingContext = true;