langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java
author mchung
Tue, 08 Jul 2014 18:26:34 -0700
changeset 25442 755ff386d1ac
parent 22163 3651128c74eb
child 25692 39537fdca12c
permissions -rw-r--r--
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API 8031092: jdeps does not recognize --help option. 8048063: (jdeps) Add filtering capability Reviewed-by: alanb, dfuchs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     1
/*
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
     2
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     4
 *
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    10
 *
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    15
 * accompanied this code).
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    16
 *
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    20
 *
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    23
 * questions.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    24
 */
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    25
package com.sun.tools.jdeps;
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    26
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    27
import com.sun.tools.classfile.Dependency.Location;
21046
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
    28
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    29
import java.util.Comparator;
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    30
import java.util.HashMap;
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    31
import java.util.HashSet;
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    32
import java.util.List;
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    33
import java.util.Map;
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    34
import java.util.Objects;
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    35
import java.util.Set;
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    36
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    37
/**
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    38
 * Dependency Analyzer.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    39
 */
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    40
public class Analyzer {
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    41
    /**
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    42
     * Type of the dependency analysis.  Appropriate level of data
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    43
     * will be stored.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    44
     */
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    45
    public enum Type {
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    46
        SUMMARY,
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    47
        PACKAGE,
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    48
        CLASS,
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    49
        VERBOSE
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 21503
diff changeset
    50
    }
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    51
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    52
    /**
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    53
     * Filter to be applied when analyzing the dependencies from the given archives.
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    54
     * Only the accepted dependencies are recorded.
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    55
     */
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    56
    interface Filter {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    57
        boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    58
    }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    59
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    60
    private final Type type;
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    61
    private final Filter filter;
21046
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
    62
    private final Map<Archive, ArchiveDeps> results = new HashMap<>();
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    63
    private final Map<Location, Archive> map = new HashMap<>();
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    64
    private final Archive NOT_FOUND
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    65
        = new Archive(JdepsTask.getMessage("artifact.not.found"));
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    66
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    67
    /**
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    68
     * Constructs an Analyzer instance.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    69
     *
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    70
     * @param type Type of the dependency analysis
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    71
     * @param filter
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    72
     */
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    73
    public Analyzer(Type type, Filter filter) {
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    74
        this.type = type;
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    75
        this.filter = filter;
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    76
    }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    77
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    78
    /**
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    79
     * Performs the dependency analysis on the given archives.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    80
     */
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
    81
    public void run(List<Archive> archives) {
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    82
        // build a map from Location to Archive
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    83
        buildLocationArchiveMap(archives);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    84
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    85
        // traverse and analyze all dependencies
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    86
        for (Archive archive : archives) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    87
            ArchiveDeps deps = new ArchiveDeps(archive, type);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    88
            archive.visitDependences(deps);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    89
            results.put(archive, deps);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    90
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    91
    }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    92
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    93
    private void buildLocationArchiveMap(List<Archive> archives) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
    94
        // build a map from Location to Archive
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    95
        for (Archive archive: archives) {
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    96
            for (Location l: archive.getClasses()) {
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    97
                if (!map.containsKey(l)) {
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    98
                    map.put(l, archive);
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
    99
                } else {
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   100
                    // duplicated class warning?
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   101
                }
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   102
            }
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   103
        }
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   104
    }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   105
21046
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
   106
    public boolean hasDependences(Archive archive) {
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
   107
        if (results.containsKey(archive)) {
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   108
            return results.get(archive).dependencies().size() > 0;
21046
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
   109
        }
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
   110
        return false;
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
   111
    }
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
   112
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   113
    public interface Visitor {
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   114
        /**
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   115
         * Visits a recorded dependency from origin to target which can be
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   116
         * a fully-qualified classname, a package name, a module or
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   117
         * archive name depending on the Analyzer's type.
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   118
         */
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   119
        public void visitDependence(String origin, Archive originArchive,
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   120
                                    String target, Archive targetArchive);
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   121
    }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   122
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   123
    /**
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   124
     * Visit the dependencies of the given source.
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   125
     * If the requested level is SUMMARY, it will visit the required archives list.
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   126
     */
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   127
    public void visitDependences(Archive source, Visitor v, Type level) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   128
        if (level == Type.SUMMARY) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   129
            final ArchiveDeps result = results.get(source);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   130
            result.requires().stream()
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   131
                  .sorted(Comparator.comparing(Archive::getName))
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   132
                  .forEach(archive -> {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   133
                      Profile profile = result.getTargetProfile(archive);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   134
                      v.visitDependence(source.getName(), source,
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   135
                                        profile != null ? profile.profileName() : archive.getName(), archive);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   136
                  });
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   137
        } else {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   138
            ArchiveDeps result = results.get(source);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   139
            if (level != type) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   140
                // requesting different level of analysis
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   141
                result = new ArchiveDeps(source, level);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   142
                source.visitDependences(result);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   143
            }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   144
            result.dependencies().stream()
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   145
                  .sorted(Comparator.comparing(Dep::origin)
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   146
                                    .thenComparing(Dep::target))
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   147
                  .forEach(d -> v.visitDependence(d.origin(), d.originArchive(), d.target(), d.targetArchive()));
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   148
        }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   149
    }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   150
