writer.append("var type = " + array + ".constructor.$meta.item;").softNewLine();
for (int i = 0; i < primitives.length; ++i) {
String wrapper = "java.lang." + primitiveWrappers[i];
MethodReference methodRef = new MethodReference(wrapper, "valueOf",
primitiveTypes[i], ValueType.object(wrapper));
ClassReader cls = context.getClassSource().get(methodRef.getClassName());
if (cls == null || cls.getMethod(methodRef.getDescriptor()) == null) {
continue;
}
writer.append("if (type === $rt_" + primitives[i].toLowerCase() + "cls()) {").indent().softNewLine();
writer.append("return ").appendMethodBody(methodRef).append("(item);").softNewLine();
writer.outdent().append("} else ");