Compare commits
10 Commits
fba7f0ee81
...
a84d1ffdd7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a84d1ffdd7 | ||
|
|
a3d63a0266 | ||
|
|
dcc2da85c5 | ||
|
|
6f193b19ab | ||
| 1c55954e5c | |||
| ec04f01a10 | |||
|
|
78a2fddc21 | ||
|
|
44f8899157 | ||
|
|
d1a6dcbbac | ||
|
|
15150fca9e |
0
resources/bytecode/javFiles/Cycle.class
Executable file → Normal file
0
resources/bytecode/javFiles/Cycle.class
Executable file → Normal file
@@ -68,10 +68,10 @@ public class JavaTXCompiler {
|
|||||||
|
|
||||||
// public static JavaTXCompiler INSTANCE;
|
// public static JavaTXCompiler INSTANCE;
|
||||||
final CompilationEnvironment environment;
|
final CompilationEnvironment environment;
|
||||||
Boolean resultmodel = false;
|
Boolean resultmodel = true;
|
||||||
public final Map<File, SourceFile> sourceFiles = new HashMap<>();
|
public final Map<File, SourceFile> sourceFiles = new HashMap<>();
|
||||||
|
|
||||||
Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll?
|
Boolean log = false; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll?
|
||||||
public volatile UnifyTaskModel usedTasks = new UnifyTaskModel();
|
public volatile UnifyTaskModel usedTasks = new UnifyTaskModel();
|
||||||
private final DirectoryClassLoader classLoader;
|
private final DirectoryClassLoader classLoader;
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class CompilationEnvironment {
|
|||||||
ClassLoader classLoader = compiler.getClassLoader();
|
ClassLoader classLoader = compiler.getClassLoader();
|
||||||
List<Class> ret = new ArrayList<>();
|
List<Class> ret = new ArrayList<>();
|
||||||
// Set classLoader to include default package for this specific source file
|
// Set classLoader to include default package for this specific source file
|
||||||
File dir = sourceFile.getParentFile();
|
File dir = sourceFile.getAbsoluteFile().getParentFile();
|
||||||
String dirPath = dir.toString() + "/";
|
String dirPath = dir.toString() + "/";
|
||||||
if (packageName.length() > 0)
|
if (packageName.length() > 0)
|
||||||
dirPath = dirPath.substring(0, dirPath.length() - packageName.length() - 1);
|
dirPath = dirPath.substring(0, dirPath.length() - packageName.length() - 1);
|
||||||
|
|||||||
@@ -445,6 +445,9 @@ public class SyntaxTreeGenerator {
|
|||||||
MethodblockContext methodblock = (MethodblockContext) body;
|
MethodblockContext methodblock = (MethodblockContext) body;
|
||||||
block = stmtgen.convert(methodblock.block(), true);
|
block = stmtgen.convert(methodblock.block(), true);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
modifiers += Modifier.ABSTRACT;
|
||||||
|
}
|
||||||
return new Method(modifiers, name, retType, paramlist, block, gtvDeclarations, bodydeclaration.getStart());
|
return new Method(modifiers, name, retType, paramlist, block, gtvDeclarations, bodydeclaration.getStart());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,11 +75,12 @@ public class ConstraintSet<A> {
|
|||||||
|
|
||||||
Constraint<B> newConst = as.stream()
|
Constraint<B> newConst = as.stream()
|
||||||
.map(o)
|
.map(o)
|
||||||
.collect(Collectors.toCollection((as.getExtendConstraint() != null)
|
.collect(Collectors.toCollection((
|
||||||
? () -> new Constraint<B> (as.isInherited(),
|
() -> new Constraint<B> (as.isInherited(),
|
||||||
as.getExtendConstraint().stream().map(o).collect(Collectors.toCollection(Constraint::new)),
|
(as.getExtendConstraint() != null)
|
||||||
as.getmethodSignatureConstraint().stream().map(o).collect(Collectors.toCollection(HashSet::new)))
|
? as.getExtendConstraint().stream().map(o).collect(Collectors.toCollection(Constraint::new))
|
||||||
: () -> new Constraint<B> (as.isInherited())
|
: null,
|
||||||
|
as.getmethodSignatureConstraint().stream().map(o).collect(Collectors.toCollection(HashSet::new))))
|
||||||
));
|
));
|
||||||
|
|
||||||
//CSA2CSB.put(as, newConst);
|
//CSA2CSB.put(as, newConst);
|
||||||
|
|||||||
@@ -668,7 +668,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
.filter(x -> x.size()==1)
|
.filter(x -> x.size()==1)
|
||||||
.map(y -> y.stream().findFirst().get())
|
.map(y -> y.stream().findFirst().get())
|
||||||
.collect(Collectors.toCollection(HashSet::new)));
|
.collect(Collectors.toCollection(HashSet::new)));
|
||||||
|
oneElems.forEach(x -> { if (x instanceof Constraint) methodSignatureConstraint.addAll(((Constraint<UnifyPair>)x).getmethodSignatureConstraint());});
|
||||||
//optNextSet: Eine mehrelementige Menge, wenn vorhanden
|
//optNextSet: Eine mehrelementige Menge, wenn vorhanden
|
||||||
Optional<Set<? extends Set<UnifyPair>>> optNextSet = topLevelSets.stream().filter(x -> x.size()>1).findAny();
|
Optional<Set<? extends Set<UnifyPair>>> optNextSet = topLevelSets.stream().filter(x -> x.size()>1).findAny();
|
||||||
|
|
||||||
@@ -2024,10 +2024,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
if (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType) {
|
if (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType) {
|
||||||
//System.out.println(pair);
|
//System.out.println(pair);
|
||||||
if (first) { //writeLog(pair.toString()+"\n");
|
if (first) { //writeLog(pair.toString()+"\n");
|
||||||
if (((PlaceholderType)(pair.getLhsType())).getName().equals("AR")) {
|
Set<Set<UnifyPair>> x1 = new HashSet<>();
|
||||||
System.out.println("AR");
|
if (pair.getRhsType().getName().equals("void")) {
|
||||||
|
Set<UnifyPair> resultOne = new HashSet<>();
|
||||||
|
resultOne.add(new UnifyPair (pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||||
|
x1.add(resultOne);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
x1 = unifyCase1(pair, fc);
|
||||||
}
|
}
|
||||||
Set<Set<UnifyPair>> x1 = unifyCase1(pair, fc);
|
|
||||||
if (pairOp == PairOperator.SMALLERNEQDOT) {
|
if (pairOp == PairOperator.SMALLERNEQDOT) {
|
||||||
Set<UnifyPair> remElem = new HashSet<>();
|
Set<UnifyPair> remElem = new HashSet<>();
|
||||||
remElem.add(new UnifyPair(pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT));
|
remElem.add(new UnifyPair(pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT));
|
||||||
@@ -2159,7 +2164,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
// Case 5: (Theta <. a)
|
// Case 5: (Theta <. a)
|
||||||
else if ((pairOp == PairOperator.SMALLERDOT) && rhsType instanceof PlaceholderType)
|
else if ((pairOp == PairOperator.SMALLERDOT) && rhsType instanceof PlaceholderType)
|
||||||
if (first) { //writeLog(pair.toString()+"\n");
|
if (first) { //writeLog(pair.toString()+"\n");
|
||||||
Set<Set<UnifyPair>> x1 = unifyCase5(pair, fc);
|
Set<Set<UnifyPair>> x1 = new HashSet<>();
|
||||||
|
if (pair.getLhsType().getName().equals("void")) {
|
||||||
|
Set<UnifyPair> resultOne = new HashSet<>();
|
||||||
|
resultOne.add(new UnifyPair (pair.getRhsType(), pair.getLhsType(), PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||||
|
x1.add(resultOne);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
x1 = unifyCase5(pair, fc);
|
||||||
|
}
|
||||||
result.get(4).add(x1);
|
result.get(4).add(x1);
|
||||||
if (x1.isEmpty()) {
|
if (x1.isEmpty()) {
|
||||||
undefined.add(pair); //Theta ist nicht im FC
|
undefined.add(pair); //Theta ist nicht im FC
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ public class TestComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
//@Ignore("This is to complex")
|
||||||
public void matrixTest() throws Exception {
|
public void matrixTest() throws Exception {
|
||||||
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Matrix.jav");
|
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Matrix.jav");
|
||||||
var matrix = classFiles.get("Matrix");
|
var matrix = classFiles.get("Matrix");
|
||||||
@@ -740,7 +741,7 @@ public class TestComplete {
|
|||||||
@Test
|
@Test
|
||||||
public void testLambdaRunnable() throws Exception {
|
public void testLambdaRunnable() throws Exception {
|
||||||
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "LambdaRunnable.jav");
|
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "LambdaRunnable.jav");
|
||||||
var clazz = classFiles.get("LamRunnable");
|
var clazz = classFiles.get("LambdaRunnable");
|
||||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||||
//var m = clazz.getDeclaredMethod("m", Integer.class);
|
//var m = clazz.getDeclaredMethod("m", Integer.class);
|
||||||
//assertEquals(m.invoke(instance, 10), 60);
|
//assertEquals(m.invoke(instance, 10), 60);
|
||||||
|
|||||||
Reference in New Issue
Block a user