21046
ebf16a1a6328 8015912: jdeps support to output in dot file format
mchung
parents: 16550
diff changeset
   151
    public void visitDependences(Archive source, Visitor v) {
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   152
        visitDependences(source, v, type);
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   153
    }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   154
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   155
    /**
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   156
     * ArchiveDeps contains the dependencies for an Archive that can have one or
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   157
     * more classes.
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   158
     */
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   159
    class ArchiveDeps implements Archive.Visitor {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   160
        protected final Archive archive;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   161
        protected final Set<Archive> requires;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   162
        protected final Set<Dep> deps;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   163
        protected final Type level;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   164
        private Profile profile;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   165
        ArchiveDeps(Archive archive, Type level) {
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   166
            this.archive = archive;
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   167
            this.deps = new HashSet<>();
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   168
            this.requires = new HashSet<>();
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   169
            this.level = level;
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   170
        }
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   171
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   172
        Set<Dep> dependencies() {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   173
            return deps;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   174
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   175
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   176
        Set<Archive> requires() {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   177
            return requires;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   178
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   179
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   180
        Profile getTargetProfile(Archive target) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   181
            return JDKArchive.isProfileArchive(target) ? profile : null;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   182
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   183
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   184
        Archive findArchive(Location t) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   185
            Archive target = archive.getClasses().contains(t) ? archive : map.get(t);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   186
            if (target == null) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   187
                map.put(t, target = NOT_FOUND);
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   188
            }
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   189
            return target;
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   190
        }
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   191
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   192
        // return classname or package name depedning on the level
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   193
        private String getLocationName(Location o) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   194
            if (level == Type.CLASS || level == Type.VERBOSE) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   195
                return o.getClassName();
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   196
            } else {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   197
                String pkg = o.getPackageName();
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   198
                return pkg.isEmpty() ? "<unnamed>" : pkg;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   199
            }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   200
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   201
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   202
        @Override
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   203
        public void visit(Location o, Location t) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   204
            Archive targetArchive = findArchive(t);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   205
            if (filter.accepts(o, archive, t, targetArchive)) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   206
                addDep(o, t);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   207
                if (!requires.contains(targetArchive)) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   208
                    requires.add(targetArchive);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   209
                }
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   210
            }
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   211
            if (targetArchive instanceof JDKArchive) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   212
                Profile p = Profile.getProfile(t.getPackageName());
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   213
                if (profile == null || (p != null && p.compareTo(profile) > 0)) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   214
                    profile = p;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   215
                }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   216
            }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   217
        }
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   218
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   219
        private Dep curDep;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   220
        protected Dep addDep(Location o, Location t) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   221
            String origin = getLocationName(o);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   222
            String target = getLocationName(t);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   223
            Archive targetArchive = findArchive(t);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   224
            if (curDep != null &&
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   225
                    curDep.origin().equals(origin) &&
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   226
                    curDep.originArchive() == archive &&
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   227
                    curDep.target().equals(target) &&
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   228
                    curDep.targetArchive() == targetArchive) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   229
                return curDep;
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   230
            }
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   231
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   232
            Dep e = new Dep(origin, archive, target, targetArchive);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   233
            if (deps.contains(e)) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   234
                for (Dep e1 : deps) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   235
                    if (e.equals(e1)) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   236
                        curDep = e1;
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   237
                    }
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   238
                }
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   239
            } else {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   240
                deps.add(e);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   241
                curDep = e;
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   242
            }
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   243
            return curDep;
16550
f20e2521f3df 8005428: Update jdeps to read the same profile information as by javac
mchung
parents: 16290
diff changeset
   244
        }
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   245
    }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   246
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   247
    /*
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   248
     * Class-level or package-level dependency
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   249
     */
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   250
    class Dep {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   251
        final String origin;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   252
        final Archive originArchive;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   253
        final String target;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   254
        final Archive targetArchive;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   255
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   256
        Dep(String origin, Archive originArchive, String target, Archive targetArchive) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   257
            this.origin = origin;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   258
            this.originArchive = originArchive;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   259
            this.target = target;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   260
            this.targetArchive = targetArchive;
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   261
        }
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   262
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   263
        String origin() {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   264
            return origin;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   265
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   266
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   267
        Archive originArchive() {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   268
            return originArchive;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   269
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   270
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   271
        String target() {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   272
            return target;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   273
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   274
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   275
        Archive targetArchive() {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   276
            return targetArchive;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   277
        }
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   278
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   279
        @Override
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   280
        @SuppressWarnings("unchecked")
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   281
        public boolean equals(Object o) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   282
            if (o instanceof Dep) {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   283
                Dep d = (Dep) o;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   284
                return this.origin.equals(d.origin) &&
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   285
                        this.originArchive == d.originArchive &&
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   286
                        this.target.equals(d.target) &&
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   287
                        this.targetArchive == d.targetArchive;
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   288
            }
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   289
            return false;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   290
        }
21503
45fc62482cae 8027481: jdeps to handle classes with the same package name and correct profile for javax.crypto.*
mchung
parents: 21046
diff changeset
   291
25442
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   292
        @Override
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   293
        public int hashCode() {
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   294
            int hash = 7;
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   295
            hash = 67*hash + Objects.hashCode(this.origin)
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   296
                           + Objects.hashCode(this.originArchive)
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   297
                           + Objects.hashCode(this.target)
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   298
                           + Objects.hashCode(this.targetArchive);
755ff386d1ac 8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents: 22163
diff changeset
   299
            return hash;
16290
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   300
        }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   301
    }
b0b4f52de7ea 8006225: tools/jdeps/Basic.java failes with AssertionError
mchung
parents:
diff changeset
   302
}