Logger angefügt

This commit is contained in:
JanUlrich 2014-10-09 12:01:16 +02:00
parent 2b33576488
commit 26f35cfeb6
84 changed files with 242 additions and 141 deletions

View File

@ -4,7 +4,6 @@
<classpathentry excluding=".classpath|.cvsignore|.externalToolBuilders/|.project|.settings/|Papers/|bin/|doc/|examples/|lib/|notizen/|src/|test/|tools/" including="log4j.xml" kind="src" path=""/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="lib/log4j-1.2.12.jar"/>
<classpathentry kind="lib" path="lib/junit-4.0.jar"/>
<classpathentry kind="lib" path="lib/antlr-4.4-complete.jar"/>
<classpathentry kind="output" path="bin"/>

1
bin/.gitignore vendored
View File

@ -1,4 +1,3 @@
/de/
/mycompiler/
/syntaxTree/
/plugindevelopment/

View File

@ -3,10 +3,10 @@
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<layout class="de.dhbwstuttgart.logger.PatternLayout">
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
</layout>
</appender>

View File

@ -3,10 +3,10 @@
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<layout class="de.dhbwstuttgart.logger.PatternLayout">
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
</layout>
</appender>

View File

@ -3,10 +3,10 @@
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<layout class="de.dhbwstuttgart.logger.PatternLayout">
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
</layout>
</appender>

View File

@ -7,9 +7,10 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.log4j.Logger;
// ino.end
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.myexception.JVMCodeException;
// ino.class.Attribute.21446.declaration

View File

@ -7,7 +7,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end
// ino.class.CPInfo.22026.declaration

View File

@ -12,8 +12,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.util.Vector;
import org.apache.log4j.Logger;
// ino.end
@ -23,7 +21,9 @@ import org.apache.log4j.Logger;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.myexception.JVMCodeException;
import de.dhbwstuttgart.syntaxtree.Interface;
import de.dhbwstuttgart.syntaxtree.ParameterList;

View File

@ -16,7 +16,6 @@ import java.util.Vector;
import de.dhbwstuttgart.myexception.JVMCodeException;
import de.dhbwstuttgart.syntaxtree.type.Type;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
// ino.class.CodeAttribute.21681.declaration
public class CodeAttribute extends Attribute

View File

@ -7,7 +7,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end
// ino.class.ExceptionTable.22047.declaration

View File

@ -8,7 +8,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end
import de.dhbwstuttgart.myexception.JVMCodeException;

View File

@ -4,7 +4,7 @@ package de.dhbwstuttgart.bytecode;
// ino.module.JVMCode.8547.import
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -6,7 +6,7 @@ package de.dhbwstuttgart.bytecode;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end
// ino.class.Key.22890.declaration

View File

@ -8,7 +8,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end
import de.dhbwstuttgart.myexception.JVMCodeException;

View File

@ -8,7 +8,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -6,7 +6,7 @@ package de.dhbwstuttgart.core;
// ino.module.AClassOrInterface.8526.import
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -5,8 +5,7 @@ import static org.junit.Assert.fail;
import java.util.*;
import org.apache.log4j.Logger;
import org.apache.log4j.varia.NullAppender;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
@ -21,7 +20,7 @@ public class ConsoleInterface {
for(String file : args){
filenames.add(file);
}
Logger.getRootLogger().addAppender(new NullAppender()); // sämtliches Logging unterdrücken
Logger.setOutput(null); // sämtliches Logging unterdrücken
run(filenames);
}

View File

@ -13,8 +13,7 @@ import java.io.Reader;
import java.io.StringReader;
import java.util.Vector;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;

View File

@ -0,0 +1,59 @@
package de.dhbwstuttgart.logger;
import java.io.PrintStream;
import java.util.HashMap;
public class Logger {
private static PrintStream standardOutput;
private static final HashMap<String, Logger> LOGGER_DIRECTORY = new HashMap<>();
private String name;
private PrintStream output;
private Logger(String name, PrintStream output) {
this.name = name;
this.output = output;
}
public void debug(String message){
output(message);
}
public static Logger getLogger(String name) {
Logger ret;
if(LOGGER_DIRECTORY.containsKey(name)){
ret = LOGGER_DIRECTORY.get(name);
}else{
ret = new Logger(name, standardOutput);
LOGGER_DIRECTORY.put(name, ret);
}
return ret;
}
private void output(String msg){
if(output != null){
output.println(msg);
}else if(standardOutput != null){
standardOutput.println(msg);
}
}
public void info(String string) {
// TODO Auto-generated method stub
}
public void error(String string) {
// TODO Auto-generated method stub
}
/**
* wird hier null übergeben, so wird sämtliches Logging unterdrückt.
*/
public static void setStandardOutput(PrintStream outputStream) {
Logger.standardOutput = outputStream;
}
}

