One possibility is to decompile bytecode, but there's a catch... Bytecode can express things that Java can't, such as overloading based purely on return type, or a constructor that calls super - but not as the first line.
The ScalaGWT project ran into exactly this problem, the solution there was to invent the "jribble" language, which is basically just Java without these restrictions. A small patch to the GWT compiler was then enough to have it accept jribble as input. It would be interesting to see the problem solved more generally, and be able to reverse-engineer any bytecode into valid Java. I'm sure that would reduce the perceived risk of using a non-Java language for many people. On 6 October 2010 09:53, Ricky Clarkson <[email protected]> wrote: > Ah. Generating readable Java is a different kettle of fish to > compiling to Java, indeed. > > I had 50 lines of Scala generating 3000 lines of 'readable', fully > Javadocced, boilerplatetastic Java code (it was for making type-safe > builders for a number of CGI-style queries). Great, but yuck at the > same time. > > On Wed, Oct 6, 2010 at 9:41 AM, Christian Catchpole > <[email protected]> wrote: > > Yeah, I don't think there isn't much that wont compile to Java.. But > > it might come down to how cryptic unmaintainable the result is if your > > boss insists you "stick to java". > > > > On Oct 6, 3:25 pm, Ricky Clarkson <[email protected]> wrote: > >> Some languages with decent type systems can compile to C, so why not to > Java? > >> > >> On Wed, Oct 6, 2010 at 3:21 AM, Christian Catchpole > >> > >> > >> > >> <[email protected]> wrote: > >> > I think it would be awesome if we had langauges which would cross- > >> > compile cleanly to and from Java. Of course, the langauge would have > >> > to closly align with Java's type system (not do too many special > >> > tricks) if you want it to coexist with vanilla Java. Of course some > >> > features just might not have a java equiv. > >> > >> > So lombok taken to another level. Reinier would probably be best to > >> > comment on some if the finer points of the whole idea. > >> > >> > -- > >> > You received this message because you are subscribed to the Google > Groups "The Java Posse" group. > >> > To post to this group, send email to [email protected]. > >> > To unsubscribe from this group, send email to > [email protected]<javaposse%[email protected]> > . > >> > For more options, visit this group athttp:// > groups.google.com/group/javaposse?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]<javaposse%[email protected]> > . > > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<javaposse%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > -- Kevin Wright mail / gtalk / msn : [email protected] pulse / skype: kev.lee.wright twitter: @thecoda -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
