< prev index next >
src/jdk.dev/share/classes/com/sun/tools/jdeps/Analyzer.java
Print this page
*** 31,40 ****
--- 31,41 ----
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
+ import java.util.stream.Stream;
import com.sun.tools.classfile.Dependency.Location;
/**
* Dependency Analyzer.
*** 135,146 ****
* If the requested level is SUMMARY, it will visit the required archives list.
*/
public void visitDependences(Archive source, Visitor v, Type level) {
if (level == Type.SUMMARY) {
final ArchiveDeps result = results.get(source);
! result.requires().stream()
! .sorted(Comparator.comparing(Archive::getName))
.forEach(archive -> {
Profile profile = result.getTargetProfile(archive);
v.visitDependence(source.getName(), source,
profile != null ? profile.profileName() : archive.getName(), archive);
});
--- 136,160 ----
* If the requested level is SUMMARY, it will visit the required archives list.
*/
public void visitDependences(Archive source, Visitor v, Type level) {
if (level == Type.SUMMARY) {
final ArchiveDeps result = results.get(source);
! final Set<Archive> reqs = result.requires();
! Stream<Archive> stream = reqs.stream();
! if (reqs.isEmpty()) {
! if (hasDependences(source) && type != Type.SUMMARY) {
! // If reqs.isEmpty() and we have dependences, then it means
! // that the dependences are from 'source' onto itself.
! // If type == SUMMARY - we can ignore that and report nothing,
! // as those dependences will not be reported.
! // However, if type is *not* summary - then we need to report
! // a dependency of 'source' into itself on the summary line,
! // because those dependences will be reported below.
! stream = Stream.of(source);
! }
! }
! stream.sorted(Comparator.comparing(Archive::getName))
.forEach(archive -> {
Profile profile = result.getTargetProfile(archive);
v.visitDependence(source.getName(), source,
profile != null ? profile.profileName() : archive.getName(), archive);
});
< prev index next >