generics in Construct
This commit is contained in:
parent
6fc78b9ad3
commit
4263ff671d
@ -7,6 +7,8 @@ import java.util.List;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.GenericContext;
|
||||
import de.dhbwstuttgart.parser.scope.GenericTypeName;
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
import de.dhbwstuttgart.strucTypes.constraint.ConstraintsSet;
|
||||
import de.dhbwstuttgart.strucTypes.constraint.SubTypeConstraint;
|
||||
@ -82,7 +84,7 @@ public class Construct extends DefaultASTVisitor {
|
||||
List<Method> methods = new ArrayList<>();
|
||||
List<GenericTypeVar> generics = new ArrayList<>();
|
||||
List<RefTypeOrTPHOrWildcardOrGeneric> parameterInhTyterm = new ArrayList<>();
|
||||
final Token offset = i.getOffset();
|
||||
final Token offset = new NullToken();
|
||||
|
||||
// For über alle FieldConstraints mit ClassType i
|
||||
this.constraintsSet.getFieldConstraints().stream().filter(fc -> fc.getClassType().equals(i)).forEach(fc -> {
|
||||
@ -90,7 +92,9 @@ public class Construct extends DefaultASTVisitor {
|
||||
parameterInhTyterm.add(fc.getFieldType());
|
||||
// TODO generics.add(new GenericTypeVar(s, bounds, offset,
|
||||
// endOffset)); mit type
|
||||
Field field = new Field(fc.getFieldName(), type, Modifier.fieldModifiers(), i.getOffset());
|
||||
generics.add(new GenericTypeVar(new GenericTypeName(new GenericContext(name, null), type.getName()),
|
||||
new ArrayList<>(), offset, offset));
|
||||
Field field = new Field(fc.getFieldName(), type, Modifier.PUBLIC, i.getOffset());
|
||||
fielddecl.add(field);
|
||||
});
|
||||
|
||||
@ -100,6 +104,7 @@ public class Construct extends DefaultASTVisitor {
|
||||
parameterInhTyterm.add(mc.getReturnType());
|
||||
// TODO generics.add(new GenericTypeVar(s, bounds, offset,
|
||||
// endOffset)); mit retrunType
|
||||
generics.add(new GenericTypeVar(new GenericTypeName(new GenericContext(name, null), returnType.getName()), new ArrayList<>(), offset, offset));
|
||||
Block block = new Block(new ArrayList<>(), offset);
|
||||
GenericDeclarationList gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), offset);
|
||||
List<FormalParameter> params = new ArrayList<>();
|
||||
@ -109,9 +114,10 @@ public class Construct extends DefaultASTVisitor {
|
||||
parameterInhTyterm.add(supertype);
|
||||
// TODO generics.add(new GenericTypeVar(s, bounds, offset,
|
||||
// endOffset)); mit tph
|
||||
generics.add(new GenericTypeVar(new GenericTypeName(new GenericContext(name, null), tph.getName()), new ArrayList<>(), offset, offset));
|
||||
});
|
||||
ParameterList parameterList = new ParameterList(params, offset);
|
||||
Method method = new Method(Modifier.PUBLIC, mc.getMethodName(), returnType, Modifier.methodModifiers(),
|
||||
Method method = new Method(Modifier.PUBLIC, mc.getMethodName(), returnType, Modifier.PUBLIC,
|
||||
parameterList, block, gtvDeclarations, offset);
|
||||
methods.add(method);
|
||||
});
|
||||
@ -123,7 +129,7 @@ public class Construct extends DefaultASTVisitor {
|
||||
this.subTypeConstraints.forEach(sc -> sc.inferTypes(this.inferredTypes));
|
||||
|
||||
|
||||
final int modifiers = Modifier.interfaceModifiers();
|
||||
final int modifiers = Modifier.PUBLIC;
|
||||
final RefType superClass = this.createSuperClass();
|
||||
final boolean isInterface = true;
|
||||
final List<Constructor> constructors = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user