private void checkSignatures(String sourceSignature, String targetSignature) { try { if (Values.SIG_JAVA_LANG_OBJECT.equals(targetSignature)) { return; } Type sourceType = Type.getType(sourceSignature); Type targetType = Type.getType(targetSignature); if ((sourceType instanceof ArrayType) && (targetType instanceof ArrayType) && isObjectType(sourceType) && isObjectType(targetType)) { ObjectType sourceElementType = (ObjectType) ((ArrayType) sourceType).getBasicType(); ObjectType targetElementType = (ObjectType) ((ArrayType) targetType).getBasicType(); if (!targetElementType.isCastableTo(sourceElementType)) { bugReporter.reportBug(new BugInstance(this, BugType.CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addSourceLine(this)); } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } }
private void checkSignatures(String sourceSignature, String targetSignature) { try { if (Values.SIG_JAVA_LANG_OBJECT.equals(targetSignature)) { return; } Type sourceType = Type.getType(sourceSignature); Type targetType = Type.getType(targetSignature); if ((sourceType instanceof ArrayType) && (targetType instanceof ArrayType) && isObjectType(sourceType) && isObjectType(targetType)) { ObjectType sourceElementType = (ObjectType) ((ArrayType) sourceType).getBasicType(); ObjectType targetElementType = (ObjectType) ((ArrayType) targetType).getBasicType(); if (!targetElementType.isCastableTo(sourceElementType)) { bugReporter.reportBug(new BugInstance(this, BugType.CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addSourceLine(this)); } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } }