diff --git a/README.md b/README.md deleted file mode 100644 index 8b1e7ddd..00000000 --- a/README.md +++ /dev/null @@ -1,19 +0,0 @@ - - -# plugin site erstellen -* die JAvaTXCOmpiler DAtei in ein plugin umwandeln und deployen. -* siehe: http://www.vogella.com/tutorials/EclipseJarToPlugin/article.html#convert-jar-files-to-osgi-bundles-with-the-p2-maven-plugin -* AUsführung: - * mvn deploy #erstellt die JAR-Datei und steckt sie in ein lokales Repo (maven-repository) - * mvn p2:site - * mvn package # hier wird die ZIP-Filf zum Einbinden in Eclipse erstellt - -# Einbinden in Eclipse -* In Eclipse kann die Zip-FIle wie ein Plugin installiert werden -* Hier tritt FEhler auf. Reflections-Library kann nicht installiert werden. Möglicherweise wird sie auch nicht gebraucht -* Nach dem installieren de.dhbwstuttagrt.JavaTXcompiler zu den DEpendencies des plugins hinzufügen -* Anschließend unter "Overview" auf "Updata Classpath" klicken - -# Windows -* JAVA_HOME setzen: - * export JAVA_HOME=/c/Program\ Files/Java/jdk1.8.0_102/ diff --git a/Website/JavaTXExamples.zip b/Website/JavaTXExamples.zip new file mode 100644 index 00000000..db9eb324 Binary files /dev/null and b/Website/JavaTXExamples.zip differ diff --git a/Website/index.html b/Website/index.html new file mode 100644 index 00000000..0253da16 --- /dev/null +++ b/Website/index.html @@ -0,0 +1,88 @@ + + +Java-TX Plugin +
+

Java-TX Plugin

+
+

Content

+ + +
+

Introduction

+Java-TX (Java Type eXtended) is an extension of Java in which a global type inference algorithm and real function types are added. Since the end of the nineties features from functional program- ming languages have been transferred to Java. Parametric polymorphism extended by wildcards, called generics, were transfered to Java 5.0. Higher-order functions and lambda expression were introduced in Java 8. Java 8 uses functional interfaces as target types of lambda expressions in contrast to real function types as in functional programming languages. +The powerful feature type inference from functional programming languages is incorporated into Java, as into other object-oriented +languages, i.e. only in a restricted way called local type inference. Local type inference allows certain type annotations to be omitted. For instance, it is often not necessary to specify the type of a variable. Type parameters of classes in the new-statement can be left out. Return types of methods can often also be omitted. Local type inference is at its most pronounced in Scala. In Java 10 an extention of local type inference is introduced, where types of local variables can be replaced by the keyword var and inferred automatically during the compilation. In contrast to global type inference, local type inference allows types of recursive methods and lambda expressions not to be omitted.
+The Java-TX project contributes to the design of object-oriented languages by developing global type inference algorithms for Java-like languages. + +

First Example

+The class Id has the method id. The type annotations are omitted. +
+ +
 
+  class Id {
+      id(x) {
+          return x;
+      }
+  } 
+ 
+The type inference algorithm inferrs the types, such that Id can be applied: +
+    new Id().id(1);
+
+    new Id().id("hallo");
+
+ +

More complex example

+
+  import java.lang.Integer;
+  import java.lang.Double; 
+  import java.lang.String; 
+
+
+  class OL {
+     m(x) { return x + x; }
+	
+  }
+    
+         
+  class OLMain {
+     main(x) { 
+	var ol;
+	ol = new OL(); 
+	return ol.m(x); 
+     }  
+  }
+
+The type inference mechanism considers only imported types. Therefore Integer Double, and String are imported. +
+As the operator + is overloaded by all numeric types and String the methods m in the class OL and main in the class OLMain, respectively, gets all these types. The generated classfile demonstrates this: +
+> javap OL.class 
+Compiled from "OL.jav"
+class OL {
+  public OL();
+  public java.lang.Integer m(java.lang.Integer);
+  public java.lang.Double m(java.lang.Double);
+}
+
+> javap OLMain.class 
+Compiled from "OLMain.jav"
+class OLMain {
+  public OLMain();
+  public java.lang.Integer main(java.lang.Integer);
+  public java.lang.Double main(java.lang.Double);
+}
+
+ + +
+
+Last modified: Fri Jun 1 16:43:55 CEST 2018 + diff --git a/Website/install/Restart.png b/Website/install/Restart.png new file mode 100644 index 00000000..5d3c3efc Binary files /dev/null and b/Website/install/Restart.png differ diff --git a/Website/install/availableSoftware1.png b/Website/install/availableSoftware1.png new file mode 100644 index 00000000..22097efe Binary files /dev/null and b/Website/install/availableSoftware1.png differ diff --git a/Website/install/availableSoftware2.png b/Website/install/availableSoftware2.png new file mode 100644 index 00000000..7bdb93cc Binary files /dev/null and b/Website/install/availableSoftware2.png differ diff --git a/Website/install/instal.html b/Website/install/instal.html new file mode 100644 index 00000000..4b4e91c7 --- /dev/null +++ b/Website/install/instal.html @@ -0,0 +1,40 @@ + + +Install Java-TX Plugin + + + +

Install Java-TX Plugin

+
    +
  1. Select "Install New Software ..."
    + + +
  2. +
  3. Add ...
    + +
  4. +
  5. Insert address
    + +
  6. +
  7. Select installation
    + +
  8. +
  9. Installation details
    + +
  10. +
  11. Accept license agreement
    + +
  12. +
  13. Install anyway
    + +
  14. +
  15. Restart
    + +
  16. +
+ + +
+
+Last modified: Fri Jun 1 11:57:15 CEST 2018 + diff --git a/Website/install/install.html b/Website/install/install.html new file mode 100644 index 00000000..11801117 --- /dev/null +++ b/Website/install/install.html @@ -0,0 +1,40 @@ + + +Install Java-TX Plugin + + + +

Install Java-TX Plugin

+
    +
  1. Select "Install New Software ..."
    + + +
  2. +
  3. Add ...
    + +
  4. +
  5. Insert address
    + +
  6. +
  7. Select installation
    + +
  8. +
  9. Installation details
    + +
  10. +
  11. Accept license agreement
    + +
  12. +
  13. Install anyway
    + +
  14. +
  15. Restart
    + +
  16. +
+ + +
+
+Last modified: Fri Jun 1 12:05:43 CEST 2018 + diff --git a/Website/install/installAnyway.png b/Website/install/installAnyway.png new file mode 100644 index 00000000..1e879655 Binary files /dev/null and b/Website/install/installAnyway.png differ diff --git a/Website/install/installationDetails.png b/Website/install/installationDetails.png new file mode 100644 index 00000000..3032caa3 Binary files /dev/null and b/Website/install/installationDetails.png differ diff --git a/Website/install/licenseAgreement.png b/Website/install/licenseAgreement.png new file mode 100644 index 00000000..4c20ccbb Binary files /dev/null and b/Website/install/licenseAgreement.png differ diff --git a/Website/install/newsoftware.png b/Website/install/newsoftware.png new file mode 100644 index 00000000..65c7005f Binary files /dev/null and b/Website/install/newsoftware.png differ diff --git a/Website/install/selectInstallation.png b/Website/install/selectInstallation.png new file mode 100644 index 00000000..eb9a3cdf Binary files /dev/null and b/Website/install/selectInstallation.png differ diff --git a/Website/newJavaTXProject/addLibrary2.png b/Website/newJavaTXProject/addLibrary2.png new file mode 100644 index 00000000..e008eeab Binary files /dev/null and b/Website/newJavaTXProject/addLibrary2.png differ diff --git a/Website/newJavaTXProject/buildPath1.png b/Website/newJavaTXProject/buildPath1.png new file mode 100644 index 00000000..e008eeab Binary files /dev/null and b/Website/newJavaTXProject/buildPath1.png differ diff --git a/Website/newJavaTXProject/buildPath2.png b/Website/newJavaTXProject/buildPath2.png new file mode 100644 index 00000000..920cc968 Binary files /dev/null and b/Website/newJavaTXProject/buildPath2.png differ diff --git a/Website/newJavaTXProject/buildPath3.png b/Website/newJavaTXProject/buildPath3.png new file mode 100644 index 00000000..8a7877c6 Binary files /dev/null and b/Website/newJavaTXProject/buildPath3.png differ diff --git a/Website/newJavaTXProject/buildPath4.png b/Website/newJavaTXProject/buildPath4.png new file mode 100644 index 00000000..1c3dd338 Binary files /dev/null and b/Website/newJavaTXProject/buildPath4.png differ diff --git a/Website/newJavaTXProject/newJavFile.png b/Website/newJavaTXProject/newJavFile.png new file mode 100644 index 00000000..85049267 Binary files /dev/null and b/Website/newJavaTXProject/newJavFile.png differ diff --git a/Website/newJavaTXProject/newJavFolder1.png b/Website/newJavaTXProject/newJavFolder1.png new file mode 100644 index 00000000..73e82fee Binary files /dev/null and b/Website/newJavaTXProject/newJavFolder1.png differ diff --git a/Website/newJavaTXProject/newJavFolder2.png b/Website/newJavaTXProject/newJavFolder2.png new file mode 100644 index 00000000..47e33951 Binary files /dev/null and b/Website/newJavaTXProject/newJavFolder2.png differ diff --git a/Website/newJavaTXProject/newJavaTXProject.html b/Website/newJavaTXProject/newJavaTXProject.html new file mode 100644 index 00000000..263e4044 --- /dev/null +++ b/Website/newJavaTXProject/newJavaTXProject.html @@ -0,0 +1,34 @@ + + + + +

