diff --git a/webapp/src/freemarker/ext/dump/BaseDumpDirective.java b/webapp/src/freemarker/ext/dump/BaseDumpDirective.java index 937cd7f53..ce94a6a3e 100644 --- a/webapp/src/freemarker/ext/dump/BaseDumpDirective.java +++ b/webapp/src/freemarker/ext/dump/BaseDumpDirective.java @@ -422,7 +422,7 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel { } // Else display method name, parameter types, and return type } else { - String returnTypeName = getTypeName(method.getReturnType()); + String returnTypeName = getReturnTypeName(method); Map methodValue = new HashMap(); if ( ! returnTypeName.equals("void") ) { methodValue.put(Key.TYPE.toString(), returnTypeName); @@ -460,14 +460,26 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel { List paramTypeList = new ArrayList(paramTypes.length); if (paramTypes.length > 0) { for (Class cls : paramTypes) { - paramTypeList.add(getTypeName(cls)); + paramTypeList.add(getSimpleTypeName(cls)); } } methodName += "(" + StringUtils.join(paramTypeList, ", ") + ")"; return methodName; } - private String getTypeName(Class cls) { + private String getReturnTypeName(Method method) { + Class cls = method.getReturnType(); + Package pkg = cls.getPackage(); + if (pkg != null) { // void return type has null package + String packageName = pkg.getName(); + if (packageName.startsWith("java")) { + return getSimpleTypeName(cls); + } + } + return cls.getName(); + } + + private String getSimpleTypeName(Class cls) { return cls.getSimpleName().replace("[]", "s"); } diff --git a/webapp/web/templates/freemarker/body/partials/dump/dump.ftl b/webapp/web/templates/freemarker/body/partials/dump/dump.ftl index d82d3430f..ac8bc9dd7 100644 --- a/webapp/web/templates/freemarker/body/partials/dump/dump.ftl +++ b/webapp/web/templates/freemarker/body/partials/dump/dump.ftl @@ -63,7 +63,7 @@ div.dump { -<#macro doTypeAndValue map> +<#macro doTypeAndValue map isMethod=false> <#local type = map.type!> <#if type?has_content>

Type: ${type}

@@ -75,8 +75,9 @@ div.dump { <#local value = map.value!> <#-- Not value?has_content: we want to print [empty] for empty strings. - See doScalarValue macro. --> - <#if value??> + See doScalarValue macro. For methods, we don't show a list of values + unless there is a value. --> + <#if value?? && (value?has_content || ! isMethod)>
<#if type?contains(".")><@doObjectValue value /> <#elseif value?is_sequence><@doSequenceValue value type /> @@ -84,7 +85,7 @@ div.dump { <#else><@doScalarValue value />
- + <#macro doObjectValue obj> @@ -110,7 +111,8 @@ div.dump { <#elseif value?is_string> <#-- value is return type --> ${method} => ${value} <#else> <#-- no-arg method: value is result of method invocation --> - ${method} => <@divValue><@doTypeAndValue value /> + <#local isMethod = true> + ${method} => <@divValue><@doTypeAndValue value isMethod />