report error in case of constructor-arg index ambiguity (SPR-6329)
This commit is contained in:
parent
d66fd9843e
commit
5d772554ae
|
|
@ -131,6 +131,14 @@ public class ConstructorArgumentValues {
|
||||||
this.indexedArgumentValues.put(key, newValue);
|
this.indexedArgumentValues.put(key, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether an argument value has been registered for the given index.
|
||||||
|
* @param index the index in the constructor argument list
|
||||||
|
*/
|
||||||
|
public boolean hasIndexedArgumentValue(int index) {
|
||||||
|
return this.indexedArgumentValues.containsKey(index);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get argument value for the given index in the constructor argument list.
|
* Get argument value for the given index in the constructor argument list.
|
||||||
* @param index the index in the constructor argument list
|
* @param index the index in the constructor argument list
|
||||||
|
|
|
||||||
|
|
@ -778,7 +778,12 @@ public class BeanDefinitionParserDelegate {
|
||||||
valueHolder.setName(nameAttr);
|
valueHolder.setName(nameAttr);
|
||||||
}
|
}
|
||||||
valueHolder.setSource(extractSource(ele));
|
valueHolder.setSource(extractSource(ele));
|
||||||
bd.getConstructorArgumentValues().addIndexedArgumentValue(index, valueHolder);
|
if (bd.getConstructorArgumentValues().hasIndexedArgumentValue(index)) {
|
||||||
|
error("Ambiguous constructor-arg entries for index " + index, ele);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bd.getConstructorArgumentValues().addIndexedArgumentValue(index, valueHolder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this.parseState.pop();
|
this.parseState.pop();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue