forked from JavaTX/JavaCompilerCore
Merge branch 'refactoring' into antlr
This commit is contained in:
commit
35b12402c7
@ -4,10 +4,10 @@
|
||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/JavaCompilerCore/tools/AntParserBuilderWindows.xml"/>
|
||||
<listEntry value="/JavaCompilerCore"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
|
@ -1,5 +1,5 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/mycompiler/mystatement/LambdaExpression.java=UTF-8
|
||||
encoding//src/typinferenz/SingleConstraint.java=UTF-8
|
||||
encoding//src/typinferenz/UndConstraint.java=UTF-8
|
||||
encoding//src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java=UTF-8
|
||||
encoding//src/de/dhbwstuttgart/typeinference/SingleConstraint.java=UTF-8
|
||||
encoding//src/de/dhbwstuttgart/typeinference/UndConstraint.java=UTF-8
|
||||
encoding/<project>=ISO-8859-1
|
||||
|
10
bin/.gitignore
vendored
10
bin/.gitignore
vendored
@ -1,8 +1,6 @@
|
||||
/mycompiler
|
||||
/typinferenz
|
||||
/userinterface
|
||||
/bytecode
|
||||
/myJvmDisassembler
|
||||
/parser
|
||||
/de
|
||||
/plugindevelopment
|
||||
/mycompiler
|
||||
/mytypereconstruction
|
||||
/syntaxTree
|
||||
/userinterface
|
||||
|
6
bin/bytecode/FieldTest.jav
Normal file
6
bin/bytecode/FieldTest.jav
Normal file
@ -0,0 +1,6 @@
|
||||
class FieldTest{
|
||||
String var;
|
||||
String methode(String para1){
|
||||
return var;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
3
bin/parser/BoundedParameter.jav
Normal file
3
bin/parser/BoundedParameter.jav
Normal file
@ -0,0 +1,3 @@
|
||||
class Matrix{
|
||||
<A extends B, C extends B> String op = "String";
|
||||
}
|
3
bin/parser/FieldInitializationTest.jav
Normal file
3
bin/parser/FieldInitializationTest.jav
Normal file
@ -0,0 +1,3 @@
|
||||
class FieldInitializationTest{
|
||||
String var = "hallo";
|
||||
}
|
3
bin/parser/GenericFieldVarTest.jav
Normal file
3
bin/parser/GenericFieldVarTest.jav
Normal file
@ -0,0 +1,3 @@
|
||||
class Test{
|
||||
<A> A var;
|
||||
}
|
4
bin/parser/ImportTest.jav
Normal file
4
bin/parser/ImportTest.jav
Normal file
@ -0,0 +1,4 @@
|
||||
import java.util.*;
|
||||
|
||||
class ImportTest{
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package myJvmDisassembler;
|
||||
package de.dhbwstuttgart.JvmDisassembler;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package myJvmDisassembler;
|
||||
package de.dhbwstuttgart.JvmDisassembler;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
@ -1,5 +1,5 @@
|
||||
// ino.module.Attribute.8529.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.Attribute.8529.import
|
||||
@ -7,11 +7,11 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
|
||||
// ino.class.Attribute.21446.declaration
|
||||
public abstract class Attribute implements ClassFileMember
|
||||
// ino.end
|
@ -1,5 +1,5 @@
|
||||
// ino.module.AttributeInfo.8530.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.AttributeInfo.8530.import
|
||||
@ -8,8 +8,7 @@ import java.io.OutputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
|
||||
// ino.class.AttributeInfo.21467.declaration
|
||||
public class AttributeInfo extends Attribute
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Class_info.8533.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_Class_info.8533.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Double_info.8534.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_Double_info.8534.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Fieldref_info.8535.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_Fieldref_info.8535.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Float_info.8536.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
// ino.module.CONSTANT_Float_info.8536.import
|
||||
import java.io.IOException;
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Integer_info.8537.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
// ino.module.CONSTANT_Integer_info.8537.import
|
||||
import java.io.FileOutputStream;
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_InterfaceMethodref_info.8538.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_InterfaceMethodref_info.8538.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Long_info.8539.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_Long_info.8539.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Methodref_info.8540.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_Methodref_info.8540.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_NameAndType_info.8541.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_NameAndType_info.8541.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_String_info.8542.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_String_info.8542.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CONSTANT_Utf8_info.8543.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CONSTANT_Utf8_info.8543.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.CPInfo.8544.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CPInfo.8544.import
|
@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
// ino.module.ClassFile.8531.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
// ino.module.ClassFile.8531.import
|
||||
import java.io.File;
|
||||
@ -13,20 +13,27 @@ import java.io.OutputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myclass.ParameterList;
|
||||
import mycompiler.myclass.UsedId;
|
||||
import mycompiler.MyCompiler;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.myinterface.Interface;
|
||||
import mycompiler.mystatement.Assign;
|
||||
import mycompiler.mystatement.Block;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.SourceFile;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.Interface;
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Assign;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
|
||||
|
||||
// ino.class.ClassFile.21492.description type=javadoc
|
||||
/**
|
||||
* Darstellung einer Klassendatei aus Sicht fuer die JVM.
|
@ -1,9 +1,9 @@
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
|
||||
public interface ClassFileMember {
|
||||
public void codegen(ClassFile cf, OutputStream out) throws JVMCodeException, IOException;
|
@ -4,7 +4,7 @@
|
||||
//muss wieder einkommentiert werden
|
||||
|
||||
// ino.module.CodeAttribute.8532.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CodeAttribute.8532.import
|
||||
@ -14,10 +14,9 @@ import java.io.OutputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mytype.Type;
|
||||
// ino.end
|
||||
|
||||
// ino.class.CodeAttribute.21681.declaration
|
||||
public class CodeAttribute extends Attribute
|
@ -1,5 +1,5 @@
|
||||
// ino.module.ExceptionTable.8545.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.ExceptionTable.8545.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.FieldInfo.8546.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.FieldInfo.8546.import
|
||||
@ -8,11 +8,11 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
|
||||
// ino.class.FieldInfo.22068.declaration
|
||||
public class FieldInfo implements ClassFileMember
|
||||
// ino.end
|
@ -1,13 +1,16 @@
|
||||
// ino.module.JVMCode.8547.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
// ino.module.JVMCode.8547.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
|
||||
// ino.class.JVMCode.22140.description type=javadoc
|
||||
/**
|
||||
* Enthaelt die Befehle fuer die Umsetzung in JVM-Code und
|
@ -1,5 +1,5 @@
|
||||
// ino.module.Key.8548.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.Key.8548.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.MethodInfo.8549.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.MethodInfo.8549.import
|
||||
@ -8,11 +8,11 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
|
||||
// ino.class.MethodInfo.22923.declaration
|
||||
public class MethodInfo implements ClassFileMember
|
||||
// ino.end
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SignatureInfo.8550.package
|
||||
package mycompiler.mybytecode;
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
// ino.end
|
||||
|
||||
// ino.module.SignatureInfo.8550.import
|
||||
@ -8,17 +8,20 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myclass.ParameterList;
|
||||
import mycompiler.myclass.UsedId;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mytype.BoundedGenericTypeVar;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
// ino.class.SignatureInfo.22968.description type=javadoc
|
@ -1,18 +1,24 @@
|
||||
|
||||
// ino.module.AClassOrInterface.8526.package
|
||||
package mycompiler;
|
||||
package de.dhbwstuttgart.core;
|
||||
// ino.end
|
||||
|
||||
// ino.module.AClassOrInterface.8526.import
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myclass.UsedId;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
|
||||
// ino.class.AClassOrInterface.21186.description type=javadoc
|
||||
/**
|
||||
* Superklasse von Class und Interface. Beinhaltet gemeinsame Attribute
|
||||
@ -28,7 +34,7 @@ public interface AClassOrInterface
|
||||
// ino.class.AClassOrInterface.21186.body
|
||||
{
|
||||
|
||||
public String getName();
|
||||
public JavaClassName getName();
|
||||
public Vector<UsedId> getSuperInterfaces();
|
||||
public void setSuperInterfaces(Vector<UsedId> vector);
|
||||
|
@ -1,19 +1,15 @@
|
||||
package userinterface;
|
||||
package de.dhbwstuttgart.core;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.MyCompiler;
|
||||
import mycompiler.MyCompilerAPI;
|
||||
import mycompiler.mytypereconstruction.TypeinferenceResultSet;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.varia.NullAppender;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
public class ConsoleInterface {
|
||||
private static final String directory = System.getProperty("user.dir");
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ino.module.IItemWithOffset.8527.package
|
||||
package mycompiler;
|
||||
package de.dhbwstuttgart.core;
|
||||
// ino.end
|
||||
|
||||
// ino.class.IItemWithOffset.21249.declaration
|
@ -1,5 +1,5 @@
|
||||
// ino.module.MyCompiler.8569.package
|
||||
package mycompiler;
|
||||
package de.dhbwstuttgart.core;
|
||||
// ino.end
|
||||
|
||||
|
||||
@ -13,42 +13,41 @@ import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myclass.Class;
|
||||
import mycompiler.myclass.ClassBody;
|
||||
import mycompiler.myclass.DeclId;
|
||||
import mycompiler.myclass.FormalParameter;
|
||||
import mycompiler.myclass.ImportDeclarations;
|
||||
import mycompiler.myclass.Method;
|
||||
import mycompiler.myclass.ParameterList;
|
||||
import mycompiler.myclass.UsedId;
|
||||
import mycompiler.myexception.CTypeReconstructionException;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.myparser.JavaParser;
|
||||
import mycompiler.myparser.Scanner;
|
||||
import mycompiler.myparser.JavaParser.yyException;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.IMatchable;
|
||||
import mycompiler.mytype.ITypeContainer;
|
||||
import mycompiler.mytype.Pair;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytypereconstruction.TypeinferenceResultSet;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
|
||||
import com.sun.corba.se.spi.orbutil.fsm.Guard.Result;
|
||||
import com.sun.org.apache.xerces.internal.impl.xs.identity.Field;
|
||||
|
||||
import typinferenz.FunNInterface;
|
||||
import typinferenz.ResultSet;
|
||||
// ino.end
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import typinferenz.exceptions.DebugException;
|
||||
import typinferenz.exceptions.ParserError;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.parser.JavaParser;
|
||||
import de.dhbwstuttgart.parser.Scanner;
|
||||
import de.dhbwstuttgart.parser.JavaParser.yyException;
|
||||
import de.dhbwstuttgart.syntaxtree.Class;
|
||||
import de.dhbwstuttgart.syntaxtree.ClassBody;
|
||||
import de.dhbwstuttgart.syntaxtree.FormalParameter;
|
||||
import de.dhbwstuttgart.syntaxtree.ImportDeclarations;
|
||||
import de.dhbwstuttgart.syntaxtree.Method;
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.IMatchable;
|
||||
import de.dhbwstuttgart.syntaxtree.type.ITypeContainer;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.FunNInterface;
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.ParserError;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
|
||||
|
||||
|
||||
@ -175,7 +174,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
// Klasse existiert, darf aber keine Parameterliste in der Definition haben
|
||||
if( KlassenVektor.elementAt(k).get_ParaList().size() == 0 )
|
||||
{
|
||||
RefType RNeu = new RefType( TempParameter.getName(), null,TempParameter.getOffset());
|
||||
RefType RNeu = new RefType( TempParameter.getName().toString(), null,TempParameter.getOffset());
|
||||
inferencelog.debug( "Vorher: " + Parameter );
|
||||
// i-te Stelle ersetzen
|
||||
Parameter.set( i, RNeu );
|
||||
@ -562,7 +561,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
* Generiert den Bytecode und das Class-File f�r den Syntaxbaum.
|
||||
* @throws NullPointerException Wenn noch kein abstrakter Syntaxbaum vorhanden
|
||||
* ist.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Vector<ClassFile> codeGeneration(ResultSet result)
|
||||
throws NullPointerException, JVMCodeException
|
||||
@ -580,7 +579,8 @@ public class MyCompiler implements MyCompilerAPI
|
||||
|
||||
codegenlog.info("Codegenerierung beendet!");
|
||||
return ret;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// ino.method.main.21313.defdescription type=javadoc
|
||||
/**
|
||||
@ -658,7 +658,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
return OutputDir;
|
||||
}
|
||||
// ino.end
|
||||
|
||||
/*
|
||||
// ino.method.getFullyQualifiedNameFromClassname.21322.definition
|
||||
public static String getFullyQualifiedNameFromClassname(String typ, ImportDeclarations declarations)
|
||||
// ino.end
|
||||
@ -669,7 +669,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
for(int j=0;j<declarations.size();j++){
|
||||
UsedId impDecl=declarations.elementAt(j);
|
||||
if(impDecl.getSimpleName().equals(typ)){
|
||||
ret=(impDecl.getQualifiedName());
|
||||
ret=(impDecl.getQualifiedName().toString());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -677,7 +677,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
return ret;
|
||||
}
|
||||
// ino.end
|
||||
|
||||
*/
|
||||
// ino.method.makeRefTypesFullyQualified.21325.defdescription type=javadoc
|
||||
/**
|
||||
* @author HOTI
|
||||
@ -686,7 +686,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
* @param containedTypes Alle Typen, die die Klasse beinhaltet
|
||||
* @param name Alle Klassen, die es in den BasicAssumptions und im
|
||||
* AbstractSyntaxTree gibt @param declarations Alle Import-Declarations
|
||||
*/
|
||||
|
||||
// ino.end
|
||||
// ino.method.makeRefTypesFullyQualified.21325.definition
|
||||
public static void makeRefTypesFullyQualified(Vector<Type> containedTypes, ImportDeclarations declarations)
|
||||
@ -716,7 +716,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
}
|
||||
}
|
||||
// ino.end
|
||||
|
||||
*/
|
||||
/**
|
||||
* @author Arne Lüdtke
|
||||
* Ersetzt alle GTVs durch TPHs mit gleichem Namen. Arbeitet Rekursiv.
|
||||
@ -737,7 +737,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
if(tt instanceof GenericTypeVar)
|
||||
{
|
||||
GenericTypeVar gtv = (GenericTypeVar)tt;
|
||||
paras.set(i,TypePlaceholder.backdoorCreate(gtv.getName()));
|
||||
paras.set(i,TypePlaceholder.backdoorCreate(gtv.getName().toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -854,5 +854,12 @@ public class MyCompiler implements MyCompilerAPI
|
||||
this.m_AbstractSyntaxTree.add(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector<ClassFile> codeGeneration(ResultSet result)
|
||||
throws NullPointerException, JVMCodeException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// ino.end
|
@ -1,5 +1,5 @@
|
||||
// ino.module.MyCompilerAPI.8570.package
|
||||
package mycompiler;
|
||||
package de.dhbwstuttgart.core;
|
||||
// ino.end
|
||||
|
||||
// ino.module.MyCompilerAPI.8570.import
|
||||
@ -8,15 +8,15 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.exceptions.ParserError;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myexception.CTypeReconstructionException;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.myparser.JavaParser;
|
||||
import mycompiler.mytypereconstruction.TypeinferenceResultSet;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.parser.JavaParser;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.ParserError;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
|
||||
// ino.class.MyCompilerAPI.21328.description type=javadoc
|
||||
/**
|
@ -1,11 +1,11 @@
|
||||
// ino.module.CTypeReconstructionException.8572.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
|
||||
// ino.module.CTypeReconstructionException.8572.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.IItemWithOffset;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
|
||||
// ino.class.CTypeReconstructionException.23746.description type=javadoc
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
// ino.module.JVMCodeException.8573.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
// ino.class.JVMCodeException.23780.declaration
|
||||
public class JVMCodeException extends Exception
|
@ -1,5 +1,5 @@
|
||||
// ino.module.MatchException.8574.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
|
||||
// ino.class.MatchException.23790.declaration
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SCClassBodyException.8575.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
// ino.module.SCClassBodyException.8575.import
|
||||
import java.util.Vector;
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SCClassException.8576.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
// ino.module.SCClassException.8576.import
|
||||
import java.util.Enumeration;
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SCExcept.8577.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
|
||||
// ino.module.SCExcept.8577.import
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SCException.8578.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
// ino.module.SCException.8578.import
|
||||
import java.util.Enumeration;
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SCMethodException.8579.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
// ino.module.SCMethodException.8579.import
|
||||
import java.util.Vector;
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SCStatementException.8580.package
|
||||
package mycompiler.myexception;
|
||||
package de.dhbwstuttgart.myexception;
|
||||
// ino.end
|
||||
// ino.module.SCStatementException.8580.import
|
||||
import java.util.Vector;
|
@ -1,9 +1,9 @@
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
|
||||
public class BoundedClassIdentifierList extends Vector<Type>{
|
||||
|
||||
@ -20,6 +20,6 @@ public class BoundedClassIdentifierList extends Vector<Type>{
|
||||
}
|
||||
|
||||
public void addOffsetOff(RefType refType) {
|
||||
this.endOffset = refType.getOffset() + refType.getName().length();
|
||||
this.endOffset = refType.getOffset() + refType.getName().toString().length();
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
// ino.module.ClassAndParameter.8613.package
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
// ino.end
|
||||
|
||||
// ino.module.ClassAndParameter.8613.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.mytype.ParaList;
|
||||
import mycompiler.mytype.Type;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.ParaList;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
|
||||
// ino.class.ClassAndParameter.24323.description type=javadoc
|
||||
/**
|
@ -1,9 +1,9 @@
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.exceptions.DebugException;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||
|
||||
public class GenericVarDeclarationList {
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ino.module.InterfaceAndParameter.8614.package
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
// ino.end
|
||||
|
||||
// ino.module.InterfaceAndParameter.8614.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.mytype.ParaList;
|
||||
import mycompiler.mytype.Type;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.ParaList;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
|
||||
// ino.class.InterfaceAndParameter.24353.description type=javadoc
|
||||
/**
|
@ -1,11 +1,11 @@
|
||||
// ino.module.InterfaceList.8615.package
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
// ino.end
|
||||
|
||||
// ino.module.InterfaceList.8615.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.myclass.UsedId;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
|
||||
// ino.class.InterfaceList.24383.description type=javadoc
|
||||
/**
|
123
src/de/dhbwstuttgart/parser/JavaClassName.java
Normal file
123
src/de/dhbwstuttgart/parser/JavaClassName.java
Normal file
@ -0,0 +1,123 @@
|
||||
package de.dhbwstuttgart.parser;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
|
||||
/**
|
||||
* Stellt den Namen einer Java Klasse dar.
|
||||
* Dieser kann auch den Packagenamen mit beinhalten: java.util.Vector
|
||||
*
|
||||
* @author janulrich
|
||||
*
|
||||
*/
|
||||
public class JavaClassName {
|
||||
|
||||
private String name;
|
||||
private PackageName packageName;
|
||||
|
||||
public JavaClassName(String name){
|
||||
String[] names = name.split("[.]");
|
||||
boolean match = true;
|
||||
if(names.length == 1){
|
||||
//packageName = new PackageName();
|
||||
this.name = name;
|
||||
}else {
|
||||
name = names[names.length-1];
|
||||
Vector<String> packageNames = new Vector<String>();
|
||||
for(int i = 0; i<names.length-1;i++){
|
||||
packageNames.add(names[i]);
|
||||
}
|
||||
packageName = new PackageName(packageNames);
|
||||
this.name = names[names.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
//Auto-generated hashCode:
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
//result = prime * result
|
||||
// + ((packageName == null) ? 0 : packageName.hashCode()); //PackageName does not infect hashCode
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Namen sind nur gleich, wenn bei den beiden zu vergleichenden JavaClassNames auch das Package angegeben ist
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if(obj instanceof String)
|
||||
return this.toString().equals(obj) || (this.name != null && this.name.equals(obj)); //Auch mit Strings als Klassennamen kompatibel TODO: sollte bald obsolet sein
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
JavaClassName other = (JavaClassName) obj;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (packageName != null && other.packageName != null) {
|
||||
if (!packageName.equals(other.packageName))
|
||||
return false;//Spezialfall, nicht beide Typen müssen eindeutig mit Packagenamen angegeben werden
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (packageName!=null ? packageName.toString() : "") + name;
|
||||
}
|
||||
}
|
||||
|
||||
class PackageName{
|
||||
|
||||
Vector<String> names = new Vector<String>();
|
||||
|
||||
public PackageName(Vector<String> packageNames) {
|
||||
names = packageNames;
|
||||
}
|
||||
|
||||
public PackageName() {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((names == null) ? 0 : names.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PackageName other = (PackageName) obj;
|
||||
if (names == null) {
|
||||
if (other.names != null)
|
||||
return false;
|
||||
} else if (!names.equals(other.names))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String ret = "";
|
||||
if(names == null)return "";
|
||||
for(String n : names)ret+=n+".";
|
||||
return ret;
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
* *
|
||||
********************************************/
|
||||
// user code:
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
|
||||
|
||||
public class JavaLexer {
|
@ -7,7 +7,7 @@
|
||||
********************************************/
|
||||
|
||||
// user code:
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
|
||||
%%
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,105 +4,25 @@
|
||||
Backup von JavaParser.jay 10.April 17 Uhr
|
||||
*/
|
||||
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
|
||||
import mycompiler.myclass.FieldDeclaration;
|
||||
import mycompiler.myclass.GenericDeclarationList;
|
||||
import mycompiler.myclass.Field;
|
||||
import de.dhbwstuttgart.core.AClassOrInterface;
|
||||
import de.dhbwstuttgart.syntaxtree.Class;
|
||||
import de.dhbwstuttgart.syntaxtree.ImportDeclarations;
|
||||
import de.dhbwstuttgart.syntaxtree.Interface;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||
import de.dhbwstuttgart.*;
|
||||
import de.dhbwstuttgart.syntaxtree.*;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.*;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.*;
|
||||
import de.dhbwstuttgart.syntaxtree.operator.*;
|
||||
import de.dhbwstuttgart.syntaxtree.type.*;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.*;
|
||||
import java.util.Vector;
|
||||
import mycompiler.SourceFile;
|
||||
import mycompiler.AClassOrInterface;
|
||||
import mycompiler.myclass.Class;
|
||||
import mycompiler.myclass.ClassBody;
|
||||
import mycompiler.myclass.Constructor;
|
||||
import mycompiler.myclass.Constant;
|
||||
import mycompiler.myclass.ImportDeclarations;
|
||||
import mycompiler.myclass.DeclId;
|
||||
import mycompiler.myclass.ExceptionList;
|
||||
import mycompiler.myclass.FormalParameter;
|
||||
import mycompiler.myclass.Method;
|
||||
import mycompiler.myclass.ParameterList;
|
||||
import mycompiler.myclass.UsedId;
|
||||
import mycompiler.myinterface.Interface;
|
||||
import mycompiler.myinterface.InterfaceBody;
|
||||
import mycompiler.mymodifier.Abstract;
|
||||
import mycompiler.mymodifier.Final;
|
||||
import mycompiler.mymodifier.Modifier;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mymodifier.Private;
|
||||
import mycompiler.mymodifier.Protected;
|
||||
import mycompiler.mymodifier.Public;
|
||||
import mycompiler.mymodifier.Static;
|
||||
import mycompiler.myoperator.AndOp;
|
||||
import mycompiler.myoperator.DivideOp;
|
||||
import mycompiler.myoperator.EqualOp;
|
||||
import mycompiler.myoperator.GreaterEquOp;
|
||||
import mycompiler.myoperator.GreaterOp;
|
||||
import mycompiler.myoperator.LessEquOp;
|
||||
import mycompiler.myoperator.LessOp;
|
||||
import mycompiler.myoperator.MinusOp;
|
||||
import mycompiler.myoperator.ModuloOp;
|
||||
import mycompiler.myoperator.NotEqualOp;
|
||||
import mycompiler.myoperator.Operator;
|
||||
import mycompiler.myoperator.OrOp;
|
||||
import mycompiler.myoperator.PlusOp;
|
||||
import mycompiler.myoperator.TimesOp;
|
||||
import mycompiler.mystatement.ArgumentList;
|
||||
import mycompiler.mystatement.Assign;
|
||||
import mycompiler.mystatement.Binary;
|
||||
import mycompiler.mystatement.Block;
|
||||
import mycompiler.mystatement.BoolLiteral;
|
||||
import mycompiler.mystatement.FloatLiteral;
|
||||
import mycompiler.mystatement.DoubleLiteral;
|
||||
import mycompiler.mystatement.LongLiteral;
|
||||
import mycompiler.mystatement.CastExpr;
|
||||
import mycompiler.mystatement.CharLiteral;
|
||||
import mycompiler.mystatement.EmptyStmt;
|
||||
import mycompiler.mystatement.Expr;
|
||||
import mycompiler.mystatement.ExprStmt;
|
||||
import mycompiler.mystatement.IfStmt;
|
||||
import mycompiler.mystatement.InstanceOf;
|
||||
import mycompiler.mystatement.IntLiteral;
|
||||
import mycompiler.mystatement.Literal;
|
||||
import mycompiler.mystatement.InstVar;
|
||||
import mycompiler.mystatement.LocalOrFieldVar;
|
||||
import mycompiler.mystatement.LocalVarDecl;
|
||||
import mycompiler.mystatement.MethodCall;
|
||||
import mycompiler.mystatement.NegativeExpr;
|
||||
import mycompiler.mystatement.NewClass;
|
||||
import mycompiler.mystatement.NotExpr;
|
||||
import mycompiler.mystatement.Null;
|
||||
import mycompiler.mystatement.PositivExpr;
|
||||
import mycompiler.mystatement.PostDecExpr;
|
||||
import mycompiler.mystatement.PostIncExpr;
|
||||
import mycompiler.mystatement.PreDecExpr;
|
||||
import mycompiler.mystatement.PreIncExpr;
|
||||
import mycompiler.mystatement.Receiver;
|
||||
import mycompiler.mystatement.Return;
|
||||
import mycompiler.mystatement.Statement;
|
||||
import mycompiler.mystatement.StringLiteral;
|
||||
import mycompiler.mystatement.This;
|
||||
import mycompiler.mystatement.UnaryMinus;
|
||||
import mycompiler.mystatement.UnaryNot;
|
||||
import mycompiler.mystatement.UnaryPlus;
|
||||
import mycompiler.mystatement.WhileStmt;
|
||||
import mycompiler.mystatement.ForStmt;
|
||||
import mycompiler.mystatement.LambdaExpression;
|
||||
import mycompiler.mytype.BaseType;
|
||||
import mycompiler.mytype.BooleanType;
|
||||
import mycompiler.mytype.CharacterType;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.BoundedGenericTypeVar;
|
||||
import mycompiler.mytype.IntegerType;
|
||||
import mycompiler.mytype.ParaList;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytype.Void;
|
||||
import mycompiler.mytype.WildcardType;
|
||||
import mycompiler.mytype.ExtendsWildcardType;
|
||||
import mycompiler.mytype.SuperWildcardType;
|
||||
import mycompiler.mytype.Pair;
|
||||
|
||||
public class JavaParser{
|
||||
public Vector path = new Vector();
|
||||
@ -226,6 +146,7 @@ public Vector<Pair> testPair = new Vector<Pair>();
|
||||
%type <DeclId> variabledeclarator
|
||||
%type <DeclId> variabledeclaratorid
|
||||
%type <UsedId> simplename
|
||||
%type <UsedId> typename
|
||||
%type <UsedId> qualifiedname
|
||||
%type <UsedId> importqualifiedname
|
||||
%type <UsedId> importdeclaration
|
||||
@ -562,7 +483,7 @@ paralist : IDENTIFIER
|
||||
ParaList pl = new ParaList();
|
||||
/* #JB# 05.04.2005 */
|
||||
/* ########################################################### */
|
||||
pl.getParalist().addElement(new GenericTypeVar($1.getLexem(), $1.getOffset()));
|
||||
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");
|
||||
@ -588,7 +509,7 @@ paralist : IDENTIFIER
|
||||
|
||||
/* #JB# 05.04.2005 */
|
||||
/* ########################################################### */
|
||||
$1.getParalist().addElement(new GenericTypeVar($3.getLexem(),$3.getOffset()));
|
||||
$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");
|
||||
@ -786,7 +707,8 @@ classbodydeclaration : classmemberdeclaration
|
||||
$$=$1;
|
||||
}
|
||||
//*/
|
||||
classorinterfacetype : simplename parameter
|
||||
|
||||
classorinterfacetype : name parameter
|
||||
{
|
||||
if ($2 != null) {
|
||||
//$1.set_ParaList($2.get_ParaList());
|
||||
@ -808,11 +730,22 @@ typelist : type
|
||||
$1.add($3);
|
||||
$$=$1;
|
||||
}
|
||||
| typelist ',' wildcardparameter
|
||||
{
|
||||
$1.add($3);
|
||||
$$=$1;
|
||||
}
|
||||
| wildcardparameter
|
||||
{
|
||||
Vector<Type> tl = new Vector<Type>();
|
||||
tl.add($1);
|
||||
$$ = tl;
|
||||
}
|
||||
|
||||
/* PL 05-07-28 erg�nzt, weil jeder classorinterfacetype auch parametrisiert sein kann */
|
||||
//TODO: Das hier ist möglicherweise falsch. Ein Typ hat keine parameterliste, nur eine Liste von RefTypes
|
||||
parameter : { $$ = null; }
|
||||
| '<'typelist'>'//'<'paralist'>'//typelist statt
|
||||
| '<' typelist '>' //'<'paralist'>'//typelist statt
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
@ -1044,11 +977,11 @@ boundedClassParameters : boundedClassParameter
|
||||
// returns GenericTypeVar
|
||||
boundedMethodParameter : IDENTIFIER
|
||||
{
|
||||
$$=new GenericTypeVar($1.getLexem(),$1.getOffset());
|
||||
$$=new GenericTypeVar($1.getLexem(),null,$1.getOffset());
|
||||
}
|
||||
| IDENTIFIER EXTENDS boundedclassidentifierlist
|
||||
{
|
||||
BoundedGenericTypeVar gtv=new BoundedGenericTypeVar($1.getLexem(), $3, $1.getOffset() ,$3.getEndOffset());
|
||||
BoundedGenericTypeVar gtv=new BoundedGenericTypeVar($1.getLexem(), $3,null, $1.getOffset() ,$3.getEndOffset());
|
||||
//gtv.setBounds($3);
|
||||
$$=gtv;
|
||||
}
|
||||
@ -1058,7 +991,7 @@ boundedclassidentifierlist : referencetype
|
||||
Vector<Type> vec=new Vector<Type>();
|
||||
vec.addElement($1);
|
||||
containedTypes.addElement($1);
|
||||
$$=new BoundedClassIdentifierList(vec, $1.getOffset()+$1.getName().length());
|
||||
$$=new BoundedClassIdentifierList(vec, $1.getOffset()+$1.getName().toString().length());
|
||||
}
|
||||
| boundedclassidentifierlist '&' referencetype
|
||||
{
|
||||
@ -1357,6 +1290,28 @@ primitivetype :BOOLEAN
|
||||
$$=$1;
|
||||
}
|
||||
|
||||
referencelongtype : typename parameter
|
||||
{
|
||||
if ($2 != null) {
|
||||
//$1.set_ParaList($2.get_ParaList());
|
||||
$1.set_ParaList($2);//Änderung von Andreas Stadelmeier. Type statt GenericVarType
|
||||
/* otth: originale (also diese) Parameterliste retten */
|
||||
//((UsedId)$1).vParaOrg = new Vector<Type>( $2.get_ParaList() );
|
||||
}
|
||||
UsedId uid = $1;
|
||||
RefType RT = new RefType(uid.getOffset());
|
||||
|
||||
RT.set_ParaList(uid.get_RealParaList());
|
||||
RT.setName(uid.getQualifiedName());
|
||||
|
||||
|
||||
//PL 05-07-30 eingefuegt containedTypes ANFANG
|
||||
containedTypes.addElement(RT);
|
||||
//PL 05-07-30 eingefuegt containedTypes ENDE
|
||||
|
||||
$$=RT;
|
||||
}
|
||||
|
||||
referencetype :classorinterfacetype
|
||||
{
|
||||
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->referenctype: " + $1);
|
||||
@ -1375,6 +1330,8 @@ referencetype :classorinterfacetype
|
||||
|
||||
$$=RT;
|
||||
}
|
||||
|
||||
|
||||
/* 05-07-28 PL Parameterdeklarationen zur classorinterfacetype verschoben */
|
||||
|
||||
variabledeclarator : variabledeclaratorid
|
@ -1,5 +1,5 @@
|
||||
// ino.module.Scanner.8618.package
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
// ino.end
|
||||
// ino.class.Scanner.24842.declaration
|
||||
public class Scanner extends JavaLexer implements JavaParser.yyInput
|
@ -1,5 +1,5 @@
|
||||
// ino.module.Token.8619.package
|
||||
package mycompiler.myparser;
|
||||
package de.dhbwstuttgart.parser;
|
||||
// ino.end
|
||||
// ino.class.Token.24859.declaration
|
||||
public class Token
|
@ -1,10 +1,9 @@
|
||||
// ino.module.BasicAssumptionClass.8552.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.BasicAssumptionClass.8552.import
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
|
||||
// ino.class.BasicAssumptionClass.23000.declaration
|
||||
public class BasicAssumptionClass extends Class
|
@ -1,5 +1,5 @@
|
||||
// ino.module.Class.8553.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
// ino.module.Class.8553.import
|
||||
import java.util.ArrayList;
|
||||
@ -9,81 +9,31 @@ import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.AClassOrInterface;
|
||||
import mycompiler.IItemWithOffset;
|
||||
import mycompiler.SyntaxTreeNode;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myexception.CTypeReconstructionException;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.myexception.SCClassBodyException;
|
||||
import mycompiler.myexception.SCClassException;
|
||||
import mycompiler.myexception.SCExcept;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mystatement.*;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.Pair;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.SuperWildcardType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytype.WildcardType;
|
||||
import mycompiler.mytypereconstruction.CReconstructionTuple;
|
||||
import mycompiler.mytypereconstruction.CSubstitution;
|
||||
import mycompiler.mytypereconstruction.CSupportData;
|
||||
import mycompiler.mytypereconstruction.CTriple;
|
||||
import mycompiler.mytypereconstruction.TypeinferenceResultSet;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import mycompiler.mytypereconstruction.set.CReconstructionTupleSet;
|
||||
import mycompiler.mytypereconstruction.set.CSubstitutionSet;
|
||||
import mycompiler.mytypereconstruction.set.CTripleSet;
|
||||
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
||||
import mycompiler.mytypereconstruction.set.IHashSetKey;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumptionkey.CMethodKey;
|
||||
import mycompiler.mytypereconstruction.unify.FC_TTO;
|
||||
import mycompiler.mytypereconstruction.unify.Unify;
|
||||
import mycompiler.SourceFile;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.core.AClassOrInterface;
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Statement;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
|
||||
import de.dhbwstuttgart.typeinference.*;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
import de.dhbwstuttgart.typeinference.unify.FC_TTO;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.OderConstraint;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.Typeable;
|
||||
import typinferenz.UndConstraint;
|
||||
import typinferenz.FunN;
|
||||
import typinferenz.assumptions.ClassAssumption;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import typinferenz.exceptions.DebugException;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import typinferenz.typedeployment.TypeInsertPoint;
|
||||
import typinferenz.*;
|
||||
|
||||
|
||||
// ino.class.Class.23010.declaration
|
||||
@ -111,9 +61,9 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
{
|
||||
this.pkgName = pkgName;
|
||||
}
|
||||
public String getName()
|
||||
public JavaClassName getName()
|
||||
{
|
||||
return name;
|
||||
return new JavaClassName((this.pkgName!=null ? this.pkgName.toString() +"." : "") +this.name);
|
||||
}
|
||||
public void setName(String strName)
|
||||
{
|
||||
@ -325,7 +275,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
* @param typeinferenceResult - Das ResultSet einer Typinferierung oder null, falls alle Typen eindeutig feststehen.
|
||||
* @return
|
||||
* @throws JVMCodeException
|
||||
*/
|
||||
|
||||
// ino.method.codegen.23071.definition
|
||||
public ClassFile codegen(ResultSet typeinferenceResult)
|
||||
throws JVMCodeException
|
||||
@ -351,7 +301,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
//geändert von Andreas Stadelmeier: pkgName wird nicht mehr aus dem SourceFile ausgelesen:
|
||||
String packageName = "";
|
||||
if(pkgName != null) packageName = pkgName.get_Name_1Element();
|
||||
classfile.add_class(getName(), packageName, superClass, getAccessFlags());
|
||||
classfile.add_class(getName(), superClass, getAccessFlags());
|
||||
|
||||
// Handling fuer Superinterfaces
|
||||
classfile.addSuperInterfaces(getSuperInterfaces());
|
||||
@ -375,25 +325,8 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
codegenlog.info("Compilierung erfolgreich abgeschlossen, "+ getName() + ".class erstellt.");
|
||||
return classfile;
|
||||
}
|
||||
|
||||
public void codegen(ClassFile classfile, Vector paralist)
|
||||
throws JVMCodeException
|
||||
{
|
||||
for(int i=0 ; i < this.getFields().size() ; i++)
|
||||
{
|
||||
/*
|
||||
* if(this.fielddecl.elementAt(i) instanceof InstVarDecl)
|
||||
{
|
||||
((InstVarDecl)this.fielddecl.elementAt(i)).codegen(classfile, paralist);
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
this.fielddecl.elementAt(i).codegen(classfile, paralist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public void set_UsedId (UsedId uid)
|
||||
// ino.end
|
||||
// ino.method.set_UsedId.23074.body
|
||||
@ -451,7 +384,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
|
||||
|
||||
// ino.method.get_Superclass_Name.23086.definition
|
||||
public String get_Superclass_Name()
|
||||
public JavaClassName get_Superclass_Name()
|
||||
// ino.end
|
||||
// ino.method.get_Superclass_Name.23086.body
|
||||
{
|
||||
@ -644,7 +577,6 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
// ino.end
|
||||
// ino.method.TRProg.23110.definition
|
||||
public ConstraintsSet typeReconstruction(FC_TTO supportData, TypeAssumptions globalAssumptions)
|
||||
throws CTypeReconstructionException
|
||||
// ino.end
|
||||
// ino.method.TRProg.23110.body
|
||||
{
|
||||
@ -655,6 +587,8 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
// Und los geht's:
|
||||
//////////////////////////////
|
||||
inferencelog.info("Rufe TRStart()...");
|
||||
|
||||
typinferenzLog.debug("Erstellte FiniteClosure: "+supportData);
|
||||
//////////////////////////////
|
||||
// Ab hier ...
|
||||
// @author A10023 - Andreas Stadelmeier:
|
||||
@ -882,7 +816,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
this.typeAssumptions = assumptions; //Diese müssen anschließend nicht wieder generiert werden.
|
||||
return assumptions;
|
||||
}
|
||||
|
||||
/*
|
||||
public ConstraintsSet TYPE(Vector<Method> methodList, Vector<Expr> fielddeclarationList, TypeAssumptions assumptions){
|
||||
ConstraintsSet ret = new ConstraintsSet();
|
||||
// Die Felddeklarationen werden zu den Assumptions hinzugefügt und gelten danach für jede Methode.
|
||||
@ -897,31 +831,8 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ino.method.clear.23113.defdescription type=javadoc
|
||||
/**
|
||||
* Entfernt Annahmen f�r lokale Variablen, die f�r Methodenparameter erzeugt
|
||||
* worden sind. (siehe Algorithmus 5.17 TRProg, Martin Pl�micke)
|
||||
* <br/>Author: J�rg B�uerle
|
||||
* @param V
|
||||
* @param locals
|
||||
*/
|
||||
// ino.end
|
||||
// ino.method.clear.23113.definition
|
||||
void clear(CTypeAssumptionSet V, Vector<CTypeAssumption> locals)
|
||||
// ino.end
|
||||
// ino.method.clear.23113.body
|
||||
{
|
||||
Iterator<CTypeAssumption> localsIt = locals.iterator();
|
||||
while(localsIt.hasNext()){
|
||||
CTypeAssumption local = localsIt.next();
|
||||
CTypeAssumption assum = V.getElement(local.getHashSetKey());
|
||||
if(assum!=null){
|
||||
V.removeElement(local.getHashSetKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
// ino.end
|
||||
*/
|
||||
|
||||
|
||||
// ino.method.RetType.23119.defdescription type=javadoc
|
||||
/**
|
||||
@ -931,7 +842,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
* @param me
|
||||
* @param V
|
||||
* @return
|
||||
*/
|
||||
|
||||
// ino.end
|
||||
// ino.method.RetType.23119.definition
|
||||
private Type RetType(Method me, CTypeAssumptionSet V)
|
||||
@ -946,6 +857,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
}
|
||||
// ino.end
|
||||
|
||||
*/
|
||||
// ino.method.toString.23125.defdescription type=javadoc
|
||||
/**
|
||||
* <br/>Author: Martin Pl�micke
|
||||
@ -1023,128 +935,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
//
|
||||
// }
|
||||
|
||||
// ino.method.addOffsetsToAssumption.23131.defdescription type=javadoc
|
||||
/**
|
||||
* Methode f�gt zu einer CTypeAssumption alle
|
||||
* Offsets hinzu, wo die Variable benutzt wird.
|
||||
* <br/>Author: Thomas Hornberger 07.04.2006
|
||||
* <br/>Author: Arne Lüdtke 20.01.2007, Auf Polymorphie erweitert.
|
||||
* Wird nicht mehr verwendet. In Block ausgelagert.
|
||||
* @return
|
||||
*/
|
||||
// ino.end
|
||||
// ino.method.addOffsetsToAssumption.23131.definition
|
||||
public static void addOffsetsToAssumption(CTypeAssumption localAssumption, Block localBlock,String NameVariable,boolean isMemberVariable)
|
||||
// ino.end
|
||||
// ino.method.addOffsetsToAssumption.23131.body
|
||||
{
|
||||
/*if(localBlock!=null){
|
||||
for(Object vectorObjekt : localBlock.statements) //durchlaufe alle Statements dieses Blocks
|
||||
{
|
||||
if(vectorObjekt instanceof Block) //Bei Block
|
||||
{
|
||||
Block b = (Block)vectorObjekt;
|
||||
addOffsetsToAssumption(localAssumption,b,NameVariable,isMemberVariable);//rekursiver Aufruf
|
||||
}
|
||||
else
|
||||
{
|
||||
String Name_Superklasse = vectorObjekt.getClass().getSuperclass().getSimpleName();
|
||||
if(Name_Superklasse.equals("Statement")) //Bei Statement
|
||||
{
|
||||
Statement s = (Statement)vectorObjekt;
|
||||
try{
|
||||
if(addOffsetsToStatement(localAssumption,s,NameVariable,isMemberVariable)==false)
|
||||
{break;}}
|
||||
catch(NullPointerException NPE){}
|
||||
}
|
||||
else if(Name_Superklasse.equals("Expr") || Name_Superklasse.equals("BinaryExpr") || Name_Superklasse.equals("UnaryExpr")) //Bei Expression
|
||||
{
|
||||
Expr e = (Expr)vectorObjekt;
|
||||
try{
|
||||
addOffsetsToExpression(localAssumption,e,NameVariable,isMemberVariable);}
|
||||
catch(NullPointerException NPE){}
|
||||
}
|
||||
}
|
||||
|
||||
}}*/
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.method.addOffsetsToStatement.23134.defdescription type=javadoc
|
||||
/**
|
||||
* Hilfs-Methode f�r die Offset-Zuweisung
|
||||
* durchsucht ein Statement rekursiv
|
||||
* <br/>Author: Thomas Hornberger 08.04.2006
|
||||
* <br/>Author: Arne Lüdtke 20.10.2007, Auf Polymorphie umgebaut.
|
||||
* @return
|
||||
*/
|
||||
// ino.end
|
||||
// ino.method.addOffsetsToStatement.23134.definition
|
||||
public static boolean addOffsetsToStatement(CTypeAssumption localAssumption,Statement statement, String NameVariable, boolean isMemberVariable)
|
||||
// ino.end
|
||||
// ino.method.addOffsetsToStatement.23134.body
|
||||
{
|
||||
return statement.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable);
|
||||
/*if(statement instanceof Block) //Wenn Block
|
||||
{
|
||||
Block b = (Block)statement;
|
||||
addOffsetsToAssumption(localAssumption,b,NameVariable,isMemberVariable);
|
||||
}
|
||||
else if(statement instanceof IfStmt)//Wenn if
|
||||
{
|
||||
IfStmt i = (IfStmt)statement;
|
||||
addOffsetsToExpression(localAssumption,i.expr,NameVariable,isMemberVariable);
|
||||
addOffsetsToStatement(localAssumption,i.else_block,NameVariable,isMemberVariable);
|
||||
addOffsetsToStatement(localAssumption,i.then_block,NameVariable,isMemberVariable);
|
||||
}
|
||||
else if(statement instanceof Return)//Wenn Return
|
||||
{
|
||||
Return r = (Return)statement;
|
||||
addOffsetsToExpression(localAssumption,r.retexpr,NameVariable,isMemberVariable);
|
||||
}
|
||||
else if(statement instanceof WhileStmt)//Wenn While
|
||||
{
|
||||
WhileStmt w = (WhileStmt)statement;
|
||||
addOffsetsToExpression(localAssumption,w.expr,NameVariable,isMemberVariable);
|
||||
addOffsetsToStatement(localAssumption,w.loop_block,NameVariable,isMemberVariable);
|
||||
}
|
||||
else if(statement instanceof LocalVarDecl)//Wenn Lokale-Variable-Deklaration
|
||||
{
|
||||
isMemberVariable=true;//hoth 02.05.06
|
||||
if(isMemberVariable)//Wenn Objektvariable
|
||||
{
|
||||
LocalVarDecl l = (LocalVarDecl)statement;
|
||||
if(l.get_Name().equals(NameVariable))
|
||||
{
|
||||
if(isFirstLocalVarDecl==false)
|
||||
{return false;}//Wenn jetzt lokale Variable kommt, dann springe raus
|
||||
else
|
||||
{isFirstLocalVarDecl=false;}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;*/
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.method.addOffsetsToExpression.23137.defdescription type=javadoc
|
||||
/**
|
||||
* Hilfs-Methode f�r die Offset-Zuweisung
|
||||
* durchsucht eine Expression rekursiv
|
||||
* <br/>Author: Thomas Hornberger 07.04.2006
|
||||
* <br/>Authos: Arne Lüdtke 20.01.2007, Auf Polymorphie umgebaut.
|
||||
* @return
|
||||
*/
|
||||
// ino.end
|
||||
// ino.method.addOffsetsToExpression.23137.definition
|
||||
public static void addOffsetsToExpression(CTypeAssumption localAssumption,Expr expression, String NameVariable,boolean isMemberVariable)
|
||||
// ino.end
|
||||
// ino.method.addOffsetsToExpression.23137.body
|
||||
{
|
||||
expression.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
|
||||
// ino.method.getSimpleName.23140.defdescription type=javadoc
|
||||
/**
|
||||
* HOTI
|
||||
@ -1159,7 +950,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
// ino.end
|
||||
// ino.method.getSimpleName.23140.body
|
||||
{
|
||||
return UsedId.createFromQualifiedName(getName(),-1).getSimpleName();
|
||||
return UsedId.createFromQualifiedName(getName().toString(),-1).getSimpleName();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -1281,7 +1072,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
parameter.add(((GenericTypeVar)param).getTypePlaceHolder());//(TypePlaceholder.fresh()); //Hier ist kein ReplacementListener notwendig. Der Typ soll nie eingesetzt werden. Der TPH wird nur gebraucht, damit das Unifizieren funktioniert.
|
||||
}
|
||||
*/
|
||||
return new RefType(this.getName(), this.get_ParaList(), 0);
|
||||
return new RefType(this.getName().toString(), this.get_ParaList(), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1334,10 +1125,19 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
}
|
||||
}
|
||||
if(!constructorVorhanden){//Falls kein Konstruktor vorhanden ist, muss noch der Standardkonstruktor angefügt werden:
|
||||
Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(this.getName(), this));
|
||||
Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(this.getName().toString(), this));
|
||||
this.addField(standardKonstruktor);
|
||||
}
|
||||
|
||||
if(this.genericClassParameters == null)this.setGenericParameter(new GenericDeclarationList(new Vector<GenericTypeVar>(), 0));
|
||||
for(Type t : this.get_ParaList()){
|
||||
if(t instanceof GenericTypeVar)this.genericClassParameters.add((GenericTypeVar)t);
|
||||
else this.genericClassParameters.add(new GenericTypeVar(t.get_Name(),this,-1));
|
||||
}
|
||||
for(GenericTypeVar gtv : this.getGenericParameter()){
|
||||
gtv.setParentClass(this);;
|
||||
}
|
||||
|
||||
//TODO: Umwandlung zu RefTypes funktioniert noch nicht richtig. (siehe LambdaTest2)
|
||||
//Als RefType geparste Generische Variablen umwandeln:
|
||||
this.wandleRefTypeAttributes2GenericAttributes();
|
||||
@ -1353,6 +1153,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
|
||||
for(Field f : this.getFields()){
|
||||
ret.add(f);
|
||||
ret.addAll(this.getGenericParameter());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1367,7 +1168,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<GenericTypeVar> getGenericParameter() {
|
||||
public Vector<GenericTypeVar> getGenericParameter() {
|
||||
if(this.genericClassParameters == null)return new Vector<GenericTypeVar>();
|
||||
return this.genericClassParameters;
|
||||
}
|
@ -1,22 +1,28 @@
|
||||
// ino.module.ClassBody.8554.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
// ino.module.ClassBody.8554.import
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.myexception.SCClassBodyException;
|
||||
import mycompiler.myexception.SCExcept;
|
||||
import mycompiler.myexception.SCMethodException;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.myexception.SCClassBodyException;
|
||||
import de.dhbwstuttgart.myexception.SCExcept;
|
||||
import de.dhbwstuttgart.myexception.SCMethodException;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
|
||||
|
||||
@ -157,7 +163,7 @@ throws SCClassBodyException
|
||||
SCExcept e = new SCExcept();
|
||||
e.set_error("unbekannte Klasse "+t.getName()+".");
|
||||
e.set_function("complete_parahashtable() --> is_declared()");
|
||||
e.set_statement(t.getName());
|
||||
e.set_statement(t.getName().toString());
|
||||
ex.addException(e);
|
||||
throw ex;
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
// ino.module.ClassHelper.8555.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.ClassHelper.8555.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
|
||||
// ino.class.ClassHelper.23206.declaration
|
||||
public class ClassHelper
|
@ -1,25 +1,24 @@
|
||||
// ino.module.Constant.8556.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.Constant.8556.import
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.AttributeInfo;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.bytecode.JVMCode;
|
||||
import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Literal;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import mycompiler.mybytecode.AttributeInfo;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.mybytecode.JVMCode;
|
||||
import mycompiler.MyCompiler;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mystatement.Expr;
|
||||
import mycompiler.mystatement.Literal;
|
||||
import mycompiler.mytype.Type;
|
||||
// ino.end
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
|
||||
// ino.class.Constant.23212.description type=javadoc
|
||||
/**
|
||||
@ -118,11 +117,11 @@ public class Constant extends Method
|
||||
// ino.end
|
||||
|
||||
// ino.method.getTypeName.23243.definition
|
||||
public String getTypeName()
|
||||
public JavaClassName getTypeName()
|
||||
// ino.end
|
||||
// ino.method.getTypeName.23243.body
|
||||
{
|
||||
return name;
|
||||
return new JavaClassName(name);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -169,7 +168,7 @@ public class Constant extends Method
|
||||
{
|
||||
|
||||
// Zugehoerigen Typ (I, Z, C, Ljava/lang/String;) fuer den Typ ermitteln
|
||||
String bcgType = JVMCode.get_codegen_Type(typ.getName(), paralist);
|
||||
String bcgType = JVMCode.get_codegen_Type(typ.getName().toString(), paralist);
|
||||
|
||||
if (getValue() == null || !(getValue() instanceof Literal) ) {
|
||||
throw new JVMCodeException("Die Generierung der Konstante wird nicht unterstuetzt!");
|
||||
@ -224,11 +223,6 @@ public class Constant extends Method
|
||||
//return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceType(CReplaceTypeEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTypeLineNumber() {
|
@ -1,24 +1,24 @@
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.SyntaxTreeNode;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mystatement.Block;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.SingleConstraint;
|
||||
import typinferenz.assumptions.ConstructorAssumption;
|
||||
import typinferenz.assumptions.MethodAssumption;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
|
||||
public class Constructor extends Method {
|
||||
private Method methode;
|
||||
@ -56,7 +56,7 @@ public class Constructor extends Method {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
public JavaClassName getTypeName() {
|
||||
|
||||
return this.getType().getName();
|
||||
}
|
||||
@ -178,12 +178,6 @@ public class Constructor extends Method {
|
||||
this.methode.setOffset(Offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceType(CReplaceTypeEvent e) {
|
||||
|
||||
this.methode.replaceType(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTypeLineNumber() {
|
||||
|
||||
@ -222,7 +216,6 @@ public class Constructor extends Method {
|
||||
|
||||
public ConstraintsSet TYPE(TypeAssumptions ass) {
|
||||
ConstraintsSet ret = new ConstraintsSet();
|
||||
|
||||
ret.add(this.methode.get_Block().TYPEStmt(ass));
|
||||
return ret;
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
// ino.module.ExceptionList.8559.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
// ino.module.ExceptionList.8559.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.mytype.RefType;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
|
||||
|
||||
|
@ -1,23 +1,22 @@
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.SyntaxTreeNode;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.GenericTypeInsertable;
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.Typeable;
|
||||
import typinferenz.TypeInsertable;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import typinferenz.typedeployment.TypeInsertPoint;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.GenericTypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.Typeable;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
|
||||
public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Typeable, Generic, GenericTypeInsertable{
|
||||
|
||||
@ -55,7 +54,7 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
|
||||
throws JVMCodeException;
|
||||
|
||||
@Override
|
||||
public Iterable<GenericTypeVar> getGenericParameter() {
|
||||
public Vector<GenericTypeVar> getGenericParameter() {
|
||||
Vector<GenericTypeVar> ret = new Vector<>();
|
||||
if(this.genericParameters == null)return ret;
|
||||
ret.addAll(this.genericParameters);
|
||||
@ -154,10 +153,16 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
|
||||
return this.offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Vector<SyntaxTreeNode> getChildren() {
|
||||
Vector<SyntaxTreeNode> ret = new Vector<>();
|
||||
if(this.getType()!=null)ret.add(this.getType());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGenericParameter(GenericDeclarationList params) {
|
||||
this.genericParameters = params;
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.OderConstraint;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.SingleConstraint;
|
||||
import typinferenz.assumptions.FieldAssumption;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import mycompiler.SyntaxTreeNode;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mystatement.Expr;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintType;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.OderConstraint;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.FieldAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
|
||||
/**
|
||||
* Eine Feldinitialisation steht für eine Felddeklaration mit gleichzeitiger Wertzuweisung
|
||||
@ -106,28 +106,19 @@ public class FieldDeclaration extends Field{
|
||||
|
||||
@Override
|
||||
public Vector<SyntaxTreeNode> getChildren() {
|
||||
Vector<SyntaxTreeNode> ret = new Vector<SyntaxTreeNode>();
|
||||
Vector<SyntaxTreeNode> ret = super.getChildren();
|
||||
if(this.wert!=null)ret.add(this.wert);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceType(CReplaceTypeEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@Override
|
||||
public int getTypeLineNumber() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getVariableLength()
|
||||
{
|
||||
return declid.elementAt(0).get_Name().length();
|
||||
}
|
||||
@Override
|
||||
public ConstraintsSet TYPE(TypeAssumptions publicAssumptions) {
|
||||
if(this.wert == null && (this.getType() == null || this.getType() instanceof TypePlaceholder))
|
||||
throw new TypeinferenceException("Typlose Felder müssen mit Wert initialisiert werden", this);
|
||||
ConstraintsSet ret = new ConstraintsSet();
|
||||
TypeAssumptions localAssumptions = publicAssumptions.clone();
|
||||
|
||||
@ -146,7 +137,7 @@ public class FieldDeclaration extends Field{
|
||||
*/
|
||||
|
||||
//TypeCheck, falls es sich um einen RefType handelt:
|
||||
this.getType().checkType(localAssumptions, this);
|
||||
ConstraintType thisType = this.getType().TYPE(localAssumptions, this);
|
||||
/*
|
||||
if(this.getType()!=null && (this.getType() instanceof RefType)){
|
||||
Type replaceType = null;
|
||||
@ -156,13 +147,13 @@ public class FieldDeclaration extends Field{
|
||||
}
|
||||
*/
|
||||
|
||||
SingleConstraint c1 = new SingleConstraint(this.getType(), this.getType());
|
||||
SingleConstraint c1 = new SingleConstraint(thisType, thisType);
|
||||
ret.add(c1); //Damit die TypVariable des Felds in den Constraints auftaucht
|
||||
|
||||
if(this.wert!=null){
|
||||
//Falls bei der Deklaration ein Wert zugewiesen wird, verhält sich das Constraintserzeugen wie bei dem Assign-Statement:
|
||||
ret.add(this.wert.TYPEExpr(localAssumptions));
|
||||
ret.add(new SingleConstraint(this.wert.getType(), this.getType()));
|
||||
ret.add(new SingleConstraint(this.wert.getType().TYPE(localAssumptions,this), thisType));
|
||||
}
|
||||
return ret;
|
||||
}
|
@ -1,45 +1,27 @@
|
||||
// ino.module.FormalParameter.8561.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.FormalParameter.8561.import
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.SyntaxTreeNode;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.mybytecode.CodeAttribute;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.Typeable;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.Typeable;
|
||||
import typinferenz.TypeInsertable;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import typinferenz.typedeployment.TypeInsertPoint;
|
||||
import typinferenz.typedeployment.TypeInsertSet;
|
||||
|
||||
// ino.class.FormalParameter.23391.declaration
|
||||
public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementListener, Typeable, TypeInsertable
|
||||
public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeInsertable
|
||||
// ino.end
|
||||
// ino.class.FormalParameter.23391.body
|
||||
{
|
||||
@ -60,7 +42,7 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if(!super.equals(object))return false;
|
||||
//if(!super.equals(object))return false; //Nicht die Position im SyntaxBaum prüfen.
|
||||
if(!(object instanceof FormalParameter))return false;
|
||||
FormalParameter equals = (FormalParameter)object;
|
||||
if((this.type==null)!=(equals.type == null))return false;
|
||||
@ -82,13 +64,6 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
||||
// ino.end
|
||||
// ino.method.setType.23404.body
|
||||
{
|
||||
if(this.type instanceof TypePlaceholder){
|
||||
((TypePlaceholder)this.type).removeReplacementListener(this);
|
||||
}
|
||||
|
||||
if(t instanceof TypePlaceholder){
|
||||
((TypePlaceholder)t).addReplacementListener(this);
|
||||
}
|
||||
this.type = t;
|
||||
}
|
||||
// ino.end
|
||||
@ -134,7 +109,7 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
||||
// ino.end
|
||||
// ino.method.getTypeName.23416.body
|
||||
{ if(this.getType() == null)return "";
|
||||
return this.getType().getName();
|
||||
return this.getType().getName().toString();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -179,24 +154,6 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.method.replaceType.23428.defdescription type=javadoc
|
||||
/**
|
||||
* <br>Author: J<EFBFBD>rg B<EFBFBD>uerle
|
||||
* @param e
|
||||
*/
|
||||
// ino.end
|
||||
// ino.method.replaceType.23428.definition
|
||||
public void replaceType(CReplaceTypeEvent e)
|
||||
// ino.end
|
||||
// ino.method.replaceType.23428.body
|
||||
{
|
||||
inferencelog.debug("Ersetze Typ in FormalParameter \""+this.getIdentifier()+"\"");
|
||||
if(type instanceof TypePlaceholder){
|
||||
((TypePlaceholder)type).removeReplacementListener(this);
|
||||
}
|
||||
this.setType(e.getNewType());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.method.getTypeLineNumber.23431.defdescription type=javadoc
|
||||
/**
|
@ -1,9 +1,9 @@
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
|
||||
/**
|
||||
* Wird von allen Klassen implementiert, welche generische Parameter halten können. (Class, Method und Field)
|
@ -1,9 +1,9 @@
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myparser.GenericVarDeclarationList;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import de.dhbwstuttgart.parser.GenericVarDeclarationList;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
|
||||
|
||||
/**
|
@ -1,11 +1,13 @@
|
||||
// ino.module.ImportDeclarations.8562.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.ImportDeclarations.8562.import
|
||||
import java.util.Vector;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
|
||||
|
||||
// ino.class.ImportDeclarations.23434.description type=javadoc
|
||||
/**
|
@ -1,32 +1,19 @@
|
||||
// ino.module.Interface.8582.package
|
||||
package mycompiler.myinterface;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.Interface.8582.import
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.AClassOrInterface;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myclass.Class;
|
||||
import mycompiler.myclass.ClassHelper;
|
||||
import mycompiler.myclass.Constant;
|
||||
import mycompiler.myclass.FormalParameter;
|
||||
import mycompiler.myclass.Method;
|
||||
import mycompiler.myclass.ParameterList;
|
||||
import mycompiler.myclass.UsedId;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytypereconstruction.CIntersectionType;
|
||||
import mycompiler.mytypereconstruction.TypeinferenceResultSet;
|
||||
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption;
|
||||
import mycompiler.SourceFile;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.core.AClassOrInterface;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
|
||||
/**
|
||||
* Ein Interface ist eine abstrakte Klasse, erbt daher von Class
|
@ -1,18 +1,13 @@
|
||||
// ino.module.InterfaceBody.8583.package
|
||||
package mycompiler.myinterface;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.InterfaceBody.8583.import
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.myclass.Field;
|
||||
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myclass.Constant;
|
||||
import mycompiler.myclass.Method;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
|
||||
// ino.class.InterfaceBody.23984.description type=javadoc
|
||||
/**
|
@ -1,5 +1,5 @@
|
||||
// ino.module.Method.8564.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
// ino.module.Method.8564.import
|
||||
import java.util.Enumeration;
|
||||
@ -7,41 +7,33 @@ import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.IItemWithOffset;
|
||||
import mycompiler.SyntaxTreeNode;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.MyCompiler;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.myexception.SCMethodException;
|
||||
import mycompiler.myexception.SCStatementException;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mystatement.Block;
|
||||
import mycompiler.mystatement.Return;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
||||
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.SingleConstraint;
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.TypeInsertable;
|
||||
import typinferenz.assumptions.MethodAssumption;
|
||||
import typinferenz.assumptions.ParameterAssumption;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import typinferenz.typedeployment.TypeInsertPoint;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.myexception.SCMethodException;
|
||||
import de.dhbwstuttgart.myexception.SCStatementException;
|
||||
import de.dhbwstuttgart.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Return;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||
import de.dhbwstuttgart.typeinference.TypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
|
||||
|
||||
|
||||
@ -172,7 +164,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
// ino.end
|
||||
|
||||
// ino.method.getTypeName.23533.definition
|
||||
public String getTypeName()
|
||||
public JavaClassName getTypeName()
|
||||
// ino.end
|
||||
// ino.method.getTypeName.23533.body
|
||||
{
|
||||
@ -203,14 +195,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
// ino.end
|
||||
// ino.method.setReturnType.23539.body
|
||||
{
|
||||
if(this.returntype instanceof TypePlaceholder){
|
||||
((TypePlaceholder)this.returntype).removeReplacementListener(this);
|
||||
}
|
||||
|
||||
if(type instanceof TypePlaceholder){
|
||||
((TypePlaceholder)type).addReplacementListener(this);
|
||||
}
|
||||
// this.returntype = type; //auskommentiert von Andreas Stadelmeier (a10023)
|
||||
this.returntype = type;
|
||||
}
|
||||
// ino.end
|
||||
@ -422,24 +406,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.method.replaceType.23599.defdescription type=javadoc
|
||||
/**
|
||||
* <br>Author: Jrg Buerle
|
||||
* @param e
|
||||
*/
|
||||
// ino.end
|
||||
// ino.method.replaceType.23599.definition
|
||||
public void replaceType(CReplaceTypeEvent e)
|
||||
// ino.end
|
||||
// ino.method.replaceType.23599.body
|
||||
{
|
||||
inferencelog.debug("Ersetze Typ in Method \""+this.get_Method_Name()+"()\"\n");
|
||||
if(returntype instanceof TypePlaceholder){
|
||||
((TypePlaceholder)returntype).removeReplacementListener(this);
|
||||
}
|
||||
this.setReturnType(e.getNewType());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.method.getTypeLineNumber.23602.defdescription type=javadoc
|
||||
/**
|
||||
@ -561,7 +527,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
}
|
||||
|
||||
//TypeCheck, falls es sich um einen RefType handelt:
|
||||
this.returntype = this.returntype.checkType(localAss, this);
|
||||
this.returntype = this.returntype.TYPE(localAss, this).getType();
|
||||
/*
|
||||
if(this.returntype!=null && (this.returntype instanceof RefType)&&
|
||||
!(this.returntype instanceof mycompiler.mytype.Void)){//Sonderfall der Methode: Ihr Typ darf Void definiert werden.
|
||||
@ -574,7 +540,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
//Die Parameter zu den Assumptions hinzufügen:
|
||||
if(this.parameterlist!=null)for(FormalParameter param : this.parameterlist){
|
||||
|
||||
param.setType(param.getType().checkType(localAss, this));
|
||||
param.setType(param.getType().TYPE(localAss, this).getType());
|
||||
/*
|
||||
if(param.getType() instanceof RefType)
|
||||
{
|
||||
@ -590,7 +556,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
}
|
||||
ret.add(this.block.TYPEStmt(localAss));
|
||||
//eine Verknüpfung mit der Type Assumption aus dem Assumption Set und dem ermittelten Typ der Methode:
|
||||
ret.add(new SingleConstraint(this.block.getType(), this.returntype));
|
||||
ret.add(new SingleConstraint(this.block.getType().TYPE(localAss, this), this.returntype.TYPE(localAss, this)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -717,6 +683,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
for(FormalParameter param : this.parameterlist){
|
||||
ret.add(param);
|
||||
}
|
||||
ret.addAll(this.getGenericParameter());
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,17 +1,19 @@
|
||||
// ino.module.ParameterList.8565.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
// ino.module.ParameterList.8565.import
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.mybytecode.CodeAttribute;
|
||||
import mycompiler.mytype.*;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
||||
import de.dhbwstuttgart.syntaxtree.type.BaseType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
// ino.end
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ino.module.SourceFile.8722.package
|
||||
package mycompiler;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
// ino.end
|
||||
|
||||
// ino.module.SourceFile.8722.import
|
||||
@ -10,56 +10,44 @@ import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myclass.BasicAssumptionClass;
|
||||
import mycompiler.myclass.Class;
|
||||
import mycompiler.myclass.Constructor;
|
||||
import mycompiler.myclass.Field;
|
||||
import mycompiler.myclass.FieldDeclaration;
|
||||
import mycompiler.myclass.ImportDeclarations;
|
||||
import mycompiler.myclass.UsedId;
|
||||
import mycompiler.myexception.CTypeReconstructionException;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.myexception.SCClassException;
|
||||
import mycompiler.myexception.SCException;
|
||||
import mycompiler.myinterface.Interface;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mymodifier.Public;
|
||||
import mycompiler.mytype.BooleanType;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.Pair;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import mycompiler.mytype.Void;
|
||||
import mycompiler.mytypereconstruction.CIntersectionType;
|
||||
import mycompiler.mytypereconstruction.CSupportData;
|
||||
import mycompiler.mytypereconstruction.TypeinferenceResultSet;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption;
|
||||
import mycompiler.mytypereconstruction.unify.FC_TTO;
|
||||
import mycompiler.mytypereconstruction.unify.Unify;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import mycompiler.myclass.*;
|
||||
import mycompiler.*;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.core.AClassOrInterface;
|
||||
import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.myexception.SCClassException;
|
||||
import de.dhbwstuttgart.myexception.SCException;
|
||||
import de.dhbwstuttgart.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Public;
|
||||
import de.dhbwstuttgart.syntaxtree.type.BooleanType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.FunN;
|
||||
import de.dhbwstuttgart.typeinference.FunNInterface;
|
||||
import de.dhbwstuttgart.typeinference.FunNMethod;
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
import de.dhbwstuttgart.typeinference.UndConstraint;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
|
||||
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.Unify;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import sun.reflect.generics.reflectiveObjects.TypeVariableImpl;
|
||||
import typinferenz.ConstraintsSet;
|
||||
import typinferenz.FunN;
|
||||
import typinferenz.FunNInterface;
|
||||
import typinferenz.FunNMethod;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.UndConstraint;
|
||||
import typinferenz.assumptions.ClassAssumption;
|
||||
import typinferenz.assumptions.MethodAssumption;
|
||||
import typinferenz.assumptions.ParameterAssumption;
|
||||
import typinferenz.assumptions.TypeAssumptions;
|
||||
import typinferenz.exceptions.DebugException;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
|
||||
|
||||
|
||||
@ -227,7 +215,7 @@ public class SourceFile
|
||||
* Startet die Bytecodegenerierung fuer alle in der Datei
|
||||
* enthaltenen Klassen und Interfaces.
|
||||
*
|
||||
*/
|
||||
|
||||
// ino.end
|
||||
// ino.method.codegen.21397.definition
|
||||
public Vector<ClassFile> codegen(ResultSet result)
|
||||
@ -250,7 +238,7 @@ public class SourceFile
|
||||
return ret;
|
||||
}
|
||||
// ino.end
|
||||
|
||||
*/
|
||||
// ino.method.createPairFromClassAndSuperclass.21400.defdescription type=javadoc
|
||||
/**
|
||||
* Erstellt ein Typ-Paar, welches im 1. Durchlauf in die Menge der Finite Closure
|
||||
@ -260,7 +248,7 @@ public class SourceFile
|
||||
*/
|
||||
// ino.end
|
||||
// ino.method.createPairFromClassAndSuperclass.21400.definition
|
||||
private Pair createPairFromClassAndSuperclass(String className, String superclassName, Vector classParaOrg, Vector superclassParaOrg)
|
||||
private Pair createPairFromClassAndSuperclass(JavaClassName className, JavaClassName superclassName, Vector classParaOrg, Vector superclassParaOrg)
|
||||
// ino.end
|
||||
// ino.method.createPairFromClassAndSuperclass.21400.body
|
||||
{
|
||||
@ -272,15 +260,15 @@ public class SourceFile
|
||||
superclassParaOrg=null;
|
||||
}
|
||||
Pair P = new Pair(
|
||||
new RefType( className, classParaOrg,-1),
|
||||
new RefType( superclassName, superclassParaOrg,-1)
|
||||
new RefType( className.toString(), classParaOrg,-1),
|
||||
new RefType( superclassName.toString(), superclassParaOrg,-1)
|
||||
);
|
||||
//PL 04-12-29 freshe Variablen ANFANG
|
||||
RefType r1 = (RefType)P.getTA1Copy();
|
||||
RefType r2 = (RefType)P.getTA2Copy();
|
||||
// #JB# 05.04.2005
|
||||
// ###########################################################
|
||||
Hashtable<String,Type> substHash = new Hashtable<String,Type>(); //fuer jedes Paar komplett neue Variablen
|
||||
Hashtable<JavaClassName,Type> substHash = new Hashtable<JavaClassName,Type>(); //fuer jedes Paar komplett neue Variablen
|
||||
Unify.varSubst(r1, substHash);
|
||||
Unify.varSubst(r2, substHash);
|
||||
// ###########################################################
|
||||
@ -326,7 +314,7 @@ public class SourceFile
|
||||
Iterator<UsedId> interfaceIterator=tempKlasse.getSuperInterfaces().iterator();
|
||||
while(interfaceIterator.hasNext()){
|
||||
UsedId intf=interfaceIterator.next();
|
||||
String interfaceName=intf.getQualifiedName();
|
||||
JavaClassName interfaceName=intf.getQualifiedName();
|
||||
Pair P=createPairFromClassAndSuperclass(tempKlasse.getName(),interfaceName,tempKlasse.get_ParaList(),intf.get_ParaList());
|
||||
vFC.add( P );
|
||||
|
||||
@ -339,7 +327,7 @@ public class SourceFile
|
||||
Iterator<UsedId> interfaceIterator=intf.getSuperInterfaces().iterator();
|
||||
while(interfaceIterator.hasNext()){
|
||||
UsedId superintf=interfaceIterator.next();
|
||||
String superinterfaceName=superintf.getQualifiedName();
|
||||
JavaClassName superinterfaceName=superintf.getQualifiedName();
|
||||
Pair P=createPairFromClassAndSuperclass(intf.getName(),superinterfaceName,intf.getParaList(), superintf.get_ParaList());
|
||||
vFC.add( P );
|
||||
|
||||
@ -452,7 +440,7 @@ public class SourceFile
|
||||
|
||||
//es werden alle Parameter in einem Typeterm, der
|
||||
//der Argumente hat ersetzt PL 04-12-28
|
||||
Hashtable<String,Type> hts = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> hts = new Hashtable<JavaClassName,Type>();
|
||||
//for(int u = nSubstStelle; u < vPara.size(); u++) {
|
||||
for(int u = 0; u < vPara.size(); u++) {
|
||||
try {
|
||||
@ -463,7 +451,7 @@ public class SourceFile
|
||||
// ###########################################################
|
||||
inferencelog.debug("Typterm_Name: " + vPara.elementAt(u));
|
||||
inferencelog.debug("Typterm_Name: " + ((Type)vPara.elementAt(u)).Type2String());
|
||||
hts.put(((RefType)PSuchen.TA1).getParaN(u), vPara.elementAt(u));
|
||||
hts.put(new JavaClassName(((RefType)PSuchen.TA1).getParaN(u)), vPara.elementAt(u));
|
||||
}
|
||||
catch( Exception E ) {
|
||||
inferencelog.error(E.getMessage());
|
||||
@ -528,7 +516,7 @@ public class SourceFile
|
||||
RefType RSuch = (RefType)PSuch.TA1;
|
||||
|
||||
//if( R.getName().equals(RSuch.getName()) )
|
||||
if (R.is_Equiv(RSuch, new Hashtable<String,Type>())) //eingefuegt PL 05-01-07
|
||||
if (R.is_Equiv(RSuch, new Hashtable<JavaClassName,Type>())) //eingefuegt PL 05-01-07
|
||||
{
|
||||
// Paar einfuegen, falls noch nicht vorhanden
|
||||
RefType L1 = (RefType)PTemp.getTA1Copy();
|
||||
@ -539,10 +527,10 @@ public class SourceFile
|
||||
//zunaechst Variablen disjunkt machen ANFANG
|
||||
// #JB# 05.04.2005
|
||||
// ###########################################################
|
||||
Hashtable<String,Type> substHash1 = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> substHash1 = new Hashtable<JavaClassName,Type>();
|
||||
Unify.varSubst(L1, substHash1);
|
||||
Unify.varSubst(L2, substHash1);
|
||||
Hashtable<String,Type> substHash2 = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> substHash2 = new Hashtable<JavaClassName,Type>();
|
||||
Unify.varSubst(R1, substHash2);
|
||||
Unify.varSubst(R2, substHash2);
|
||||
// ###########################################################
|
||||
@ -553,9 +541,9 @@ public class SourceFile
|
||||
|
||||
// #JB# 05.04.2005
|
||||
// ###########################################################
|
||||
Hashtable<String,Type> h = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> h = new Hashtable<JavaClassName,Type>();
|
||||
L2.Equiv2Equal(R1, h);
|
||||
Hashtable<String,Type> substHash3 = h;
|
||||
Hashtable<JavaClassName,Type> substHash3 = h;
|
||||
Unify.varSubst(L1, substHash3);
|
||||
Unify.varSubst(R2, substHash3);
|
||||
// ###########################################################
|
||||
@ -687,6 +675,8 @@ public class SourceFile
|
||||
}
|
||||
typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints);
|
||||
|
||||
finiteClosure.generateFullyNamedTypes(globalAssumptions);
|
||||
|
||||
//////////////////////////////
|
||||
// Unifizierung der Constraints:
|
||||
//////////////////////////////
|
||||
@ -730,25 +720,27 @@ public class SourceFile
|
||||
//Erst die Unifizierung erstellen:
|
||||
Vector<Pair> constraintsClone = (Vector<Pair>)constraints.clone();
|
||||
|
||||
/*
|
||||
//Typen kontrollieren:
|
||||
for(Pair p : constraintsClone){
|
||||
Type t = p.TA1;
|
||||
//TypeCheck, falls es sich um einen RefType handelt:
|
||||
if(t!=null && (t instanceof RefType)&&
|
||||
!(t instanceof mycompiler.mytype.Void)){
|
||||
!(t instanceof de.dhbwstuttgart.syntaxtree.type.Void)){
|
||||
Type replaceType = null;
|
||||
replaceType = globalAssumptions.getTypeFor((RefType)t);
|
||||
replaceType = globalAssumptions.getTypeFor((RefType)t, null);
|
||||
if(!(replaceType == null))p.TA1 = replaceType;
|
||||
}
|
||||
t = p.TA2;
|
||||
//TypeCheck, falls es sich um einen RefType handelt:
|
||||
if(t!=null && (t instanceof RefType)&&
|
||||
!(t instanceof mycompiler.mytype.Void)){
|
||||
!(t instanceof de.dhbwstuttgart.syntaxtree.type.Void)){
|
||||
Type replaceType = null;
|
||||
replaceType = globalAssumptions.getTypeFor((RefType)t);
|
||||
replaceType = globalAssumptions.getTypeFor((RefType)t, null);
|
||||
if(!(replaceType == null))p.TA2 = replaceType;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Vector<Vector<Pair>> unifyResult = Unify.unify(constraintsClone, finiteClosure);
|
||||
//Dann den Ergebnissen anfügen
|
||||
@ -933,7 +925,7 @@ public class SourceFile
|
||||
/**
|
||||
* Erstellt die Basic Assumptions (siehe MakeBasicAssumptions) als AssumptionSet
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Deprecated //angefügt von Andreas Stadelmeier. Grund: Die Funktion wurde neu als makeBasicAssumptionsFromJRE angelegt
|
||||
private TypeAssumptions getBasicAssumptions() {
|
||||
TypeAssumptions ret = new TypeAssumptions(null);
|
||||
@ -954,7 +946,7 @@ public class SourceFile
|
||||
// Properties laden
|
||||
java.lang.Class<?> x;
|
||||
try {
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName());
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName().toString());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl);
|
||||
}
|
||||
@ -1046,7 +1038,7 @@ public class SourceFile
|
||||
for(int k=0;k<gpt.length;k++){
|
||||
Type type=createTypeFromJavaGenericType(gpt[k],pt[k],jreSpiderRegistry);
|
||||
// Fixme HOTI beachte overloaded id
|
||||
method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()));
|
||||
method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName().toString(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()));
|
||||
}
|
||||
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(method));
|
||||
//ret.add(method); //auskommentiert von Andreas Stadelmeier
|
||||
@ -1076,7 +1068,7 @@ public class SourceFile
|
||||
imports.addAll(doneImports);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}*/
|
||||
|
||||
// ino.method.makeBasicAssumptionsFromJRE.21409.definition
|
||||
private TypeAssumptions makeBasicAssumptionsFromJRE(Vector<UsedId> imports)
|
||||
@ -1094,7 +1086,6 @@ public class SourceFile
|
||||
mod.addModifier(new Public());
|
||||
|
||||
//Für Object:
|
||||
//TODO: toString()-Methode gerät nicht in die BasicAssumptions
|
||||
imports.add(new UsedId("java.lang.Object",-1));
|
||||
|
||||
// Für jede einzelne Klasse
|
||||
@ -1104,7 +1095,7 @@ public class SourceFile
|
||||
// Properties laden
|
||||
java.lang.Class<?> x;
|
||||
try {
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName());
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName().toString());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl);
|
||||
}
|
||||
@ -1116,19 +1107,19 @@ public class SourceFile
|
||||
//String className=x.getSimpleName();
|
||||
String className=x.getName();
|
||||
|
||||
// Generische Typen erzeugen
|
||||
|
||||
|
||||
|
||||
Class parentClass = new Class(className, mod, 0);
|
||||
// Generische Typen erzeugen
|
||||
Hashtable<String,GenericTypeVar> jreSpiderRegistry=new Hashtable<String,GenericTypeVar>();
|
||||
Vector<GenericTypeVar> typeGenPara = new Vector<GenericTypeVar>();
|
||||
for(int j=0;j<tvs.length;j++){
|
||||
GenericTypeVar gtv=new GenericTypeVar(tvs[j].getName(),-1);
|
||||
GenericTypeVar gtv=new GenericTypeVar(tvs[j].getName(), parentClass,-1);
|
||||
typeGenPara.addElement(gtv);
|
||||
jreSpiderRegistry.put(tvs[j].getName(),gtv);
|
||||
}
|
||||
|
||||
//BasicAssumptionClass myCl = new BasicAssumptionClass(className, mod);
|
||||
Class parentClass = new Class(className, mod, 0);
|
||||
|
||||
if(typeGenPara.size()>0){
|
||||
//auskommentiert von Andreas Stadelmeier:
|
||||
@ -1158,7 +1149,7 @@ public class SourceFile
|
||||
java.lang.reflect.TypeVariable[] superclassTVS=superClass.getTypeParameters();
|
||||
Vector<Type> supertypeGenPara = new Vector<Type>();
|
||||
for(int tvi=0;tvi<superclassTVS.length;tvi++){
|
||||
GenericTypeVar newGTV=new GenericTypeVar(superclassTVS[tvi].getName(),-1);
|
||||
GenericTypeVar newGTV=new GenericTypeVar(superclassTVS[tvi].getName(),parentClass,-1);
|
||||
supertypeGenPara.addElement(newGTV);
|
||||
}
|
||||
|
||||
@ -1177,30 +1168,27 @@ public class SourceFile
|
||||
|
||||
for(int j=0;j<fields.length;j++){
|
||||
if(java.lang.reflect.Modifier.isPublic(fields[j].getModifiers())){
|
||||
//CInstVarTypeAssumption instVar = new CInstVarTypeAssumption(className, fields[j].getName(), new RefType(fields[j].getType().getSimpleName()), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>());
|
||||
CInstVarTypeAssumption instVar = new CInstVarTypeAssumption(className, fields[j].getName(), new RefType(fields[j].getType().getName(),-1), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>());
|
||||
//basicAssumptions.addFieldOrLocalVarAssumption(instVar);
|
||||
parentClass.addField(new FieldDeclaration(fields[j].getName(),new RefType(fields[j].getType().getName(),-1)));
|
||||
parentClass.addField(new FieldDeclaration(fields[j].getName(),new RefType(fields[j].getType().getName(),-1)));
|
||||
}
|
||||
}
|
||||
for(int j=0;j<methods.length;j++){
|
||||
if(java.lang.reflect.Modifier.isPublic(methods[j].getModifiers())){
|
||||
String methodName=methods[j].getName();
|
||||
if(methodName.equals("add")){
|
||||
//if(methodName.equals("add")){
|
||||
|
||||
java.lang.reflect.Type genericReturnType=methods[j].getGenericReturnType();
|
||||
Type returnType=createTypeFromJavaGenericType(genericReturnType,methods[j].getReturnType(),jreSpiderRegistry);
|
||||
|
||||
Type returnType=createTypeFromJavaGenericType(genericReturnType,methods[j].getReturnType(),jreSpiderRegistry, parentClass);
|
||||
|
||||
java.lang.reflect.Type[] gpt=methods[j].getGenericParameterTypes();
|
||||
java.lang.Class[] pt=methods[j].getParameterTypes();
|
||||
|
||||
//CMethodTypeAssumption method = new CMethodTypeAssumption(new RefType(className, 0), methodName, returnType, pt.length,MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>(),null);
|
||||
Method method = mycompiler.myclass.Method.createEmptyMethod(methodName, parentClass);
|
||||
Method method = de.dhbwstuttgart.syntaxtree.Method.createEmptyMethod(methodName, parentClass);
|
||||
method.setType(returnType);
|
||||
ParameterList parameterList = new ParameterList();
|
||||
|
||||
for(int k=0;k<gpt.length;k++){
|
||||
Type type=createTypeFromJavaGenericType(gpt[k],pt[k],jreSpiderRegistry);
|
||||
Type type=createTypeFromJavaGenericType(gpt[k],pt[k],jreSpiderRegistry, parentClass);
|
||||
// Fixme HOTI beachte overloaded id
|
||||
//method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()));
|
||||
FormalParameter parameter = new FormalParameter(new DeclId(type.get_Name()));
|
||||
@ -1211,22 +1199,25 @@ public class SourceFile
|
||||
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(method));
|
||||
parentClass.addField(method);
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
for(int j=0;j<constructors.length;j++){
|
||||
if(java.lang.reflect.Modifier.isPublic(constructors[j].getModifiers())){
|
||||
String methodName="<init>";
|
||||
CMethodTypeAssumption constructor = new CMethodTypeAssumption(new RefType(className, 0), methodName, new RefType(className,-1), constructors[j].getParameterTypes().length,MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>(),null);
|
||||
String methodName=className;
|
||||
ParameterList paraList = new ParameterList();
|
||||
for(int k=0;k<constructors[j].getParameterTypes().length;k++){
|
||||
String paraType=constructors[j].getParameterTypes()[k].getName();
|
||||
//String paraType=constructors[j].getParameterTypes()[k].getSimpleName();
|
||||
// Fixme HOTI beachte overloaded id
|
||||
constructor.addParaAssumption(new CParaTypeAssumption(className, methodName, constructors[j].getParameterTypes().length,0,paraType, new RefType(paraType,-1), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()));
|
||||
// Fixme HOTI beachte overloaded id
|
||||
FormalParameter fpara = new FormalParameter(new DeclId("p"+k));
|
||||
fpara.setType(new RefType(paraType,-1));
|
||||
paraList.formalparameter.add(fpara);
|
||||
}
|
||||
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(constructor));
|
||||
Method constructorMethod = mycompiler.myclass.Method.createEmptyMethod(methodName, parentClass);
|
||||
Method constructorMethod = de.dhbwstuttgart.syntaxtree.Method.createEmptyMethod(methodName, parentClass);
|
||||
constructorMethod.parameterlist = paraList;
|
||||
parentClass.addField(new Constructor(constructorMethod));
|
||||
}
|
||||
}
|
||||
@ -1235,7 +1226,6 @@ public class SourceFile
|
||||
basicAssumptions.addClassAssumption(new ClassAssumption(parentClass));
|
||||
imports.removeElement(importDecl);
|
||||
doneImports.addElement(importDecl);
|
||||
|
||||
}
|
||||
imports.addAll(doneImports);
|
||||
return basicAssumptions;
|
||||
@ -1262,7 +1252,7 @@ public class SourceFile
|
||||
boolean found = false;
|
||||
for(UsedId id : searchVector)
|
||||
{
|
||||
String s = id.getQualifiedName();
|
||||
String s = id.getQualifiedName().toString();
|
||||
found |= s.equals(searchString);
|
||||
}
|
||||
return found;
|
||||
@ -1270,13 +1260,13 @@ public class SourceFile
|
||||
|
||||
|
||||
// ino.method.createTypeFromJavaGenericType.21415.definition
|
||||
private Type createTypeFromJavaGenericType(java.lang.reflect.Type type, java.lang.Class<?> cl, Hashtable<String,GenericTypeVar>jreSpiderRegistry)
|
||||
private Type createTypeFromJavaGenericType(java.lang.reflect.Type type, java.lang.Class<?> cl, Hashtable<String,GenericTypeVar>jreSpiderRegistry, Class parentClass)
|
||||
// ino.end
|
||||
// ino.method.createTypeFromJavaGenericType.21415.body
|
||||
{
|
||||
if(type instanceof TypeVariableImpl){
|
||||
TypeVariableImpl tvi=((TypeVariableImpl)type);
|
||||
return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName(),-1));
|
||||
return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName().toString(),parentClass,-1));
|
||||
}else{
|
||||
//String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName());
|
||||
String jccNameForClass=baseTypeTranslationTable.get(cl.getName());
|
||||
@ -1641,5 +1631,21 @@ public class SourceFile
|
||||
//this.filename = filename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getVariableLength() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
// ino.end
|
@ -1,22 +1,21 @@
|
||||
package mycompiler;
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.TypeInsertable;
|
||||
import typinferenz.exceptions.DebugException;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import typinferenz.typedeployment.GenericTypeInsertPoint;
|
||||
import typinferenz.typedeployment.TypeInsertPoint;
|
||||
import typinferenz.typedeployment.TypeInsertSet;
|
||||
import mycompiler.myclass.Class;
|
||||
import mycompiler.myclass.Generic;
|
||||
import mycompiler.mytype.GenericTypeVar;
|
||||
import mycompiler.mytype.Pair;
|
||||
import mycompiler.mytype.Type;
|
||||
import mycompiler.mytype.TypePlaceholder;
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.GenericTypeInsertPoint;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
|
||||
|
||||
public abstract class SyntaxTreeNode{
|
||||
public abstract class SyntaxTreeNode implements IItemWithOffset{
|
||||
|
||||
protected SyntaxTreeNode parent;
|
||||
|
||||
@ -31,7 +30,8 @@ public abstract class SyntaxTreeNode{
|
||||
*/
|
||||
public void parserPostProcessing(SyntaxTreeNode parent) {
|
||||
this.parent = parent;
|
||||
for(SyntaxTreeNode node : this.getChildren())node.parserPostProcessing(this);
|
||||
for(SyntaxTreeNode node : this.getChildren())
|
||||
if(node!=null)node.parserPostProcessing(this);
|
||||
}
|
||||
|
||||
public SyntaxTreeNode getParent() {
|
@ -1,30 +1,39 @@
|
||||
// ino.module.DeclId.8558.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree.misc;
|
||||
// ino.end
|
||||
// ino.module.DeclId.8558.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.mybytecode.Attribute;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.mybytecode.CodeAttribute;
|
||||
import mycompiler.mybytecode.JVMCode;
|
||||
import mycompiler.mybytecode.SignatureInfo;
|
||||
import mycompiler.MyCompiler;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mymodifier.Final;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
import mycompiler.mystatement.Assign;
|
||||
import mycompiler.mystatement.Expr;
|
||||
import mycompiler.mystatement.ExprStmt;
|
||||
import mycompiler.mystatement.InstVar;
|
||||
import mycompiler.mystatement.LocalOrFieldVar;
|
||||
import mycompiler.mytype.RefType;
|
||||
import mycompiler.mytype.Type;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.bytecode.Attribute;
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
||||
import de.dhbwstuttgart.bytecode.JVMCode;
|
||||
import de.dhbwstuttgart.bytecode.SignatureInfo;
|
||||
import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.Constant;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Final;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Assign;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.ExprStmt;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.InstVar;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.LocalOrFieldVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
|
||||
|
||||
|
||||
|
||||
// ino.class.DeclId.23280.declaration
|
||||
public class DeclId
|
||||
// ino.end
|
||||
@ -205,7 +214,7 @@ public class DeclId
|
||||
if (type instanceof RefType)
|
||||
codegen_type = ((RefType)type).get_codegen_Type(null);
|
||||
else
|
||||
codegen_type = JVMCode.get_codegen_Type(type.getName(), paralist);
|
||||
codegen_type = JVMCode.get_codegen_Type(type.getName().toString(), paralist);
|
||||
|
||||
|
||||
// Instanzvariable genenerieren
|
||||
@ -216,7 +225,7 @@ public class DeclId
|
||||
if(wert instanceof Expr) {
|
||||
classfile.add_field_ref(name, null, codegen_type);
|
||||
Assign assign = new Assign(getOffset(),name.length());
|
||||
assign.set_Expr(new InstVar(name, type.getName(),getOffset()), (Expr)wert);
|
||||
assign.set_Expr(new InstVar(name, type.getName().toString(),getOffset()), (Expr)wert);
|
||||
classfile.add_classblock_Element(assign);
|
||||
}
|
||||
else throw new JVMCodeException("Wertzuweisung der Instanzvariable kann nicht uebersetzt werden!");
|
@ -1,10 +1,7 @@
|
||||
// ino.module.Status.8566.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree.misc;
|
||||
// ino.end
|
||||
|
||||
// ino.module.Status.8566.import
|
||||
import mycompiler.unused.Import;
|
||||
// ino.end
|
||||
|
||||
// ino.class.Status.23644.declaration
|
||||
public abstract class Status
|
||||
@ -14,9 +11,6 @@ public abstract class Status
|
||||
// ino.attribute.userdef.23647.declaration
|
||||
protected UserDef userdef;
|
||||
// ino.end
|
||||
// ino.attribute.imp.23650.declaration
|
||||
protected Import imp;
|
||||
// ino.end
|
||||
|
||||
// ino.method.set_UserDef.23653.definition
|
||||
public void set_UserDef( UserDef userdef)
|
||||
@ -26,13 +20,6 @@ public abstract class Status
|
||||
this.userdef = userdef;
|
||||
}
|
||||
// ino.end
|
||||
// ino.method.set_Import.23656.definition
|
||||
public void set_Import(Import imp)
|
||||
// ino.end
|
||||
// ino.method.set_Import.23656.body
|
||||
{
|
||||
this.imp = imp;
|
||||
}
|
||||
// ino.end
|
||||
|
||||
}
|
||||
// ino.end
|
@ -1,17 +1,17 @@
|
||||
// ino.module.UsedId.8567.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree.misc;
|
||||
// ino.end
|
||||
// ino.module.UsedId.8567.import
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import typinferenz.exceptions.TypeinferenceException;
|
||||
import mycompiler.IItemWithOffset;
|
||||
import mycompiler.mybytecode.JVMCode;
|
||||
import mycompiler.mytype.Type;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.bytecode.JVMCode;
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
|
||||
|
||||
// ino.class.UsedId.23659.declaration
|
||||
@ -183,7 +183,7 @@ public class UsedId implements IItemWithOffset
|
||||
// ino.end
|
||||
// ino.method.getSignatureUsedId.23717.body
|
||||
{
|
||||
String basis = JVMCode.get_codegen_Type(getQualifiedName(),null);
|
||||
String basis = JVMCode.get_codegen_Type(getQualifiedName().toString(),null);
|
||||
|
||||
if (paralist == null || paralist.size() ==0)
|
||||
return basis;
|
||||
@ -242,7 +242,7 @@ public class UsedId implements IItemWithOffset
|
||||
// ino.end
|
||||
|
||||
// ino.method.getQualifiedName.23726.definition
|
||||
public String getQualifiedName()
|
||||
public JavaClassName getQualifiedName()
|
||||
// ino.end
|
||||
// ino.method.getQualifiedName.23726.body
|
||||
{
|
||||
@ -254,7 +254,7 @@ public class UsedId implements IItemWithOffset
|
||||
sb.append(".");
|
||||
}
|
||||
}
|
||||
return(sb.toString());
|
||||
return new JavaClassName(sb.toString());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -312,8 +312,8 @@ public class UsedId implements IItemWithOffset
|
||||
// ino.end
|
||||
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
if(this.name.size()>1)throw new TypeinferenceException("Es kann maximal nur eine Superklasse pro Klasse geben", this);
|
||||
JavaCodeResult ret = new JavaCodeResult(this.getQualifiedName());
|
||||
if(this.name.size()>1)throw new TypeinferenceException("Es kann maximal nur eine Superklasse pro Klasse geben", null);
|
||||
JavaCodeResult ret = new JavaCodeResult(this.getQualifiedName().toString());
|
||||
if(this.paralist != null){
|
||||
ret.attach( "<" );
|
||||
Iterator<Type> it = this.paralist.iterator();
|
@ -1,5 +1,5 @@
|
||||
// ino.module.UserDef.8568.package
|
||||
package mycompiler.myclass;
|
||||
package de.dhbwstuttgart.syntaxtree.misc;
|
||||
// ino.end
|
||||
// ino.class.UserDef.23741.declaration
|
||||
public class UserDef extends Status
|
@ -1,9 +1,8 @@
|
||||
// ino.module.Abstract.8585.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
|
||||
// ino.class.Abstract.24015.description type=javadoc
|
@ -1,9 +1,8 @@
|
||||
// ino.module.Final.8586.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
|
||||
// ino.class.Final.24022.description type=javadoc
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
/**
|
||||
* @author Daniel
|
@ -1,8 +1,8 @@
|
||||
// ino.module.Modifier.8587.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
// ino.end
|
||||
// ino.class.Modifier.24029.declaration
|
@ -1,15 +1,15 @@
|
||||
// ino.module.Modifiers.8588.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
// ino.end
|
||||
|
||||
// ino.module.Modifiers.8588.import
|
||||
import java.util.Vector;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import de.dhbwstuttgart.syntaxtree.type.BaseType;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
// ino.end
|
||||
|
||||
import mycompiler.mytype.BaseType;
|
||||
|
||||
// ino.class.Modifiers.24035.description type=javadoc
|
||||
/**
|
@ -1,9 +1,8 @@
|
||||
// ino.module.Private.8589.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
|
||||
// ino.class.Private.24059.declaration
|
@ -1,9 +1,8 @@
|
||||
// ino.module.Protected.8590.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
|
||||
// ino.class.Protected.24066.declaration
|
@ -1,9 +1,8 @@
|
||||
// ino.module.Public.8591.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
|
||||
// ino.class.Public.24073.declaration
|
@ -1,9 +1,8 @@
|
||||
// ino.module.Static.8592.package
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
// ino.end
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
|
||||
// ino.class.Static.24080.declaration
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package mycompiler.mymodifier;
|
||||
package de.dhbwstuttgart.syntaxtree.modifier;
|
||||
|
||||
import typinferenz.JavaCodeResult;
|
||||
import typinferenz.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
|
||||
/**
|
||||
* @author Daniel
|
75
src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java
Executable file
75
src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java
Executable file
@ -0,0 +1,75 @@
|
||||
// ino.module.AddOp.8594.package
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
// ino.end
|
||||
// ino.module.AddOp.8594.import
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
||||
import de.dhbwstuttgart.myexception.CTypeReconstructionException;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Binary;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
import de.dhbwstuttgart.syntaxtree.type.IntegerType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintType;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||
|
||||
|
||||
|
||||
|
||||
// ino.class.AddOp.24088.declaration
|
||||
public abstract class AddOp extends Operator
|
||||
// ino.end
|
||||
// ino.class.AddOp.24088.body
|
||||
{
|
||||
// ino.method.AddOp.24092.definition
|
||||
public AddOp(int offset, int variableLength)
|
||||
// ino.end
|
||||
// ino.method.AddOp.24092.body
|
||||
{
|
||||
super(offset,variableLength);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
// ino.method.codegen.24095.declaration
|
||||
public abstract void codegen(ClassFile classfile, CodeAttribute code, Expr expr, boolean neg, Vector paralist)
|
||||
throws JVMCodeException;
|
||||
// ino.end
|
||||
|
||||
@Override
|
||||
protected Hashtable<RefType,RefType> getOperatorTypes() {
|
||||
Hashtable<RefType, RefType> types = new Hashtable<RefType, RefType>();
|
||||
|
||||
types.put(new RefType("java.lang.Integer",-1),new RefType("java.lang.Integer",-1));
|
||||
types.put(new RefType("java.lang.Double",-1),new RefType("java.lang.Double",-1));
|
||||
types.put(new RefType("java.lang.Float",-1), new RefType("java.lang.Float",-1));
|
||||
types.put(new RefType("java.lang.Long",-1), new RefType("java.lang.Long",-1));
|
||||
types.put(new RefType("java.lang.String",-1), new RefType("java.lang.String",-1));
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
||||
HashMap<ConstraintType,ConstraintType> ret = new HashMap<ConstraintType,ConstraintType>();
|
||||
ret.put(ass.getTypeFor(new RefType("java.lang.Integer",-1), this), ass.getTypeFor(new RefType("java.lang.Integer",-1),this));
|
||||
ret.put(ass.getTypeFor(new RefType("java.lang.Double",-1), this), ass.getTypeFor(new RefType("java.lang.Double",-1),this));
|
||||
ret.put(ass.getTypeFor(new RefType("java.lang.Float",-1), this), ass.getTypeFor(new RefType("java.lang.Float",-1),this));
|
||||
ret.put(ass.getTypeFor(new RefType("java.lang.Long",-1), this), ass.getTypeFor(new RefType("java.lang.Long",-1),this));
|
||||
ret.put(ass.getTypeFor(new RefType("java.lang.String",-1),this), ass.getTypeFor(new RefType("java.lang.String",-1),this));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
// ino.end
|
32
src/de/dhbwstuttgart/syntaxtree/operator/AndOp.java
Executable file
32
src/de/dhbwstuttgart/syntaxtree/operator/AndOp.java
Executable file
@ -0,0 +1,32 @@
|
||||
// ino.module.AndOp.8595.package
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
import de.dhbwstuttgart.syntaxtree.type.BooleanType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.IntegerType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
|
||||
// ino.class.AndOp.24101.declaration
|
||||
public class AndOp extends LogOp
|
||||
// ino.end
|
||||
// ino.class.AndOp.24101.body
|
||||
{
|
||||
|
||||
// ino.method.AndOp.24105.definition
|
||||
public AndOp(int offset, int variableLength)
|
||||
// ino.end
|
||||
// ino.method.AndOp.24105.body
|
||||
{
|
||||
super(offset,variableLength);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
|
||||
}
|
||||
// ino.end
|
@ -1,15 +1,16 @@
|
||||
// ino.module.DivideOp.8596.package
|
||||
package mycompiler.myoperator;
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
// ino.end
|
||||
// ino.module.DivideOp.8596.import
|
||||
import java.util.Vector;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.mybytecode.CodeAttribute;
|
||||
import mycompiler.mybytecode.JVMCode;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mystatement.Binary;
|
||||
import mycompiler.mystatement.Expr;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.bytecode.ClassFile;
|
||||
import de.dhbwstuttgart.bytecode.CodeAttribute;
|
||||
import de.dhbwstuttgart.bytecode.JVMCode;
|
||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Binary;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
|
||||
|
||||
@ -41,7 +42,7 @@ public class DivideOp extends MulOp
|
||||
code.add_code(JVMCode.ndiv(expr1.getTypeName()));
|
||||
}
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user