diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index 86666a49..e8d74cb6 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -82,7 +82,7 @@ public class JavaTXCompiler { List allClasses = new ArrayList<>();//environment.getAllAvailableClasses(); //Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC for(SourceFile sf : this.sourceFiles.values()) { - //allClasses.addAll(getAvailableClasses(sf)); + allClasses.addAll(getAvailableClasses(sf)); allClasses.addAll(sf.getClasses()); } diff --git a/src/de/dhbwstuttgart/environment/CompilationEnvironment.java b/src/de/dhbwstuttgart/environment/CompilationEnvironment.java index 5f294130..8a6976d6 100644 --- a/src/de/dhbwstuttgart/environment/CompilationEnvironment.java +++ b/src/de/dhbwstuttgart/environment/CompilationEnvironment.java @@ -49,9 +49,19 @@ public class CompilationEnvironment { * */ //String bootClassPath = System.getProperty("sun.boot.class.path"); - ClassLoader cl = ClassLoader.getPlatformClassLoader(); - URLClassLoader loader = new URLClassLoader(new URL[0], cl); - librarys = Arrays.asList(loader.getURLs()); + // ClassLoader cl = ClassLoader.getPlatformClassLoader(); + ClassLoader cl = ClassLoader.getSystemClassLoader(); + String bootClassPath = System.getProperty("java.class.path"); + librarys = new ArrayList<>(); + for(String path : bootClassPath.split(File.pathSeparator)) { + try { + librarys.add(new URL("file:"+path)); + } catch (MalformedURLException e) { + new DebugException("Fehler im Classpath auf diesem System"); + } + } + //URLClassLoader loader = new URLClassLoader(new URL[0], cl); + //librarys = Arrays.asList(loader.getURLs()); this.sourceFiles = sourceFiles; this.packageCrawler = new PackageCrawler(librarys); } diff --git a/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java b/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java index 66c206e1..ea162c11 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java @@ -37,7 +37,7 @@ public class ASPGenerator { TypeConverter converter = new TypeConverter(); for(ClassOrInterface cl : fcClasses){ ASPRefType superClass = (ASPRefType) cl.getSuperClass().acceptTV(converter); - ASPPairSmaller fcEntry = new ASPPairSmaller(new ASPFCType(convert(cl)), new ASPFCType(superClass)); + ASPPairSmaller fcEntry = new ASPPairSmaller(new ASPFCType(convert(cl)), new ASPFCType(superClass), writer); writer.add(new ASPStatement(fcEntry.toASP())); } for(Pair cons : constraintSet){ @@ -52,9 +52,9 @@ public class ASPGenerator { ASPType ls = pair.TA1.acceptTV(converter); ASPType rs = pair.TA2.acceptTV(converter); if(pair.OperatorEqual()){ - return new ASPPairEquals(ls, rs); + return new ASPPairEquals(ls, rs,writer); }else if(pair.OperatorSmallerDot()){ - return new ASPPairSmallerDot(ls, rs); + return new ASPPairSmallerDot(ls, rs, writer); }else throw new NotImplementedException(); } diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java index 777a34a7..790fd5af 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java @@ -1,12 +1,9 @@ package de.dhbwstuttgart.sat.asp.writer.model; import de.dhbwstuttgart.sat.asp.model.ASPRule; +import de.dhbwstuttgart.sat.asp.writer.ASPWriter; public class ASPFCType extends ASPRefType { - public ASPFCType(String name, ASPParameterList params){ - super(name, params); - } - public ASPFCType(ASPRefType refType){ super(refType.name, refType.params); } diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPGenericType.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPGenericType.java index 57619edf..8e732d64 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPGenericType.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPGenericType.java @@ -12,4 +12,14 @@ public class ASPGenericType implements ASPType{ public String toString(){ return ASPRule.ASP_GENERIC_TYPE_NAME + "(" + name + ")"; } + + @Override + public String toASP() { + return toString(); + } + + @Override + public String getPointer() { + return name; + } } diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPair.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPair.java index 662f995c..19730639 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPair.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPair.java @@ -1,16 +1,20 @@ package de.dhbwstuttgart.sat.asp.writer.model; +import de.dhbwstuttgart.sat.asp.writer.ASPWriter; + public abstract class ASPPair { public final ASPType leftSide; public final ASPType rightSide; - public ASPPair(ASPType ls, ASPType rs){ + public ASPPair(ASPType ls, ASPType rs, ASPWriter writer){ this.leftSide = ls; this.rightSide = rs; + writer.add(new ASPStatement(ls.toASP())); + writer.add(new ASPStatement(rs.toASP())); } public String toASP(){ - return this.getRuleName() + "(" + leftSide + ","+ rightSide + ")"; + return this.getRuleName() + "(" + leftSide.getPointer() + ","+ rightSide.getPointer() + ")"; } public String toString(){ diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairEquals.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairEquals.java index 8806f2ce..bf6e2485 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairEquals.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairEquals.java @@ -1,10 +1,11 @@ package de.dhbwstuttgart.sat.asp.writer.model; import de.dhbwstuttgart.sat.asp.model.ASPRule; +import de.dhbwstuttgart.sat.asp.writer.ASPWriter; public class ASPPairEquals extends ASPPair{ - public ASPPairEquals(ASPType ls, ASPType rs){ - super(ls, rs); + public ASPPairEquals(ASPType ls, ASPType rs, ASPWriter writer){ + super(ls, rs, writer); } @Override diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmaller.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmaller.java index 928acb49..610e5c56 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmaller.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmaller.java @@ -1,12 +1,13 @@ package de.dhbwstuttgart.sat.asp.writer.model; import de.dhbwstuttgart.sat.asp.model.ASPRule; +import de.dhbwstuttgart.sat.asp.writer.ASPWriter; import java.util.Map; public class ASPPairSmaller extends ASPPair{ - public ASPPairSmaller(ASPFCType ls, ASPFCType rs){ - super(ls, rs); + public ASPPairSmaller(ASPFCType ls, ASPFCType rs, ASPWriter writer){ + super(ls, rs, writer); } @Override diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmallerDot.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmallerDot.java index e8482bfc..b572ed99 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmallerDot.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPPairSmallerDot.java @@ -1,10 +1,11 @@ package de.dhbwstuttgart.sat.asp.writer.model; import de.dhbwstuttgart.sat.asp.model.ASPRule; +import de.dhbwstuttgart.sat.asp.writer.ASPWriter; public class ASPPairSmallerDot extends ASPPair{ - public ASPPairSmallerDot(ASPType ls, ASPType rs){ - super(ls, rs); + public ASPPairSmallerDot(ASPType ls, ASPType rs, ASPWriter writer){ + super(ls, rs, writer); } @Override diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPRefType.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPRefType.java index bfbf27a0..5eab65be 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPRefType.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPRefType.java @@ -18,4 +18,14 @@ public class ASPRefType implements ASPType { public String toString(){ return ASPRule.ASP_TYPE + "(" + name +"," + params.name + ")"; } + + @Override + public String toASP() { + return toString(); + } + + @Override + public String getPointer() { + return name; + } } diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPType.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPType.java index da694218..6e715dba 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPType.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPType.java @@ -1,4 +1,7 @@ package de.dhbwstuttgart.sat.asp.writer.model; public interface ASPType { + String toASP(); + + String getPointer(); } diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPTypeVar.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPTypeVar.java index 4b07d30b..8b3c1af6 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPTypeVar.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPTypeVar.java @@ -11,4 +11,14 @@ public class ASPTypeVar implements ASPType{ public String toString() { return "typeVar("+ name +")"; } + + @Override + public String toASP() { + return toString(); + } + + @Override + public String getPointer() { + return name; + } } diff --git a/test/javFiles/Vector.jav b/test/javFiles/Vector.jav index f2a9cdae..1ea1ac41 100644 --- a/test/javFiles/Vector.jav +++ b/test/javFiles/Vector.jav @@ -1,3 +1,4 @@ +import java.util.Vector; class Vector{