Commit 5800edd8 authored by Lubomir Bulej's avatar Lubomir Bulej

Remove setMultipleValDelim() from the marker Parameter class

This was a source of issues with markers which forgot to set the
delimiter prior to requesting multiple values. Instead, the
getMultipleValues() method has been modified to require the delimiter
as an argument, forcing the users of the Parameter class to supply the
delimiter on use. The BytecodeMarker, InsnNodeMarker, and the
StrictBytecodeMarker were updated to reflect the change.
parent d9755659
Pipeline #3294 passed with stages
in 3 minutes and 3 seconds
......@@ -22,18 +22,13 @@ import ch.usi.dag.disl.util.AsmOpcodes;
*/
public class BytecodeMarker extends AbstractDWRMarker {
protected static final String INSTR_DELIM = ",";
protected Set <Integer> searchedInstrNums = new HashSet <Integer> ();
public BytecodeMarker (final Parameter param) throws MarkerException {
// set delim for instruction list
param.setMultipleValDelim (INSTR_DELIM);
// translate all instructions to opcodes
for (final String instr : param.getMultipleValues ()) {
for (final String instr : param.getMultipleValues (",")) {
try {
final AsmOpcodes opcode = AsmOpcodes.valueOf (
instr.trim ().toUpperCase ()
......
......@@ -26,11 +26,8 @@ public class InsnNodeMarker extends AbstractInsnMarker {
classes = new HashSet<Class<? extends AbstractInsnNode>>();
// set delimiter for list of *InsnNode classes
param.setMultipleValDelim (",");
// translate all instructions to opcodes
for (String className : param.getMultipleValues()) {
for (String className : param.getMultipleValues(",")) {
try {
......
......@@ -7,8 +7,6 @@ public final class Parameter {
protected String __value;
protected String __delimiter;
/**
* Create parameter with a value.
*/
......@@ -16,12 +14,6 @@ public final class Parameter {
__value = value;
}
/**
* Set delimiter for multi-value parsing.
*/
public void setMultipleValDelim(final String delim) {
__delimiter = delim;
}
/**
* Get parameter value.
......@@ -30,10 +22,17 @@ public final class Parameter {
return __value;
}
/**
* @return Array of values split using a predefined delimiter.
* Retrieves multiple values by splitting the annotation parameter using the
* given delimiter.
*
* @param delimiter
* the delimiter to use for splitting the parameter
* @return An array of values obtained by splitting the annotation
* parameter.
*/
public String [] getMultipleValues () {
return __value.split (__delimiter);
public String [] getMultipleValues (final String delimiter) {
return __value.split (delimiter);
}
}
......@@ -30,7 +30,7 @@ public class StrictBytecodeMarker extends AbstractInsnMarker {
public StrictBytecodeMarker(Parameter param) throws MarkerException {
// translate all instructions to opcodes
for (String instr : param.getMultipleValues()) {
for (String instr : param.getMultipleValues(",")) {
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment