Merge and fix folder structure

This commit is contained in:
Daniel Holle 2023-06-26 12:31:00 +02:00
commit 9c1e016bb1
235 changed files with 6273 additions and 7849 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ bin
.DS_Store
.project
.settings/
.vscode/
/target/
settings.json

22
pom.xml
View File

@ -51,13 +51,28 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.11.0</version>
<configuration>
<compilerArgs>--enable-preview</compilerArgs>
<<<<<<< HEAD
<source>20</source>
<target>20</target>
=======
<release>20</release>
>>>>>>> patternMatching
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<argLine>--enable-preview</argLine>
<excludes>
<exclude>**/JavaTXCompilerTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
@ -112,8 +127,11 @@ http://maven.apache.org/maven-v4_0_0.xsd">
</repository>
</repositories>
<properties>
<<<<<<< HEAD
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
=======
>>>>>>> patternMatching
<mainClass>de.dhbwstuttgart.core.ConsoleInterface</mainClass>
</properties>
<distributionManagement>
@ -123,4 +141,4 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<url>file:///${project.basedir}/maven-repository/</url>
</repository>
</distributionManagement>
</project>
</project>

View File

@ -1,13 +0,0 @@
class Box<A>{
void m(A a){}
}
class B { }
class Box_Main extends B {
m(b) {
b.m(new Box_Main());
b.m(new B());
}
}

View File

@ -1,13 +0,0 @@
class Box<A>{
A f;
}
class B { }
class Box_Main extends B {//Fehler Bugzilla Bug 230
m(b) {
b.f = new Box_Main();
b.f = new B();
}
}

View File

@ -1,12 +0,0 @@
import java.util.Vector;
import java.util.List;
import java.lang.Integer;
class FCTest1 extends Vector<Vector<Integer>> {
fc1() {
var y;
var z;
y.add(z);
return y;
}
}

View File

@ -1,11 +0,0 @@
import java.util.Vector;
import java.util.List;
import java.lang.Integer;
class FCTest2 extends Vector<Vector<Integer>> {
fc2(y) {
var z;
y.add(z);
return y;
}
}

View File

@ -1,19 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
class FCTest3 extends Pair<Vector<Integer>, Vector<Integer>> {
fc2(x) {
x.snd().addElement(2);
}
fc2a() {
var y;
y.snd().addElement(2);
return y;
}
}

View File

@ -1,10 +0,0 @@
import java.lang.Integer;
import java.util.Vector;
public class GenTest {
main(x) {
var v = new Vector();
return 1 + v.elementAt(0);
}
}

View File

@ -1,9 +0,0 @@
class Generics {
a;
id(b) { return b; }
setA(x) {
a = x;
return a;
}
m(x,y) { x = id(y); }
}

View File

@ -1,7 +0,0 @@
import java.util.List;
class M {
void m(p, p2){
new addList().addLists(p, p2);
}
}

View File

@ -1,9 +0,0 @@
import java.util.Stack;
import java.util.Vector;
class OverloadingMain {
mmMain(x) { var y; return new O1().mm(y); }
}

View File

@ -1,20 +0,0 @@
import java.lang.Integer;
public class Overloading_Generics {
id1 (x) { return x; }
//Integer id (Integer x) { return x; }
}
class Overloading_Generics1 {
main(x) {
var olg = new Overloading_Generics();
return olg.id1(1);
}
}

View File

