Merge branch 'plugin' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into plugin
BIN
Website/JavaTXExamples.zip
Normal file
88
Website/index.html
Normal file
@ -0,0 +1,88 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<html> <head>
|
||||
<title>Java-TX Plugin</title></head>
|
||||
<center>
|
||||
<h1>Java-TX Plugin</h1>
|
||||
</center>
|
||||
<h2>Content</h2>
|
||||
<ul>
|
||||
<li><h4><a href="#introduction">Introduction</a></h4></li>
|
||||
<li><h4><a href="newJavaTXProject/newJavaTXProject.html" >New Java-TX project</a></h4></li>
|
||||
<li><h4><a href=" JavaTXExamples.zip" >Example project</a></h4></li>
|
||||
<li><a href="usePlugin/usePlugin.html" >Using the plugin</a></li>
|
||||
<li><h4><a href="install/install.html" >Installation</a></h4>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
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.<br>
|
||||
The Java-TX project contributes to the design of object-oriented languages by developing global type inference algorithms for Java-like languages.
|
||||
|
||||
<h3>First Example</h3>
|
||||
The class <tt>Id</tt> has the method <tt>id</tt>. The type annotations are omitted.
|
||||
<br/>
|
||||
|
||||
<pre> <code class="language-java">
|
||||
class Id {
|
||||
id(x) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
</code> </pre>
|
||||
The type inference algorithm inferrs the types, such that <tt>Id</tt> can be applied:
|
||||
<pre>
|
||||
new Id().id(1);
|
||||
|
||||
new Id().id("hallo");
|
||||
</pre>
|
||||
|
||||
<h3>More complex example</h3>
|
||||
<pre>
|
||||
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);
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
The type inference mechanism considers only imported types. Therefore <tt>Integer</tt> <tt>Double</tt>, and <tt>String</tt> are imported.
|
||||
<br/>
|
||||
As the operator <tt>+</tt> is overloaded by all numeric types and String the methods <tt>m</tt> in the class <tt>OL</tt> and <tt>main</tt> in the class <tt>OLMain</tt>, respectively, gets all these types. The generated classfile demonstrates this:
|
||||
<pre>
|
||||
> 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);
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
||||
<hr>
|
||||
<address></address>
|
||||
<!-- hhmts start -->Last modified: Fri Jun 1 16:43:55 CEST 2018 <!-- hhmts end -->
|
||||
</body> </html>
|
BIN
Website/install/Restart.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
Website/install/availableSoftware1.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
Website/install/availableSoftware2.png
Normal file
After Width: | Height: | Size: 109 KiB |
40
Website/install/instal.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<html> <head>
|
||||
<title>Install Java-TX Plugin</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Install Java-TX Plugin</h1>
|
||||
<ol>
|
||||
<li>Select "Install New Software ..."<br>
|
||||
<img width= 400 src="newsoftware.png" >
|
||||
|
||||
</li>
|
||||
<li>Add ...<br>
|
||||
<img width=550 src="availableSoftware1.png" >
|
||||
</li>
|
||||
<li>Insert address<br>
|
||||
<img width=550 src="availableSoftware2.png" >
|
||||
</li>
|
||||
<li>Select installation<br>
|
||||
<img width=550 src="selectInstallation.png" >
|
||||
</li>
|
||||
<li>Installation details<br>
|
||||
<img width=550 src="installationDetails.png" >
|
||||
</li>
|
||||
<li>Accept license agreement<br>
|
||||
<img width=550 src="licenseAgreement.png" >
|
||||
</li>
|
||||
<li>Install anyway<br>
|
||||
<img width=450 src="installAnyway.png">
|
||||
</li>
|
||||
<li>Restart<br>
|
||||
<img width=450 src="Restart.png">
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<hr>
|
||||
<address></address>
|
||||
<!-- hhmts start -->Last modified: Fri Jun 1 11:57:15 CEST 2018 <!-- hhmts end -->
|
||||
</body> </html>
|
40
Website/install/install.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<html> <head>
|
||||
<title>Install Java-TX Plugin</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Install Java-TX Plugin</h2>
|
||||
<ol>
|
||||
<li>Select "Install New Software ..."<br>
|
||||
<img width= 400 src="newsoftware.png" >
|
||||
|
||||
</li>
|
||||
<li>Add ...<br>
|
||||
<img width=550 src="availableSoftware1.png" >
|
||||
</li>
|
||||
<li>Insert address<br>
|
||||
<img width=550 src="availableSoftware2.png" >
|
||||
</li>
|
||||
<li>Select installation<br>
|
||||
<img width=550 src="selectInstallation.png" >
|
||||
</li>
|
||||
<li>Installation details<br>
|
||||
<img width=550 src="installationDetails.png" >
|
||||
</li>
|
||||
<li>Accept license agreement<br>
|
||||
<img width=550 src="licenseAgreement.png" >
|
||||
</li>
|
||||
<li>Install anyway<br>
|
||||
<img width=450 src="installAnyway.png">
|
||||
</li>
|
||||
<li>Restart<br>
|
||||
<img width=450 src="Restart.png">
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<hr>
|
||||
<address></address>
|
||||
<!-- hhmts start -->Last modified: Fri Jun 1 12:05:43 CEST 2018 <!-- hhmts end -->
|
||||
</body> </html>
|
BIN
Website/install/installAnyway.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Website/install/installationDetails.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
Website/install/licenseAgreement.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
Website/install/newsoftware.png
Normal file
After Width: | Height: | Size: 96 KiB |
BIN
Website/install/selectInstallation.png
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
Website/newJavaTXProject/addLibrary2.png
Normal file
After Width: | Height: | Size: 163 KiB |
BIN
Website/newJavaTXProject/buildPath1.png
Normal file
After Width: | Height: | Size: 163 KiB |
BIN
Website/newJavaTXProject/buildPath2.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
Website/newJavaTXProject/buildPath3.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
Website/newJavaTXProject/buildPath4.png
Normal file
After Width: | Height: | Size: 96 KiB |
BIN
Website/newJavaTXProject/newJavFile.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
Website/newJavaTXProject/newJavFolder1.png
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
Website/newJavaTXProject/newJavFolder2.png
Normal file
After Width: | Height: | Size: 76 KiB |
34
Website/newJavaTXProject/newJavaTXProject.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<html> <head>
|
||||
<title></title>
|
||||
</head>
|
||||
<h2>New Java-TX project in eclipse</h2>
|
||||
<ol>
|
||||
<li>New -> Java Project<br/>
|
||||
<img width= 400 src="newJavaTXProject.png" >
|
||||
</li>
|
||||
<br/>
|
||||
<li>Generate a jav-File folder<br/>
|
||||
<img width= 550 src="newJavFolder1.png" ><br/><br/>
|
||||
<img width= 550 src="newJavFolder2.png" >
|
||||
</li>
|
||||
<br/>
|
||||
<li>Add jav-File folder as library<br/>
|
||||
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:<br/>
|
||||
<img width= 550 src="buildPath1.png" ><br/><br/>
|
||||
<img width= 550 src="buildPath2.png" ><br/><br/>
|
||||
<img width= 400 src="buildPath3.png" ><br/><br/>
|
||||
<img width= 550 src="buildPath4.png" ><br/>
|
||||
|
||||
|
||||
</li>
|
||||
</ol>
|
||||
<body>
|
||||
<h1></h1>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
<address></address>
|
||||
<!-- hhmts start -->Last modified: Fri Jun 1 16:50:02 CEST 2018 <!-- hhmts end -->
|
||||
</body> </html>
|
BIN
Website/newJavaTXProject/newJavaTXProject.png
Normal file
After Width: | Height: | Size: 150 KiB |
24
Website/usePlugin/usePlugin.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<html> <head>
|
||||
<title>Using the plugin</title>
|
||||
</head>
|
||||
<h2>Using the plugin</h2>
|
||||
<ol>
|
||||
<li>Overview<br/>
|
||||
<img width=800 src="usePlugin1.png" >
|
||||
</li>
|
||||
<br/>
|
||||
<li>Select types<br/>
|
||||
If the method is overloaded the user can select types in the outline the right mouse button:<br/><br/>
|
||||
<img src="usePlugin2.png" ><br/>
|
||||
</li>
|
||||
</ol>
|
||||
<body>
|
||||
<h1></h1>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
<address></address>
|
||||
<!-- hhmts start -->Last modified: Fri Jun 1 16:51:28 CEST 2018 <!-- hhmts end -->
|
||||
</body> </html>
|
BIN
Website/usePlugin/usePlugin1.png
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
Website/usePlugin/usePlugin2.png
Normal file
After Width: | Height: | Size: 33 KiB |
@ -1,18 +1,16 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Double;
|
||||
import java.lang.Double;
|
||||
import java.lang.String;
|
||||
|
||||
|
||||
class OL {
|
||||
class OL {
|
||||
|
||||
m(java.lang.Double x) { return x + x; }
|
||||
m(x) { return x + x; }
|
||||
|
||||
//m(x) { return x || x; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class Main {
|
||||
class OLMain {
|
||||
|
||||
main(x) {
|
||||
var ol;
|
||||
|