Einsetzen von generischen Typen gefixt

This commit is contained in:
JanUlrich 2014-04-26 17:41:53 +02:00
parent d053ce0b08
commit 64d01e8ee2

View File

@ -39,7 +39,21 @@ public class GenericTypeInsertPoint extends TypeInsertPoint {
@Override
protected Type getInsertType(){
if(genericPairs.size()==0)return this.type;
Iterator<Pair> it = genericPairs.iterator();
Vector<Pair> pairs = new Vector<Pair>();
//Problem: <P1 extends P2> ist falsch! Es muss: <P2, P1 extends P2> heißen:
Vector<Type> P1s = new Vector<Type>();
Vector<Type> P2s = new Vector<Type>();
for(Pair p : genericPairs){
P1s.add(p.TA1);
P2s.add(p.TA2);
}
for(Type t : P2s){
if(!P1s.contains(t))pairs.add(new Pair(t,null));
}
pairs.addAll(this.genericPairs);
Iterator<Pair> it = pairs.iterator();
String genericTypeParameters = "<";
while(it.hasNext()){
genericTypeParameters += new GenericTypeVar(it.next(), 0).printJavaCode(this.getResultSet());