< prev index next >

src/share/classes/com/sun/tools/jdeps/Analyzer.java

Print this page
rev 2788 : 8068937: jdeps shows "not found" if target class has no reference other than its own package
Reviewed-by: alanb


 206                 map.put(t, target = NOT_FOUND);
 207             }
 208             return target;
 209         }
 210 
 211         // return classname or package name depedning on the level
 212         private String getLocationName(Location o) {
 213             if (level == Type.CLASS || level == Type.VERBOSE) {
 214                 return o.getClassName();
 215             } else {
 216                 String pkg = o.getPackageName();
 217                 return pkg.isEmpty() ? "<unnamed>" : pkg;
 218             }
 219         }
 220 
 221         @Override
 222         public void visit(Location o, Location t) {
 223             Archive targetArchive = findArchive(t);
 224             if (filter.accepts(o, archive, t, targetArchive)) {
 225                 addDep(o, t);
 226                 if (!requires.contains(targetArchive)) {
 227                     requires.add(targetArchive);
 228                 }
 229             }
 230             if (targetArchive instanceof JDKArchive) {
 231                 Profile p = Profile.getProfile(t.getPackageName());
 232                 if (profile == null || (p != null && p.compareTo(profile) > 0)) {
 233                     profile = p;
 234                 }
 235             }
 236         }
 237 
 238         private Dep curDep;
 239         protected Dep addDep(Location o, Location t) {
 240             String origin = getLocationName(o);
 241             String target = getLocationName(t);
 242             Archive targetArchive = findArchive(t);
 243             if (curDep != null &&
 244                     curDep.origin().equals(origin) &&
 245                     curDep.originArchive() == archive &&
 246                     curDep.target().equals(target) &&




 206                 map.put(t, target = NOT_FOUND);
 207             }
 208             return target;
 209         }
 210 
 211         // return classname or package name depedning on the level
 212         private String getLocationName(Location o) {
 213             if (level == Type.CLASS || level == Type.VERBOSE) {
 214                 return o.getClassName();
 215             } else {
 216                 String pkg = o.getPackageName();
 217                 return pkg.isEmpty() ? "<unnamed>" : pkg;
 218             }
 219         }
 220 
 221         @Override
 222         public void visit(Location o, Location t) {
 223             Archive targetArchive = findArchive(t);
 224             if (filter.accepts(o, archive, t, targetArchive)) {
 225                 addDep(o, t);
 226                 if (archive != targetArchive && !requires.contains(targetArchive)) {
 227                     requires.add(targetArchive);
 228                 }
 229             }
 230             if (targetArchive instanceof JDKArchive) {
 231                 Profile p = Profile.getProfile(t.getPackageName());
 232                 if (profile == null || (p != null && p.compareTo(profile) > 0)) {
 233                     profile = p;
 234                 }
 235             }
 236         }
 237 
 238         private Dep curDep;
 239         protected Dep addDep(Location o, Location t) {
 240             String origin = getLocationName(o);
 241             String target = getLocationName(t);
 242             Archive targetArchive = findArchive(t);
 243             if (curDep != null &&
 244                     curDep.origin().equals(origin) &&
 245                     curDep.originArchive() == archive &&
 246                     curDep.target().equals(target) &&


< prev index next >