diff --git a/pom.xml b/pom.xml index 9cce2d99..ea7be6b3 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 9 + 9 + + diff --git a/src/de/dhbwstuttgart/environment/CompilationEnvironment.java b/src/de/dhbwstuttgart/environment/CompilationEnvironment.java index eca8c9c2..44754e7c 100644 --- a/src/de/dhbwstuttgart/environment/CompilationEnvironment.java +++ b/src/de/dhbwstuttgart/environment/CompilationEnvironment.java @@ -40,17 +40,29 @@ public class CompilationEnvironment { * @param sourceFiles die zu kompilierenden Dateien */ public CompilationEnvironment(List sourceFiles) { - String bootClassPath = System.getProperty("sun.boot.class.path"); + /** + * Java 9 bringt einige Ă„nderungen am Classloader + * So funktioniert der BootClassLoader nicht mehr. + * hier gibts ein paar Quellen zum nachlesen: + * http://java9.wtf/class-loading/ + * https://stackoverflow.com/questions/46494112/classloaders-hierarchy-in-java-9 + * + */ + //String bootClassPath = System.getProperty("sun.boot.class.path"); + // ClassLoader cl = ClassLoader.getPlatformClassLoader(); + ClassLoader cl = ClassLoader.getSystemClassLoader(); + String bootClassPath = System.getProperty("java.class.path"); librarys = new ArrayList<>(); - if(bootClassPath != null){ - 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"); - } + 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/model/ASPRule.java b/src/de/dhbwstuttgart/sat/asp/model/ASPRule.java index 41237547..8d4d73f9 100644 --- a/src/de/dhbwstuttgart/sat/asp/model/ASPRule.java +++ b/src/de/dhbwstuttgart/sat/asp/model/ASPRule.java @@ -8,7 +8,8 @@ public enum ASPRule { ASP_PARAMLIST_NAME("param"), ASP_PARAMLISTNUMERATION_NAME("paramNum"), ASP_PARAMLIST_END_POINTER("null"), - ASP_TYPE("type") + ASP_TYPE("type"), + ASP_FCTYPE("type") ; private final String text; diff --git a/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java b/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java index 002e3c7f..ea162c11 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/ASPGenerator.java @@ -36,8 +36,8 @@ public class ASPGenerator { private String toASP(List constraintSet, Collection fcClasses){ TypeConverter converter = new TypeConverter(); for(ClassOrInterface cl : fcClasses){ - ASPType superClass = cl.getSuperClass().acceptTV(converter); - ASPPairSmaller fcEntry = new ASPPairSmaller(convert(cl), superClass); + ASPRefType superClass = (ASPRefType) cl.getSuperClass().acceptTV(converter); + ASPPairSmaller fcEntry = new ASPPairSmaller(new ASPFCType(convert(cl)), new ASPFCType(superClass), writer); writer.add(new ASPStatement(fcEntry.toASP())); } for(Pair cons : constraintSet){ @@ -52,13 +52,13 @@ 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(); } - private ASPType convert(ClassOrInterface cl){ + private ASPRefType convert(ClassOrInterface cl){ List paramList = new ArrayList<>(); for(GenericTypeVar gtv : cl.getGenerics()){ paramList.add(new ASPGenericType(toConstant(gtv.getName()))); diff --git a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java new file mode 100644 index 00000000..790fd5af --- /dev/null +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java @@ -0,0 +1,14 @@ +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(ASPRefType refType){ + super(refType.name, refType.params); + } + + public String toString(){ + return ASPRule.ASP_FCTYPE + "(" + name +"," + params.name + ")"; + } +} 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 f57170f6..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(ASPType ls, ASPType 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 6491ff33..5eab65be 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/model/ASPRefType.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/model/ASPRefType.java @@ -3,8 +3,8 @@ package de.dhbwstuttgart.sat.asp.writer.model; import de.dhbwstuttgart.sat.asp.model.ASPRule; public class ASPRefType implements ASPType { - private final ASPParameterList params; - private final String name; + protected final ASPParameterList params; + protected final String name; public ASPRefType(String name, ASPParameterList params){ this.name = name; @@ -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{