Java to Ceylon converter - variables

235 views
Skip to first unread message

Rohit Mohan

unread,
May 26, 2015, 5:50:06 AM5/26/15
to ceylo...@googlegroups.com
Hi

I am working on a Java to Ceylon Converter for my GSoC project. 

I am currently using Antlr to generate an AST and then parse it and produce the Ceylon code.

What I wanted to know was how to handle variables. Because in Ceylon, values have to be specified as a variable to assign them more than once. So should I make everything a variable? Or check if the value changes and then make it a variable?


Regards

Rohit Mohan 

Stephane Epardaud

unread,
May 26, 2015, 5:57:03 AM5/26/15
to ceylon-dev
I think if the field is defined as "final" then it's not mutable. Otherwise it's "variable". Now, be careful that you will also have to handle JavaBean properties. If you have a getter method for a given field, but no setter it should be immutable. Unless it's mutated internally, I suppose. This is never going to be 100% right. Just do the best thing most of the time ;)

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/3bba4625-ebe4-4b54-8e21-97960e5d25d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Julien Viet

unread,
May 26, 2015, 5:58:50 AM5/26/15
to ceylo...@googlegroups.com, Rohit Mohan
interesting, for Vert.x 3, I wrote a converter based on Java internal AST to convert simple examples to Groovy, Ruby, JavaScript (and perhaps Ceylon too later):


-- 
Julien Viet
www.julienviet.com

Tako Schotanus

unread,
May 26, 2015, 6:04:13 AM5/26/15
to ceylon-dev
Ok, people seem to prefer this copy of the mail (impatient youngsters these days heh) so I'll copy my reply over:

I would definitely try to detect if a value is variable or not.
Normally you'd do this with a separate pass over the AST where you look for all the assignment statements and things like ++ and -- and then mark the value it refers to as variable. That way when you do the final pass that generates the code you will know if you need to generate a "variable" annotation or not.

At the same time I'd suggest to just get things working in the beginning and handle details like that later.


-Tako

Julien Viet

unread,
May 26, 2015, 6:12:45 AM5/26/15
to ceylo...@googlegroups.com, Tako Schotanus

Rohit Mohan

unread,
May 26, 2015, 8:25:19 AM5/26/15
to ceylo...@googlegroups.com
OK thanks. Right now, I just made it a variable if it is not final. 

Rohit Mohan

unread,
May 26, 2015, 1:21:31 PM5/26/15
to ceylo...@googlegroups.com
Oh and since there is no implicit type conversion what should I do?

Stephane Epardaud

unread,
May 26, 2015, 2:51:07 PM5/26/15
to ceylon-dev
For what specific case?

On 26 May 2015 at 19:21, Rohit Mohan <rohitm...@gmail.com> wrote:
Oh and since there is no implicit type conversion what should I do?

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Rohit Mohan

unread,
May 26, 2015, 3:15:42 PM5/26/15
to ceylo...@googlegroups.com

For what specific case?

Say I have a method 
public void foo(float a){
   
...
}

Now if I do 
foo(1);

This would not work in ceylon. 
 

Tako Schotanus

unread,
May 26, 2015, 3:32:24 PM5/26/15
to ceylon-dev
You should probably generate something like

    foo(1.float);

You'd have to code a list of implicit-to-explicit type conversions.


-Tako

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Gavin King

unread,
May 26, 2015, 3:52:14 PM5/26/15
to ceylo...@googlegroups.com

Tako Schotanus

unread,
May 26, 2015, 3:56:01 PM5/26/15
to ceylon-dev
Ah yes, I'm thinking of all the info we have in the javac AST.

But a "dumb" parser will have big problems making a proper conversion, won't it?


-Tako

Julien Viet

unread,
May 26, 2015, 4:13:07 PM5/26/15
to ceylo...@googlegroups.com
my experience (similar needs) : I needed indeed to go beyond that point with vertx-codetrans and have an attributed AST (with types). That's why I used the Java Compiler tree API and its internal stuff.

On Tue, May 26, 2015 at 9:51 PM, Gavin King <gavin...@gmail.com> wrote:

Rohit Mohan

unread,
May 27, 2015, 10:19:47 AM5/27/15
to ceylo...@googlegroups.com
So is there any way to do it?

You received this message because you are subscribed to a topic in the Google Groups "ceylon-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceylon-dev/q8Oo_k0zBHI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceylon-dev+...@googlegroups.com.

To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Stephane Epardaud

