From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-40137.protonmail.ch (mail-40137.protonmail.ch [185.70.40.137]) by sourceware.org (Postfix) with ESMTPS id 138283939C35 for ; Tue, 23 Jun 2020 11:10:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 138283939C35 Date: Tue, 23 Jun 2020 11:10:52 +0000 To: Per Bothner From: spellcard199 Cc: Duncan Mak , kawa mailing list Reply-To: spellcard199 Subject: Re: Going from Scheme list to Java array Message-ID: In-Reply-To: <60f49197-5651-bf5d-fa25-9c7472874875@bothner.com> References: <60f49197-5651-bf5d-fa25-9c7472874875@bothner.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, FREEMAIL_REPLYTO_END_DIGIT, KAM_ASCII_DIVIDERS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 11:11:01 -0000 Hello. I tried looking it up (just out of curiosity) and it seems that the method... > candidate: Type java.lang.Object[] java.util.List.toArray(ClassType > java.util.function.IntFunction) ... has been added between Java 8 and Java 11: - https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html - https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Co= llection.html How I found it: I used my Java IDE's "jump to definition" from a Java project that has Kawa's Java API as a dependency, with the cursor over ".toArray": gnu.lists.LList l =3D gnu.lists.LList.makeList(new ArrayList()); java.util.function.IntFunction f =3D (int x) -> null; l.toArray(f); =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Tuesday, June 23, 2020 2:02 AM, Per Bothner 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) )) > > 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 'toArra= y' > > in java.util.List > > candidate: Type java.lang.Object[] java.util.List.toArray(ClassType > > java.util.function.IntFunction) > > 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 se= e > it in the documentation here: > https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/Li= st.html > > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------------------------- > > --Per Bothner > > > per@bothner.com http://per.bothner.com/