|
1 | 1 | /* |
2 | | - * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -138,25 +138,20 @@ private final class Renderer { |
138 | 138 |
|
139 | 139 | // Generates a graph in DOT format |
140 | 140 | String graph(TypeElement rootClass, Set<String> exports) { |
141 | | - if (!isInPublicApi(rootClass, exports)) { |
142 | | - // Alternatively we can return "" for the graph since there is no single root to render |
143 | | - throw new IllegalArgumentException("Root not in public API: " + rootClass.getQualifiedName()); |
144 | | - } |
145 | 141 | final State state = new State(rootClass); |
146 | 142 | traverse(state, rootClass, exports); |
147 | 143 | return state.render(); |
148 | 144 | } |
149 | 145 |
|
150 | 146 | static void traverse(State state, TypeElement node, Set<String> exports) { |
151 | | - if (!isInPublicApi(node, exports)) { |
152 | | - throw new IllegalArgumentException("Bad request, not in public API: " + node.getQualifiedName()); |
153 | | - } |
154 | 147 | state.addNode(node); |
155 | 148 | if (!(node.getModifiers().contains(Modifier.SEALED) || node.getModifiers().contains(Modifier.FINAL))) { |
156 | 149 | state.addNonSealedEdge(node); |
157 | 150 | } else { |
158 | 151 | for (TypeElement subNode : permittedSubclasses(node, exports)) { |
159 | | - state.addEdge(node, subNode); |
| 152 | + if (isInPublicApi(node, exports) && isInPublicApi(subNode, exports)) { |
| 153 | + state.addEdge(node, subNode); |
| 154 | + } |
160 | 155 | traverse(state, subNode, exports); |
161 | 156 | } |
162 | 157 | } |
|
0 commit comments