1. Tim Vernum
  2. syntactic

Commits

Tim Vernum  committed 4c6c4f5

Add Java 8=>7 doco

  • Participants
  • Parent commits 4fbe8d6
  • Branches default

Comments (0)

Files changed (3)

File ConvertingJava8To7.md

View file
+Converting Java 8 to 7
+======================
+_How to use Syntactic to convert Java 8 syntax into Java 7 syntax_
+
+Caveats
+-------
+* Not all Java 8 features are supported
+* Those features that are supported, are not supported in full
+* Error handling is minimal - if your code is not valid, then you may receive abstruse error messages
+* The tool to call the converter is very barebones
+
+Supported Features
+------------------
+
+### Lambda expressions 
+_Lambda expressions_ are supported in a variable declaration
+
+e.g.
+    Runnable runnable = () -> { System.out.println("Running!"); } ;
+    Callable<String> callable = () -> "abc" ;
+    FileFilter filter = (file) -> file.getName().endsWith(".xml") ;
+    javax.swing.event.ChangeListener listener = event -> { System.err.println("Event:" + event); };
+    Comparator<? super String> cmp = (CharSequence a, CharSequence b) -> { 
+        Integer l1 = a.length(), l2 = b.length();
+        return l1.compareTo(l2);
+    };
+        
+As you can see from the examples above the following are supported:
+* _Block_ based lambdas _(runnable, listener and cmp)_
+* _Expression_ based lambdas _(callable and filter)_
+* Zero-argument lambdas _(runnable and callable)_
+* The parenthesis-less syntax for single-argument lambdas _(listener)_
+* Implied argument types _(filter, listener)_
+* Generics _(callable and cmp)_
+* Generics with wildcards _(cmp)_
+
+
+Not Yet Supported Features
+--------------------------
+
+### Other lambda expressions
+Lambda expressions outside of a variable declaration are not supported, but will be in the future.
+
+### Method and Constructor references
+Method references and constructor references are not yet supported, but will be in the future.
+
+
+Unlikely to be Supported Features
+---------------------------------
+
+### Default methods
+Default methods may be supported in some limited fashion in the future, but are unlikely to be supported in full.
+
+### Collections Framework Changes
+The converter handles syntax changes only, and does not provide a backwards-compatible class library.
+
+The Conversion Tool 
+-------------------
+
+### Executing
+
+The _conversion_ tool is in `org.adjective.syntactic.convert.j8to7.Main`. 
+
+The arguments are a list of filenames to convert.
+
+It requires two jar files on the classpath `syntactic-parser.jar` and `syntactic-convert.jar`  
+_(See [Download]_ for more info)
+
+e.g.
+    java -cp syntactic-parser.jar:syntactic-convert.jar src/com/example/MyClass.java
+
+The converted source is printed to standard output _(System.out)_
+
+### Limitiations
+
+The tool currently has these limitations.  
+We intend to fix these in time.
+
+* All files are printed to standard out, which isn't very helpful if you're trying to convert multiple files at once
+* All dependant classes (including the [functional interfaces](http://www.lambdafaq.org/what-is-a-functional-interface/) must be either
+ 1. Available on the classpath
+ 2. Included in the same compilation unit (file)
+

File Download.md

View file
+Syntactic has 2 jar files.
+
+A zip file containing the snapshot version of these jar files is available at the [download page](https://bitbucket.org/tvernum/syntactic/downloads)
+

File Home.md

View file
 
 - Supports proposed Java 8 syntax
 - Supports generating Java source code for an AST
-- Has partial support for converting Java 8 syntax to Java 7
+- Has partial support for [converting Java 8 syntax to Java 7](ConvertingJava8To7)
 
 ## License