unread,
May 27, 2015, 10:44:55 AM5/27/15
to ceylon-dev
Well, we're not interested in completeness, because there will be lots of causes for errors, specifically in case of missing dependencies. In this case, converting it to a call with no conversion would be enough and the user can fix it.

Remember we want this to be usable in the IDE where the user would copy/paste code from Java to Ceylon so it's likely there will be lots of things missing that we can't typecheck in the Java code. Hell it should even allow expressions and not just complete files.


For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Rohit Mohan

unread,
May 27, 2015, 9:16:46 PM5/27/15
to ceylo...@googlegroups.com
Expressions? Well, that doesn't work right now..

Stephane Epardaud

unread,
May 28, 2015, 4:43:14 AM5/28/15
to ceylon-dev
Well, not yet ;)

On 28 May 2015 at 03:16, Rohit Mohan <rohitm...@gmail.com> wrote:
Expressions? Well, that doesn't work right now..

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Rohit Mohan

unread,
May 30, 2015, 9:10:29 AM5/30/15
to ceylo...@googlegroups.com
And what should I do about constructors and overloading?

Gavin King

unread,
May 30, 2015, 10:30:40 AM5/30/15
to ceylo...@googlegroups.com
Well, I mean, I don't think there's any reasonable way you can detect
and deal with overloading unless you have a full typechecker for Java.

So just leave it alone for now, and let the user deal with it.

On Sat, May 30, 2015 at 3:10 PM, Rohit Mohan <rohitm...@gmail.com> wrote:
> And what should I do about constructors and overloading?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-dev/0dbec6ec-3536-496a-8cdb-50a0c46dcf77%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Rohit Mohan

unread,
May 31, 2015, 8:03:50 AM5/31/15
to ceylo...@googlegroups.com
OK thanks. I think I'll start with the IDE now. I would like to know how I should be implementing the converter in the IDE.

Stephane Epardaud

unread,
Jun 1, 2015, 3:50:44 AM6/1/15
to ceylon-dev
Have you pushed your progress somewhere so we can try what you have so far?

On 31 May 2015 at 14:03, Rohit Mohan <rohitm...@gmail.com> wrote:
OK thanks. I think I'll start with the IDE now. I would like to know how I should be implementing the converter in the IDE.

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Rohit Mohan

unread,
Jun 1, 2015, 5:08:08 AM6/1/15
to ceylo...@googlegroups.com

Stephane Epardaud

unread,
Jun 1, 2015, 5:37:36 AM6/1/15
to ceylon-dev
Great, I should have paid more attention :)

I see you have a test file, you should make this a unit test suite, so for example split it up in features (if, switch, for, class, etc…) and for each file convert it to a Ceylon file and compare with an expected output Ceylon file that you store in your test suite.

Otherwise, progress is looking good :)

On 1 June 2015 at 11:08, Rohit Mohan <rohitm...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Rohit Mohan

unread,
Jun 1, 2015, 11:22:13 AM6/1/15
to ceylo...@googlegroups.com
Done. :)

Right now, the generated Ceylon code is not formatted. So what would the best way to format it?



Regards

Rohit Mohan

Lucas Werkmeister

unread,
Jun 1, 2015, 11:23:20 AM6/1/15
to ceylo...@googlegroups.com
Call me biased, but I suggest using https://github.com/ceylon/ceylon.formatter/ :)
It’s even integrated into the IDE! FormatAction or something, can’t look it up right now sorry

Lucas
--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Rohit Mohan

unread,
Jun 1, 2015, 11:27:29 AM6/1/15
to ceylo...@googlegroups.com

Call me biased, but I suggest using https://github.com/ceylon/ceylon.formatter/ :)
It’s even integrated into the IDE! FormatAction or something, can’t look it up right now sorry

I thought so...But can I use it if I use the converter as a standalone utility and not in the IDE? 

Lucas Werkmeister

unread,
Jun 1, 2015, 11:48:32 AM6/1/15
to ceylo...@googlegroups.com
There is a format function, but it takes a Node, not a String, since the formatter doesn’t include a parser. You can use the compiler’s parser though; something like this should work:

import org.antlr.runtime {
    ANTLRStringStream,
    CommonTokenStream
}
import com.redhat.ceylon.compiler.typechecker.parser {
    CeylonLexer,
    CeylonParser
}
import ceylon.formatter {
    format
}

