Skip to content

Commit

Permalink
Yet more post-merge clean up for #4515
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 31, 2024
1 parent db04993 commit 1fda8f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ private void _addExplicitPropertyCreator(DeserializationContext ctxt,
CreatorCandidate candidate)
throws JsonMappingException
{
//System.err.println("_addExplicitPropertyCreator(): "+candidate);
final int paramCount = candidate.paramCount();
SettableBeanProperty[] properties = new SettableBeanProperty[paramCount];

Expand All @@ -525,9 +524,12 @@ private void _addExplicitPropertyCreator(DeserializationContext ctxt,
if (unwrapper != null) {
_reportUnwrappedCreatorProperty(ctxt, beanDesc, param);
}
name = candidate.findImplicitParamName(i);
_validateNamedPropertyParameter(ctxt, beanDesc, candidate, i,
name, injectId);
// Must be injectable or have name; without either won't work
if ((name == null) && (injectId == null)) {
ctxt.reportBadTypeDefinition(beanDesc,
"Argument #%d of Creator %s has no property name (and is not Injectable): can not use as property-based Creator",
i, candidate);
}
}
properties[i] = constructCreatorProperty(ctxt, beanDesc, name, i, param, injectId);
}
Expand Down Expand Up @@ -587,24 +589,6 @@ private boolean _handleSingleArgumentCreator(CreatorCollector creators,
return false;
}

// Helper method to check that parameter of Property-based creator either
// has name or is marked as Injectable
//
// @since 2.12.1
private void _validateNamedPropertyParameter(DeserializationContext ctxt,
BeanDescription beanDesc,
CreatorCandidate candidate, int paramIndex,
PropertyName name, JacksonInject.Value injectId)
throws JsonMappingException
{
// Must be injectable or have name; without either won't work
if ((name == null) && (injectId == null)) {
ctxt.reportBadTypeDefinition(beanDesc,
"Argument #%d of Creator %s has no property name (and is not Injectable): can not use as property-based Creator",
paramIndex, candidate);
}
}

// 01-Dec-2016, tatu: As per [databind#265] we cannot yet support passing
// of unwrapped values through creator properties, so fail fast
private void _reportUnwrappedCreatorProperty(DeserializationContext ctxt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public PropertyName explicitParamName(int i) {
return null;
}

@Deprecated // since 2.18 (remove from 2.19 or later)
public PropertyName findImplicitParamName(int i) {
String str = _intr.findImplicitPropertyName(_params[i].annotated);
if (str != null && !str.isEmpty()) {
Expand All @@ -67,12 +68,8 @@ public PropertyName findImplicitParamName(int i) {
return null;
}

/**
* Specialized accessor that finds index of the one and only parameter
* with NO injection and returns that; or, if none or more than one found,
* returns -1.
*/
public int findOnlyParamWithoutInjection()
@Deprecated // since 2.18 (remove from 2.19 or later)
public int findOnlyParamWithoutInjectionX()
{
int missing = -1;
for (int i = 0; i < _paramCount; ++i) {
Expand Down

0 comments on commit 1fda8f8

Please sign in to comment.