Use bounded wildcards in API in static methods to make it more conventional and flexible

This commit is contained in:
Alexey Kudravtsev
2018-10-01 13:42:18 +03:00
parent 32674967de
commit 9891772dec
5 changed files with 9 additions and 9 deletions

View File

@@ -1065,7 +1065,7 @@ public class ClassWriter {
return null;
}
public static void appendTypeParameters(TextBuffer buffer, List<String> parameters, List<List<GenericType>> bounds) {
public static void appendTypeParameters(TextBuffer buffer, List<String> parameters, List<? extends List<GenericType>> bounds) {
buffer.append('<');
for (int i = 0; i < parameters.size(); i++) {

View File

@@ -12,7 +12,7 @@ import java.util.Set;
public class DecHelper {
public static boolean checkStatementExceptions(List<Statement> lst) {
public static boolean checkStatementExceptions(List<? extends Statement> lst) {
Set<Statement> all = new HashSet<>(lst);
@@ -55,7 +55,7 @@ public class DecHelper {
return true;
}
public static boolean isChoiceStatement(Statement head, List<Statement> lst) {
public static boolean isChoiceStatement(Statement head, List<? super Statement> lst) {
Statement post = null;
@@ -189,7 +189,7 @@ public class DecHelper {
return setHandlers;
}
public static List<Exprent> copyExprentList(List<Exprent> lst) {
public static List<Exprent> copyExprentList(List<? extends Exprent> lst) {
List<Exprent> ret = new ArrayList<>();
for (Exprent expr : lst) {
ret.add(expr.copy());

View File

@@ -794,7 +794,7 @@ public class ExprProcessor implements CodeConstants {
return res;
}
public static TextBuffer listToJava(List<Exprent> lst, int indent, BytecodeMappingTracer tracer) {
public static TextBuffer listToJava(List<? extends Exprent> lst, int indent, BytecodeMappingTracer tracer) {
if (lst == null || lst.isEmpty()) {
return new TextBuffer();
}

View File

@@ -20,7 +20,7 @@ public class IfHelper {
return res;
}
private static boolean mergeAllIfsRec(Statement stat, Set<Integer> setReorderedIfs) {
private static boolean mergeAllIfsRec(Statement stat, Set<? super Integer> setReorderedIfs) {
boolean res = false;
if (stat.getExprents() == null) {
@@ -47,7 +47,7 @@ public class IfHelper {
return res;
}
public static boolean mergeIfs(Statement statement, Set<Integer> setReorderedIfs) {
public static boolean mergeIfs(Statement statement, Set<? super Integer> setReorderedIfs) {
if (statement.type != Statement.TYPE_IF && statement.type != Statement.TYPE_SEQUENCE) {
return false;
}

View File

@@ -85,7 +85,7 @@ public class StrongConnectivityHelper {
}
}
public static boolean isExitComponent(List<Statement> lst) {
public static boolean isExitComponent(List<? extends Statement> lst) {
Set<Statement> set = new HashSet<>();
for (Statement stat : lst) {
set.addAll(stat.getNeighbours(StatEdge.TYPE_REGULAR, Statement.DIRECTION_FORWARD));
@@ -95,7 +95,7 @@ public class StrongConnectivityHelper {
return (set.size() == 0);
}
public static List<Statement> getExitReps(List<List<Statement>> lst) {
public static List<Statement> getExitReps(List<? extends List<Statement>> lst) {
List<Statement> res = new ArrayList<>();
for (List<Statement> comp : lst) {