Fehler in TypeStmt beheben

This commit is contained in:
JanUlrich 2017-09-18 18:32:22 +02:00
parent 201a0978bc
commit f81496fe1f
6 changed files with 17 additions and 3 deletions

View File

@ -0,0 +1,9 @@
package de.dhbwstuttgart.core;
/**
* Stellt die Java-Environment dar
* Speichert alle Typen, Klassen aus den benutzen SourceFiles und Librarys
*/
public class CompilationEnvironment {
}

View File

@ -22,7 +22,11 @@ import java.util.stream.Collectors;
public class JavaTXCompiler {
protected List<SourceFile> sourceFiles = new ArrayList<>();
/*
public JavaTXCompiler(List<File> sourceFiles){
}
*/
public List<ResultSet> typeInference(){
List<ClassOrInterface> allClasses = new ArrayList<>();
for(SourceFile sf : sourceFiles){

View File

@ -210,7 +210,7 @@ public class SyntaxTreeGenerator{
String name = header.methodDeclarator().Identifier().getText();
GenericDeclarationList gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), header.getStart());
if(header.typeParameters() != null){
gtvDeclarations = TypeGenerator.convert(header.typeParameters(), parentClass, name,reg, localGenerics);
gtvDeclarations = TypeGenerator.convert(header.typeParameters(), parentClass, name, reg, localGenerics);
}else{
gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), header.getStart());
}

View File

@ -50,6 +50,7 @@ class Resolver implements ResultSetVisitor {
resultPair.accept(this);
}
if(resolved==null){//TPH kommt nicht im Result vor:
resolved = tph;
}
return new ResolvedType(resolved, additionalTPHs);//resolved;

View File

@ -260,6 +260,7 @@ public class TYPEStmt implements StatementVisitor{
protected Set<Pair> generateParameterConstraints(MethodCall foMethod, MethodAssumption assumption, TypeInferenceBlockInformation info) {
Set<Pair> ret = new HashSet<>();
for(int i = 0;i<foMethod.arglist.getArguments().size();i++){
foMethod.arglist.getArguments().get(i).accept(this);
ret.add(ConstraintsFactory.createPair(foMethod.arglist.getArguments().get(i).getType(),
assumption.getArgTypes().get(i), PairOperator.SMALLERDOT, info));
}
@ -293,7 +294,7 @@ public class TYPEStmt implements StatementVisitor{
return getMethods(name, arglist.getArguments().size(), info);
}
protected static List<RefTypeOrTPHOrWildcardOrGeneric> convertParams(ParameterList parameterList, TypeInferenceBlockInformation info){
protected static List<RefTypeOrTPHOrWildcardOrGeneric> convertParams(ParameterList parameterList, TypeInferenceBlockInformation info){
List<RefTypeOrTPHOrWildcardOrGeneric> params = new ArrayList<>();
for(FormalParameter fp : parameterList.getFormalparalist()){
params.add(info.checkGTV(fp.getType()));

View File

@ -47,7 +47,6 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
}
}
}
}
static String readFile(String path, Charset encoding)