总是提示“Iterator is a raw type. References to generic type Iterator should be parameterized”
解决方法: 添加: @SuppressWarnings("unchecked")
如:
private void addAttributes(ObjectType object, Builder builder, int Id) throws Exception {
Iterator itAttributes = object.getAttributes();
while (itAttributes.hasNext()) {
AttributeType attr = (AttributeType) itAttributes.next();
if (!attr.getName().equals("Id")) {
setAttrValue(attr, object, builder, false);
} else {
builder.setAttribute(attr.getName(), "" + Id);
}
}
}
修改为
@SuppressWarnings("unchecked")
private void addAttributes(ObjectType object, Builder builder, int Id) throws Exception {
Iterator itAttributes = object.getAttributes();
while (itAttributes.hasNext()) {
AttributeType attr = (AttributeType) itAttributes.next();
if (!attr.getName().equals("Id")) {
setAttrValue(attr, object, builder, false);
} else {
builder.setAttribute(attr.getName(), "" + Id);
}
}
}
阅读(5092) | 评论(0) | 转发(0) |