Git Product home page Git Product logo

vertx-codetrans's People

Contributors

alexlehm avatar cescoffier avatar gmariotti avatar okou19900722 avatar pflanzenmoerder avatar pmlopes avatar purplefox avatar slinkydeveloper avatar tomfi avatar tsegismont avatar vietj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vertx-codetrans's Issues

reduce wrong

Buffer buff = Buffer.buffer();
for (int i = 0; i < buff.length(); i += 4) {
    System.out.println("int value at " + i + " is " + buff.getInt(i));
}

method reduce of class TreeScanner while return 4 only, the Identifier i has being discard.
when the method forLoop of CodeBuilder invoker, update only render 4

code of reduce of class TreeScanner

public R reduce(R r1, R r2) {
    return r1;
}

Lack of documentation for this repo

Hey, I'm trying to have a browse of this repo but I'm not exactly sure how it works, how it relates to Vertx, and which files correspond to what. Is it possible to update the documentation to make it a little easier for possible contributors? ;)

Invalid Javascript code generated for isXXX methods

Hi,
Java methods like isSuccessful are not correctly translated to Javascript. It will result in something like that:
Java code:

Request data = new Request().setInput(sampleInput);
ex.check(data, checkResult -> {
    if(checkResult.succeeded()) {
        if (checkResult.result().isSuccessful()) {
            System.out.println("Yeah! ");
        } else {
            System.out.println("Nah!");
        }
    } else {
        System.out.println("ERROR: "+checkResult.cause().getLocalizedMessage());
    }
});

Generated JS code (copied from the adoc file):

var data = {
  "input" : sampleInput
};
ex.check(data, function (checkResult, checkResult_err) {
  if (checkResult_err == null) {
    if (checkResult.uccessful) {
      console.log("Yeah! ");
    } else {
      console.log("Nah!");
    }
  } else {
    console.log("ERROR: " + checkResult_err.getLocalizedMessage());
  }
});

Carefully look at line 6 of the Javascript: checkResult.uccessful instead of .successful

Reproducer: https://github.com/doernemt/vertx-codetrans-js-reproducer

More idiomatic Kotlin translation

As @cbeust mentioned me off the record, Kotlin code translated as:

var message = MailMessage()
message.from = "[email protected] (Example User)"
message.to = "[email protected]"
message.cc = "Another User <[email protected]>"
message.text = "this is the plain message text"

would be more idiomatic written with a val and apply:

val message = MailMessage().apply {
  from = "[email protected] (Example User)"
  to = "[email protected]"
  cc = "Another User <[email protected]>"
  text = "this is the plain message text"
}

CodeBuilder.enhancedForLoop needs more type infos

CodeBuilder.enhancedForLoop needs to provide the TypeInfo of the object the enhancedforloop is called on.
This is important for Scala to know the type of collection it is called on so I can use the correct conversions.

Invalid snippet if string contains the dollar sign

Some code writers can produce interpolated strings where the dollar sign is the special char.

If the original java code has a string which contains the dollar sign, the resulting snippet can be invalid.

Fix bug with expression used in AsyncResult lambdas

i.e we handle fine:

foo(id -> {
  // Block of statements
});

but not yet

foo(id -> /* expression */);

which result in a class cast exception:

java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCMethodInvocation cannot be cast to com.sun.source.tree.BlockTree
	at io.vertx.codetrans.ModelBuilder.visitLambdaExpression(ModelBuilder.java:774)
	at io.vertx.codetrans.ModelBuilder.visitLambdaExpression(ModelBuilder.java:88)
	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1628)
	at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
	at io.vertx.codetrans.ModelBuilder.scan(ModelBuilder.java:123)
	at io.vertx.codetrans.ModelBuilder.lambda$visitMethodInvocation$8(ModelBuilder.java:531)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.