Weitere obsolete Methoden entfernt. TypeInsertPoint angefügt
This commit is contained in:
parent
bda8dbe671
commit
3cd6b2f792
File diff suppressed because one or more lines are too long
@ -180,41 +180,6 @@ public class SourceFile
|
|||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
|
||||||
// ino.method.sc_check.21391.defdescription type=javadoc
|
|
||||||
/**
|
|
||||||
* DEPRECATED. Wird nicht mehr benutzt, TypeReconstruction uebernimmt
|
|
||||||
* diese Aufgabe.
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.method.sc_check.21391.definition
|
|
||||||
public void sc_check(boolean ext)
|
|
||||||
throws SCException // Semantikcheck
|
|
||||||
// ino.end
|
|
||||||
// ino.method.sc_check.21391.body
|
|
||||||
{
|
|
||||||
SCException except=null;
|
|
||||||
|
|
||||||
for( Enumeration<Class> el = KlassenVektor.elements(); el.hasMoreElements(); )
|
|
||||||
{
|
|
||||||
Class sc_class = el.nextElement();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
sc_class.sc_check( KlassenVektor, ext );
|
|
||||||
}
|
|
||||||
catch (SCClassException ex)
|
|
||||||
{
|
|
||||||
ex.printStackTrace();
|
|
||||||
if(except==null)
|
|
||||||
except=new SCException();
|
|
||||||
except.add_classexceptions(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(except!=null)
|
|
||||||
throw except;
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.addElement.21394.defdescription type=javadoc
|
// ino.method.addElement.21394.defdescription type=javadoc
|
||||||
/**
|
/**
|
||||||
* Fuegt ein neues Element (Interface oder Klasse) hinzu.
|
* Fuegt ein neues Element (Interface oder Klasse) hinzu.
|
||||||
|
@ -320,69 +320,6 @@ public class Class extends AClassOrInterface
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.sc_check.23065.definition
|
|
||||||
public void sc_check(Vector<Class> classlist, boolean ext)
|
|
||||||
throws SCClassException
|
|
||||||
// ino.end
|
|
||||||
// ino.method.sc_check.23065.body
|
|
||||||
{
|
|
||||||
|
|
||||||
// Der normale Semantik-Check - Aufgabe: Initialisierung der Class-Hashtable und Aufruf des Semantik-Checks
|
|
||||||
// otth: Diese Funktion wird f�r alle Objekte vom Typ 'Class`,
|
|
||||||
// otth: die im Vector Sourcefile.classes gespeichert sind, im Sourcefile aufgerufen.
|
|
||||||
|
|
||||||
// PARAMETRISIERTE TYPEN
|
|
||||||
try
|
|
||||||
{
|
|
||||||
para_check(classlist,ext);
|
|
||||||
}
|
|
||||||
catch(SCClassException ex)
|
|
||||||
{
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialisierung der Hash-Tabelle!
|
|
||||||
// erbt die Klasse von einer anderen???
|
|
||||||
String strSuperKlassenName = null;
|
|
||||||
if( superclassid != null )
|
|
||||||
{
|
|
||||||
Vector superclass = superclassid.get_Name(); // 'superclass'-nur ein Element, da in Java keine Mehrfachver.
|
|
||||||
for( Enumeration el = superclass.elements(); el.hasMoreElements(); )
|
|
||||||
{
|
|
||||||
strSuperKlassenName = (String) el.nextElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hash-Tabelle aufrufen!
|
|
||||||
try
|
|
||||||
{
|
|
||||||
body.sc_init_hashtable( classlist, strSuperKlassenName, getName(), ext );
|
|
||||||
}
|
|
||||||
catch (SCClassBodyException ex)
|
|
||||||
{
|
|
||||||
SCClassException except = new SCClassException();
|
|
||||||
except.addException(ex.get_exlist());
|
|
||||||
except.addClassname(getName());
|
|
||||||
throw except;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Semantik-Check aufrufen
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
body.sc_check( classlist,ext );
|
|
||||||
}
|
|
||||||
catch (SCClassBodyException ex)
|
|
||||||
{
|
|
||||||
SCClassException except = new SCClassException();
|
|
||||||
except.addException( ex.get_exlist() );
|
|
||||||
except.addClassname( getName() );
|
|
||||||
throw except;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.sc_check_for_extended_classes.23068.definition
|
// ino.method.sc_check_for_extended_classes.23068.definition
|
||||||
public void sc_check_for_extended_classes(Vector<Class> classlist, Hashtable<String,String> childhash,boolean ext)
|
public void sc_check_for_extended_classes(Vector<Class> classlist, Hashtable<String,String> childhash,boolean ext)
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -1041,202 +978,6 @@ public class Class extends AClassOrInterface
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.TRStart.23116.defdescription type=javadoc
|
|
||||||
/**
|
|
||||||
* Zentrale Methode des Typrekonstruktionsalgorithmus zur Steuerung des Ablaufs
|
|
||||||
* zwischen den einzelnen Methoden und Konstruktion der Ergebnismengen.<br/>
|
|
||||||
* (siehe Algorithmus 5.18 TRStart, Martin Pl�micke)
|
|
||||||
* <br/>Author: J�rg B�uerle
|
|
||||||
* @param methodList
|
|
||||||
* @param V
|
|
||||||
* @param V_fields_methods
|
|
||||||
* @param supportData
|
|
||||||
* @return Menge aller neu berechneter, m�glichen Typkombinationen in Form von
|
|
||||||
* 2-Tupeln aus einer Menge von Unifiern und einer Menge von Typannahmen ==>
|
|
||||||
* (sigma, V)
|
|
||||||
* @throws CTypeReconstructionException
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRStart.23116.definition
|
|
||||||
private CReconstructionTupleSet TRStart(Vector<Method> methodList, Vector<CTypeAssumptionSet> V, CTypeAssumptionSet V_fields_methods, CSupportData supportData)
|
|
||||||
throws CTypeReconstructionException
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRStart.23116.body
|
|
||||||
{
|
|
||||||
// --------------------------
|
|
||||||
// Startdaten vorbereiten:
|
|
||||||
// --------------------------
|
|
||||||
inferencelog.debug("Bereite Startdaten vor...");
|
|
||||||
V.insertElementAt(new CTypeAssumptionSet(), 0); // V_0
|
|
||||||
CReconstructionTupleSet ret = new CReconstructionTupleSet(); // ret_0
|
|
||||||
ret.addElement(new CReconstructionTuple(new CSubstitutionSet(), V_fields_methods));
|
|
||||||
// --------------------------
|
|
||||||
// Alle n Methoden durchgehen:
|
|
||||||
// --------------------------
|
|
||||||
for(int i=1; i<methodList.size()+1; i++){
|
|
||||||
Method currentMethod = methodList.elementAt(i-1);
|
|
||||||
// --------------------------
|
|
||||||
// TRNextMeth rufen:
|
|
||||||
// --------------------------
|
|
||||||
inferencelog.debug("Rufe TRNextMeth f�r Methode \""+currentMethod.get_Method_Name()+"()\"");
|
|
||||||
CTripleSet triples = this.TRNextMeth(V.elementAt(i-1), V.elementAt(i), ret, currentMethod, supportData);
|
|
||||||
inferencelog.debug("Bin zur�ck in TRStart().");
|
|
||||||
ret = new CReconstructionTupleSet();
|
|
||||||
// --------------------------
|
|
||||||
// Alle m Triple durchgehen:
|
|
||||||
// --------------------------
|
|
||||||
inferencelog.debug("Durchlaufe Menge der Ergebnis-Triple...");
|
|
||||||
Iterator<CTriple> it = triples.getIterator();
|
|
||||||
|
|
||||||
// HOTI 14.5.06
|
|
||||||
// HadAChance gibt an, ob überhaupt eine Typannahme vom Inferieren zurückkam
|
|
||||||
// Wenn false, dann ausgeben, dass keine zurück kam
|
|
||||||
// Wenn true, nachschauen, ob diese Typannahme(n) mit dem Returntyp unifizierbar sind!
|
|
||||||
// Die unifizierbaren zählt successfulls
|
|
||||||
// Wenn successfulls nachher==0 ausgeben, dass kein Returntyp passt. Ansonsten ist alles o.k.
|
|
||||||
boolean hadAChance=it.hasNext();
|
|
||||||
int successfulls=0;
|
|
||||||
Vector<CTypeReconstructionException> exceptions=new Vector<CTypeReconstructionException>();
|
|
||||||
while(it.hasNext()){
|
|
||||||
CTriple triple = it.next();
|
|
||||||
// --------------------------
|
|
||||||
// Typannahme f�r R�ckgabewert der Methode extrahieren:
|
|
||||||
// --------------------------
|
|
||||||
CTypeAssumptionSet V_j = triple.getAssumptionSet();
|
|
||||||
Type theta = this.RetType(currentMethod, V_j);
|
|
||||||
// --------------------------
|
|
||||||
// Extrahierte Typannahme mit zur�ckgelieferter Typannahme
|
|
||||||
// des Blocks unifizieren:
|
|
||||||
// --------------------------
|
|
||||||
inferencelog.debug("Rufe Unify() f�r ReturnType...");
|
|
||||||
Iterator<Vector<Pair>> unifierPossibilities = Unify.unify(triple.getResultType(), theta, supportData.getFiniteClosure()).iterator();
|
|
||||||
inferencelog.debug("Wende Unifier an...");
|
|
||||||
CReconstructionTuple resultTuple = null;
|
|
||||||
// --------------------------
|
|
||||||
// Wenn Unifier vorhanden, dann anwenden:
|
|
||||||
// --------------------------
|
|
||||||
if(unifierPossibilities.hasNext()){
|
|
||||||
// --------------------------
|
|
||||||
// Alle m�glichen Unifier auf V_j anwenden:
|
|
||||||
// --------------------------
|
|
||||||
successfulls++;
|
|
||||||
while(unifierPossibilities.hasNext()){
|
|
||||||
CSubstitutionSet unifier = new CSubstitutionSet(unifierPossibilities.next());
|
|
||||||
// --------------------------
|
|
||||||
// Typannahmen bauen:
|
|
||||||
// --------------------------
|
|
||||||
CTypeAssumptionSet V_j_substituted = V_j.deepCopy();
|
|
||||||
V_j_substituted.sub(unifier);
|
|
||||||
// --------------------------
|
|
||||||
// Substitutionen bauen:
|
|
||||||
// --------------------------
|
|
||||||
CSubstitutionSet substSet = triple.getSubstitutions().deepCopy();
|
|
||||||
substSet.applyUnifier(unifier);
|
|
||||||
substSet.unite(unifier);
|
|
||||||
// --------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
resultTuple = new CReconstructionTuple(substSet, V_j_substituted);
|
|
||||||
// --------------------------
|
|
||||||
// Tuple zu R�ckgabemenge hinzuf�gen
|
|
||||||
// (entspricht der Vereinigung in Algorithmus 5.18, Martin Pl�micke):
|
|
||||||
// --------------------------
|
|
||||||
inferencelog.warn("##########################################");
|
|
||||||
inferencelog.warn("F�ge neues passendes Ergebnis-Tuple hinzu:");
|
|
||||||
inferencelog.warn("##########################################");
|
|
||||||
inferencelog.warn(resultTuple.toString());
|
|
||||||
inferencelog.warn("##########################################\n");
|
|
||||||
ret.addElement(resultTuple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// --------------------------
|
|
||||||
// Ansonsten ohne Unifier hinzuf�gen:
|
|
||||||
// --------------------------
|
|
||||||
else{
|
|
||||||
exceptions.addElement(new CTypeReconstructionException("Der berechnete Return-Typ("+triple.getResultType()+") laesst sich nicht mit dem Return-Typ der Methode ("+this.RetType(currentMethod, V_j)+") unifizieren.",currentMethod));
|
|
||||||
//resultTuple = new CReconstructionTuple(triple.getSubstitutions(), V_j);
|
|
||||||
//inferencelog.warn("");
|
|
||||||
//inferencelog.warn("#########################################");
|
|
||||||
//inferencelog.warn("Fuege neues unpassendes Ergebnis-Tuple hinzu:");
|
|
||||||
//inferencelog.warn("##########################################");
|
|
||||||
//inferencelog.warn(resultTuple.toString());
|
|
||||||
//inferencelog.warn("##########################################\n");
|
|
||||||
//ret.addElement(resultTuple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(hadAChance && successfulls==0 && exceptions.size()>0) {
|
|
||||||
if(exceptions.size()==1){
|
|
||||||
throw exceptions.elementAt(0);
|
|
||||||
}
|
|
||||||
throw new CTypeReconstructionException("Die berechneten Return-Typen lassen sich nicht mit dem Return-Typ der Methode unifizieren.",exceptions,currentMethod);
|
|
||||||
}
|
|
||||||
// --------------------------
|
|
||||||
// TupleSet "ret" geht als Eingabewert bzw. Vorkenntnis
|
|
||||||
// in den n�chsten Schleifendurchlauf, d.h. in TRNextMeth
|
|
||||||
// f�r die n�chste Methode, ein...
|
|
||||||
// --------------------------
|
|
||||||
}
|
|
||||||
// --------------------------
|
|
||||||
// Nach dem letzten Schleifendurchlauf
|
|
||||||
// TupleSet "ret" als Ergebnis zur�ckgeben:
|
|
||||||
// --------------------------
|
|
||||||
|
|
||||||
for(int i=0;i<ret.getCardinality();i++){
|
|
||||||
CReconstructionTuple tuple=ret.getVector().elementAt(i);
|
|
||||||
CTypeAssumptionSet V_j_substituted=tuple.getAssumSet();
|
|
||||||
// HOTI 25.5.06
|
|
||||||
// Suche nach nicht erkannten TypePlaceholdern in den Parametern
|
|
||||||
// und Rückgabewerten der Methoden
|
|
||||||
|
|
||||||
Hashtable<TypePlaceholder, CMethodTypeAssumption> typePlaceholderHasMethod=new Hashtable<TypePlaceholder, CMethodTypeAssumption>();
|
|
||||||
|
|
||||||
Vector<TypePlaceholder> tphs=new Vector<TypePlaceholder>();
|
|
||||||
Hashtable<IHashSetKey, CTypeAssumption> data = V_j_substituted.getHashtable();
|
|
||||||
Collection<CTypeAssumption> values=data.values();
|
|
||||||
Iterator<CTypeAssumption> myit=values.iterator();
|
|
||||||
while(myit.hasNext()){
|
|
||||||
CTypeAssumption myassum=myit.next();
|
|
||||||
if(myassum instanceof CMethodTypeAssumption){
|
|
||||||
CMethodTypeAssumption mAssum=(CMethodTypeAssumption)myassum;
|
|
||||||
Type aT=mAssum.getAssumedType();
|
|
||||||
if(aT instanceof TypePlaceholder && !tphs.contains(aT)){
|
|
||||||
tphs.addElement((TypePlaceholder)aT);
|
|
||||||
typePlaceholderHasMethod.put((TypePlaceholder)aT,mAssum);
|
|
||||||
}
|
|
||||||
Vector<CParaTypeAssumption> paras=mAssum.getParaAssumptions();
|
|
||||||
if(paras!=null){
|
|
||||||
for(int j=0;j<paras.size();j++){
|
|
||||||
Type pT=paras.elementAt(j).getAssumedType();
|
|
||||||
if(pT instanceof TypePlaceholder && !tphs.contains(pT)){
|
|
||||||
tphs.addElement((TypePlaceholder)pT);
|
|
||||||
typePlaceholderHasMethod.put((TypePlaceholder)pT,mAssum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mache diese zu MethodenGenerics
|
|
||||||
CSubstitutionSet sub = new CSubstitutionSet();
|
|
||||||
for(int j=0;j<tphs.size();j++){
|
|
||||||
TypePlaceholder var=tphs.elementAt(j);
|
|
||||||
GenericTypeVar gtv=new GenericTypeVar(TypePlaceholder.fresh().getName(),-1);
|
|
||||||
CMethodTypeAssumption meth=typePlaceholderHasMethod.get(var);
|
|
||||||
if(meth!=null){
|
|
||||||
sub.addElement(new CSubstitution(var,gtv));
|
|
||||||
meth.getGenericMethodParameters().addElement(gtv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
V_j_substituted.sub(sub);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.RetType.23119.defdescription type=javadoc
|
// ino.method.RetType.23119.defdescription type=javadoc
|
||||||
/**
|
/**
|
||||||
* Liefert den berechneten R<EFBFBD>ckgabetyp f<EFBFBD>r die <EFBFBD>bergebene Methode zur<EFBFBD>ck.<br/>
|
* Liefert den berechneten R<EFBFBD>ckgabetyp f<EFBFBD>r die <EFBFBD>bergebene Methode zur<EFBFBD>ck.<br/>
|
||||||
@ -1260,70 +1001,7 @@ public class Class extends AClassOrInterface
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.TRNextMeth.23122.defdescription type=javadoc
|
// ino.method.toString.23125.defdescription type=javadoc
|
||||||
/**
|
|
||||||
* Erweitert die bisherigen Teilergebnisse um weitere Informationen aus dem
|
|
||||||
* �bergebenen Block der aktuellen Methode.<br/>
|
|
||||||
* (siehe Algorithmus TRNextMeth, Martin Pl�micke)
|
|
||||||
* <br/>Author: J�rg B�uerle
|
|
||||||
* @param V_last
|
|
||||||
* @param V_next
|
|
||||||
* @param tupleSet
|
|
||||||
* @param nextMethod
|
|
||||||
* @param supportData
|
|
||||||
* @return
|
|
||||||
* @throws CTypeReconstructionException
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRNextMeth.23122.definition
|
|
||||||
private CTripleSet TRNextMeth(CTypeAssumptionSet V_last, CTypeAssumptionSet V_next, CReconstructionTupleSet tupleSet, Method nextMethod, CSupportData supportData)
|
|
||||||
throws CTypeReconstructionException
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRNextMeth.23122.body
|
|
||||||
{
|
|
||||||
Block Bl = nextMethod.get_Block();
|
|
||||||
CTripleSet returnSet = new CTripleSet();
|
|
||||||
// --------------------------
|
|
||||||
// Alle Tupel durchgehen:
|
|
||||||
// --------------------------
|
|
||||||
Vector<CTypeReconstructionException> exceptions=new Vector<CTypeReconstructionException>();
|
|
||||||
int successfulls=0;
|
|
||||||
Iterator<CReconstructionTuple> tuples = tupleSet.getIterator();
|
|
||||||
while(tuples.hasNext()){
|
|
||||||
CReconstructionTuple currentTuple = tuples.next();
|
|
||||||
CTypeAssumptionSet V_i = currentTuple.getAssumSet().shallowCopy();
|
|
||||||
CSubstitutionSet sigma_i = currentTuple.getSubSet().shallowCopy();
|
|
||||||
V_next = V_next.deepCopy();
|
|
||||||
V_next.sub(sigma_i);
|
|
||||||
//this.removeOldLocalVars(V_i, V_last); // Wird ganz am Ende �ber clear() in TRProg() gemacht --> hier nicht mehr n�tig
|
|
||||||
V_i.unite(V_next);
|
|
||||||
|
|
||||||
supportData.setCurrentMethod(nextMethod.get_Method_Name());
|
|
||||||
supportData.setCurrentMethodParaCount(nextMethod.getParameterCount());
|
|
||||||
supportData.setCurrentMethodOverloadedID(nextMethod.getOverloadedID());
|
|
||||||
supportData.resetBlockId();
|
|
||||||
|
|
||||||
try{
|
|
||||||
CTripleSet tripleSet = Bl.TRStatement(sigma_i, V_i, supportData);
|
|
||||||
returnSet.unite(tripleSet);
|
|
||||||
successfulls++;
|
|
||||||
}catch(CTypeReconstructionException tre){
|
|
||||||
exceptions.addElement(tre);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(successfulls==0&& exceptions.size()>0){
|
|
||||||
if(exceptions.size()==1){
|
|
||||||
throw exceptions.elementAt(0);
|
|
||||||
}
|
|
||||||
throw new CTypeReconstructionException("Class: Es konnte keine Assumption gefunden werden, die auf die Anforderung passt.",exceptions,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnSet;
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.toString.23125.defdescription type=javadoc
|
|
||||||
/**
|
/**
|
||||||
* <br/>Author: Martin Pl<EFBFBD>micke
|
* <br/>Author: Martin Pl<EFBFBD>micke
|
||||||
* @return
|
* @return
|
||||||
|
@ -226,53 +226,6 @@ public class ClassBody
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.sc_check.23167.definition
|
|
||||||
public void sc_check(Vector<Class> classlist, boolean ext)
|
|
||||||
throws SCClassBodyException
|
|
||||||
// ino.end
|
|
||||||
// ino.method.sc_check.23167.body
|
|
||||||
{
|
|
||||||
// In den Methoden der Klasse wird der Semantik-Check aufgerufen
|
|
||||||
|
|
||||||
SCClassBodyException except = null;
|
|
||||||
SCExcept hilfex;
|
|
||||||
Vector<SCExcept> v;
|
|
||||||
|
|
||||||
// otth: Schleife <EFBFBD>ber alle Felddeklarationen - wenn Methode gefunden wird --> Semantik-Check dort aufrufen!!!
|
|
||||||
for( Enumeration<FieldDecl> el = fielddecl.elements(); el.hasMoreElements(); )
|
|
||||||
{
|
|
||||||
Object tempObjekt = el.nextElement();;
|
|
||||||
Method tempMethod = null;
|
|
||||||
if( tempObjekt instanceof Method )
|
|
||||||
{
|
|
||||||
tempMethod = (Method)tempObjekt;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Semantikcheck f<EFBFBD>r die Methode aufrufen!
|
|
||||||
tempMethod.call_sc_check( classlist, this.hash, ext, this.paraclasshash );
|
|
||||||
}
|
|
||||||
catch (SCMethodException ex)
|
|
||||||
{
|
|
||||||
if(except==null)
|
|
||||||
except=new SCClassBodyException();
|
|
||||||
v=ex.get_exlist();
|
|
||||||
for (Enumeration<SCExcept> el2=v.elements(); el2.hasMoreElements();)
|
|
||||||
{
|
|
||||||
hilfex=el2.nextElement();
|
|
||||||
hilfex.set_function( tempMethod.get_Method_Name() );
|
|
||||||
except.addException(hilfex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fehler werfen
|
|
||||||
if( except != null )
|
|
||||||
throw except;
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
|
|
||||||
// ino.method.init_parahashtable.23170.defdescription type=line
|
// ino.method.init_parahashtable.23170.defdescription type=line
|
||||||
//
|
//
|
||||||
// ***NEU*****************************************************************************
|
// ***NEU*****************************************************************************
|
||||||
|
@ -6,6 +6,8 @@ import java.util.Vector;
|
|||||||
|
|
||||||
import typinferenz.JavaCodeResult;
|
import typinferenz.JavaCodeResult;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
|
import typinferenz.Typable;
|
||||||
|
import typinferenz.TypeInsertable;
|
||||||
import typinferenz.assumptions.TypeAssumptions;
|
import typinferenz.assumptions.TypeAssumptions;
|
||||||
import mycompiler.mybytecode.ClassFile;
|
import mycompiler.mybytecode.ClassFile;
|
||||||
import mycompiler.myexception.JVMCodeException;
|
import mycompiler.myexception.JVMCodeException;
|
||||||
@ -15,7 +17,7 @@ import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
|||||||
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
||||||
|
|
||||||
// ino.class.FieldDecl.23367.declaration
|
// ino.class.FieldDecl.23367.declaration
|
||||||
public abstract class FieldDecl
|
public abstract class FieldDecl implements TypeInsertable
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.class.FieldDecl.23367.body
|
// ino.class.FieldDecl.23367.body
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ import mycompiler.mytype.Type;
|
|||||||
import mycompiler.mytype.TypePlaceholder;
|
import mycompiler.mytype.TypePlaceholder;
|
||||||
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
||||||
|
|
||||||
public class FieldInitialization extends InstVarDecl{
|
public class FieldInitialization extends InstVarDecl {
|
||||||
|
|
||||||
|
|
||||||
private Expr wert;
|
private Expr wert;
|
||||||
|
@ -9,15 +9,18 @@ import mycompiler.mytype.Type;
|
|||||||
import mycompiler.mytype.TypePlaceholder;
|
import mycompiler.mytype.TypePlaceholder;
|
||||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||||
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
|
||||||
import typinferenz.JavaCodeResult;
|
import typinferenz.JavaCodeResult;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
import typinferenz.Typable;
|
import typinferenz.Typable;
|
||||||
|
import typinferenz.TypeInsertable;
|
||||||
|
|
||||||
// ino.class.FormalParameter.23391.declaration
|
// ino.class.FormalParameter.23391.declaration
|
||||||
public class FormalParameter implements ITypeReplacementListener, Typable
|
public class FormalParameter implements ITypeReplacementListener, Typable, TypeInsertable
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.class.FormalParameter.23391.body
|
// ino.class.FormalParameter.23391.body
|
||||||
{
|
{
|
||||||
|
@ -35,13 +35,14 @@ import typinferenz.JavaCodeResult;
|
|||||||
import typinferenz.SingleConstraint;
|
import typinferenz.SingleConstraint;
|
||||||
import typinferenz.ConstraintsSet;
|
import typinferenz.ConstraintsSet;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
|
import typinferenz.TypeInsertable;
|
||||||
import typinferenz.assumptions.TypeAssumptions;
|
import typinferenz.assumptions.TypeAssumptions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ino.class.Method.23482.declaration
|
// ino.class.Method.23482.declaration
|
||||||
public class Method extends FieldDecl implements ITypeReplacementListener, IItemWithOffset
|
public class Method extends FieldDecl implements ITypeReplacementListener, IItemWithOffset, TypeInsertable
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.class.Method.23482.body
|
// ino.class.Method.23482.body
|
||||||
{
|
{
|
||||||
@ -107,61 +108,6 @@ public class Method extends FieldDecl implements ITypeReplacementListener, IItem
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.call_sc_check.23527.definition
|
|
||||||
public void call_sc_check(Vector<Class> classlist, Hashtable classhash, boolean ext, Hashtable parach)
|
|
||||||
throws SCMethodException
|
|
||||||
// ino.end
|
|
||||||
// ino.method.call_sc_check.23527.body
|
|
||||||
{
|
|
||||||
// Semantikcheck fr Methoden
|
|
||||||
Hashtable<String,String> blockhash = new Hashtable<String,String>(); // lokale Hashtabelle, z.B. fr Funktionsparameter
|
|
||||||
Hashtable parabh = new Hashtable();
|
|
||||||
|
|
||||||
// otth: Rckgabetyp der Funktion bestimmen und bestimmen ob Konstruktor oder Funktion!
|
|
||||||
if( getTypeName() == null )
|
|
||||||
{
|
|
||||||
// Hier wird Methoden-Rckgabewert fr's Return-Statement eingetragen last1
|
|
||||||
blockhash.put("###_Method_Ret_Type", "__Constructor__");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
blockhash.put("###_Method_Ret_Type", getTypeName() );
|
|
||||||
}
|
|
||||||
parserlog.debug( "Methoden-Rckgabetyp von " + declid.elementAt(0).name + ": " + (String)blockhash.get("###_Method_Ret_Type"));
|
|
||||||
|
|
||||||
// otth: bergebene Parameter in die lokale Hash-Tabelle aufnehmen, falls Parameter vorhanden!
|
|
||||||
String strDebug = ""; // otth: nur zum Debuggen
|
|
||||||
if( this.getParameterList() != null )
|
|
||||||
{
|
|
||||||
for( Enumeration en = this.getParameterList().formalparameter.elements(); en.hasMoreElements(); )
|
|
||||||
{
|
|
||||||
FormalParameter tempParameter = (FormalParameter)en.nextElement();
|
|
||||||
String type = tempParameter.getTypeName();
|
|
||||||
String name = tempParameter.get_Name();
|
|
||||||
strDebug = strDebug + type + " --- " + name + " | "; // otth: Debug-Ausgabe
|
|
||||||
blockhash.put(name, type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// otth: Debug-Ausgabe
|
|
||||||
if ( strDebug == "" ) strDebug = "---";
|
|
||||||
parserlog.debug( "Parameter von " + declid.elementAt(0).name + ": " + strDebug);
|
|
||||||
|
|
||||||
// otth: Semantik-Check fr Block
|
|
||||||
try
|
|
||||||
{
|
|
||||||
parserlog.debug( "Blockhashtabelle (vor Blocksemantikcheck): " + blockhash);
|
|
||||||
block.sc_check( classlist, classhash, blockhash, ext, parach, parabh );
|
|
||||||
}
|
|
||||||
catch (SCStatementException ex)
|
|
||||||
{
|
|
||||||
SCMethodException except = new SCMethodException();
|
|
||||||
except.set_exlist(ex.get_exlist());
|
|
||||||
throw except;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.sc_init_parameterlist.23530.definition
|
// ino.method.sc_init_parameterlist.23530.definition
|
||||||
public void sc_init_parameterlist(boolean ext)
|
public void sc_init_parameterlist(boolean ext)
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -118,18 +118,6 @@ public class NegativeExpr extends UnaryExpr
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.TRStatement.25781.definition
|
|
||||||
public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRStatement.25781.body
|
|
||||||
{
|
|
||||||
CTripleSet tripleSet = this.TRExp(sigma, V, supportData).deepCopy();
|
|
||||||
Iterator<CTriple> tripleIt = tripleSet.getIterator();
|
|
||||||
while(tripleIt.hasNext()){
|
|
||||||
tripleIt.next().setResultType(new Void(getOffset()));
|
|
||||||
}
|
|
||||||
return tripleSet;
|
|
||||||
}
|
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.wandleRefTypeAttributes2GenericAttributes.25784.definition
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.25784.definition
|
||||||
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
||||||
|
@ -178,30 +178,6 @@ public class NewClass extends Expr
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.TRStatement.25861.defdescription type=javadoc
|
|
||||||
/**
|
|
||||||
* Implementierung des Algorithmus 5.26 von Martin Pl<EFBFBD>micke
|
|
||||||
* <br>Author: J<EFBFBD>rg B<EFBFBD>uerle
|
|
||||||
* @param sigma
|
|
||||||
* @param V
|
|
||||||
* @param supportData
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRStatement.25861.definition
|
|
||||||
public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRStatement.25861.body
|
|
||||||
{
|
|
||||||
CTripleSet returnSet = this.TRExp(sigma, V, supportData).deepCopy();
|
|
||||||
Iterator<CTriple> tripleIt = returnSet.getIterator();
|
|
||||||
while(tripleIt.hasNext()){
|
|
||||||
tripleIt.next().setResultType(new Void(getOffset()));
|
|
||||||
}
|
|
||||||
return returnSet;
|
|
||||||
}
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.method.toString.25867.defdescription type=javadoc
|
// ino.method.toString.25867.defdescription type=javadoc
|
||||||
/**
|
/**
|
||||||
* <br/>Author: Martin Pl<EFBFBD>micke
|
* <br/>Author: Martin Pl<EFBFBD>micke
|
||||||
|
@ -137,18 +137,6 @@ public class NotExpr extends UnaryExpr
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ino.method.TRStatement.25913.definition
|
|
||||||
public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRStatement.25913.body
|
|
||||||
{
|
|
||||||
CTripleSet tripleSet = this.TRExp(sigma, V, supportData).deepCopy();
|
|
||||||
Iterator<CTriple> tripleIt = tripleSet.getIterator();
|
|
||||||
while(tripleIt.hasNext()){
|
|
||||||
tripleIt.next().setResultType(new Void(getOffset()));
|
|
||||||
}
|
|
||||||
return tripleSet;
|
|
||||||
}
|
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.wandleRefTypeAttributes2GenericAttributes.25916.definition
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.25916.definition
|
||||||
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
||||||
|
@ -156,18 +156,6 @@ public class PostDecExpr extends UnaryExpr
|
|||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.TRStatement.26015.definition
|
|
||||||
public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData)
|
|
||||||
// ino.end
|
|
||||||
// ino.method.TRStatement.26015.body
|
|
||||||
{
|
|
||||||
CTripleSet tripleSet = this.TRExp(sigma, V, supportData).deepCopy();
|
|
||||||
Iterator<CTriple> tripleIt = tripleSet.getIterator();
|
|
||||||
while(tripleIt.hasNext()){
|
|
||||||
tripleIt.next().setResultType(new Void(getOffset()));
|
|
||||||
}
|
|
||||||
return tripleSet;
|
|
||||||
}
|
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.wandleRefTypeAttributes2GenericAttributes.26018.definition
|
// ino.method.wandleRefTypeAttributes2GenericAttributes.26018.definition
|
||||||
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist, Vector<GenericTypeVar> genericMethodParameters)
|
||||||
|
@ -372,5 +372,16 @@ public class Pair
|
|||||||
{
|
{
|
||||||
return this.copyPair();
|
return this.copyPair();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt eine Liste aller TypePlaceholder die in diesem Pair enthalten sind zurück.
|
||||||
|
* (Immer zwischen 0 und 2 Stück ;P)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector<TypePlaceholder> getTypePlaceholder() {
|
||||||
|
Vector<TypePlaceholder> ret = new Vector<TypePlaceholder>();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -9,6 +9,7 @@ import java.util.Vector;
|
|||||||
|
|
||||||
import typinferenz.ConstraintsSet;
|
import typinferenz.ConstraintsSet;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
|
import typinferenz.TypeInsertPoint;
|
||||||
import typinferenz.TypinferenzException;
|
import typinferenz.TypinferenzException;
|
||||||
import typinferenz.assumptions.TypeAssumptions;
|
import typinferenz.assumptions.TypeAssumptions;
|
||||||
import mycompiler.mytype.GenericTypeVar;
|
import mycompiler.mytype.GenericTypeVar;
|
||||||
@ -39,8 +40,14 @@ import mycompiler.mytypereconstruction.typeassumptionkey.CTypeAssumptionKey;
|
|||||||
public class TypeinferenceResultSet
|
public class TypeinferenceResultSet
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alle Constraints vor der Unifizierung.
|
||||||
|
* Dies ist nur eine Liste von Pair-Objekten (jedes Pair Objekt bildet dabei einen Constraint: Bsp.: TA <. TB)
|
||||||
|
*/
|
||||||
private Vector<Pair> constraints;
|
private Vector<Pair> constraints;
|
||||||
|
/**
|
||||||
|
* Das unifizierte ConstaraintsSet
|
||||||
|
*/
|
||||||
private ResultSet unifiedConstraints;
|
private ResultSet unifiedConstraints;
|
||||||
private mycompiler.myclass.Class ownerOfResultSet;//Jedes Resultset gilt immer nur für eine Klasse. Diese wird in dieser Variable gespeichert.
|
private mycompiler.myclass.Class ownerOfResultSet;//Jedes Resultset gilt immer nur für eine Klasse. Diese wird in dieser Variable gespeichert.
|
||||||
|
|
||||||
@ -105,5 +112,18 @@ public class TypeinferenceResultSet
|
|||||||
return "Unified Constraints: "+this.unifiedConstraints.toString();
|
return "Unified Constraints: "+this.unifiedConstraints.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Berechnet alle möglichen Punkte zum Einsetzen eines Typs im Quelltext
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Vector<TypeInsertPoint> getTypeInsertionPoints(){
|
||||||
|
for(Pair p : constraints){
|
||||||
|
for(TypePlaceholder tph : p.getTypePlaceholder()){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
5
src/typinferenz/TypeInsertPoint.java
Normal file
5
src/typinferenz/TypeInsertPoint.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package typinferenz;
|
||||||
|
|
||||||
|
public class TypeInsertPoint {
|
||||||
|
|
||||||
|
}
|
5
src/typinferenz/TypeInsertable.java
Normal file
5
src/typinferenz/TypeInsertable.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package typinferenz;
|
||||||
|
|
||||||
|
public interface TypeInsertable {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user