use of com.jopdesign.common.type.FieldRef in project jop by jop-devel.
the class UsedCodeFinder method visitReferences.
private void visitReferences(Set<String> refs) {
for (String id : refs) {
// The member IDs returned by the reference finder use a syntax which is
// always unique, so if in doubt, we need to interpret it as a classname, not a fieldname
MemberID sig = MemberID.parse(id, false);
// find/load the corresponding classInfo
ClassInfo cls = getClassInfo(sig);
// class has been excluded from loading, skip this class
if (cls == null) {
continue;
}
// referenced class is used, visit it if it has not yet been visited, but skip its class members
// Note that this class might be different than the class containing the class member
markUsedMembers(cls, false);
// check if this id specifies a class member (or just a class, in this case we are done)
if (sig.hasMethodSignature()) {
// It's a method! mark the method as used (implementations are marked later)
MethodRef ref = appInfo.getMethodRef(sig);
MethodInfo method = ref.getMethodInfo();
// we keep the declarations. We mark it without following it and make it abstract later.
if (method != null) {
setMark(method, false);
}
} else if (sig.hasMemberName()) {
// It's a field! No need to look in subclasses, fields are not virtual
FieldRef ref = appInfo.getFieldRef(sig);
FieldInfo field = ref.getFieldInfo();
if (field != null) {
markUsedMembers(field);
}
}
}
}
Aggregations