private LogMessage(Type type, String message, Object... arguments) { Validate.notNull(type); Validate.notNull(message); Validate.notNull(arguments); // arguments can contain null elements this.type = type; this.message = message; List<String> args = Arrays.stream(arguments) // convert args to strings here on purpose -- objects may not be immutable/serializable .map(x -> { if (x == null) { return NULL_STRING; } else if (x instanceof Throwable) { return ExceptionUtils.getStackTrace((Throwable) x); } else { return x.toString(); } }) .collect(Collectors.toList()); this.arguments = (UnmodifiableList<String>) UnmodifiableList.unmodifiableList(args); }
public SystemInfo(String hostName, String user, Long pid, List<String> publicKeys, String osName, int numCpus) { this.hostName = hostName; this.user = user; this.pid = pid; this.publicKeys = new UnmodifiableList<>(publicKeys); this.osName = osName; this.numCpus = numCpus; }
MethodAttributes( MethodSignature signature, InstrumentationSettings settings, List<ContinuationPoint> continuationPoints, List<SynchronizationPoint> synchPoints, CoreVariables coreVars, CacheVariables cacheVars, StorageContainerVariables storageContainerVars, StorageVariables localsStorageVars, StorageVariables stackStorageVars, LockVariables lockVars) { Validate.notNull(signature); Validate.notNull(settings); Validate.notNull(continuationPoints); Validate.notNull(synchPoints); Validate.notNull(coreVars); Validate.notNull(cacheVars); Validate.notNull(storageContainerVars); Validate.notNull(localsStorageVars); Validate.notNull(stackStorageVars); Validate.notNull(lockVars); Validate.noNullElements(continuationPoints); Validate.noNullElements(synchPoints); this.signature = signature; this.settings = settings; this.continuationPoints = (UnmodifiableList<ContinuationPoint>) UnmodifiableList.unmodifiableList(new ArrayList<>(continuationPoints)); this.synchPoints = (UnmodifiableList<SynchronizationPoint>) UnmodifiableList.unmodifiableList(new ArrayList<>(synchPoints)); this.coreVars = coreVars; this.cacheVars = cacheVars; this.storageContainerVars = storageContainerVars; this.localsStorageVars = localsStorageVars; this.stackStorageVars = stackStorageVars; this.lockVars = lockVars; }
@Override public void pass(ClassNode classNode, InstrumentationState state) { Validate.notNull(classNode); Validate.notNull(state); // Methods attributes should be assigned at this point. Validate.validState(!state.methodAttributes().isEmpty()); Validate.validState(state.methodAttributes().keySet().stream().allMatch(x -> x != null)); Validate.validState(state.methodAttributes().values().stream().allMatch(x -> x != null)); // Sanity check to make sure that we're only dealing with methodnodes in the classnode -- this should never trigger unless previous // passes mess up Validate.validState(classNode.methods.containsAll(state.methodAttributes().keySet())); // Generate the fields needed by the serializer/deserializer for (Map.Entry<MethodNode, MethodAttributes> method : state.methodAttributes().entrySet()) { MethodAttributes methodAttrs = method.getValue(); UnmodifiableList<ContinuationPoint> continuationPoints = methodAttrs.getContinuationPoints(); // Shove in versioning info for the method as a fields on the class. int methodId = methodAttrs.getSignature().getMethodId(); for (int i = 0; i < continuationPoints.size(); i++) { int continuationPointId = i; FieldNode methodIdField = new FieldNode( INSTRUMENTED_METHODID_FIELD_ACCESS, getIdentifyingFieldName(methodId, continuationPointId), INSTRUMENTED_METHODID_FIELD_TYPE.getDescriptor(), null, INSTRUMENTED_METHODID_FIELD_VALUE); classNode.fields.add(methodIdField); } } }
/** * Constructs a {@link CreateProcessRequest} object. * @param id of process * @param responseBus bus to send responses/notifications to for the created process * @param executable executable to run * @param parameters parameters to use when running {@code executable} * @throws NullPointerException if any argument is {@code null}, or contains {@code null} */ public CreateProcessRequest(int id, Bus responseBus, String executable, String ... parameters) { super(id); Validate.notNull(responseBus); Validate.notNull(executable); Validate.notNull(parameters); Validate.noNullElements(parameters); this.responseBus = responseBus; this.executable = executable; this.parameters = (UnmodifiableList<String>) UnmodifiableList.unmodifiableList(new ArrayList<>(Arrays.asList(parameters))); }
private MemoryStore(String prefix, int concurrency) { Validate.notNull(prefix); Validate.isTrue(concurrency > 0); LockRegion[] regions = new LockRegion[concurrency]; for (int i = 0; i < regions.length; i++) { regions[i] = new LockRegion(); } this.prefix = prefix; this.lockRegions = (UnmodifiableList<LockRegion>) unmodifiableList(new ArrayList<>(asList(regions))); this.closed = false; }
BatchedCreateRootCommand(String id, Coroutine coroutine, Object... primingMessages) { Validate.notNull(id); Validate.notNull(coroutine); Validate.notNull(primingMessages); Validate.noNullElements(primingMessages); this.id = id; this.coroutine = coroutine; this.primingMessages = (UnmodifiableList<Object>) unmodifiableList(new ArrayList<>(Arrays.asList(primingMessages))); }
BatchedCreateChildCommand(Context fromContext, String id, Coroutine coroutine, Object... primingMessages) { Validate.notNull(fromContext); Validate.notNull(id); Validate.notNull(coroutine); Validate.notNull(primingMessages); Validate.noNullElements(primingMessages); this.fromContext = fromContext; this.id = id; this.coroutine = coroutine; this.primingMessages = (UnmodifiableList<Object>) unmodifiableList(new ArrayList<>(Arrays.asList(primingMessages))); }
RequestBlock(String id, int outQueueOffset, int inQueueOffset, List<Message> inQueue) { Validate.notNull(id); Validate.notNull(inQueue); Validate.noNullElements(inQueue); Validate.isTrue(outQueueOffset >= 0); Validate.isTrue(inQueueOffset >= 0); this.id = id; this.outQueueOffset = outQueueOffset; this.inQueueOffset = inQueueOffset; this.inQueue = (UnmodifiableList<Message>) unmodifiableList(new ArrayList<>(inQueue)); }
@Override public List<K> subList(final int fromIndexInclusive, final int toIndexExclusive) { return UnmodifiableList.unmodifiableList(super.subList(fromIndexInclusive, toIndexExclusive)); }
public List<IHUPackingMaterialCollectorSource> getSources() { return new UnmodifiableList<IHUPackingMaterialCollectorSource>(sources); }
public void detail(MethodNode methodNode, MethodAttributes attrs, StringBuilder output) { Validate.notNull(methodNode); Validate.notNull(attrs); Validate.notNull(output); int methodId = attrs.getSignature().getMethodId(); output.append("Class Name: ").append(attrs.getSignature().getClassName().replace('/', '.')).append('\n'); output.append("Method Name: ").append(attrs.getSignature().getMethodName()).append('\n'); output.append("Method Params: ").append(attrs.getSignature().getMethodDescriptor()).append('\n'); output.append("Method Return: ").append(attrs.getSignature().getReturnType()).append('\n'); output.append("Method ID: ").append(methodId).append('\n'); output.append("------------------------------------\n"); UnmodifiableList<ContinuationPoint> cps = attrs.getContinuationPoints(); for (int i = 0; i < cps.size(); i++) { ContinuationPoint cp = cps.get(i); int line = cp.getLineNumber() == null ? -1 : cp.getLineNumber(); String header = String.format("Continuation Point ID: %-4d Line: %-4d Type: %s", i, line, cp.getClass().getSimpleName()); output.append(header).append('\n'); // Check out PackStateGenerators class for how things are organized. Brief overview follows... // container[0] has local variables that are bytes/shorts/ints // container[1] has local variables that are floats // container[2] has local variables that are longs // container[3] has local variables that are doubles // container[4] has local variables that are Objects // container[5] has operands that are bytes/shorts/ints // container[6] has operands that are floats // container[7] has operands that are longs // container[8] has operands that are doubles // container[9] has operands that are Objects detailLocals(cp, methodNode, output); detailOperands(cp, output); output.append('\n'); } output.append('\n'); }
public UnmodifiableList<ContinuationPoint> getContinuationPoints() { return continuationPoints; }
public UnmodifiableList<SynchronizationPoint> getSynchronizationPoints() { return synchPoints; }
UnmodifiableList<BatchedOutgoingMessageCommand> viewOuts() { return (UnmodifiableList<BatchedOutgoingMessageCommand>) unmodifiableList(outs); }
UnmodifiableList<Object> getPrimingMessages() { return primingMessages; }
ResponseBlock(List<Message> outQueue) { Validate.notNull(outQueue); Validate.noNullElements(outQueue); this.outQueue = (UnmodifiableList<Message>) unmodifiableList(new ArrayList<>(outQueue)); }
public UnmodifiableList<Message> getOutQueue() { return outQueue; }
public UnmodifiableList<Message> getInQueue() { return inQueue; }
private Address(List<String> addressElements) { this.addressElements = (UnmodifiableList<String>) UnmodifiableList.unmodifiableList(addressElements); }
/** * Gets a view over the keys in the map as a List. * <p> * The List will be ordered by object insertion into the map. * The List is unmodifiable. * * @see #keySet() * @return the unmodifiable list view over the keys * @since 3.2 */ public List<K> keyList() { return UnmodifiableList.unmodifiableList(insertOrder); }
/** * Gets an unmodifiable view of the order of the Set. * * @return an unmodifiable list view */ public List<E> asList() { return UnmodifiableList.unmodifiableList(setOrder); }
/** * Gets the sets being decorated. * * @return Unmodifiable list of all sets in this composite. */ public List<Set<E>> getSets() { return UnmodifiableList.unmodifiableList(all); }
/** * Returns an unmodifiable list backed by the given list. * <p> * This method uses the implementation in the decorators subpackage. * * @param <E> the element type * @param list the list to make unmodifiable, must not be null * @return an unmodifiable list backed by the given list * @throws NullPointerException if the list is null */ public static <E> List<E> unmodifiableList(final List<? extends E> list) { return UnmodifiableList.unmodifiableList(list); }
/** * Gets the collections being decorated. * * @return Unmodifiable list of all collections in this composite. */ public List<Collection<E>> getCollections() { return UnmodifiableList.unmodifiableList(all); }
/** * Gets the list of Iterators (unmodifiable). * * @return the unmodifiable list of iterators added */ public List<Iterator<? extends E>> getIterators() { return UnmodifiableList.unmodifiableList(iterators); }
/** * Get parameters to use when running executables. * @return parameters */ public UnmodifiableList<String> getParameters() { return parameters; }