コード例 #1
0
ファイル: DependencyChecker.java プロジェクト: sba1/teavm
 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;
 }
コード例 #2
0
ファイル: DependencyChecker.java プロジェクト: sba1/teavm
 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;
 }