From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [IPv6:2a0c:5a00:149::25]) by sourceware.org (Postfix) with ESMTPS id B3B813850841 for ; Fri, 24 Feb 2023 15:18:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B3B813850841 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bothner.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bothner.com Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1pVZqE-004N21-LU; Fri, 24 Feb 2023 16:18:34 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bothner.com ; s=selector1; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:Cc:From: References:To:Subject:MIME-Version:Date:Message-ID; bh=VHsWeo+zJam64nitxqv+XR4y+tuy75Q0BY1sB9C3Cbg=; b=vayNRcXgM7I4q0l3BTD4ufeOKn DsJ9v9HYlA/8OglLvr4PiBTcggMoY1I0mLIMMaNQHirRKZ6R7QDY68MKhkH/54PWcqH0+M5086T00 RN71K2Wpew35SYAn95pZuvQ3+DSoHFeuAF+jfLEq+0JLNmp4piSE0lQto3G1hChC1qjmH9x155TGm IcDhxPffpaD4FhMB5/NE0dFPBXhfpuwne0qTuvs3S6w/ZTYKf7pS/kMPfE24VXFofTF0PL0/3bmc4 RiBmnr/3L7JSo9xDZ3SvwnRPS1mS6g1aAewCQcsDdlO+0h1APngbgPeHQ/LfRI0AI25ebPwWtQpSD PBzoVgrg==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1pVZqE-0004mX-08; Fri, 24 Feb 2023 16:18:34 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (524175)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1pVZpt-00018x-Eu; Fri, 24 Feb 2023 16:18:13 +0100 Message-ID: <678da991-45f5-ed45-baff-456b27f10115@bothner.com> Date: Fri, 24 Feb 2023 07:18:09 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: ClassCastException (class java.lang.Integer cannot be cast to class gnu.math.IntNum) Content-Language: en-US To: Zachary Kurmas , Andy Keep via Kawa References: <550c8c8b-d654-43cc-be7b-4e34d7606dac@Spark> From: Per Bothner Cc: Kawa Community In-Reply-To: <550c8c8b-d654-43cc-be7b-4e34d7606dac@Spark> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: (Please don't use Reply-to without the list. If you post a question to the list, the answer should also go to the list, with few exceptions. One reason is to avoid wasting people's time if multiple people answer.) On 2/24/23 06:26, Zachary Kurmas via Kawa wrote: > Does anybody recognize this exception: > > java.lang.ClassCastException: class java.lang.Integer cannot be cast to class gnu.math.IntNum (java.lang.Integer is in module java.base of loader 'bootstrap'; gnu.math.IntNum is in unnamed module of loader 'app') If it helps: java.lang.Integer is the standard "boxing" (i.e. conversion to Object) of 32-bit int values. gnu.math.IntNum handles "infinite-precision" integers. It is like (but predates) java.math.BigInteger, but with some optmizations and it is part of the gnu.math.Numeric hierarchy, which is used to implement the Scheme "number tower". Kawa can certainly convert java.lang.Integer to gnu.math.IntNum but it needs to actually generate some code to do so - it can't just use a primitive cast. if you have Java code that calls a Kawa method that expects a gnu.math.IntNum you may have to do the conversion yourself. (If you call the method indirectly as a Kawa Procedure object, using one of the 'apply' method, I believe the 'apply' glue should be able to take care of the conversion - but I'm not 100% sure.) > So, trying to isolate the bug makes it go away. Also, when connect4.scm calls connet4_engine.scm the stack trace does not contain line numbers of connect4_engine, so I don’t have a good sense of where the bug is popping up. Are you getting a stack trace? If not, that might be helpful. -- --Per Bothner per@bothner.com http://per.bothner.com/