private Class<?> ensureReplacedClass(Scriptable scope, Object obj,
				Class<?> staticType) {
			final Class<?> type = (staticType == null && obj != null) ? obj
					.getClass() : staticType;

			if (!type.isPrimitive() && !type.getName().startsWith("java.")
					&& this.replacedClasses.add(type)) {
				this.replaceJavaNativeClass(type, scope);
			}

			return type;
		}