diff --git a/src/de/dhbwstuttgart/syntaxtree/Class.java b/src/de/dhbwstuttgart/syntaxtree/Class.java index 53f81428..2ea33d0e 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Class.java +++ b/src/de/dhbwstuttgart/syntaxtree/Class.java @@ -223,8 +223,8 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I superclassid=null; } this.offset = offset; - if(!name.equals("Object"))//Alle Klassen außer Object erben von Object: - this.superClass = new Class("Object", -1).getType(); + if(!name.equals("Object") && !name.equals("java.lang.Object"))//Alle Klassen außer Object erben von Object: + this.superClass = new Class("java.lang.Object", -1).getType(); } // ino.end @@ -1026,5 +1026,67 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I public boolean isInterface(){ return false; } + + /* + private Collection getGenericClasses() { + Collection results = new Menge<>(); + + for(Field field : this.fielddecl){ + Type type = field.getType(); + //Der Type des Feldes + if(type instanceof RefType){ + RefType refType = (RefType) type; + + if(!refType.getCombinedType(null).equals(refType.get_Name().replace(".", "%"))){ + results.addAll(generateGenericClass(refType.getCombinedType(null), new Class("java/util/Vector",-1))); + } + } + + if(field instanceof Method){ + Method method = (Method) field; + ParameterList parameterList = method.getParameterList(); + + //Die Typen der Methodenparameter + for(FormalParameter parameter: parameterList){ + Type parameterType = parameter.getType(); + + if(parameterType instanceof RefType){ + RefType refType = (RefType) parameterType; + + if(!refType.getCombinedType(null).equals(refType.get_Name().replace(".", "%"))){ + results.addAll(generateGenericClass(refType.getCombinedType(null), new Class("java/util/Vector",-1))); + } + } + } + } + } + + return results; + } + */ + + /* + private Menge generateGenericClass(String name, Class superClass){ + //TODO: bytecode -- Generics hinzuf�gen + //Type superClassType = superClass.getType(); + + //TODO: bytecode + //ClassGenerator genericClassGenerator = new ClassGenerator(name, superClassType, name + ".java", Constants.ACC_PUBLIC , new String[] { }, new TypeinferenceResultSet(null, null, null)); + + //TODO: bytecode -- Namen der neuen Klasse + Class generatedClass = new Class(name, 0); + + //TODO: bytecode -- alle Konstruktoren generieren + Block konstruktorBlock = new Block(); + konstruktorBlock.setType(new de.dhbwstuttgart.syntaxtree.type.Void(konstruktorBlock, 0)); + konstruktorBlock.statements.add(new SuperCall(konstruktorBlock)); + Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(konstruktorBlock, name, superClass), superClass); + standardKonstruktor.parserPostProcessing(generatedClass); + + generatedClass.addField(standardKonstruktor); + + return generatedClass.genByteCode(new TypeinferenceResultSet(generatedClass, new Menge<>(), new ResultSet())); + } + */ } // ino.end