Skip to content
Permalink
Browse files
minor refactor: remove groovy-macro style warnings
  • Loading branch information
paulk-asert committed Apr 19, 2022
1 parent 978cc4e commit b5301d60e470f69e2c82cb5f7a0902a6240b331b
Showing 2 changed files with 11 additions and 11 deletions.
@@ -613,8 +613,9 @@ public List<TreeContext> pathUpTo(Class<ASTNode> node, ASTNodePredicate predicat

// ----------------------------- inner classes --------------------------------------

@SuppressWarnings("unchecked")
public static List<ASTNodePredicate> matchByClass(Class<ASTNode>... classes) {
ArrayList<ASTNodePredicate> result = new ArrayList<ASTNodePredicate>(classes.length);
ArrayList<ASTNodePredicate> result = new ArrayList<>(classes.length);
for (final Class<ASTNode> astNodeClass : classes) {
result.add(new MatchByClass(astNodeClass));
}
@@ -37,13 +37,12 @@ private enum TreeContextKey {
}
final TreeContext parent;
final ASTNode node;
final List<TreeContext> siblings = new LinkedList<TreeContext>();
final List<TreeContextAction> onPopHandlers = new LinkedList<TreeContextAction>();
final Map<Object, List<?>> userdata = MapWithDefault.newInstance(
new HashMap<Object, List<?>>(),
new Closure(this) {
final List<TreeContext> siblings = new LinkedList<>();
final List<TreeContextAction> onPopHandlers = new LinkedList<>();
final Map<Object, List<Object>> userdata = MapWithDefault.newInstance(
new HashMap<Object, List<Object>>(),
new Closure<List<Object>>(this) {
private static final long serialVersionUID = -4694773031569936343L;

public Object doCall(Object key) {
return new LinkedList<Object>();
}
@@ -58,19 +57,20 @@ public Object doCall(Object key) {
}
}

public Map<?, List<?>> getUserdata() {
public Map<Object, List<Object>> getUserdata() {
return userdata;
}

@SuppressWarnings("unchecked")
public void putUserdata(Object key, Object value) {
((List)userdata.get(key)).add(value);
}

public List<?> getUserdata(Object key) {
public List<Object> getUserdata(Object key) {
return getUserdata(key,true);
}

public List<?> getUserdata(Object key, boolean searchParent) {
public List<Object> getUserdata(Object key, boolean searchParent) {
if (userdata.containsKey(key)) {
return userdata.get(key);
} else if (parent!=null && searchParent) {
@@ -136,7 +136,6 @@ public String toString() {
sb.append("<-");
p = p.parent;
}
//sb.append(", siblings=").append(siblings);
sb.append('}');
return sb.toString();
}

0 comments on commit b5301d6

Please sign in to comment.