@ -1,25 +0,0 @@
import java.util.Vector;
import java.util.Stack;
class OverrideMain {
ovrMain(x) {
var overide;
overide.ovr(x);
}
}
/*
[
[(TPH L = java.util.Stack<TPH FTM>), (TPH N = java.lang.String), (TPH M = ? extends Override2), (TPH FTN, TPH FTM), (TPH K = void)],
[(TPH FTO, TPH FTP), (TPH M = ? extends Override2), (TPH N = java.lang.String), (TPH L = java.util.Stack<TPH FTP>), (TPH K = void)],
[(TPH M = ? extends Override2), (TPH N = java.lang.String), (TPH K = void), (TPH FTR, TPH FTQ), (TPH L = java.util.Vector<TPH FTQ>)],
[(TPH FTT, TPH FTS), (TPH M = ? extends Override2), (TPH L = java.util.Vector<TPH FTS>), (TPH K = void), (TPH N = java.lang.String)],
[(TPH L = java.util.Vector<TPH FTV>), (TPH M = ? extends Override2), (TPH N = java.lang.String), (TPH FTU, TPH FTV), (TPH K = void)],
[(TPH FTX, TPH FTW), (TPH M = ? extends Override2), (TPH L = java.util.Vector<TPH FTW>), (TPH K = void), (TPH N = java.lang.String)],
[(TPH M = ? extends Override2), (TPH L = java.util.Stack<TPH FTZ>), (TPH K = void), (TPH FTY, TPH FTZ), (TPH N = java.lang.String)],
[(TPH FUB, TPH FUA), (TPH K = void), (TPH M = ? extends Override2), (TPH N = java.lang.String), (TPH L = java.util.Vector<TPH FUA>)],
[(TPH N = java.lang.String), (TPH L = java.util.Vector<TPH FUC>), (TPH FUD, TPH FUC), (TPH M = ? extends Override2), (TPH K = void)],
[(TPH N = java.lang.String), (TPH FUF, TPH FUE), (TPH M = ? extends Override2), (TPH K = void), (TPH L = java.util.Vector<TPH FUE>)]]
[[(TPH M = ? extends Override2), (TPH MNX, TPH MNY), (TPH N = java.lang.String), (TPH K = void), (TPH L = java.util.Stack<TPH MNY>)], [(TPH L = java.util.Stack<TPH MOC>), (TPH N = java.lang.String), (TPH M = ? extends Override2), (TPH K = void), (TPH MOB, TPH MOC)], [(TPH M = ? extends Override2), (TPH N = java.lang.String), (TPH MNZ, TPH MOA), (TPH L = java.util.Vector<TPH MOA>), (TPH K = void)], [(TPH L = java.util.Vector<TPH MOE>), (TPH K = void), (TPH M = ? extends Override2), (TPH MOD, TPH MOE), (TPH N = java.lang.String)], [(TPH M = ? extends Override2), (TPH K = void), (TPH N = java.lang.String), (TPH MOF, TPH MOG), (TPH L = java.util.Stack<TPH MOG>)], [(TPH L = java.util.Vector<TPH MOI>), (TPH K = void), (TPH MOH, TPH MOI), (TPH M = ? extends Override2), (TPH N = java.lang.String)], [(TPH L = java.util.Vector<TPH MOK>), (TPH MOJ, TPH MOK), (TPH K = void), (TPH M = ? extends Override2), (TPH N = java.lang.String)], [(TPH MOL, TPH MOM), (TPH L = java.util.Stack<TPH MOM>), (TPH M = ? extends Override2), (TPH K = void), (TPH N = java.lang.String)], [(TPH L = java.util.Vector<TPH MOO>), (TPH MON, TPH MOO), (TPH N = java.lang.String), (TPH K = void), (TPH M = ? extends Override2)], [(TPH L = java.util.Stack<TPH MOP>), (TPH N = java.lang.String), (TPH M = ? extends Override2), (TPH MOQ, TPH MOP), (TPH K = void)]]
*/

View File

@ -1,11 +0,0 @@
import java.util.Vector;
import java.util.Stack;
class OverrideMainRet {
ovrMain() {
var overide;
var x;
overide.ovr(x);
return x;
}
}

View File

@ -1,18 +0,0 @@
class Pair<T, U> {
T x;
U y;
public Pair() { }
public Pair(T x, U y) {
this.x = x;
this.y = y;
}
public T fst () {
return x;
}
public U snd () {
return y;
}
}

View File

@ -1,19 +0,0 @@
import java.util.Vector;
import java.util.Stack;
class Put {
putElement(ele, v) {
v.addElement(ele);
}
putElement(ele, s) {
s.push(ele);
}
main(ele, x) {
putElement(ele, x);
}
}

View File

@ -1,4 +0,0 @@
class Test {
a;
Test b;
}

View File

@ -1,12 +0,0 @@
import java.util.ArrayList;
class TestSubTypless {
m(a){
var l = new ArrayList<>();
l.add(a);
return m2(l).get(0);
}
m2(a){
return m(a);
}
}

View File

@ -1,3 +0,0 @@
class Twice {
twice = f -> x -> f.apply(f.apply(x));
}

View File

@ -1,5 +0,0 @@
class Var {
var(x) { var y; }
}

View File

@ -1,15 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
public class VectorConstAdd {
vectorAdd(v1) {
var i = 0;
var erg = new Vector<>();
while (i < v1.size()) {
erg.addElement(v1.elementAt(i) + 1);
i++;
}
return erg;
}
}

