The Artima Developer Community
Sponsored Link

Java Buzz Forum
Converting Java 8 syntax to Java 7

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Tim Vernum

Posts: 58
Nickname: tpv
Registered: Dec, 2002

Tim Vernum is passionate about designing secure systems
Converting Java 8 syntax to Java 7 Posted: Jan 17, 2013 5:36 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Tim Vernum.
Original Post: Converting Java 8 syntax to Java 7
Feed Title: A word used to describe something
Feed URL: http://blog.adjective.org/feed/category/Development/rss2
Feed Description: Tim's random musings on software development, java, jetty and other such frivolities.
Latest Java Buzz Posts
Latest Java Buzz Posts by Tim Vernum
Latest Posts From A word used to describe something

Advertisement

A project I was working on finished up abruptly, and I found myself with some spare time over the last few weeks, so I decided to test out a new idea - a utility to convert Java 8 syntax into Java 7

For the most part, this is simply an experiment - to see how difficult it would be to write such a utility (and the short answer is that it's difficult to do well, but certainly not impossible), but it has the potential to be useful for supporting lambda-based code in environments that do not (yet) have support for Java 8.

I have a working prototype, that supports conversion of a subset of Java 8 features. And by a subset, I mean essentially 1...

It can convert a variable declaration for a functional interface with a lambda initializer into a anonymous inner class. e.g.

Callable<String> callable = () -> "abc" ;

is converted to

Callable<String> callable = new Callable<String>() {
    public String call() throws java.lang.Exception { 
        return "abc"; 
    }
};

It's a long way from being feature complete, but it's usable (within the scope of what has been implemented). It looks like I'll be starting a new role next week, so that may reduce my time to work on this project for a little while - I wanted to get it published before that happened.

Documentation is available here.

Feedback (and/or patches) highly desired.

Read: Converting Java 8 syntax to Java 7

Topic: A Grails plugin to bridge Spring Security and Shiro Previous Topic   Next Topic Topic: Difference between Callable and Runnable in Java - Interview question

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use