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 D52053858C2C for ; Fri, 25 Mar 2022 04:56:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D52053858C2C 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 1nXbzm-00DTYt-Or; Fri, 25 Mar 2022 05:56:18 +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:From: References:To:Subject:MIME-Version:Date:Message-ID; bh=P8mWk0QxHriE9K+fmpX7UDyXOZi9vt6DmfmgQSXAPqk=; b=FOBi/bAkXKOYwsFnNSnk57jWGG cpl9LJkSKhRARdg6lrc3Tc2SBD7JXJyU0dJ991czi8Th6Ywau7xzzTgdzSca62pbaaeoZ2Vpm3U6I 3UHfUnCeM8ZcqsSXhnfwYbvhY1fWV0AEqbSg4lu/HujKfqsMHflLeZra0C4y0ObhlAUnh9/rzd5+T +jLYxjDSymOoGiOVruXORPVZM/C9XaSGCp8bgAG8X9ip9UN1V9QuWdMWN/IsiwNpbnj+fXCZ0J/wV u115Ql1HjScWfDxIp1zedyOlAkQhu7QVHJVkJPD8ytd1RnWAlQ8jOnwg6zmVstOHfXZ6wYqJXOwNo O2aJMMSQ==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1nXbzm-0007a3-BL; Fri, 25 Mar 2022 05:56:18 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (524175)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1nXbzc-0008A8-5P; Fri, 25 Mar 2022 05:56:08 +0100 Message-ID: <31ee8d16-0229-3c1a-a11d-2402f4fdffce@bothner.com> Date: Thu, 24 Mar 2022 21:56:04 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: A protected slot is not accessible in a subclass Content-Language: en-US To: Panicz Maciej Godek , kawa@sourceware.org References: From: Per Bothner In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 25 Mar 2022 04:56:23 -0000 On 3/24/22 15:14, Panicz Maciej Godek via Kawa wrote: > I get the following error: > > slot 'name' in gnu.mapping.Symbol not accessible here > > What are the rules for accessing protected members in Kawa? The rules are supposed to be the same as in Java (because those rules are enforced by the JVM). However, those rules are actually a bit complicated: https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.6.2 In this case there is a bug in Kawa. It treats (set! name ...) as equivalent to: (set! (this):name ...) which is fine. However, there seems to a problem where Kawa thinks (this) has the type Symbol (because that is where name is defined) rather than class S. And this violates the rule: If the access is by (i) a qualified name of the form ExpressionName.Id or TypeName.Id, or (ii) a field access expression of the form Primary.Id, then access to the instance field Id is permitted if and only if the qualifying type is S or a subclass of S. The qualifying type is the type of the ExpressionName or Primary, or the type denoted by TypeName. A work-around is to use the field special procedure: (set! (field (this) 'name) ...) -- --Per Bothner per@bothner.com http://per.bothner.com/