New Java-TX project in eclipse

+
    +
  1. New -> Java Project
    + +
  2. +
    +
  3. Generate a jav-File folder
    +

    + +
  4. +
    +
  5. Add jav-File folder as library
    + At the moment no package system is implemented, Therefore the compiled class files are in the jav-File folder. This has to be added as library:
    +

    +

    +

    +
    + + +
  6. +
+ +

+ + + +
+
+Last modified: Fri Jun 1 16:50:02 CEST 2018 + diff --git a/Website/newJavaTXProject/newJavaTXProject.png b/Website/newJavaTXProject/newJavaTXProject.png new file mode 100644 index 00000000..57fc7727 Binary files /dev/null and b/Website/newJavaTXProject/newJavaTXProject.png differ diff --git a/Website/usePlugin/usePlugin.html b/Website/usePlugin/usePlugin.html new file mode 100644 index 00000000..45e744cf --- /dev/null +++ b/Website/usePlugin/usePlugin.html @@ -0,0 +1,24 @@ + + +Using the plugin + +

Using the plugin

+
    +
  1. Overview
    + +
  2. +
    +
  3. Select types
    + If the method is overloaded the user can select types in the outline the right mouse button:

    +
    +
  4. +
+ +

+ + + +
+
+Last modified: Fri Jun 1 16:51:28 CEST 2018 + diff --git a/Website/usePlugin/usePlugin1.png b/Website/usePlugin/usePlugin1.png new file mode 100644 index 00000000..c6f47149 Binary files /dev/null and b/Website/usePlugin/usePlugin1.png differ diff --git a/Website/usePlugin/usePlugin2.png b/Website/usePlugin/usePlugin2.png new file mode 100644 index 00000000..aefeb0bf Binary files /dev/null and b/Website/usePlugin/usePlugin2.png differ diff --git a/doc/PluginBau.pdf b/doc/PluginBau.pdf new file mode 100644 index 00000000..f6bab5cc Binary files /dev/null and b/doc/PluginBau.pdf differ diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index ffa8d54d..6c9763a2 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -110,13 +110,6 @@ public class JavaTXCompiler { TypeUnify unify = new TypeUnify(); Set> results = new HashSet<>(); - try { - FileWriter logFile = new FileWriter(new File(System.getProperty("user.dir")+"/test/logFiles/"+"log")); - logFile.write("FC:\\" + finiteClosure.toString()+"\n"); - for(SourceFile sf : this.sourceFiles.values()) { - logFile.write(ASTTypePrinter.print(sf)); - } - logFile.flush(); Set>> cardProd = unifyCons.cartesianProduct(); for (List> xCons : cardProd ){ Set xConsSet = new HashSet<>(); @@ -175,15 +168,11 @@ public class JavaTXCompiler { return y; } ) .collect(Collectors.toCollection(HashSet::new)); varianceInheritance(xConsSet); - Set> result = unify.unifySequential(xConsSet, finiteClosure, logFile, log); + Set> result = unify.unifySequential(xConsSet, finiteClosure); //Set> result = unify.unify(xConsSet, finiteClosure); - System.out.println("RESULT: " + result); - logFile.write("RES: " + result.toString()+"\n"); - logFile.flush(); results.addAll(result); } - } - catch (IOException e) { } + return results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, generateTPHMap(cons))))).collect(Collectors.toList()); diff --git a/src/de/dhbwstuttgart/typedeployment/TypeInsert.java b/src/de/dhbwstuttgart/typedeployment/TypeInsert.java index 4756e49f..665bd380 100644 --- a/src/de/dhbwstuttgart/typedeployment/TypeInsert.java +++ b/src/de/dhbwstuttgart/typedeployment/TypeInsert.java @@ -33,4 +33,22 @@ public class TypeInsert { public String getInsertString(){ return point.getInsertString(); } + + /* PL 2018-06-18 + * Zwei TypeInsert's sind gleich, wenn ihre point's und ihre inserts' gleich sind + * eingefuegt damit man TypeReplaceMarker vergleichen kann + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if(!(obj instanceof TypeInsert)) { + return false; + } + else { + return ((TypeInsert)obj).point.equals(this.point); + + } + } + public String toString() { + return point.toString(); + } } diff --git a/src/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java b/src/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java index 816628e6..14c86b65 100644 --- a/src/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java +++ b/src/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java @@ -2,6 +2,8 @@ package de.dhbwstuttgart.typedeployment; import org.antlr.v4.runtime.Token; +import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; + import java.util.List; import java.util.stream.Collectors; @@ -25,4 +27,23 @@ public class TypeInsertPoint { public String getInsertString() { return insertString; } + + /* PL 2018-06-19 + * Zwei TypeInsertPoint's sind gleich, wenn ihre point's gleich sind + * eingefuegt damit man TypeReplaceMarker vergleichen kann + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if(!(obj instanceof TypeInsertPoint)) { + return false; + } + else { + return ((TypeInsertPoint)obj).point.equals(this.point) && + ((TypeInsertPoint)obj).insertString.equals(this.insertString); + } + } + + public String toString() { + return point.toString() + " " + insertString.toString(); + } } diff --git a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index f84a4dbe..68907c56 100644 --- a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -202,7 +202,7 @@ public class TYPEStmt implements StatementVisitor{ unaryExpr.operation == UnaryExpr.Operation.PREINCREMENT){ //@see: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.14.2 //Expression muss zu Numeric Convertierbar sein. also von Numeric erben - constraintsSet.addUndConstraint(new Pair(unaryExpr.expr.getType(), number, PairOperator.SMALLERDOT)); + constraintsSet.addUndConstraint(new Pair(unaryExpr.expr.getType(), number, PairOperator.SMALLERNEQDOT)); //The type of the postfix increment expression is the type of the variable constraintsSet.addUndConstraint(new Pair(unaryExpr.expr.getType(), unaryExpr.getType(), PairOperator.EQUALSDOT)); }else{ diff --git a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java index 6c3cfaad..f54b1eb1 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java +++ b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java @@ -36,15 +36,10 @@ import java.io.IOException; */ public class RuleSet implements IRuleSet{ - FileWriter logFile; - RuleSet() { super(); } - RuleSet(FileWriter logFile) { - this.logFile = logFile; - } @Override public Optional reduceUp(UnifyPair pair) { diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnify.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnify.java index fa190cb7..5f0126aa 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnify.java @@ -8,16 +8,16 @@ import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; public class TypeUnify { - public Set> unify(Set eq, IFiniteClosure fc, FileWriter logFile, Boolean log) { - TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, true, logFile, log); + public Set> unify(Set eq, IFiniteClosure fc) { + TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, true); ForkJoinPool pool = new ForkJoinPool(); pool.invoke(unifyTask); Set> res = unifyTask.join(); return res; } - public Set> unifySequential(Set eq, IFiniteClosure fc, FileWriter logFile, Boolean log) { - TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, false, logFile, log); + public Set> unifySequential(Set eq, IFiniteClosure fc) { + TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, false); Set> res = unifyTask.compute(); return res; } diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index e38e1443..3ee49cdb 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -50,8 +50,7 @@ public class TypeUnifyTask extends RecursiveTask>> { private boolean printtag = false; Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"/test/logFiles/log" geschrieben werden soll? - public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/"; - FileWriter logFile; + //public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/"; /** * The implementation of setOps that will be used during the unification @@ -88,14 +87,12 @@ public class TypeUnifyTask extends RecursiveTask>> { rules = new RuleSet(); } - public TypeUnifyTask(Set eq, IFiniteClosure fc, boolean parallel, FileWriter logFile, Boolean log) { + public TypeUnifyTask(Set eq, IFiniteClosure fc, boolean parallel) { this.eq = eq; this.fc = fc; this.oup = new OrderingUnifyPair(fc); this.parallel = parallel; - this.logFile = logFile; - this.log = log; - rules = new RuleSet(logFile); + rules = new RuleSet(); } @@ -155,7 +152,6 @@ public class TypeUnifyTask extends RecursiveTask>> { * Step 1: Repeated application of reduce, adapt, erase, swap */ nOfUnify++; - writeLog(nOfUnify.toString() + " Unifikation: " + eq.toString()); //eq = eq.stream().map(x -> {x.setVariance((byte)-1); return x;}).collect(Collectors.toCollection(HashSet::new)); /* @@ -231,10 +227,6 @@ public class TypeUnifyTask extends RecursiveTask>> { // those pairs are contradictory and the unification is impossible. if(!undefinedPairs.isEmpty()) { noUndefPair++; - for (UnifyPair up : undefinedPairs) { - writeLog(noUndefPair.toString() + " UndefinedPairs; " + up); - writeLog("BasePair; " + up.getBasePair()); - } Set> error = new HashSet<>(); undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new)); error.add(undefinedPairs); @@ -323,13 +315,13 @@ public class TypeUnifyTask extends RecursiveTask>> { eqPrimePrimeSet.add(eqPrime); else if(eqPrimePrime.isPresent()) { //System.out.println("nextStep: " + eqPrimePrime.get()); - TypeUnifyTask fork = new TypeUnifyTask(eqPrimePrime.get(), fc, true, logFile, log); + TypeUnifyTask fork = new TypeUnifyTask(eqPrimePrime.get(), fc, true); forks.add(fork); fork.fork(); } else { //System.out.println("nextStep: " + eqPrime); - TypeUnifyTask fork = new TypeUnifyTask(eqPrime, fc, true, logFile, log); + TypeUnifyTask fork = new TypeUnifyTask(eqPrime, fc, true); forks.add(fork); fork.fork(); } @@ -340,13 +332,7 @@ public class TypeUnifyTask extends RecursiveTask>> { //PL 2017-09-29 dies ersetzt //(!eqPrimePrime.isPresent()) //PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst //eqPrimePrime Veraenderungen in subst repraesentieren. - try { - if (isSolvedForm(eqPrime)) { - logFile.write(eqPrime.toString()+"\n"); - logFile.flush(); - } - } - catch (IOException e) { } + eqPrimePrimeSet.add(eqPrime); } else if(eqPrimePrime.isPresent()) { @@ -377,8 +363,6 @@ public class TypeUnifyTask extends RecursiveTask>> { * Step 7: Filter empty sets; */ eqPrimePrimeSet = eqPrimePrimeSet.stream().filter(x -> isSolvedForm(x) || this.isUndefinedPairSet(x)).collect(Collectors.toCollection(HashSet::new)); - if (!eqPrimePrimeSet.isEmpty() && !isUndefinedPairSetSet(eqPrimePrimeSet)) - writeLog("Result1 " + eqPrimePrimeSet.toString()); return eqPrimePrimeSet; } @@ -398,7 +382,6 @@ public class TypeUnifyTask extends RecursiveTask>> { return result; } Set> nextSet = remainingSets.remove(0); - writeLog("nextSet: " + nextSet.toString()); List> nextSetasList =new ArrayList<>(nextSet); try { //List> @@ -448,7 +431,6 @@ public class TypeUnifyTask extends RecursiveTask>> { System.out.print(""); if (nextSetasList.iterator().next().stream().filter(x -> x.getLhsType().getName().equals("D")).findFirst().isPresent() && nextSetasList.size()>1) System.out.print(""); - writeLog("nextSetasList: " + nextSetasList.toString()); while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) { Set a = null; if (variance == 1) { @@ -569,16 +551,8 @@ public class TypeUnifyTask extends RecursiveTask>> { //} return (!x.containsAll(durchschnitt)); }).collect(Collectors.toCollection(ArrayList::new)); - writeLog("abhSubst: " + abhSubst.toString()); - writeLog("a: " + a.toString()); - writeLog("Durchschnitt: " + durchschnitt.toString()); - writeLog("nextSet: " + nextSet.toString()); - writeLog("nextSetasList: " + nextSetasList.toString()); - writeLog("Number erased Elements (undef): " + (len - nextSetasList.size())); noAllErasedElements = noAllErasedElements + (len - nextSetasList.size()); - writeLog("Number erased Elements (undef): " + noAllErasedElements.toString()); noBacktracking++; - writeLog("Number of Backtracking: " + noBacktracking); System.out.println(""); } //if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) { @@ -1238,7 +1212,7 @@ public class TypeUnifyTask extends RecursiveTask>> { permuteParams(candidates, idx+1, result, current); } } - +/* void writeLog(String str) { if (log) { try { @@ -1249,4 +1223,6 @@ public class TypeUnifyTask extends RecursiveTask>> { catch (IOException e) { } } } + */ } + diff --git a/target/JavaTXcompiler-0.1-jar-with-dependencies.jar b/target/JavaTXcompiler-0.1-jar-with-dependencies.jar index 88d0644c..fdf649ee 100644 Binary files a/target/JavaTXcompiler-0.1-jar-with-dependencies.jar and b/target/JavaTXcompiler-0.1-jar-with-dependencies.jar differ diff --git a/test/bytecode/javFiles/Faculty.jav b/test/bytecode/javFiles/Faculty.jav index a5c649b8..dae93abe 100644 --- a/test/bytecode/javFiles/Faculty.jav +++ b/test/bytecode/javFiles/Faculty.jav @@ -5,12 +5,12 @@ class Faculty { m () { var fact = (Integer x) -> { - if (x == 1) { + //if (x == 1) { return x; - } - else { - return x * fact.apply(x-1); - } + //} + //else { + //return x * (fact.apply(x-1)); + //} }; return fact; } diff --git a/test/bytecode/javFiles/Lambda.jav b/test/bytecode/javFiles/Lambda.jav index ba466b18..bb7de0b4 100644 --- a/test/bytecode/javFiles/Lambda.jav +++ b/test/bytecode/javFiles/Lambda.jav @@ -6,6 +6,13 @@ public class Lambda { var lam1 = (x) -> { return x; }; +<<<<<<< HEAD return lam1; +======= + + return lam1.apply(new Apply()); + //return lam1; + //return new Vector(); +>>>>>>> 3fedbcc4a0e015ec8f5f6ccb77081f888135c850 } } diff --git a/test/bytecode/javFiles/OL.jav b/test/bytecode/javFiles/OL.jav index e117f7dd..55e018bc 100644 --- a/test/bytecode/javFiles/OL.jav +++ b/test/bytecode/javFiles/OL.jav @@ -1,19 +1,27 @@ import java.lang.String; import java.lang.Integer; -import java.lang.Double; +import java.lang.Double; +import java.lang.String; +<<<<<<< HEAD public class OL { m(x) { return x + x; } +======= +class OL { + + m(x) { return x + x; } +>>>>>>> 3fedbcc4a0e015ec8f5f6ccb77081f888135c850 - //m(x) { return x || x; } - - - } - +} + +<<<<<<< HEAD public class OLMain { +======= +class OLMain { +>>>>>>> 3fedbcc4a0e015ec8f5f6ccb77081f888135c850 main(java.lang.Integer x) { var ol; diff --git a/test/javFiles/Lambda.jav b/test/javFiles/Lambda.jav index b9a2c3f9..48359fc8 100644 --- a/test/javFiles/Lambda.jav +++ b/test/javFiles/Lambda.jav @@ -3,7 +3,7 @@ class Apply { } public class Lambda { m () { - var lam1 = (x) -> { + var lam1 = (Integer x) -> { return x; }; return lam1.apply(new Apply()); diff --git a/test/typeinference/UnifyTest.java b/test/typeinference/UnifyTest.java index 8ce8c71a..f8b6ec2e 100644 --- a/test/typeinference/UnifyTest.java +++ b/test/typeinference/UnifyTest.java @@ -81,16 +81,14 @@ public class UnifyTest { } */ - - @Test public void matrix() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"Matrix.jav")); //JavaTXCompiler compiler = new JavaTXCompiler(new File(rootDirectory+"Matrix.jav")); //compiler.generateBytecode(); } - + /* @Test public void vector() throws IOException, ClassNotFoundException {