Compare commits

...
9 Commits
Author SHA1 Message Date
dholle bac547859a Failing test
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 1m31s
SonarQube Scan / SonarQube Trigger (pull_request) Failing after 1m44s
2026-11-23 16:30:34 +01:00
dholle e38e20bd21 Re-enable full test, seems to work
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 1m33s
SonarQube Scan / SonarQube Trigger (pull_request) Successful in 2m35s
2026-11-23 14:41:16 +01:00
pl@gohorb.ba-horb.de 9f5265f62b In ReduceFunN Variance aufeinander abgeglichen
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m43s
SonarQube Scan / SonarQube Trigger (pull_request) Successful in 3m45s
2026-11-20 17:11:22 +01:00
pl@gohorb.ba-horb.de 5db0c66ad0 modified: src/test/java/TestComplete.java
modified:   src/test/java/targetast/TestCodegen.java
2026-11-18 11:51:05 +01:00
pl@gohorb.ba-horb.de 3b0c419a1a Merge branch 'master' of https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 1m23s
SonarQube Scan / SonarQube Trigger (pull_request) Failing after 1m40s
2026-11-12 10:51:05 +01:00
pl@gohorb.ba-horb.de 67d9be8878 modified: resources/bytecode/javFiles/LazyList.jav
modified:   resources/bytecode/javFiles/Primzahlen.jav
	modified:   src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java
	modified:   src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java
	modified:   src/main/java/de/dhbwstuttgart/syntaxtree/visual/OutputGenerator.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/distributeVariance.java
	modified:   src/test/java/TestComplete.java
