forked from JavaTX/JavaCompilerCore
Aufräumen
This commit is contained in:
parent
01a954ca68
commit
c34b3c4c14
@ -1,9 +1,7 @@
|
||||
package de.dhbwstuttgart.bytecode;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.ObjectType;
|
||||
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||
|
||||
public class BytecodeTypeFactory {
|
||||
@ -11,7 +9,7 @@ public class BytecodeTypeFactory {
|
||||
/**
|
||||
* @see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-FieldType
|
||||
*/
|
||||
public static String generateFieldDescriptor(Type t){
|
||||
public static String generateFieldDescriptor(RefType t){
|
||||
String ret = "";
|
||||
if(t instanceof RefType){
|
||||
ret += "L" + t.getName().toString().replace('.', '/') + ";";
|
||||
@ -39,15 +37,15 @@ public class BytecodeTypeFactory {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static String generateSuperClassSignature(Type superClass){
|
||||
public static String generateSuperClassSignature(RefType superClass){
|
||||
String ret = "";
|
||||
//TODO:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static String generateTypeParameter(GenericTypeVar gtv){
|
||||
String ret = gtv.get_Name() + ":";
|
||||
for(ObjectType t : gtv.getBounds()){
|
||||
String ret = gtv.getName() + ":";
|
||||
for(RefType t : gtv.getBounds()){
|
||||
ret += generateReferenceTypeSignature(t);
|
||||
ret += ":";
|
||||
}
|
||||
@ -65,17 +63,16 @@ public class BytecodeTypeFactory {
|
||||
/**
|
||||
* @see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-ReferenceTypeSignature
|
||||
*/
|
||||
private static String generateReferenceTypeSignature(Type t){
|
||||
private static String generateReferenceTypeSignature(RefType t){
|
||||
if(t instanceof RefType)return generateReferenceTypeSignature((RefType)t);
|
||||
if(t instanceof GenericTypeVar)return generateReferenceTypeSignature((GenericTypeVar)t);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static String generateReferenceTypeSignature(RefType t){
|
||||
String ret = "L" + t.get_Name();
|
||||
String ret = "L" + t.getName();
|
||||
if(t.getParaList() != null && t.getParaList().size() > 0){
|
||||
ret += "<";
|
||||
for(Type p : t.getParaList()){
|
||||
for(RefType p : t.getParaList()){
|
||||
ret += generateReferenceTypeSignature(p);
|
||||
}
|
||||
ret+=">";
|
||||
|
@ -1,7 +1,10 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -23,10 +26,12 @@ public class GenericTypeVar extends SyntaxTreeNode
|
||||
*/
|
||||
List<RefType> bounds=new ArrayList<RefType>();
|
||||
private int endOffset;
|
||||
private String name;
|
||||
|
||||
public GenericTypeVar(String s, List<RefType> bounds, int offset, int endOffset)
|
||||
{
|
||||
super(s, offset);
|
||||
super(offset);
|
||||
name = s;
|
||||
if(bounds != null)for(RefType t : bounds){
|
||||
//if(t!=null)this.extendVars.add(t);
|
||||
}
|
||||
@ -34,8 +39,7 @@ public class GenericTypeVar extends SyntaxTreeNode
|
||||
this.bounds = bounds;
|
||||
this.endOffset = endOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int getEndOffset(){
|
||||
return this.endOffset;
|
||||
}
|
||||
@ -44,22 +48,25 @@ public class GenericTypeVar extends SyntaxTreeNode
|
||||
{
|
||||
return bounds;
|
||||
}
|
||||
|
||||
public GenericTypeVar clone()
|
||||
{
|
||||
return new GenericTypeVar(this.getName().toString(), this.getBounds(), getOffset(), this.getEndOffset());
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "BoGTV " + this.getName();
|
||||
return "BoGTV " + this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Menge<SyntaxTreeNode> getChildren() {
|
||||
Menge<SyntaxTreeNode> ret = super.getChildren();
|
||||
public List<SyntaxTreeNode> getChildren() {
|
||||
List<SyntaxTreeNode> ret = new ArrayList<>();
|
||||
ret.addAll(this.bounds);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user