View File

@ -4,7 +4,7 @@ package de.dhbwstuttgart.myexception;
// ino.module.SCClassException.8576.import
import java.util.Enumeration;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -3,7 +3,7 @@ package de.dhbwstuttgart.myexception;
// ino.end
// ino.module.SCExcept.8577.import
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end
// ino.class.SCExcept.23838.declaration

View File

@ -4,7 +4,7 @@ package de.dhbwstuttgart.myexception;
// ino.module.SCException.8578.import
import java.util.Enumeration;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -1291,7 +1291,7 @@ public class JavaLexer {
case -37:
break;
case 37:
{org.apache.log4j.Logger.getLogger("parser").debug("Kommentar: "+yytext());}
{de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("Kommentar: "+yytext());}
case -38:
break;
case 38:

View File

@ -167,7 +167,7 @@ null {
//">>=" {this.token = new Token(JavaParser.SIGNEDSHIFTRIGHTEQUAL, yytext(), yyline, yychar);return true;}
//">>>=" {this.token = new Token(JavaParser.UNSIGNEDSHIFTRIGHTEQUAL, yytext(), yyline, yychar);return true;}
{ws}|\n { /* System.out.print(yytext()); */ }
\\.\n {org.apache.log4j.Logger.getLogger("parser").debug("Kommentar: "+yytext());}
\\.\n {de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("Kommentar: "+yytext());}
"->" {this.token = new Token(JavaParser.LAMBDAASSIGNMENT, yytext(), yyline, yychar);return true;}

View File

@ -978,7 +978,7 @@ case 36:
pl.getParalist().addElement(new GenericTypeVar(((Token)yyVals[0+yyTop]).getLexem(),null, ((Token)yyVals[0+yyTop]).getOffset()));
/*pl.getParalist().addElement( new TypePlaceholder($1.getLexem()) );*/
/* ########################################################### */
org.apache.log4j.Logger.getLogger("parser").debug( "IDENTIFIER --> Paralist f<>r " + ((Token)yyVals[0+yyTop]).getLexem() + " TV");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "IDENTIFIER --> Paralist f<>r " + ((Token)yyVals[0+yyTop]).getLexem() + " TV");
yyVal = pl;
}
break;
@ -989,7 +989,7 @@ case 37:
RefType t = new RefType( ((Token)yyVals[-3+yyTop]).getLexem(),null,((Token)yyVals[-3+yyTop]).getOffset() );
t.set_ParaList( ((ParaList)yyVals[-1+yyTop]).get_ParaList() );
pl.getParalist().addElement(t);
org.apache.log4j.Logger.getLogger("parser").debug( "IDENTIFIER '<' paralist '>' --> Paralist f<>r " + ((Token)yyVals[-3+yyTop]).getLexem() + ": RefType");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "IDENTIFIER '<' paralist '>' --> Paralist f<>r " + ((Token)yyVals[-3+yyTop]).getLexem() + ": RefType");
yyVal = pl;
}
break;
@ -1010,8 +1010,8 @@ case 39:
((ParaList)yyVals[-2+yyTop]).getParalist().addElement(new GenericTypeVar(((Token)yyVals[0+yyTop]).getLexem(), null,((Token)yyVals[0+yyTop]).getOffset()));
/*$1.getParalist().addElement(new TypePlaceholder($3.getLexem()));*/
/* ########################################################### */
org.apache.log4j.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER --> Paralist f<>r " + ((Token)yyVals[0+yyTop]).getLexem() + ": TV");
org.apache.log4j.Logger.getLogger("parser").debug( "paralist: " + ((ParaList)yyVals[-2+yyTop]).getParalist());
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER --> Paralist f<>r " + ((Token)yyVals[0+yyTop]).getLexem() + ": TV");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "paralist: " + ((ParaList)yyVals[-2+yyTop]).getParalist());
yyVal=((ParaList)yyVals[-2+yyTop]);
}
break;
@ -1021,7 +1021,7 @@ case 40:
RefType t = new RefType( ((Token)yyVals[-3+yyTop]).getLexem(),null ,((Token)yyVals[-3+yyTop]).getOffset() );
t.set_ParaList( ((ParaList)yyVals[-1+yyTop]).get_ParaList() );
((ParaList)yyVals[-5+yyTop]).getParalist().addElement(t);
org.apache.log4j.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER '<' paralist '>' --> Paralist f<>r " + ((Token)yyVals[-3+yyTop]).getLexem() + ": RefType");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER '<' paralist '>' --> Paralist f<>r " + ((Token)yyVals[-3+yyTop]).getLexem() + ": RefType");
yyVal=((ParaList)yyVals[-5+yyTop]);
}
break;
@ -1423,7 +1423,7 @@ case 93:
case 94:
// line 875 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->fielddeclaration ...: type " + ((Type)yyVals[-2+yyTop]));
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("T->Parser->fielddeclaration ...: type " + ((Type)yyVals[-2+yyTop]));
((FieldDeclaration)yyVals[-1+yyTop]).setType(((Type)yyVals[-2+yyTop]));
yyVal = ((FieldDeclaration)yyVals[-1+yyTop]);
}
@ -1955,7 +1955,7 @@ case 155:
case 156:
// line 1316 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->referenctype: " + ((UsedId)yyVals[0+yyTop]));
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("T->Parser->referenctype: " + ((UsedId)yyVals[0+yyTop]));
RefType RT = new RefType(null,((UsedId)yyVals[0+yyTop]).getOffset());
/*ausgetauscht PL 05-07-30*/
@ -2002,7 +2002,7 @@ case 160:
case 161:
// line 1393 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("\nFunktionsdeklaration mit typlosen Parametern: " + ((DeclId)yyVals[0+yyTop]).name);
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nFunktionsdeklaration mit typlosen Parametern: " + ((DeclId)yyVals[0+yyTop]).name);
FormalParameter FP = new FormalParameter(((DeclId)yyVals[0+yyTop]));
@ -2011,7 +2011,7 @@ case 161:
/*Type T = TypePlaceholder.fresh(); //auskommentiert von Andreas Stadelmeier*/
/* Type T = new TypePlaceholder(""); /* otth: Name wird automatisch berechnet * /*/
/* ###########################################################*/
/*org.apache.log4j.Logger.getLogger("parser").debug("\n--> berechneter Name: " + T.getName());*/
/*de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\n--> berechneter Name: " + T.getName());*/
/*auskommentiert von Andreas Stadelmeier (a10023) FP.setType( T );*/
/*FP.set_DeclId($1);*/
@ -2132,7 +2132,7 @@ case 176:
case 177:
// line 1500 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
LocalVarDecl LVD = new LocalVarDecl(((Type)yyVals[-1+yyTop]).getOffset(),((Type)yyVals[-1+yyTop]).getVariableLength());
LVD.setType(((Type)yyVals[-1+yyTop]));
LVD.setDeclidVector(((FieldDeclaration)yyVals[0+yyTop]).getDeclIdVector());
@ -2142,7 +2142,7 @@ case 177:
case 178:
// line 1511 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
LocalVarDecl LVD = new LocalVarDecl(((FieldDeclaration)yyVals[0+yyTop]).getOffset(),((FieldDeclaration)yyVals[0+yyTop]).getVariableLength());
/*auskommentiert von Andreas Stadelmeier (a10023) LVD.setType(TypePlaceholder.fresh());*/
LVD.setDeclidVector(((FieldDeclaration)yyVals[0+yyTop]).getDeclIdVector());
@ -2296,7 +2296,7 @@ case 193:
case 194:
// line 1650 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("conditionalexpression");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("conditionalexpression");
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
@ -2361,7 +2361,7 @@ case 203:
case 204:
// line 1703 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1!\n");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nParser --> Zuweisung1!\n");
Assign Ass = new Assign(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
LocalOrFieldVar LOFV = new LocalOrFieldVar(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
LOFV.set_UsedId(((UsedId)yyVals[-2+yyTop]));
@ -2369,7 +2369,7 @@ case 204:
/*auskommentiert von Andreas Stadelmeier (a10023) Ass.setType(TypePlaceholder.fresh());*/
if( ((Operator)yyVals[-1+yyTop]) == null )
{
org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> " + ((Expr)yyVals[0+yyTop]) + " \n");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> " + ((Expr)yyVals[0+yyTop]) + " \n");
Ass.set_Expr( LOFV,((Expr)yyVals[0+yyTop]) );
}
else
@ -2378,7 +2378,7 @@ case 204:
Bin.set_Expr1(LOFV);
Bin.set_Operator(((Operator)yyVals[-1+yyTop]));
Bin.set_Expr2(((Expr)yyVals[0+yyTop]));
org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> Binary\n");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> Binary\n");
/*auskommentiert von Andreas Stadelmeier (a10023) Bin.setType(TypePlaceholder.fresh());*/
Ass.set_Expr( LOFV, Bin );
}
@ -2608,7 +2608,7 @@ case 232:
case 233:
// line 1933 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M1");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M1");
MethodCall MC = new MethodCall(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
UsedId udidmeth = new UsedId(((UsedId)yyVals[-2+yyTop]).getOffset());
udidmeth.set_Name((String)((((UsedId)yyVals[-2+yyTop]).get_Name()).elementAt(((UsedId)yyVals[-2+yyTop]).get_Name().size()-1)));
@ -2640,7 +2640,7 @@ case 233:
case 234:
// line 1963 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M2");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M2");
MethodCall MCarg = new MethodCall(((UsedId)yyVals[-3+yyTop]).getOffset(),((UsedId)yyVals[-3+yyTop]).getVariableLength());
UsedId udidmeth = new UsedId(((UsedId)yyVals[-3+yyTop]).getOffset());
udidmeth.set_Name((String)((((UsedId)yyVals[-3+yyTop]).get_Name()).elementAt(((UsedId)yyVals[-3+yyTop]).get_Name().size()-1)));
@ -2673,7 +2673,7 @@ case 234:
case 235:
// line 1994 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M3");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M3");
MethodCall MCpr = new MethodCall(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength());
/* PL 05-08-21 primary ist kein UsedId*/
@ -2694,7 +2694,7 @@ case 235:
case 236:
// line 2013 "./../src/de/dhbwstuttgart/parser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M4");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M4");
MethodCall MCPA = new MethodCall(((Expr)yyVals[-5+yyTop]).getOffset(),((Expr)yyVals[-5+yyTop]).getVariableLength());
/* PL 05-08-21 primary ist kein UsedId*/

View File

@ -486,7 +486,7 @@ paralist : IDENTIFIER
pl.getParalist().addElement(new GenericTypeVar($1.getLexem(),null, $1.getOffset()));
//pl.getParalist().addElement( new TypePlaceholder($1.getLexem()) );
/* ########################################################### */
org.apache.log4j.Logger.getLogger("parser").debug( "IDENTIFIER --> Paralist f<>r " + $1.getLexem() + " TV");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "IDENTIFIER --> Paralist f<>r " + $1.getLexem() + " TV");
$$ = pl;
}
| IDENTIFIER '<' paralist '>'
@ -495,7 +495,7 @@ paralist : IDENTIFIER
RefType t = new RefType( $1.getLexem(),null,$1.getOffset() );
t.set_ParaList( $3.get_ParaList() );
pl.getParalist().addElement(t);
org.apache.log4j.Logger.getLogger("parser").debug( "IDENTIFIER '<' paralist '>' --> Paralist f<>r " + $1.getLexem() + ": RefType");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "IDENTIFIER '<' paralist '>' --> Paralist f<>r " + $1.getLexem() + ": RefType");
$$ = pl;
}
| wildcardparameter
@ -512,8 +512,8 @@ paralist : IDENTIFIER
$1.getParalist().addElement(new GenericTypeVar($3.getLexem(), null,$3.getOffset()));
//$1.getParalist().addElement(new TypePlaceholder($3.getLexem()));
/* ########################################################### */
org.apache.log4j.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER --> Paralist f<>r " + $3.getLexem() + ": TV");
org.apache.log4j.Logger.getLogger("parser").debug( "paralist: " + $1.getParalist());
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER --> Paralist f<>r " + $3.getLexem() + ": TV");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "paralist: " + $1.getParalist());
$$=$1;
}
@ -522,7 +522,7 @@ paralist : IDENTIFIER
RefType t = new RefType( $3.getLexem(),null ,$3.getOffset() );
t.set_ParaList( $5.get_ParaList() );
$1.getParalist().addElement(t);
org.apache.log4j.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER '<' paralist '>' --> Paralist f<>r " + $3.getLexem() + ": RefType");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug( "paralist ',' IDENTIFIER '<' paralist '>' --> Paralist f<>r " + $3.getLexem() + ": RefType");
$$=$1;
}
| paralist ',' wildcardparameter
@ -873,7 +873,7 @@ fielddeclaration : type fielddeclarator ';'
|
type variabledeclarators ';'
{
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->fielddeclaration ...: type " + $1);
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("T->Parser->fielddeclaration ...: type " + $1);
$2.setType($1);
$$ = $2;
}
@ -1314,7 +1314,7 @@ referencelongtype : typename parameter
referencetype :classorinterfacetype
{
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->referenctype: " + $1);
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("T->Parser->referenctype: " + $1);
RefType RT = new RefType(null,$1.getOffset());
//ausgetauscht PL 05-07-30
@ -1385,13 +1385,13 @@ formalparameter : type variabledeclaratorid
//FP.set_DeclId($5);
$$=FP;
org.apache.log4j.Logger.getLogger("parser").debug("P->Polymorphes Methodenargument hinzugefuegt: Name = " + $5.get_Name() + " Typ = " + $1.getName());
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("P->Polymorphes Methodenargument hinzugefuegt: Name = " + $5.get_Name() + " Typ = " + $1.getName());
}
*/
| variabledeclaratorid
{
org.apache.log4j.Logger.getLogger("parser").debug("\nFunktionsdeklaration mit typlosen Parametern: " + $1.name);
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nFunktionsdeklaration mit typlosen Parametern: " + $1.name);
FormalParameter FP = new FormalParameter($1);
@ -1400,7 +1400,7 @@ formalparameter : type variabledeclaratorid
//Type T = TypePlaceholder.fresh(); //auskommentiert von Andreas Stadelmeier
// Type T = new TypePlaceholder(""); /* otth: Name wird automatisch berechnet */
// ###########################################################
//org.apache.log4j.Logger.getLogger("parser").debug("\n--> berechneter Name: " + T.getName());
//de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\n--> berechneter Name: " + T.getName());
//auskommentiert von Andreas Stadelmeier (a10023) FP.setType( T );
//FP.set_DeclId($1);
@ -1498,7 +1498,7 @@ integraltype :INT
localvariabledeclaration : type variabledeclarators
{
org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
LocalVarDecl LVD = new LocalVarDecl($1.getOffset(),$1.getVariableLength());
LVD.setType($1);
LVD.setDeclidVector($2.getDeclIdVector());
@ -1509,7 +1509,7 @@ localvariabledeclaration : type variabledeclarators
/* ########################################################### */
|variabledeclarators
{
org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
LocalVarDecl LVD = new LocalVarDecl($1.getOffset(),$1.getVariableLength());
//auskommentiert von Andreas Stadelmeier (a10023) LVD.setType(TypePlaceholder.fresh());
LVD.setDeclidVector($1.getDeclIdVector());
@ -1648,7 +1648,7 @@ forstatement
assignmentexpression : conditionalexpression
{
org.apache.log4j.Logger.getLogger("parser").debug("conditionalexpression");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("conditionalexpression");
$$=$1;
}
| assignment
@ -1701,7 +1701,7 @@ conditionalexpression :conditionalorexpression
assignment :lefthandside assignmentoperator assignmentexpression
{
org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1!\n");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nParser --> Zuweisung1!\n");
Assign Ass = new Assign($1.getOffset(),$1.getVariableLength());
LocalOrFieldVar LOFV = new LocalOrFieldVar($1.getOffset(),$1.getVariableLength());
LOFV.set_UsedId($1);
@ -1709,7 +1709,7 @@ assignment :lefthandside assignmentoperator assignmentexpr
//auskommentiert von Andreas Stadelmeier (a10023) Ass.setType(TypePlaceholder.fresh());
if( $2 == null )
{
org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> " + $3 + " \n");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> " + $3 + " \n");
Ass.set_Expr( LOFV,$3 );
}
else
@ -1718,7 +1718,7 @@ assignment :lefthandside assignmentoperator assignmentexpr
Bin.set_Expr1(LOFV);
Bin.set_Operator($2);
Bin.set_Expr2($3);
org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> Binary\n");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("\nParser --> Zuweisung1 --> Binary\n");
//auskommentiert von Andreas Stadelmeier (a10023) Bin.setType(TypePlaceholder.fresh());
Ass.set_Expr( LOFV, Bin );
}
@ -1931,7 +1931,7 @@ postdecrementexpression :postfixexpression DECREMENT
methodinvocation:
name '(' ')'
{
org.apache.log4j.Logger.getLogger("parser").debug("M1");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M1");
MethodCall MC = new MethodCall($1.getOffset(),$1.getVariableLength());
UsedId udidmeth = new UsedId($1.getOffset());
udidmeth.set_Name((String)(($1.get_Name()).elementAt($1.get_Name().size()-1)));
@ -1961,7 +1961,7 @@ methodinvocation:
}
| name '('argumentlist')'
{
org.apache.log4j.Logger.getLogger("parser").debug("M2");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M2");
MethodCall MCarg = new MethodCall($1.getOffset(),$1.getVariableLength());
UsedId udidmeth = new UsedId($1.getOffset());
udidmeth.set_Name((String)(($1.get_Name()).elementAt($1.get_Name().size()-1)));
@ -1992,7 +1992,7 @@ methodinvocation:
}
| primary '.' IDENTIFIER '(' ')'
{
org.apache.log4j.Logger.getLogger("parser").debug("M3");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M3");
MethodCall MCpr = new MethodCall($1.getOffset(),$1.getVariableLength());
// PL 05-08-21 primary ist kein UsedId
@ -2011,7 +2011,7 @@ methodinvocation:
}
| primary '.' IDENTIFIER '('argumentlist ')'
{
org.apache.log4j.Logger.getLogger("parser").debug("M4");
de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("M4");
MethodCall MCPA = new MethodCall($1.getOffset(),$1.getVariableLength());
// PL 05-08-21 primary ist kein UsedId

View File

@ -9,7 +9,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.core.AClassOrInterface;
import de.dhbwstuttgart.core.IItemWithOffset;

View File

@ -6,7 +6,7 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree;
// ino.module.FormalParameter.8561.import
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -7,7 +7,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.core.IItemWithOffset;

View File

@ -10,8 +10,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.core.AClassOrInterface;
import de.dhbwstuttgart.core.MyCompiler;
@ -45,6 +44,7 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.unify.FC_TTO;
import de.dhbwstuttgart.typeinference.unify.Unifier;
import de.dhbwstuttgart.typeinference.unify.Unify;
@ -691,11 +691,16 @@ public class SourceFile
////////////////
//Unmögliche ConstraintsSets aussortieren durch Unifizierung
oderConstraints.filterWrongConstraints((pairs)->{return Unify.unify(pairs,finiteClosure);});
Unifier unifier = (pairs)->{
Vector<Vector<Pair>> retValue = new Vector<>();
retValue = Unify.unify(pairs, finiteClosure);
return retValue;};
oderConstraints.filterWrongConstraints(unifier);
oderConstraints.unifyUndConstraints(unifier);
typinferenzLog.debug("Übriggebliebene Konstraints:\n"+oderConstraints+"\n");
//Die Constraints in Pair's umwandeln (Karthesisches Produkt bilden):
Vector<Vector<Pair>> xConstraints = new Vector<Vector<Pair>>();// = oderConstraints.getConstraints();
for(Vector<UndConstraint> uC:oderConstraints.getConstraints()){ //mit dem getConstraints-Aufruf wird das Karthesische Produkt erzeugt.
for(Vector<UndConstraint> uC : oderConstraints.getConstraints()){ //mit dem getConstraints-Aufruf wird das Karthesische Produkt erzeugt.
Vector<Pair> cons = new Vector<Pair>();
for(UndConstraint undCons:uC){
cons.addAll(undCons.getConstraintPairs());

View File

@ -4,7 +4,7 @@ package de.dhbwstuttgart.syntaxtree.misc;
// ino.module.DeclId.8558.import
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -7,7 +7,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -7,7 +7,7 @@ import java.util.HashMap;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -7,7 +7,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -4,7 +4,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
// ino.module.CharLiteral.8628.import
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.syntaxtree.type.Type;

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -5,7 +5,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -7,7 +7,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -7,7 +7,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -6,7 +6,7 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -6,7 +6,7 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
@ -209,7 +209,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
throw ex;
}
else if(paralist==null && c.get_ParaList().size()>0){
parserlog.debug(paralist);
parserlog.debug(paralist.toString());
parserlog.debug(c.getName()+" "+c.get_ParaList().size());
SCStatementException ex = new SCStatementException();
SCExcept e = new SCExcept();

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -8,7 +8,7 @@ import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.myexception.CTypeReconstructionException;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -6,7 +6,7 @@ import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -5,7 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;
import de.dhbwstuttgart.bytecode.JVMCode;

View File

@ -7,7 +7,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassFile;
import de.dhbwstuttgart.bytecode.CodeAttribute;

View File

@ -3,7 +3,7 @@ package de.dhbwstuttgart.syntaxtree.type;
// ino.end
// ino.module.ParaList.8674.import
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -8,7 +8,7 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.JVMCode;
import de.dhbwstuttgart.core.IItemWithOffset;

View File

@ -74,5 +74,11 @@ public class Void extends RefType
public ConstraintType TYPE(TypeAssumptions ass, SyntaxTreeNode parent){
return new ConstraintType(this);
}
@Override
public Type checkTYPE(TypeAssumptions ass, SyntaxTreeNode method) {
return this;//VOID ist immer korrekt, das wird vom Parser geprüft
}
}
// ino.end

View File

@ -57,4 +57,23 @@ public class ConstraintsSet implements Iterable<OderConstraint>{
constraint.filterWrongConstraints(unify);
}
}
public void unifyUndConstraints(Unifier unifier) {
Vector<UndConstraint> uCons = this.filterUndConstraints();
}
/**
* Aus dem ConstraintsSet [ u1, u2, ... (OderConstraint), ... uN ] werden alle
* UndConstraints, welche sich nicht innerhalb eines OderConstraints befinden, herausgefiltert
* @return [u1, ... , uN]
*/
private Vector<UndConstraint> filterUndConstraints() {
Vector<UndConstraint> ret = new Vector<>();
for(OderConstraint con : constraintsSet){
UndConstraint filtered = con.filterUndConstraints();
if(filtered != null)ret.add(filtered);
}
return ret;
}
}

View File

@ -2,7 +2,7 @@ package de.dhbwstuttgart.typeinference;
import java.util.Vector;
import de.dhbwstuttgart.logger.TypinferenzLog;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
@ -11,6 +11,8 @@ import de.dhbwstuttgart.typeinference.unify.Unifier;
public class OderConstraint{
private Vector<UndConstraint> oderConstraintPairs;
private final static Logger logger = Logger.getLogger(OderConstraint.class.getName());
/**
* Erstellt ein neues Oder Constraint und fügt bereits ein Constraint hinzu.
* @param p1
@ -81,16 +83,21 @@ public class OderConstraint{
oderConstraintPairs.add(methodConstraint);
}
public void filterWrongConstraints(Unifier unify) {
void filterWrongConstraints(Unifier unifier) {
Vector<UndConstraint> filteredConstraints = new Vector<>();
for(UndConstraint cons : this.getUndConstraints()){
if(!unify.unify(cons.getConstraintPairs()).isEmpty()){
Vector<Vector<Pair>> unifierResult = unifier.apply(cons.getConstraintPairs());
if(!unifierResult.isEmpty()){
filteredConstraints.add(cons);
}else{
TypinferenzLog.debug("Ausgesondertes Constraint: "+cons);
logger.debug("Ausgesondertes Constraint: "+cons);
}
}
this.oderConstraintPairs = filteredConstraints;
}
UndConstraint filterUndConstraints() {
return null;
}
}

View File

@ -3,6 +3,7 @@ package de.dhbwstuttgart.typeinference;
import java.util.Vector;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.unify.Unifier;
/**
* Stellt ein Constraint dar, welches aus mehreren Constraint-Paaren besteht. Diese gelten alle stets gleichzeitig / sind per "Und" miteinander verknüpft.
@ -36,5 +37,14 @@ public class UndConstraint extends OderConstraint {
}
return ret+"]";
}
@Override
void filterWrongConstraints(Unifier unifier) {
//In einem UndConstraint gibt es keine falschen Constraints
}
@Override
UndConstraint filterUndConstraints(){
return this;
}
}

View File

@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.core.IItemWithOffset;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;

View File

@ -6,7 +6,7 @@ package de.dhbwstuttgart.typeinference.unify;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
// ino.end

View File

@ -6,6 +6,6 @@ import de.dhbwstuttgart.typeinference.Pair;
public interface Unifier {
public Vector<Vector<Pair>> unify (Vector<Pair> E);
public Vector<Vector<Pair>> apply (Vector<Pair> E);
}

View File

@ -7,7 +7,7 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
import de.dhbwstuttgart.myexception.MatchException;
@ -128,7 +128,7 @@ public class Unify
//WAS PASSIERT MIT EINE PAAR HIER DRIN BLEIBT???
Eq_12.addElement(P);
printMenge("Eq_12", Eq_12, 6);
inferencelog.debug(P.OperatorEqual());
//inferencelog.debug(P.OperatorEqual());
}
else if (P.TA1 instanceof BoundedGenericTypeVar && P.TA2 instanceof RefType)
{ //PL 06-06-13
@ -224,7 +224,7 @@ public class Unify
else ready = false;
sigma.addElement(new Pair(r1, r2));
}
inferencelog.debug(ready);
//inferencelog.debug(ready);
if (!ready) {
printMenge("Sigma", sigma, 6);

View File

@ -3,10 +3,10 @@
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<layout class="de.dhbwstuttgart.logger.PatternLayout">
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
</layout>
</appender>

View File

@ -13,7 +13,7 @@ import mycompiler.test.operators.AllTestsOperators;
import mycompiler.test.primitiveTypes.AllTestsPrimitiveTypes;
import mycompiler.test.trivial.AllTestsTrivial;
import org.apache.log4j.xml.DOMConfigurator;
import de.dhbwstuttgart.logger.xml.DOMConfigurator;
public class AllTests {

View File

@ -1,6 +1,6 @@
package mycompiler.test;
import org.apache.log4j.xml.DOMConfigurator;
import de.dhbwstuttgart.logger.xml.DOMConfigurator;
/**
* needed to assure one-time execution of configure script

View File

@ -1,6 +1,6 @@
package mycompiler.test.inferenceByCharacteristic;
import org.apache.log4j.xml.DOMConfigurator;
import de.dhbwstuttgart.logger.xml.DOMConfigurator;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import mycompiler.test.AbstractInferenceTest;

View File

@ -4,8 +4,8 @@ import java.util.Vector;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.xml.DOMConfigurator;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.ClassBody;

View File

@ -5,8 +5,8 @@ import java.util.Vector;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.xml.DOMConfigurator;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;

View File

@ -4,7 +4,7 @@ import java.util.Vector;
import junit.framework.TestCase;
import org.apache.log4j.xml.DOMConfigurator;
import de.dhbwstuttgart.logger.xml.DOMConfigurator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

View File

@ -10,12 +10,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Vector;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.SimpleLayout;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.core.MyCompilerAPI;
@ -31,11 +26,14 @@ public class TypeInsertTester{
private static Logger inferencelog = Logger.getLogger("Typeinference");
static{
{
Logger.setStandardOutput(System.out);
/*
// Ausgabeoptionen fuer die Logger
ConsoleAppender logAppender = new ConsoleAppender(new SimpleLayout());
logAppender.setTarget("System.out");
logAppender.activateOptions();
inferencelog.addAppender(logAppender); //Bei den Tests wird der Log auch in System.out geschrieben.
*/
}
}
static final String rootDirectory = System.getProperty("user.dir")+"/test/plugindevelopment/";