Bytecode-Generierung generiert jetzt wieder Bytecode für alle möglichen Typen.
This commit is contained in:
parent
481986e8ab
commit
11bee80969
@ -1,6 +1,7 @@
|
|||||||
package de.dhbwstuttgart.bytecode;
|
package de.dhbwstuttgart.bytecode;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -53,7 +54,7 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
public static RefTypeOrTPHOrWildcardOrGeneric THISTYPE = null;
|
public static RefTypeOrTPHOrWildcardOrGeneric THISTYPE = null;
|
||||||
String className;
|
String className;
|
||||||
private boolean isInterface;
|
private boolean isInterface;
|
||||||
private List<ResultSet> listOfResultSets;
|
private Collection<ResultSet> listOfResultSets;
|
||||||
private ResultSet resultSet;
|
private ResultSet resultSet;
|
||||||
private SourceFile sf;
|
private SourceFile sf;
|
||||||
private String path;
|
private String path;
|
||||||
@ -93,7 +94,7 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
this.simplifyResultsList = simplifyResultsList;
|
this.simplifyResultsList = simplifyResultsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BytecodeGen(HashMap<String,byte[]> classFiles, List<ResultSet> listOfResultSets,SourceFile sf ,String path) {
|
public BytecodeGen(HashMap<String,byte[]> classFiles, Collection<ResultSet> listOfResultSets,SourceFile sf ,String path) {
|
||||||
this.classFiles = classFiles;
|
this.classFiles = classFiles;
|
||||||
this.listOfResultSets = listOfResultSets;
|
this.listOfResultSets = listOfResultSets;
|
||||||
this.sf = sf;
|
this.sf = sf;
|
||||||
|
@ -32,22 +32,34 @@ public class ResultSet {
|
|||||||
if(type instanceof TypePlaceholder)
|
if(type instanceof TypePlaceholder)
|
||||||
return new Resolver(this).resolve((TypePlaceholder)type);
|
return new Resolver(this).resolve((TypePlaceholder)type);
|
||||||
if(type instanceof GenericRefType)return new ResolvedType(type, new HashSet<>());
|
if(type instanceof GenericRefType)return new ResolvedType(type, new HashSet<>());
|
||||||
if(type instanceof RefType){
|
if(type instanceof RefType) {
|
||||||
RelatedTypeWalker related = new RelatedTypeWalker(null, this);
|
RelatedTypeWalker related = new RelatedTypeWalker(null, this);
|
||||||
type.accept(related);
|
type.accept(related);
|
||||||
return new ResolvedType(type, related.relatedTPHs);
|
return new ResolvedType(type, related.relatedTPHs);
|
||||||
}else{
|
} else {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
//return new ResolvedType(type,new HashSet<>());
|
//return new ResolvedType(type,new HashSet<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Beim Einsetzen eines Generics, müssen die new und Methodenaufrufe verändert werden
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return results.toString();
|
return results.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (o instanceof ResultSet) {
|
||||||
|
ResultSet other = (ResultSet)o;
|
||||||
|
return this.results.equals(other.results);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return results.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Resolver implements ResultSetVisitor {
|
class Resolver implements ResultSetVisitor {
|
||||||
|
Loading…
Reference in New Issue
Block a user