< prev index next >
test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java
Print this page
rev 9430 : [mq]: PrintDirectives
rev 9150 : 8066166: JEP-JDK-8046155: Test task: dcmd tests
Summary: Tests for diagnostic command in CompilerControl
Reviewed-by: kvn
@@ -34,28 +34,27 @@
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
+import java.util.stream.Collectors;
public class JcmdStateBuilder implements StateBuilder<JcmdCommand> {
private static final List<Pair<Executable, Callable<?>>> METHODS
= new PoolHelper().getAllMethods();
private final Map<Executable, State> stateMap = new HashMap<>();
private final DirectiveBuilder directiveBuilder;
private Map<MethodDescriptor, List<CompileCommand>> matchBlocks
= new LinkedHashMap<>();
- private List<JcmdCommand> commands = new ArrayList<>();
private boolean isFileValid = true;
public JcmdStateBuilder(String fileName) {
directiveBuilder = new DirectiveBuilder(fileName);
}
@Override
public void add(JcmdCommand compileCommand) {
- commands.add(compileCommand);
switch (compileCommand.jcmdType) {
case ADD:
directiveBuilder.add(compileCommand);
addCommand(compileCommand);
break;
@@ -157,8 +156,17 @@
return new ArrayList<>();
}
@Override
public List<JcmdCommand> getCompileCommands() {
- return commands;
+ if (isFileValid) {
+ return matchBlocks.keySet().stream()
+ /* only method descriptor is required
+ to check print_directives */
+ .map(md -> new JcmdCommand(null, md, null, null,
+ Scenario.JcmdType.ADD))
+ .collect(Collectors.toList());
+ } else {
+ return new ArrayList<>();
+ }
}
}
< prev index next >