View File

@ -1,9 +0,0 @@
import java.util.Vector;
class VectorNotObject {
vectorAddAll(v1, v2) {
v1.addAll(v2);
return v1;
}
}

View File

@ -1,16 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
import java.lang.String;
class WildcardCaptureConversionTest {
m(x, y ,z) {
x = new Vector<Integer>();
y = new Vector<String>();
x.add(1);
y.add("2");
//Integer i = x.elementAt(0);
//String s = y.elementAt(0);
return z.vectorAddAll(x, y);
}
}

View File

@ -1,8 +0,0 @@
class Wildcard_Andi {
Test<? extends A> ex = new Test<>();
Test<? super A> sup = new Test<>();
}

View File

@ -1,8 +0,0 @@
import java.util.List;
class addList {
addLists(a, b){
a.add(b.get(0));
b.add(a.get(0));
}
}

View File

@ -1,22 +0,0 @@
import java.util.List;
import java.lang.Integer;
import java.lang.Object;
import java.lang.Boolean;
class wildcardPair {
make(l) {
var p = new Pair(l.get(0), l.get(1));
return p;
}
//<X>Boolean compare(Pair<X, X> x) { return true; }
void m(l) {
Object o = l.get(0);
//Pair<? extends Object, ? extends Object> p;
//List<?> b;
//this.compare(p); //1, type incorrect
make(l);
//this.compare(this.make(b)); //2, OK
}
}

View File

