public CallStackElement(CallStackElement<?> caller, Thread thread, Class<?> declaringType, String fileName, int lineNumber, Object object, F function, Object[] args) {
		super();
		this.caller = caller;
		this.thread = thread;
		this.declaringType = declaringType;
		this.fileName = fileName;
		this.lineNumber = lineNumber;
		this.object = object;
		this.function = function;
		this.args = args;

		final String functionName;
		if (function != null) {
			if (function instanceof Method) {
				functionName = ((Method)function).getName();
			} else if (function instanceof Constructor<?>) {
				functionName = "<init>";
			} else {
				throw new IllegalArgumentException(function.getClass().getName());
			}
		} else {
			// this may happen if declaringType is a dynamic proxy
			functionName = "n/a";
		}
		
		
		this.stackTraceElement = new StackTraceElement(declaringType.getName(), functionName, fileName, lineNumber);
	}