value tokens
= CommonTokenStream(CeylonLexer(ANTLRStringStream(code + " ")));
format
{
    node
= CeylonParser(tokens); // the space seems to be required sometimes
    writer
= someWriter; // defaults to stdout
    tokens = tokens; // in case you want to keep comments; however, this also means existing line breaks in your code will mostly be kept, which may or may not be the best thing
};

Stephane Epardaud

unread,
Jun 1, 2015, 11:53:08 AM6/1/15
to ceylon-dev
I think his code is written in Java for now. Perhaps now would be a good time to convert it to Ceylon?

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Julien Viet

unread,
Jun 1, 2015, 12:02:43 PM6/1/15
to Stephane Epardaud, ceylo...@googlegroups.com
or maybe he can keep it in Java and convert it with his own converter at some point.

-- 
Julien Viet
www.julienviet.com

Rohit Mohan

unread,
Jun 1, 2015, 11:19:10 PM6/1/15
to ceylo...@googlegroups.com

I think his code is written in Java for now. Perhaps now would be a good time to convert it to Ceylon?

If I write it in Ceylon, will I be able to implement it in the Ceylon IDE? 

Rohit Mohan

unread,
Jun 11, 2015, 2:09:59 PM6/11/15
to ceylo...@googlegroups.com
So how should I get on with implementing the converter in the Ceylon IDE? 

And how do I know if the pasted code is java itself?

Gavin King

unread,
Jun 11, 2015, 3:11:44 PM6/11/15
to ceylo...@googlegroups.com
I think it would be better to get it working with just some automated
tests first. Then, after you have something that works, I can help you
with integrating it into the IDE.

On Thu, Jun 11, 2015 at 8:09 PM, Rohit Mohan <rohitm...@gmail.com> wrote:
> So how should I get on with implementing the converter in the Ceylon IDE?
>
> And how do I know if the pasted code is java itself?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-dev/26bba335-48ef-4326-b812-d714399e9029%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Rohit Mohan

unread,
Jun 17, 2015, 2:37:09 PM6/17/15
to ceylo...@googlegroups.com
So what would be the alternative to arrays in Ceylon? 

Tom Bentley

unread,
Jun 17, 2015, 3:03:51 PM6/17/15
to ceylon-dev
It all depends what you're doing.

* If you need something mutable then you need Array.
* If you need to interoperate with Java arrays or there's magic ObjectArray, LongArray classes which you can import from java.lang
* If you don't need something mutable then you want a Sequence, or more specifically a Tuple.
* Unless you want a List or an Iterable.


On 17 June 2015 at 19:37, Rohit Mohan <rohitm...@gmail.com> wrote:
So what would be the alternative to arrays in Ceylon? 

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Rohit Mohan

unread,
Jun 17, 2015, 3:10:03 PM6/17/15
to ceylo...@googlegroups.com
Well, I had figured that out. But for the converter, if I just have a normal java array then what should I do?

Tom Bentley

unread,
Jun 17, 2015, 3:24:02 PM6/17/15
to ceylon-dev
Personally I would prefer it to use Array, because that's going to make for more idiomatic Ceylon. But there are plenty of cases where that won't work, because you're passing a Java array through an API (e.g. you're implementing a Java interface which consumes or produces Java arrays), so it's probably simplest to use the ObjectArray, IntArray etc.

If you knew the array was internal to a class you could switch to using Array, of course, but IIRC you've not got a type-checked Java AST, so that's probably not feasible.

On 17 June 2015 at 20:10, Rohit Mohan <rohitm...@gmail.com> wrote:
Well, I had figured that out. But for the converter, if I just have a normal java array then what should I do?

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Rohit Mohan

unread,
Jun 17, 2015, 3:54:10 PM6/17/15
to ceylo...@googlegroups.com
Ok so if I want to convert something like 

int[] a ={3, 1, 2};

Tom Bentley

unread,
Jun 17, 2015, 4:17:55 PM6/17/15
to ceylon-dev
Well IntArray and friends support initializing their elements during allocation, so this I guess:

import java.lang {
    IntArray
}
void m() {
    value a = IntArray(3);
    a.set(0, 3);
    a.set(1, 2);
    a.set(2, 2);
}

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Rohit Mohan

unread,
Jun 17, 2015, 4:25:22 PM6/17/15
to ceylo...@googlegroups.com
Oh ok.. I thought there would be a shorter way to do it.

Tom Bentley

unread,
Jun 17, 2015, 4:33:44 PM6/17/15
to ceylon-dev
Well I don't see why we couldn't now give those array classes a constructor which took a sequenced argument, so you could write

    IntArray.fromElements(3,1,2);

Except that you couldn't spread an iterable into it: It would just support listed arguments.


Rohit Mohan

unread,
Jun 17, 2015, 5:27:30 PM6/17/15
to ceylo...@googlegroups.com
And what about multi dimensional arrays?

Gavin King

unread,
Jun 17, 2015, 6:38:10 PM6/17/15
to ceylo...@googlegroups.com
Use ObjectArray, IntArray, LongArray, etc.

On Wed, Jun 17, 2015 at 9:10 PM, Rohit Mohan <rohitm...@gmail.com> wrote:
> Well, I had figured that out. But for the converter, if I just have a normal
> java array then what should I do?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-dev/3635439b-b654-4427-a37d-8be198a92d4b%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



Gavin King

unread,
Jun 17, 2015, 6:39:19 PM6/17/15
to ceylo...@googlegroups.com

Gavin King

unread,
Jun 17, 2015, 6:40:13 PM6/17/15
to ceylo...@googlegroups.com
I don't think multidimensional arrays are at all common in typical
Java code. In my 10+ years coding Java, I don't think I've ever
actually seen one in real code.

So I wouldn't worry about them

On Wed, Jun 17, 2015 at 11:27 PM, Rohit Mohan <rohitm...@gmail.com> wrote:
> And what about multi dimensional arrays?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-dev/4d796836-3b12-4cbd-b07e-5f2ab8a02dad%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



Rohit Mohan

unread,
Jun 25, 2015, 12:19:24 PM6/25/15
to ceylo...@googlegroups.com
As the GSoC mid term evaluations are approaching, I would like to know about the progress of the project and also how I should go about it from here.

Also, the converter right now handles only full programs and not expressions. So I would like to know how to go about this.

Rohit Mohan

unread,
Jun 27, 2015, 5:17:49 PM6/27/15
to ceylo...@googlegroups.com

So how should I handle expressions and code snippets instead of full programs? That doesn't work right now.


On Thu, Jun 25, 2015, 9:49 PM Rohit Mohan <rohitm...@gmail.com> wrote:
As the GSoC mid term evaluations are approaching, I would like to know about the progress of the project and also how I should go about it from here.

Also, the converter right now handles only full programs and not expressions. So I would like to know how to go about this.

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Gavin King

unread,
Jun 27, 2015, 6:32:04 PM6/27/15
to ceylo...@googlegroups.com
Well is that a critical priority yet?

Wouldn't it be better to concentrate on improving the Java->Ceylon
transformation for whole files first, and then we can worry about
snippets, which are generally a bit of a harder problem.
> https://groups.google.com/d/msgid/ceylon-dev/CAF7ZTx%2BRqNZZ3zGEE9UqazqDjTOy%2BUqsb3dFUH%2BQAWS9QkmTEw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



Rohit Mohan

unread,
Jun 28, 2015, 1:30:58 PM6/28/15
to ceylo...@googlegroups.com
Well, it's not critical but I feel the converter pretty much works now. It's not perfect by any means but I felt I should get the other stuff working. 
This is also because this is my GSoC project and there are time constraints.

Gavin King

unread,
Jun 28, 2015, 6:09:39 PM6/28/15
to ceylo...@googlegroups.com
OK, so would you be able to give us a run-down of the kinds of things
it can handle, and what are the known limitations (things it can't
handle).
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-dev/CAF7ZTxK0_%2B9C838PVwoKJeAnVWbp5CxrbJ7P4sv-xM4NtX%2B9zA%40mail.gmail.com.

Rohit Mohan

unread,
Jun 29, 2015, 2:44:02 AM6/29/15
to ceylo...@googlegroups.com

Things that don't work right now/limitations are:

  • arrays declarations that are like {1, 2, 3} etc.

  • constructors

  • type casting

  • generic methods

  • bounded type parameters

  • overloading

  • do while

  • Anonymous classes

  • Annotations (not sure what to do with them)

Gavin King

unread,
Jun 29, 2015, 11:07:54 AM6/29/15
to ceylo...@googlegroups.com
Rohit, it would be nice if you could pop up on the Gitter channel one day ... ?
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-dev/eefaf3aa-d843-4ac5-a844-5230f4a53c1a%40googlegroups.com.

Rohit Mohan

unread,
Jul 25, 2015, 4:44:14 PM7/25/15
to ceylon-dev, gavin...@gmail.com
So, now I have conversion in the IDE working and I have been working on fixing bugs in the converter itself. So is there any other functionality to be added in the IDE related to the converter?

Oh, and can I use the converter as a Ceylon plugin? I am assuming I cannot because its in java right now...

Tako Schotanus

unread,
Jul 25, 2015, 9:06:20 PM7/25/15
to ceylon-dev
Rohit,

are you talking about a plugin for the "ceylon" command on the CLI?

If so you could take a look at the "plugin" sample I just added to the `ceylon-dist` project.
It's a very simple example of how to create a "ceylon" plugin written in Ceylon.
But seeing as it's very easy to call Java code from Ceylon it should be no problem to use your Java code.

HTH


-Tako

On Sat, Jul 25, 2015 at 10:44 PM, Rohit Mohan <rohitm...@gmail.com> wrote:
So, now I have conversion in the IDE working and I have been working on fixing bugs in the converter itself. So is there any other functionality to be added in the IDE related to the converter?

Oh, and can I use the converter as a Ceylon plugin? I am assuming I cannot because its in java right now...

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

Rohit Mohan

unread,
Jul 26, 2015, 3:18:52 AM7/26/15
to ceylon-dev, ta...@codejive.org
Thanks! So does that mean I have to make it a Ceylon project that calls the java code? 

Tako Schotanus

unread,
Jul 26, 2015, 6:15:16 AM7/26/15
to ceylon-dev
Well it's necessary to make it a Ceylon project but I do think it's the easiest way, you'll have access to al the necessary tools for making, packaging and installing plugins.

You could also make a Ceylon module written with 100% Java but that's just making life more difficult I think, that's why I suggested a Ceylon module with an entry point written in Ceylon which then call your Java code from that.


-Tako

Rohit Mohan

unread,
Jul 26, 2015, 8:50:01 AM7/26/15
to ceylon-dev, ta...@codejive.org

Ok thanks. So now I have done something similar to the sample plugin in ceylon-dist. So how do I take arguments while using it as a plugin?

Rohit Mohan

unread,
Jul 26, 2015, 10:23:04 AM7/26/15
to ceylon-dev, ta...@codejive.org, rohitm...@gmail.com
ok okokokokOookokokoOK I have got arguments working now. Can I still use maven to build the project now that it is a ceylon project?

Tako Schotanus

unread,
Jul 26, 2015, 10:44:46 AM7/26/15
to ceylon-dev
There was Maven support at some time, but to be honest I have no idea if it still works or how it would work, it's a very long time since I looked at any of that.
Maybe someone else can answer that question for you.

Doesn't the Eclipse IDE plugin use Maven to build some Ceylon projects? You might take a look at that (in the `ceylon-ide-eclipse` project, or perhaps `ceylon-ide-common`)

Btw, you already found out how but I extended the plugin sample with some examples of options, flags and arguments to get people started.

-Tako

Rohit Mohan

unread,
Jul 27, 2015, 11:27:34 AM7/27/15
to ceylon-dev, ta...@codejive.org
I just used ant. So right now I have a Ceylon project that just calls my java code. So I think with this I might be able to get formatting working (not in eclipse). I was also wondering how I should use this version in the eclipse IDE (Because I had used a jar previously).

Tako Schotanus

unread,
Jul 27, 2015, 11:31:07 AM7/27/15
to ceylon-dev
Well, it's a ".car" now instead of a ".jar" which means it has OSGi information which Eclipse can use, so theoretically it should be just as easy or even easier to use in Eclipse, but I'm not the expert on that, David should be able to tell you more.


-Tako

On Mon, Jul 27, 2015 at 5:27 PM, Rohit Mohan <rohitm...@gmail.com> wrote:
I just used ant. So right now I have a Ceylon project that just calls my java code. So I think with this I might be able to get formatting working (not in eclipse). I was also wondering how I should use this version in the eclipse IDE (Because I had used a jar previously).

--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.

David Festal

unread,
Jul 27, 2015, 2:47:53 PM7/27/15
to ceylo...@googlegroups.com
Hi !

In order to use it inside Eclipse, you should create the p2 repository
containing your module, and then reference the OSGI bundle contained in
this p2 repo from the IDE build.

For the generation of the p2 repository, I suggest you look into how it
done for the `ceylon-ide-common` project (in the build.xml, it's the
ide-quick task).

For this and for adding it inside the Eclipse IDE project, I can help.
Just contact me on Gitter or GTalk.

David.
Reply all
Reply to author
Forward
0 new messages