Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/org/stringtemplate/v4/Interpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -803,11 +803,11 @@ protected int writePOJO(STWriter out, InstanceScope scope, Object o, String[] op
return n;
}

private <T> String renderObject(InstanceScope scope, String formatString, T o, Class<? extends T> attributeType) {
private <T> String renderObject(InstanceScope scope, String formatString, Object o, Class<T> attributeType) {
// ask the native group defining the surrounding template for the renderer
AttributeRenderer<? super T> r = scope.st.impl.nativeGroup.getAttributeRenderer(attributeType);
if ( r!=null ) {
return r.toString(o, formatString, locale);
return r.toString(attributeType.cast(o), formatString, locale);
} else {
return o.toString();
}
Expand Down Expand Up @@ -1449,4 +1449,3 @@ protected static class ArgumentsMap extends HashMap<String, Object> {
}

}

2 changes: 1 addition & 1 deletion src/org/stringtemplate/v4/STGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ public <T> void registerRenderer(Class<T> attributeType, AttributeRenderer<? sup
* have multiple renderers for {@code String}, say, then just make uber combined
* renderer with more specific format names.</p>
*/
public <T> AttributeRenderer<? super T> getAttributeRenderer(Class<? extends T> attributeType) {
public <T> AttributeRenderer<? super T> getAttributeRenderer(Class<T> attributeType) {
if ( renderers==null ) {
return null;
}
Expand Down