Exemple #1
0
 private FieldDependency createFieldNode(FieldReference fieldRef, FieldReader field) {
   DependencyNode node = createNode();
   if (shouldLog) {
     node.setTag(fieldRef.getClassName() + "#" + fieldRef.getFieldName());
   }
   FieldDependency dep = new FieldDependency(node, field, fieldRef);
   if (!dep.isMissing()) {
     tasks.add(() -> linkClass(fieldRef.getClassName(), null).initClass(null));
   }
   return dep;
 }
Exemple #2
0
 public FieldDependency linkField(FieldReference fieldRef, CallLocation location) {
   if (completing) {
     throw new IllegalStateException("Can't submit class during completion phase");
   }
   boolean added = true;
   if (location != null) {
     added =
         callGraph
             .getNode(location.getMethod())
             .addFieldAccess(fieldRef, location.getSourceLocation());
   } else {
     added = fieldsAddedByRoot.add(fieldRef);
   }
   FieldDependency dep = fieldCache.map(fieldRef);
   if (!dep.isMissing()) {
     tasks.add(() -> linkClass(fieldRef.getClassName(), location).initClass(location));
   }
   if (!dep.isMissing() && added) {
     for (DependencyListener listener : listeners) {
       listener.fieldReached(agent, dep, location);
     }
   }
   return dep;
 }