Changes between Initial Version and Version 4 of Ticket #259


Ignore:
Timestamp:
10/30/12 17:11:58 (9 years ago)
Author:
Mark Evenson
Comment:

Things seem rather complicated with Java the language generics.

A method that takes an Object[] as an argument

   public static void objectArgs(Object[] args)

cannot be invoked on an array of primitive types

   int i[] = {42};
   objectArgs(i); // Doesn't compile

But the signature of the method originally in question declares the type of array to extend java.lang.Object:

   public static <T extends Object> List<T> asList(T[] ts) 

and *can* be invoked on an array of primitive types

   int i[] = {42};
   java.util.Arrays.asList(i);

Need to check exactly what kind of code is generated by javac here, but presumably the compiler somehow transforms the primitive array to wrapped type here?

So, JAVA:JSTATIC cannot make currently make a call that can be made in Java the language. Presumably JAVA:JCALL has the same sort of problem

From experimenting a bit, it would not be enough to fix Java.isApplicableMethod(). We would also at least have to extend Java.javaInstance(Class<?>) to return arrays of primitive types.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #259

    • Property Status changed from new to accepted
    • Property Version changed from to 1.1.0-dev
    • Property Summary changed from jss:jarray-to-list fails to JAVA:JSTATIC cannot always be invoked properly
    • Property Milestone changed from to 1.1.0
  • Ticket #259 – Description

    initial v4  
     1The following doesn't work
     2
     3{{{
     4(jstatic "asList" "java.util.Arrays" (java:jnew-array (jclass "int") 1))
     5}}}
     6
     7The question is: should it?
     8
    19CL-USER> *
    210#<jarray [B@5719d1 {15F987F}>