/** * Returns the size of call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation (see {@link #getStackTrace()}). */ int getStackTraceSize() { if (parent == null) { return partialCallStack.length; } return parent.getStackTraceSize() + partialCallStack.length; }
/** * Removes the {@link #moduleSource} call stack from the beginning of current call stack. It * also removes the last two elements in order to make {@link #install(Module)} the last call in * the call stack. */ private StackTraceElement[] getPartialCallStack(StackTraceElement[] callStack) { int toSkip = 0; if (moduleSource != null) { toSkip = moduleSource.getStackTraceSize(); } // -1 for skipping 'getModuleSource' and 'getElementSource' calls int chunkSize = callStack.length - toSkip - 1; StackTraceElement[] partialCallStack = new StackTraceElement[chunkSize]; System.arraycopy(callStack, 1, partialCallStack, 0, chunkSize); return partialCallStack; }
/** * Returns the sequence of method calls that ends at one of {@link com.google.inject.Binder} * {@code bindXXX()} methods and eventually defines the element. Note that {@link #getStackTrace} * lists {@link StackTraceElement StackTraceElements} in reverse chronological order. The first * element (index zero) is the last method call and the last element is the first method * invocation. In the cases where stack trace is not available (i.e.,the stack trace was not * collected), it returns an empty array. */ public StackTraceElement[] getStackTrace() { int modulesCallStackSize = moduleSource.getStackTraceSize(); int chunkSize = partialCallStack.length; int size = moduleSource.getStackTraceSize() + chunkSize; StackTraceElement[] callStack = new StackTraceElement[size]; System.arraycopy( StackTraceElements.convertToStackTraceElement(partialCallStack), 0, callStack, 0, chunkSize); System.arraycopy(moduleSource.getStackTrace(), 0, callStack, chunkSize, modulesCallStackSize); return callStack; }
/** * Returns the full call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation. The return array is non-empty if stack trace collection * on. */ StackTraceElement[] getStackTrace() { int stackTraceSize = getStackTraceSize(); StackTraceElement[] callStack = new StackTraceElement[stackTraceSize]; int cursor = 0; ModuleSource current = this; while (current != null) { StackTraceElement[] chunk = StackTraceElements.convertToStackTraceElement(current.partialCallStack); int chunkSize = chunk.length; System.arraycopy(chunk, 0, callStack, cursor, chunkSize); current = current.parent; cursor = cursor + chunkSize; } return callStack; } }
/** * Returns the size of call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation (see {@link #getStackTrace()}). */ int getStackTraceSize() { if (parent == null) { return partialCallStack.length; } return parent.getStackTraceSize() + partialCallStack.length; }
/** * Returns the size of call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation (see {@link #getStackTrace()}). */ int getStackTraceSize() { if (parent == null) { return partialCallStack.length; } return parent.getStackTraceSize() + partialCallStack.length; }
/** * Returns the size of call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation (see {@link #getStackTrace()}). */ int getStackTraceSize() { if (parent == null) { return partialCallStack.length; } return parent.getStackTraceSize() + partialCallStack.length; }
/** * Removes the {@link #moduleSource} call stack from the beginning of current call stack. It * also removes the last two elements in order to make {@link #install(Module)} the last call in * the call stack. */ private StackTraceElement[] getPartialCallStack(StackTraceElement[] callStack) { int toSkip = 0; if (moduleSource != null) { toSkip = moduleSource.getStackTraceSize(); } // -1 for skipping 'getModuleSource' and 'getElementSource' calls int chunkSize = callStack.length - toSkip - 1; StackTraceElement[] partialCallStack = new StackTraceElement[chunkSize]; System.arraycopy(callStack, 1, partialCallStack, 0, chunkSize); return partialCallStack; }
/** * Removes the {@link #moduleSource} call stack from the beginning of current call stack. It * also removes the last two elements in order to make {@link #install(Module)} the last call * in the call stack. */ private StackTraceElement[] getPartialCallStack(StackTraceElement[] callStack) { int toSkip = 0; if (moduleSource != null) { toSkip = moduleSource.getStackTraceSize(); } // -1 for skipping 'getModuleSource' and 'getElementSource' calls int chunkSize = callStack.length - toSkip - 1; StackTraceElement[] partialCallStack = new StackTraceElement[chunkSize]; System.arraycopy(callStack, 1, partialCallStack, 0, chunkSize); return partialCallStack; }
/** * Removes the {@link #moduleSource} call stack from the beginning of current call stack. It * also removes the last two elements in order to make {@link #install(Module)} the last call in * the call stack. */ private StackTraceElement[] getPartialCallStack(StackTraceElement[] callStack) { int toSkip = 0; if (moduleSource != null) { toSkip = moduleSource.getStackTraceSize(); } // -1 for skipping 'getModuleSource' and 'getElementSource' calls int chunkSize = callStack.length - toSkip - 1; StackTraceElement[] partialCallStack = new StackTraceElement[chunkSize]; System.arraycopy(callStack, 1, partialCallStack, 0, chunkSize); return partialCallStack; }
/** * Returns the sequence of method calls that ends at one of {@link com.google.inject.Binder} * {@code bindXXX()} methods and eventually defines the element. Note that * this method lists {@link StackTraceElement StackTraceElements} in reverse * chronological order. The first element (index zero) is the last method call and the last * element is the first method invocation. In the cases where stack trace is not available * (i.e.,the stack trace was not collected), it returns an empty array. */ public StackTraceElement[] getStackTrace() { int modulesCallStackSize = moduleSource.getStackTraceSize(); int chunkSize = partialCallStack.length; int size = moduleSource.getStackTraceSize() + chunkSize; StackTraceElement[] callStack = new StackTraceElement[size]; System.arraycopy( StackTraceElements.convertToStackTraceElement(partialCallStack), 0, callStack, 0, chunkSize); System.arraycopy(moduleSource.getStackTrace(), 0, callStack, chunkSize, modulesCallStackSize); return callStack; }
/** * Returns the full call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation. The return array is non-empty if stack trace collection * on. */ StackTraceElement[] getStackTrace() { int stackTraceSize = getStackTraceSize(); StackTraceElement[] callStack = new StackTraceElement[stackTraceSize]; int cursor = 0; ModuleSource current = this; while (current != null) { StackTraceElement[] chunk = StackTraceElements.convertToStackTraceElement(current.partialCallStack); int chunkSize = chunk.length; System.arraycopy(chunk, 0, callStack, cursor, chunkSize); current = current.parent; cursor = cursor + chunkSize; } return callStack; } }
/** * Returns the full call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation. The return array is non-empty if stack trace collection * on. */ StackTraceElement[] getStackTrace() { int stackTraceSize = getStackTraceSize(); StackTraceElement[] callStack = new StackTraceElement[stackTraceSize]; int cursor = 0; ModuleSource current = this; while (current != null) { StackTraceElement[] chunk = StackTraceElements.convertToStackTraceElement(current.partialCallStack); int chunkSize = chunk.length; System.arraycopy(chunk, 0, callStack, cursor, chunkSize); current = current.parent; cursor = cursor + chunkSize; } return callStack; } }
/** * Returns the full call stack that ends just before the module {@link Module#configure(Binder) * configure(Binder)} method invocation. The return array is non-empty if stack trace collection * on. */ StackTraceElement[] getStackTrace() { int stackTraceSize = getStackTraceSize(); StackTraceElement[] callStack = new StackTraceElement[stackTraceSize]; int cursor = 0; ModuleSource current = this; while (current != null) { StackTraceElement[] chunk = StackTraceElements.convertToStackTraceElement(current.partialCallStack); int chunkSize = chunk.length; System.arraycopy(chunk, 0, callStack, cursor, chunkSize); current = current.parent; cursor = cursor + chunkSize; } return callStack; } }
/** * Returns the sequence of method calls that ends at one of {@link com.google.inject.Binder} * {@code bindXXX()} methods and eventually defines the element. Note that {@link #getStackTrace} * lists {@link StackTraceElement StackTraceElements} in reverse chronological order. The first * element (index zero) is the last method call and the last element is the first method * invocation. In the cases where stack trace is not available (i.e.,the stack trace was not * collected), it returns an empty array. */ public StackTraceElement[] getStackTrace() { int modulesCallStackSize = moduleSource.getStackTraceSize(); int chunkSize = partialCallStack.length; int size = moduleSource.getStackTraceSize() + chunkSize; StackTraceElement[] callStack = new StackTraceElement[size]; System.arraycopy( StackTraceElements.convertToStackTraceElement(partialCallStack), 0, callStack, 0, chunkSize); System.arraycopy(moduleSource.getStackTrace(), 0, callStack, chunkSize, modulesCallStackSize); return callStack; }
/** * Returns the sequence of method calls that ends at one of {@link com.google.inject.Binder} * {@code bindXXX()} methods and eventually defines the element. Note that {@link #getStackTrace} * lists {@link StackTraceElement StackTraceElements} in reverse chronological order. The first * element (index zero) is the last method call and the last element is the first method * invocation. In the cases where stack trace is not available (i.e.,the stack trace was not * collected), it returns an empty array. */ public StackTraceElement[] getStackTrace() { int modulesCallStackSize = moduleSource.getStackTraceSize(); int chunkSize = partialCallStack.length; int size = moduleSource.getStackTraceSize() + chunkSize; StackTraceElement[] callStack = new StackTraceElement[size]; System.arraycopy( StackTraceElements.convertToStackTraceElement(partialCallStack), 0, callStack, 0, chunkSize); System.arraycopy(moduleSource.getStackTrace(), 0, callStack, chunkSize, modulesCallStackSize); return callStack; }