2026-11-12 10:49:35 +01:00
dholle e1b9766a53 Merge pull request 'Fix various issues with static methods, fixes #416' (#433) from fix-416 into master
SonarQube Scan / SonarQube Trigger (push) Successful in 2m38s
Reviewed-on: #433
2026-11-11 16:51:45 +00:00
pl@gohorb.ba-horb.de 272d9fa586 Merge branch 'master' of https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore 2026-09-25 15:46:44 +02:00
pl@gohorb.ba-horb.de 32a01c500a DEBUG 2026-09-25 15:46:27 +02:00
10 changed files with 39 additions and 13 deletions

No files matched your search

+4 -3
View File
@@ -18,8 +18,8 @@ public class Filter {
/*public LazyList filter(Fun1$$<Integer, Boolean> p, LazyList l) {
return switch(l) {
case Empty e -> e;
case Cons(Integer x, Supplier<LazyList> l1) ->
p.apply(x) ? new Cons(x, () -> filter(p, l1.get())) : filter(p, l1.get());
case Cons(Integer x, Fun0$$<LazyList> l1) ->
p.apply(x) ? new Cons(x, () -> filter(p, l1.apply())) : filter(p, l1.apply());
};
}*/
public LazyList filter(Fun1$$<Integer, Boolean> p, Empty()@l) {
@@ -45,7 +45,7 @@ record Empty() implements LazyList {
public LazyList rest() { return null; }
}
/*
class Main {
static LazyList Count(int i) { return new Cons(i, () -> Count(i+1)); }
@@ -54,3 +54,4 @@ class Main {
System.out.println(Count(1).rest().fst());
}
}
*/
+7 -6
View File
@@ -10,15 +10,16 @@ import Empty;
import Filter;
public class Primzahlen {
static LazyList from(Integer i) { return new Cons(i, () -> from(i+1)); }
/*LazyList filter(Fun1$$<Integer, Boolean> p, LazyList l) {
LazyList filter(Fun1$$<Integer, Boolean> p, LazyList l) {
return switch(l) {
case Empty e -> e;
case Cons(Integer x, Fun0$$<LazyList> l1) ->
p.apply(x) ? new Cons(x, () -> filter(p, l1.apply())) : filter(p, l1.apply());
};
}*/
}
LazyList dropMul(Integer x, LazyList xs) {
return new Filter().filter(y -> (y % x != 0), xs);
@@ -47,9 +48,9 @@ public class Primzahlen {
System.out.println(l);
var filtered = new Filter().filter(x -> x == 2, l);
System.out.println(filtered);
//System.out.println(from(1).rest().fst());
//Primzahlen pz = new Primzahlen();
//System.out.println(pz.take(10, pz.from(2)));
//System.out.println(pz.take(14, pz.primes()));
System.out.println(from(1).rest().fst());
Primzahlen pz = new Primzahlen();
System.out.println(pz.take(10, pz.from(2)));
System.out.println(pz.take(14, pz.primes()));
}
}
@@ -885,6 +885,7 @@ public class Codegen {
}
var descriptor = TargetMethod.getDescriptor(lambda.type(), params.toArray(TargetType[]::new));
System.out.println(impl.name() + " " + descriptor);
mv.visitInvokeDynamicInsn(methodName, descriptor, bootstrap, Type.getType(signature.getSignature()), handle, Type.getType(signature.getDescriptor()));
}
@@ -1111,7 +1111,7 @@ public class StatementGenerator {
if (expression.lambdaBody().expression() != null) {
List<Statement> statements = new ArrayList<>();
statements.add(new Return(lambdaGenerator.convert(expression.lambdaBody().expression()), expression.lambdaBody().expression().getStart()));
block = new Block(statements, expression.lambdaBody().getStart());
block = new Block(statements, expression.lambdaBody().getStart(), -1);
} else {
block = lambdaGenerator.convert(expression.lambdaBody().block(), true);
}
@@ -14,6 +14,11 @@ public class Block extends Statement {
this.statements = statements;
}
public Block(List<Statement> statements, Token offset, int variance) {
super(TypePlaceholder.fresh(offset, variance, true), offset);
this.statements = statements;
}
public List<Statement> statements = new ArrayList<>();
public List<Statement> getStatements() {
@@ -188,8 +188,10 @@ public class OutputGenerator implements ASTVisitor {
@Override
public void visit(LambdaExpression lambdaExpression) {
out.append("(");
lambdaExpression.params.accept(this);
out.append(" -> ");
out.append("(");
lambdaExpression.methodBody.accept(this);
}
@@ -867,9 +867,20 @@ public class RuleSet implements IRuleSet{
}
}
result.stream().forEach(x -> { UnifyType l = x.getLhsType();
if (l instanceof PlaceholderType) { ((PlaceholderType)l).disableWildcardtable(); }
UnifyType r = x.getRhsType();
if (r instanceof PlaceholderType) { ((PlaceholderType)r).disableWildcardtable(); }
Boolean phl = l instanceof PlaceholderType;
Boolean phr = r instanceof PlaceholderType;
if (phl) { ((PlaceholderType)l).disableWildcardtable(); }
if (phr) { ((PlaceholderType)r).disableWildcardtable(); }
if (phl && phr) {
Integer lv = ((PlaceholderType)l).getVariance();
Integer rv = ((PlaceholderType)r).getVariance();
if (lv != 0 && rv == 0) ((PlaceholderType)r).setVariance(lv);
if (rv != 0 && lv == 0) ((PlaceholderType)l).setVariance(rv);
}
} );
logger.debug(() -> "FUNgreater: " + pair);
@@ -39,6 +39,7 @@ public class distributeVariance extends visitUnifyTypeVisitor<Integer> {
List<UnifyType> param = new ArrayList<>(funnty.getTypeParams().get().length);
param.addAll(Arrays.asList(funnty.getTypeParams().get()));
UnifyType resultType = param.remove(param.size()-1);
ht = (ht == 0)? 1 : 0; //bei ht = 0 wird ht auf die Standardwerte für Functionstypes gesetzt
int htInverse = inverseVariance(ht);
param = param.stream()
.map(x -> x.accept(this, htInverse))
+3 -1
View File
@@ -257,6 +257,7 @@ public class TestComplete {
@Test
//@Disabled("This is too complex")
public void matrixTest() throws Exception {
//ConsoleInterface.logLevel = LogLevel.DEBUG;
var classFiles = generateClassFiles(createClassLoader(), "Matrix.jav");
var matrix = classFiles.get("Matrix");
@@ -1356,9 +1357,10 @@ public class TestComplete {
m.invoke(null, List.of("foo", "bar", "baz"));
}
@Disabled("See #405")
//@Disabled("See #405")
@Test
public void testLazy() throws Exception {
ConsoleInterface.logLevel = LogLevel.INFO;
var classFiles = generateClassFiles(createClassLoader(), false, "LazyList.jav", "Primzahlen.jav");
var clazz = classFiles.get("Primzahlen");
var main = clazz.getDeclaredMethod("main", List.class);
+2
View File
@@ -5,6 +5,7 @@ import de.dhbwstuttgart.bytecode.Codegen;
import de.dhbwstuttgart.environment.DirectoryClassLoader;
import de.dhbwstuttgart.environment.IByteArrayClassLoader;
import de.dhbwstuttgart.parser.scope.JavaClassName;
import de.dhbwstuttgart.syntaxtree.factory.NameGenerator;
import de.dhbwstuttgart.syntaxtree.visual.ASTPrinter;
import de.dhbwstuttgart.target.generate.ASTToTargetAST;
import de.dhbwstuttgart.target.tree.MethodParameter;
@@ -52,6 +53,7 @@ public class TestCodegen {
public static Map<String, ? extends Class<?>> generateClassFiles(IByteArrayClassLoader classLoader, boolean inferTogether, String... files) throws IOException, ClassNotFoundException {
Files.createDirectories(outputPath);
var filenames = Arrays.stream(files).map(filename -> Path.of(path.toString(), filename).toFile()).toList();
NameGenerator.reset();
var compiler = new JavaTXCompiler(filenames, List.of(path.toFile(), outputPath.toFile()), outputPath.toFile(), inferTogether);
compiler.generateBytecode();