@ -1,32 +1,15 @@
import java.lang.Double;
import java.lang.String;
import java.lang.Integer;
import java.lang.Double;
import java.lang.Boolean;
//import java.util.Vector;
import java.lang.Long;
public class OL {
java.lang.Double m(java.lang.Double x) { return x + x; }
java.lang.Integer m(java.lang.Integer x) { return x + x; }
java.lang.String m(java.lang.String x) { return x + x; }
java.lang.Boolean m(Boolean x) { return x; }
// if the class contains just this method, then correct BC will be generated.
// But if another methods are contained then the generated BC is not correct
// m(x) {
// //x.add(1);
// x.addAll(x);
// return x;
// }
class OL {
m (x) { return x + x; }
}
public class OLMain {
main(x) {
class OLMain {
main(x) {
var ol;
ol = new OL();
return ol.m(x);
}
ol = new OL();
return ol.m(x);
}
}

View File

@ -1,37 +0,0 @@
public class EmptyMethod{
static String s1 ="";
String s2;
public void m1(){
//String s = "";
System.out.println("test");
//Integer ab = Math.abs(1);
//Math.abs(1);
//String lV = "local";
//s1 = "1";
//s1.concat("2");
s2 = s1;
//m2();
Clazz i = new Clazz();
Integer i = new Integer(1);
}
public void m2(){}
}
class Clazz{}
/*
public class EmptyMethod2{
public static test = "5";
public void m1(Integer i, String j, Boolean b){
//String s = "";
EmptyMethod em = new EmptyMethod();
em.m1();
em.s1 = "";
//Integer ab = Math.abs(1);
//Math.abs(1);
//String lV = "local";
//s1 = "1";
//s1.concat("2");
//s2 = s1;
}
}*/

View File

@ -1,16 +0,0 @@
import java.lang.Integer;
class Faculty {
//fact;
Integer mul(Integer x, Integer y) {
return x;
}
m () {
var fact = (Integer x) -> {
return mul(x, fact.apply(x));
};
return fact;
}
}

View File

@ -1,22 +0,0 @@
import java.lang.String;
class Generics<B> {
//<A extends B> A mt1(A a, B b){
B mt1(B a, B b){
return mt1(a, a);
}
}
class Test {
methode(String s){
return new Generics<String>().mt1(s,s);
}
}
/*
Problem:
auto test = new List<String>();
auto test2 = new List<Integer>();
... //code, welcher möglicherweise test und test2 vertauscht
test.add("hallo");
*/

View File

@ -1,14 +0,0 @@
import java.lang.Integer;
import java.lang.Boolean;
import java.lang.Object;
public class IfTest {
Object m1(b) {
Integer i;
if(b) {
return i;
}else{
return b;
}
}
}

View File

@ -1,8 +0,0 @@
import java.util.Vector;
class Import {
void methode(){
var v;
v.add(v);
}
}

View File

@ -1,12 +0,0 @@
class Apply { }
public class Lambda {
m () {
var lam1 = (x) -> {
return x;
};
return lam1.apply(new Apply());
}
}

View File

@ -1,33 +0,0 @@
import java.lang.String;
public class Lambda2
{
public static void main(List<String> args){
var listOfStrings = new List<String>();
var listOfObjects;
listOfObjects = map(listOfStrings, (a) -> a);
}
public map(a , b){
b.apply(a);
return a;
}
/*
public static <I,O> List<O> map(List<I> input, Function<I,O> func) {
List<O> output;
output = new List<O>();
output.add(func.apply(input.get()));
return output;
}
*/
}
class List<A>{
A get();
void add(A);
}
class Function<A,B>{
B apply(A a);
}

View File

@ -1,24 +0,0 @@
import java.lang.String;
public class Lambda2
{
/*
public static <A> List<A> map(List<? extends A> input,
Function<? super A, ? extends A> func){
input.add(func.apply(input.get()));
}
*/
public map(input,func){
input.add(func.apply(input.get()));
return map(new List<String>(), func);
}
}
class List<A>{
A get();
void add(A);
}
class Function<A,B>{
B apply(A a);
}

View File

@ -1,28 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
class Matrix extends Vector<Vector<Integer>> {
Integer mul1(Integer x, Integer y) { return x;}
Integer add1(Integer x, Integer y) { return x;}
mul(m) {
var ret = new Matrix();
var i = 0;
while(i < size()) {
var v1 = this.elementAt(i);
var v2 = new Vector<Integer>();
var j = 0;
while(j < v1.size()) {
var erg = 0;
var k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
//erg = add1(erg, mul1(v1.elementAt(k),
// m.elementAt(k).elementAt(j)));
k++; }
v2.addElement(new Integer(erg));
j++; }
ret.addElement(v2);
i++; }
return ret;
}
}

View File

@ -1,17 +0,0 @@
class Methods {
mt4(a,b,c) { return a.add(b).sub(c) ; }
mt1(a) {return a;}
mt2(a) {return a.f; }
mt3(a) {return a.add(); }
}
class Test {
java.lang.Object f;
add(){}
add(b){return b;}
sub(b){}
}

View File

@ -1,15 +0,0 @@
import java.lang.Double;
import java.lang.String;
import java.lang.Long;
class OL {
m (x) { return x + x; }
}
class OLMain {
main(x) {
var ol;
ol = new OL();
return ol.m(x);
}
}

View File

@ -1,15 +0,0 @@
import java.util.List;
import java.util.Collection;
class Sorting{
void merge(a, b){
a.addAll(b);
return a;
}
sort(in){
var firstHalf = in;
var secondHalf = in;
return merge(sort(firstHalf), sort(secondHalf));
}
}

View File

@ -1,8 +0,0 @@
class MathStruc <A> {
A model;
innerOp = o -> ms -> new MathStruc<A>(o.apply(this.model, ms.model));
MathStruc(A m) { model=m; }
}

View File

@ -1,8 +0,0 @@
import java.lang.Integer;
import java.util.Vector;
public class Gen{
Vector<Integer> m(Vector<Integer> v){
return v;
}
}

View File

@ -1,12 +0,0 @@
import java.lang.String;
import java.lang.Integer;
import java.lang.Double;
public class OLMain {
main(x) {
var ol;
ol = new OLextends();
return ol.m(x);
}
}

View File

@ -1,22 +0,0 @@
import java.lang.String;
import java.lang.Integer;
import java.lang.Double;
import java.lang.Boolean;
public class OLOneFile {
m2(x) { return x + x; }
}
public class OLextendsOneFile extends OLOneFile { }
public class OLMainOneFile {
main(x) {
var ol;
ol = new OLextendsOneFile();
return ol.m2(x);
}
}

View File

@ -1,6 +0,0 @@
java -jar ~/eclipse-workspace/JavaCompilerCore/target/JavaTXcompiler-0.2-jar-with-dependencies.jar de/test/OL.jav -d de/test/output
java -jar ~/eclipse-workspace/JavaCompilerCore/target/JavaTXcompiler-0.2-jar-with-dependencies.jar OLextends.jav -cp de/test/output
java -jar ~/eclipse-workspace/JavaCompilerCore/target/JavaTXcompiler-0.2-jar-with-dependencies.jar OLMain.jav -cp .:de/test/output
javac UseOLMain.java
java -cp .:de/test/output UseOLMain
rm -f UseOLMain.class

View File

@ -1,7 +0,0 @@
import de.test.OL;
public class OLextends extends OL {
}

View File

@ -1,14 +0,0 @@
import de.test.Pair;
class Pairs {
setfst(fst) {
return new Pair<>(snd, fst);
}
swap () {
return new Pair<> (snd, fst); }
polyrec(p) {
return polyrec (p.swap());
}
}

View File

@ -1,3 +0,0 @@
public class Test{
}

View File

@ -1,5 +0,0 @@
class UseOLMain {
public static void main(String[] arg) {
System.out.println(new OLMain().main(1+1));
}
}

View File

@ -1,9 +0,0 @@
package de.test;
import de.test.ToImport;
class ImportTest{
void methode(){
new ToImport();
}
}

View File

@ -1,11 +0,0 @@
package de.test;
import de.test.subpackage1.ToImport2;
import de.test.subpackage2.ToImport3;
class ImportTest2{
void methode(){
new ToImport2().m1();
new ToImport3().m2();
}
}

View File

@ -1,7 +0,0 @@
package de.test;
class ImportTestDefault{
void methode(){
new ToImport();
}
}

View File

@ -1,13 +0,0 @@
package de.test;
import java.lang.String;
import java.lang.Integer;
import java.lang.Double;
import java.lang.Boolean;
//import java.util.Vector;
public class OL {
public m(x) { return x + x; }
}

View File

@ -1,12 +0,0 @@
package de.test;
class Pair {
fst;
snd;
Pair(fst, snd) {
this.fst = fst;
this.snd = snd;
}
}

View File

@ -1,3 +0,0 @@
package de.test;
public class TestClass{}

View File

@ -1,4 +0,0 @@
package de.test;
class ToImport{
}

View File

@ -1,18 +0,0 @@
package de.test;
import java.util.Vector;
import java.lang.Integer;
public class mathStruc {
model;
//Fun1*<Fun2*<A,A,A>, Fun1*<MathStruc <A>,MathStruc <A>>>
innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model));
public mathStruc(m) {
model =m;
//innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(this.model,ms.model));
}
}

View File

@ -1,33 +0,0 @@
package de.test;
import java.util.Vector;
import java.lang.Integer;
import java.lang.Boolean;
import de.test.mathStruc;
import de.test.vectorAdd;
public class mathStrucVector {
public main() {
Vector<Integer> v1 = new Vector<Integer>();
v1.addElement(2);
v1.addElement(2);
Vector<Integer> v2 = new Vector<Integer>();
v2.addElement(3);
v2.addElement(3);
vectorAdd va = new vectorAdd();
var ms;
ms = new mathStruc<>(v1);
var ms2;
ms2 = new mathStruc<>(v2);
var ms3;
ms3 = ms.innerOp.apply(va.add).apply(ms2);
return ms3;
}
}

View File

@ -1,10 +0,0 @@
package de.test;
import de.test.mathStrucVector;
class mathStrucVectorUse {
public static void main(String[] args) {
new mathStrucVector().main();
}
}

View File

@ -1,8 +0,0 @@
class mathStrucVectorUse {
public static void main(String[] args) {
new mathStrucVector().main();
}
}

View File

@ -1,3 +0,0 @@
package de.tesst;
class TestClass{}

View File

@ -1,4 +0,0 @@
package de.test.subpackage1;
class Test1{
}

View File

@ -1,5 +0,0 @@
package de.test.subpackage1;
class ToImport2{
void m1(){}
}

View File

@ -1,4 +0,0 @@
package de.test.subpackage2;
class Test2{
}

View File

@ -1,5 +0,0 @@
package de.test.subpackage2;
class ToImport3{
void m2(){}
}

View File

@ -1,20 +0,0 @@
package de.test;
import java.util.Vector;
import java.lang.Integer;
import java.lang.Boolean;
public class vectorAdd {
public add = (v1, v2) -> {
var ret = new Vector<Integer>();
var i = 0;
while(i < v1.size()) {
//if (i < v2.size()) {
ret.addElement(v1.elementAt(i) + v2.elementAt(i));
//}
}
return ret;
};
}

View File

View File

View File

View File

View File

View File

View File

View File

View File

Some files were not shown because too many files have changed in this diff Show More