Going from Scheme list to Java array
Duncan Mak
duncanmak@gmail.com
Tue Jun 23 00:05:03 GMT 2020
On my box, I'm running on JDK 11 on a Mac when I get the error:
$ java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
On Mon, Jun 22, 2020 at 8:02 PM Per Bothner <per@bothner.com> wrote:
> On 6/22/20 9:26 AM, Duncan Mak via Kawa wrote:
> > (define (into-array l ::java.util.List array-type)
> > (let* ((size (length l))
> > (array ((primitive-array-new array-type) size)))
> > (l:toArray array)))
> >
> > (display (into-array (list 1 2 3) <int>))
> >
> > When I run this in Kawa 3.1.1, this is what I see:
> >
> > foo.scm:4:5: warning - more than one possibly applicable method 'toArray'
> > in java.util.List
> > candidate: Type java.lang.Object[] java.util.List.toArray(ClassType
> > java.util.function.IntFunction<null>)
> > candidate: Type java.lang.Object[]
> > java.util.List.toArray(java.lang.Object[])
>
> Not sure what is going on here. When I use Java 8, there is no problem.
> When I use Java 14, I get the same error. So it seems like something
> got added (after Java got default interface methods). However, I don't see
> it in the documentation here:
>
> https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/List.html
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
>
--
Duncan.
More information about the Kawa
mailing list