Error in interoperation with Java

41 views
Skip to first unread message

Evgeniy Martin

unread,
Aug 29, 2016, 9:42:26 AM8/29/16
to ceylon-users
Hi,

For example, I create ceylon project "testCeylon" and 1 module "testJava" which contains 2 java class:

package testJava;

public class B {

}

package testJava;


public class TestClass {
   
   
public TestClass(){
       
   
}
   
   
public void doTest(B[] a){
       
   
}
   
   
public  void doTest(B[][] a){
       
   
}
   
}


In source file "run.ceylon":

import java.lang {
   
ObjectArray
}

"Run the module `testJava`."
shared
void run() {
    value b
= ObjectArray<B>(1,B());
   
   
TestClass testClass = TestClass();
    testClass
.doTest(b);
}


and I get an error:

Argument must be assignable to parameter bArray of doTest in TestClass: ObjectArray<B> is not assignable to ObjectArray<ObjectArray<B>>?

In my real app I use
GRBCallback.getSolution()

http://www.gurobi.com/documentation/6.5/refman/java_grbcallback_getsoluti.html




How I can call "public void doTest(B[] a)" ?

Gavin King

unread,
Aug 29, 2016, 9:46:45 AM8/29/16
to ceylon...@googlegroups.com
Interesting. What's going on here is that as far as the Ceylon typechecker is concerned, ObjectArray is just a regular generic type, and type arguments of generic types can't be used to resolve overloaded methods.

However, as far as *Java* is concerned, arrays are "special", and methods *can* be overloaded by an array element type.

If you open an issue, I can fix this by making the Ceylon typechecker handle java.lang.ObjectArray as a special case.


--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/1b1f96de-4c99-4409-ba57-554bfe3addb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Stephane Epardaud

unread,
Aug 29, 2016, 9:54:27 AM8/29/16
to ceylon...@googlegroups.com
Is this with 1.2.2 or the latest master?

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/1b1f96de-4c99-4409-ba57-554bfe3addb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Evgeniy Martin

unread,
Aug 30, 2016, 3:28:38 AM8/30/16
to ceylon-users

Gavin King

unread,
Aug 30, 2016, 1:12:39 PM8/30/16
to ceylon...@googlegroups.com
It's fixed now, I believe:


On Mon, Aug 29, 2016 at 3:42 PM, Evgeniy Martin <mart...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/1b1f96de-4c99-4409-ba57-554bfe3addb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Evgeniy Martin

unread,
Aug 31, 2016, 4:23:46 AM8/31/16
to ceylon-users
Awsome! Thanks.

Reply all
Reply to author
Forward
0 new messages