@Override public void classReached(DependencyAgent agent, String className) { allClasses.propagate(agent.getType(className)); } }
public MethodDependency propagate(int parameterIndex, DependencyType type) { getVariable(parameterIndex).propagate(type); return this; }
@Override public void classReached(DependencyAgent agent, String className) { allClasses.propagate(agent.getType(className)); }
@Override public void classReached(DependencyAgent agent, String className) { allClasses.propagate(agent.getType(className)); }
private void propagate(DependencyType type) { if (destination.typeSet == source.typeSet) { return; } if (shouldMergeDomains()) { mergeDomains(new DependencyType[] { type }); } else { destination.propagate(type); } }
private void propagate(DependencyType[] types) { if (destination.typeSet == source.typeSet) { return; } if (shouldMergeDomains()) { mergeDomains(types); } else { destination.propagate(types); } }
@Override public void methodReached(DependencyAgent agent, MethodDependency method) { method.getResult().propagate(agent.getType("java.lang.String")); } }
public void addEntryPoint(MethodReference methodRef, String... argumentTypes) { ValueType[] parameters = methodRef.getDescriptor().getParameterTypes(); if (parameters.length + 1 != argumentTypes.length) { throw new IllegalArgumentException("argumentTypes length does not match the number of method's arguments"); } MethodDependency method = linkMethod(methodRef); method.use(); DependencyNode[] varNodes = method.getVariables(); varNodes[0].propagate(getType(methodRef.getClassName())); for (int i = 0; i < argumentTypes.length; ++i) { varNodes[i + 1].propagate(getType(argumentTypes[i])); } }
@Override public void classReached(DependencyAgent agent, String className) { ClassReader cls = agent.getClassSource().get(className); if (cls == null || cls.getParent() == null || !cls.getParent().equals("java.lang.Enum")) { return; } allEnums.propagate(agent.getType(className)); }
@Override public void methodReached(DependencyAgent agent, MethodDependency method) { if (!method.getReference().getClassName().equals(ResourceAccessor.class.getName())) { return; } switch (method.getReference().getName()) { case "castToString": method.getResult().propagate(agent.getType("java.lang.String")); break; } } }
private void linkType(DependencyAgent agent, ValueType type) { while (type instanceof ValueType.Array) { type = ((ValueType.Array) type).getItemType(); } if (type instanceof ValueType.Object) { String className = ((ValueType.Object) type).getClassName(); agent.linkClass(className); typesInReflectableSignaturesNode.propagate(agent.getType(className)); } }
private void reachGetComponentType(DependencyAgent agent, MethodDependency method) { method.getVariable(0).getClassValueNode().addConsumer(t -> { if (!t.getName().startsWith("[")) { return; } String typeName = t.getName().substring(1); if (typeName.charAt(0) == 'L') { typeName = ((ValueType.Object) ValueType.parse(typeName)).getClassName(); } method.getResult().getClassValueNode().propagate(agent.getType(typeName)); }); }
@Override public void classReached(DependencyAgent agent, String className) { ClassReader cls = agent.getClassSource().get(className); if (cls != null && !cls.hasModifier(ElementModifier.ABSTRACT) && !cls.hasModifier(ElementModifier.INTERFACE)) { allClassesNode.propagate(agent.getType(className)); } }
@Override public void create(VariableReader receiver, String type) { getAnalyzer().linkClass(type); DependencyNode node = getNode(receiver); if (node != null) { node.propagate(getAnalyzer().getType(type)); } }
public FastDependencyAnalyzer(ClassReaderSource classSource, ClassLoader classLoader, ServiceRepository services, Diagnostics diagnostics) { super(classSource, classLoader, services, diagnostics); instancesNode = new DependencyNode(this, null); classesNode = new DependencyNode(this, null); instancesNode.addConsumer(type -> { getSubtypeNode(type.getName()).propagate(type); }); }
@Override public void createArray(VariableReader receiver, ValueType itemType, VariableReader size) { DependencyNode node = getNode(receiver); if (node != null) { node.propagate(getAnalyzer().getType("[" + itemType)); } String className = extractClassName(itemType); if (className != null) { getAnalyzer().linkClass(className); } }
private void attachConstructor(DependencyAgent agent, String type, CallLocation location) { MethodReference ref = new MethodReference(type, "<init>", ValueType.VOID); MethodDependency methodDep = agent.linkMethod(ref); methodDep.addLocation(location); methodDep.getVariable(0).propagate(agent.getType(type)); methodDep.use(); } }
@Override public void started(DependencyAgent agent) { allClasses = agent.createNode(); allClasses.addConsumer(c -> { if (agent.getClassSource().isSuperType("java.lang.Throwable", c.getName()).orElse(false)) { MethodDependency methodDep = agent.linkMethod(new MethodReference(c.getName(), GET_MESSAGE)); methodDep.getVariable(0).propagate(c); methodDep.use(); } }); agent.linkClass("java.lang.Throwable"); }
private void reachGetSuperclass(DependencyAgent agent, MethodDependency method) { method.getVariable(0).getClassValueNode().addConsumer(type -> { String className = type.getName(); if (className.startsWith("[")) { return; } ClassReader cls = agent.getClassSource().get(className); if (cls != null && cls.getParent() != null) { method.getResult().getClassValueNode().propagate(agent.getType(cls.getParent())); } }); }
@Override public void stringConstant(VariableReader receiver, String cst) { DependencyNode node = getNode(receiver); if (node != null) { node.propagate(getAnalyzer().getType("java.lang.String")); } MethodDependency method = getAnalyzer().linkMethod(STRING_INIT_FROM_CHARS_METHOD); method.addLocation(getCallLocation()); method.use(); }