undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
53
tests/support/AbstractTestNode.java
Normal file
53
tests/support/AbstractTestNode.java
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
package support;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Concrete TarjanNode subclass for use in tests.
|
||||
*
|
||||
* Because GraphUtils.TarjanNode is an abstract class in an internal package
|
||||
* (com.sun.tools.javac.util), tests that exercise GraphUtils.tarjan() directly
|
||||
* must extend it. This class provides a minimal, concrete implementation.
|
||||
*
|
||||
* Usage (requires --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED):
|
||||
*
|
||||
* AbstractTestNode n = new AbstractTestNode("N0");
|
||||
* n.addDep(other);
|
||||
* GraphUtils.tarjan(List.of(n));
|
||||
*/
|
||||
public class AbstractTestNode
|
||||
extends com.sun.tools.javac.util.GraphUtils.TarjanNode<String, AbstractTestNode> {
|
||||
|
||||
private final List<AbstractTestNode> deps = new ArrayList<>();
|
||||
|
||||
public AbstractTestNode(String label) {
|
||||
super(label);
|
||||
}
|
||||
|
||||
public void addDep(AbstractTestNode dep) {
|
||||
deps.add(dep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends AbstractTestNode> getAllDependencies() {
|
||||
return deps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.sun.tools.javac.util.GraphUtils.DependencyKind[] getSupportedDependencyKinds() {
|
||||
return new com.sun.tools.javac.util.GraphUtils.DependencyKind[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends AbstractTestNode> getDependenciesByKind(
|
||||
com.sun.tools.javac.util.GraphUtils.DependencyKind dk) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue