FieldAnnotation maskedFieldAnnotation = FieldAnnotation.fromBCELField(superClasses[c].getClassName(), fld); bugReporter.reportBug( new BugInstance("MF_CLASS_MASKS_FIELD", priority) .addClass(this) .addField(maskedFieldAnnotation) .describe("FIELD_MASKED") .addField(fa) .describe("FIELD_MASKING") ); }
FieldAnnotation maskedFieldAnnotation = FieldAnnotation.fromBCELField(superClasses[c].getClassName(), fld); bugReporter.reportBug(new BugInstance("MF_CLASS_MASKS_FIELD", priority) .addClass(this) .addField(maskedFieldAnnotation) .describe("FIELD_MASKED") .addField(fa) .describe("FIELD_MASKING"));
	public void visit(JavaClass obj) {		if (obj.isInterface())			return;		classFields.clear();				Field[] fields = obj.getFields();		String fieldName;		for (int f = 0; f < fields.length; f++) {			fieldName = fields[f].getName();			classFields.put(fieldName, fields[f]);		}				// Walk up the super class chain, looking for name collisions		try		{				JavaClass[] superClasses = org.apache.bcel.Repository.getSuperClasses(obj);				for (int c = 0; c < superClasses.length; c++) {					fields = superClasses[c].getFields();					for (int f = 0; f < fields.length; f++) {						Field fld = fields[f];						if (!fld.isStatic() 							&& !maskedFields.contains(fld)							&& (fld.isPublic() || fld.isProtected())) {							fieldName = fld.getName();							if (fieldName.length() == 1)								continue;							if (fieldName.equals("serialVersionUID"))								continue;							if (classFields.containsKey( fieldName )) {								maskedFields.add(fld);								Field maskingField = classFields.get( fieldName);								FieldAnnotation fa = new FieldAnnotation( getDottedClassName(),													  maskingField.getName(), 													  maskingField.getSignature(), 													  maskingField.isStatic());								int priority = NORMAL_PRIORITY;								if (maskingField.isStatic()								    || maskingField.isFinal())								  priority++;								else if (fld.getSignature().charAt(0) == 'L'									&& !fld.getSignature().startsWith("Ljava/lang/")								    || fld.getSignature().charAt(0) == '[')								  priority--;								if (fld.getAccessFlags() 									!= maskingField.getAccessFlags()) 								  priority++;								if (!fld.getSignature().equals(									maskingField.getSignature()) )								  priority++;								FieldAnnotation maskedFieldAnnotation 								 = FieldAnnotation.fromBCELField(superClasses[c].getClassName(), fld);				                                bugReporter.reportBug(									new BugInstance("MF_CLASS_MASKS_FIELD", 										priority)				                                        	.addClass(this)										.addField(maskedFieldAnnotation)											.describe("FIELD_MASKED")				                                        	.addField(fa)											.describe("FIELD_MASKING")											);							}						}					}			}		}		catch (ClassNotFoundException e) { 			bugReporter. reportMissingClass(e);		}				super.visit(obj);	}