Fehler behoben, Fehler behoben, Fehler behoben.

This commit is contained in:
JanUlrich 2015-01-23 15:28:15 +01:00
parent 615d2c633e
commit 99d3ecf030
2 changed files with 46 additions and 9 deletions

View File

@ -99,19 +99,37 @@ class GenericVarPatch {
*/
public void add(Pair p){
GenericVarExtendsDeclarationPatch toAdd = new GenericVarExtendsDeclarationPatch(p);
boolean mussDeklariertWerden = true;
for(GenericVarDeclarationPatch patch : genericVarDeclarations){
if(patch.genericVar.equals(p.TA2)){
mussDeklariertWerden = false;
break;
}
}
if(!this.genericVarExtendDeclarations.contains(toAdd))this.genericVarExtendDeclarations.add(toAdd);
if(mussDeklariertWerden && p.TA2 instanceof TypePlaceholder)this.add((TypePlaceholder)p.TA2);
}
public String getInsertString(ResultSet rs){
//Hier sollten TPHs nicht aufgelöst sondern in Generische Variablen umgewandelt werden:
String ret = "";
Iterator<GenericVarDeclarationPatch> it1 = this.genericVarDeclarations.iterator();
boolean bereitsVorhanden = false;
while(it1.hasNext()){
bereitsVorhanden = false;
GenericVarDeclarationPatch p = it1.next();
ret += p.getInsertString(rs);
if(it1.hasNext())ret += ", ";
//Kontrollieren, ob GenericVar bereits von den Extends Declarations definiert wird:
for(GenericVarExtendsDeclarationPatch pe : this.genericVarExtendDeclarations){
if(pe.definesGenericVar(p.genericVar)){
bereitsVorhanden = true;
}
}
if(bereitsVorhanden == false){
ret += p.getInsertString(rs);
if(it1.hasNext())ret += ", ";
}
}
if(this.genericVarExtendDeclarations.size()>0)ret+=", ";
if(this.genericVarExtendDeclarations.size()>0 && bereitsVorhanden == false)ret+=", ";
Iterator<GenericVarExtendsDeclarationPatch> it2 = this.genericVarExtendDeclarations.iterator();
while(it2.hasNext()){
GenericVarExtendsDeclarationPatch p = it2.next();
@ -120,7 +138,7 @@ class GenericVarPatch {
}
return ret;
}
public void add(TypePlaceholder tph) {
GenericVarDeclarationPatch toAdd = new GenericVarDeclarationPatch(tph);
if(!this.genericVarDeclarations.contains(toAdd))this.genericVarDeclarations.add(toAdd);
@ -145,6 +163,11 @@ class GenericVarExtendsDeclarationPatch {
private Pair genericPair;
public boolean definesGenericVar(TypePlaceholder tph){
if(genericPair.TA1.equals(tph))return true;
return false;
}
public GenericVarExtendsDeclarationPatch(Pair p) {
this.genericPair = p;
}
@ -178,17 +201,17 @@ class GenericVarExtendsDeclarationPatch {
*/
class GenericVarDeclarationPatch {
private TypePlaceholder genericPair;
TypePlaceholder genericVar;
public GenericVarDeclarationPatch(TypePlaceholder p) {
this.genericPair = p;
this.genericVar = p;
}
public String getInsertString(ResultSet resultSet){
String ret = "";
if(this.genericPair != null){
if(this.genericVar != null){
//ret += this.genericPair.printJavaCode(resultSet);
ret += this.genericPair.getName().toString();
ret += this.genericVar.getName().toString();
}
return ret;
}
@ -196,7 +219,12 @@ class GenericVarDeclarationPatch {
@Override
public boolean equals(Object o){
if(!(o instanceof GenericVarDeclarationPatch))return false;
if(!(this.genericPair.equals(((GenericVarDeclarationPatch)o).genericPair)))return false;
if(!(this.genericVar.equals(((GenericVarDeclarationPatch)o).genericVar)))return false;
return true;
}
@Override
public String toString(){
return genericVar.toString();
}
}

View File

@ -8,3 +8,12 @@ class OverloadingInMethod{
}
class OverloadingInMethod2{
<ABM, T11702297201, ABL extends ABM, R1702297201 extends ABL, C extends T11702297201> Fun1<? extends Fun1<? extends ABM, ? super Fun1<R1702297201, T11702297201>>, ? super C> m () {
Fun1<? extends Fun1<? extends ABM, ? super Fun1<R1702297201, T11702297201>>, ? super C> op;
op = (m) -> (f) -> f.apply(m);
return op;
}
}