Java 9: Classloader ändern
*
This commit is contained in:
parent
0610ea8e63
commit
6e770b5ec5
8
pom.xml
8
pom.xml
@ -73,6 +73,14 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>9</source>
|
||||||
|
<target>9</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -40,15 +40,18 @@ public class CompilationEnvironment {
|
|||||||
* @param sourceFiles die zu kompilierenden Dateien
|
* @param sourceFiles die zu kompilierenden Dateien
|
||||||
*/
|
*/
|
||||||
public CompilationEnvironment(List<File> sourceFiles) {
|
public CompilationEnvironment(List<File> sourceFiles) {
|
||||||
String bootClassPath = System.getProperty("sun.boot.class.path");
|
/**
|
||||||
librarys = new ArrayList<>();
|
* Java 9 bringt einige Änderungen am Classloader
|
||||||
for(String path : bootClassPath.split(File.pathSeparator)) {
|
* So funktioniert der BootClassLoader nicht mehr.
|
||||||
try {
|
* hier gibts ein paar Quellen zum nachlesen:
|
||||||
librarys.add(new URL("file:"+path));
|
* http://java9.wtf/class-loading/
|
||||||
} catch (MalformedURLException e) {
|
* https://stackoverflow.com/questions/46494112/classloaders-hierarchy-in-java-9
|
||||||
new DebugException("Fehler im Classpath auf diesem System");
|
*
|
||||||
}
|
*/
|
||||||
}
|
//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());
|
||||||
this.sourceFiles = sourceFiles;
|
this.sourceFiles = sourceFiles;
|
||||||
this.packageCrawler = new PackageCrawler(librarys);
|
this.packageCrawler = new PackageCrawler(librarys);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class JavaTXParser {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Für das Typsystem ist es notwendig, dass sich der Source in einer Datei befindet:
|
/* Für das Typsystem ist es notwendig, dass sich der Source in einer Datei befindet:
|
||||||
public SourceFile parse(String fileContent) throws IOException, java.lang.ClassNotFoundException {
|
public SourceFile parse(String fileContent) throws IOException, java.lang.ClassNotFoundException {
|
||||||
return this.parse(new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8)));
|
return this.parse(new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@ public enum ASPRule {
|
|||||||
ASP_PARAMLIST_NAME("param"),
|
ASP_PARAMLIST_NAME("param"),
|
||||||
ASP_PARAMLISTNUMERATION_NAME("paramNum"),
|
ASP_PARAMLISTNUMERATION_NAME("paramNum"),
|
||||||
ASP_PARAMLIST_END_POINTER("null"),
|
ASP_PARAMLIST_END_POINTER("null"),
|
||||||
ASP_TYPE("type")
|
ASP_TYPE("type"),
|
||||||
|
ASP_FCTYPE("type")
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
|
@ -36,8 +36,8 @@ public class ASPGenerator {
|
|||||||
private String toASP(List<Pair> constraintSet, Collection<ClassOrInterface> fcClasses){
|
private String toASP(List<Pair> constraintSet, Collection<ClassOrInterface> fcClasses){
|
||||||
TypeConverter converter = new TypeConverter();
|
TypeConverter converter = new TypeConverter();
|
||||||
for(ClassOrInterface cl : fcClasses){
|
for(ClassOrInterface cl : fcClasses){
|
||||||
ASPType superClass = cl.getSuperClass().acceptTV(converter);
|
ASPRefType superClass = (ASPRefType) cl.getSuperClass().acceptTV(converter);
|
||||||
ASPPairSmaller fcEntry = new ASPPairSmaller(convert(cl), superClass);
|
ASPPairSmaller fcEntry = new ASPPairSmaller(new ASPFCType(convert(cl)), new ASPFCType(superClass));
|
||||||
writer.add(new ASPStatement(fcEntry.toASP()));
|
writer.add(new ASPStatement(fcEntry.toASP()));
|
||||||
}
|
}
|
||||||
for(Pair cons : constraintSet){
|
for(Pair cons : constraintSet){
|
||||||
@ -58,7 +58,7 @@ public class ASPGenerator {
|
|||||||
}else throw new NotImplementedException();
|
}else throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ASPType convert(ClassOrInterface cl){
|
private ASPRefType convert(ClassOrInterface cl){
|
||||||
List<ASPType> paramList = new ArrayList<>();
|
List<ASPType> paramList = new ArrayList<>();
|
||||||
for(GenericTypeVar gtv : cl.getGenerics()){
|
for(GenericTypeVar gtv : cl.getGenerics()){
|
||||||
paramList.add(new ASPGenericType(toConstant(gtv.getName())));
|
paramList.add(new ASPGenericType(toConstant(gtv.getName())));
|
||||||
|
17
src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java
Normal file
17
src/de/dhbwstuttgart/sat/asp/writer/model/ASPFCType.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package de.dhbwstuttgart.sat.asp.writer.model;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.sat.asp.model.ASPRule;
|
||||||
|
|
||||||
|
public class ASPFCType extends ASPRefType {
|
||||||
|
public ASPFCType(String name, ASPParameterList params){
|
||||||
|
super(name, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ASPFCType(ASPRefType refType){
|
||||||
|
super(refType.name, refType.params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
return ASPRule.ASP_FCTYPE + "(" + name +"," + params.name + ")";
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ import de.dhbwstuttgart.sat.asp.model.ASPRule;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ASPPairSmaller extends ASPPair{
|
public class ASPPairSmaller extends ASPPair{
|
||||||
public ASPPairSmaller(ASPType ls, ASPType rs){
|
public ASPPairSmaller(ASPFCType ls, ASPFCType rs){
|
||||||
super(ls, rs);
|
super(ls, rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ package de.dhbwstuttgart.sat.asp.writer.model;
|
|||||||
import de.dhbwstuttgart.sat.asp.model.ASPRule;
|
import de.dhbwstuttgart.sat.asp.model.ASPRule;
|
||||||
|
|
||||||
public class ASPRefType implements ASPType {
|
public class ASPRefType implements ASPType {
|
||||||
private final ASPParameterList params;
|
protected final ASPParameterList params;
|
||||||
private final String name;
|
protected final String name;
|
||||||
|
|
||||||
public ASPRefType(String name, ASPParameterList params){
|
public ASPRefType(String name, ASPParameterList params){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package de.dhbwstuttgart.typeinference.assumptions;
|
package de.dhbwstuttgart.typeinference.assumptions;
|
||||||
|
|
||||||
import com.sun.org.apache.regexp.internal.RE;
|
|
||||||
import de.dhbwstuttgart.parser.NullToken;
|
import de.dhbwstuttgart.parser.NullToken;
|
||||||
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.GenericContext;
|
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.GenericContext;
|
||||||
import de.dhbwstuttgart.parser.scope.GenericTypeName;
|
import de.dhbwstuttgart.parser.scope.GenericTypeName;
|
||||||
|
Loading…
Reference in New Issue
Block a user