@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)); }
@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)); }
@Override public void classReached(DependencyAgent agent, String className) { allClasses.propagate(agent.getType(className)); }
@Override public void methodReached(DependencyAgent agent, MethodDependency method) { method.getResult().propagate(agent.getType("java.lang.String")); } }
@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)); } }
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(); } }
private void reachGet(DependencyAgent agent, MethodDependency method) { method.getVariable(1).getArrayItem().connect(method.getResult()); method.getVariable(1).addConsumer(type -> { if (type.getName().startsWith("[")) { String typeName = type.getName().substring(1); for (int i = 0; i < primitiveTypes.length; ++i) { if (primitiveTypes[i].toString().equals(typeName)) { String wrapper = "java.lang." + primitiveWrappers[i]; MethodReference methodRef = new MethodReference(wrapper, "valueOf", primitiveTypes[i], ValueType.object(wrapper)); agent.linkMethod(methodRef).use(); method.getResult().propagate(agent.getType("java.lang." + primitiveWrappers[i])); } } } }); }
@Override public void classReached(DependencyAgent agent, String className) { ClassReader cls = agent.getClassSource().get(className); if (cls == null) { return; } if (cls.hasModifier(ElementModifier.ABSTRACT) || cls.hasModifier(ElementModifier.INTERFACE)) { return; } MethodReader method = cls.getMethod(INIT_METHOD); if (method != null) { allClassesNode.propagate(agent.getType(className)); } }
@Override public void classReached(DependencyAgent agent, String className) { ClassReader cls = agent.getClassSource().get(className); for (MethodReader method : cls.getMethods()) { AnnotationReader exposeAnnot = method.getAnnotations().get(JSMethodToExpose.class.getName()); if (exposeAnnot != null) { MethodDependency methodDep = agent.linkMethod(method.getReference()); methodDep.getVariable(0).propagate(agent.getType(className)); methodDep.use(); } } } }
private void reachGetInterfaces(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) { for (String iface : cls.getInterfaces()) { method.getResult().getClassValueNode().propagate(agent.getType(iface)); } } }); }
@Override public void methodReached(DependencyAgent agent, MethodDependency method) { MethodReference ref = method.getReference(); if (ref.getClassName().equals("java.util.ServiceLoader") && ref.getName().equals("loadServices")) { List<ServiceLoaderFilter> filters = getFilters(agent); method.getResult().propagate(agent.getType("[Ljava/lang/Object;")); DependencyNode sourceNode = agent.linkMethod(LOAD_METHOD).getVariable(1).getClassValueNode(); sourceNode.connect(method.getResult().getArrayItem()); sourceNode.addConsumer(type -> { CallLocation location = new CallLocation(LOAD_METHOD); for (String implementationType : getImplementations(type.getName())) { if (filters.stream().anyMatch(filter -> !filter.apply(type.getName(), implementationType))) { continue; } serviceMap.computeIfAbsent(type.getName(), k -> new ArrayList<>()).add(implementationType); MethodReference ctor = new MethodReference(implementationType, new MethodDescriptor("<init>", ValueType.VOID)); agent.linkMethod(ctor).addLocation(location).use(); method.getResult().getArrayItem().propagate(agent.getType(implementationType)); } }); } }
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())); } }); }
private void includeDefaultDependencies(DependencyAgent agent) { agent.linkMethod(JavaScriptConvGenerator.fromJsMethod).use(); agent.linkMethod(JavaScriptConvGenerator.toJsMethod).use(); agent.linkMethod(JavaScriptConvGenerator.intValueMethod).propagate(0, Integer.class).use(); agent.linkMethod(JavaScriptConvGenerator.valueOfIntMethod).use(); agent.linkMethod(JavaScriptConvGenerator.booleanValueMethod).propagate(0, Boolean.class).use(); agent.linkMethod(JavaScriptConvGenerator.valueOfBooleanMethod).use(); agent.linkMethod(JavaScriptConvGenerator.doubleValueMethod).propagate(0, Double.class).use(); agent.linkMethod(JavaScriptConvGenerator.valueOfDoubleMethod).use(); agent.linkMethod(JavaScriptConvGenerator.charValueMethod).propagate(0, Character.class).use(); agent.linkMethod(JavaScriptConvGenerator.valueOfCharMethod).use(); agent.linkMethod(JavaScriptConvGenerator.byteValueMethod).propagate(0, Byte.class).use(); agent.linkMethod(JavaScriptConvGenerator.valueOfByteMethod).use(); agent.linkMethod(JavaScriptConvGenerator.shortValueMethod).propagate(0, Short.class).use(); agent.linkMethod(JavaScriptConvGenerator.valueOfShortMethod).use(); agent.linkMethod(JavaScriptConvGenerator.valueOfLongMethod).use(); allClassesNode.propagate(agent.getType("java.lang.Integer")); allClassesNode.propagate(agent.getType("java.lang.Float")); allClassesNode.propagate(agent.getType("java.lang.Double")); allClassesNode.propagate(agent.getType("java.lang.String")); }
@Override public void methodReached(DependencyAgent agent, MethodDependency method) { switch (method.getMethod().getName()) { case "initialize": method.getVariable(0).getClassValueNode().addConsumer(type -> { ClassDependency classDep = agent.linkClass(type.getName()); if (classDep != null) { classDep.initClass(new CallLocation(method.getReference())); } }); break; case "getSimpleNameCacheLowLevel": method.getResult().propagate(agent.getType("java.lang.String")); break; } } }