From jimdragongod at 126.com Fri Nov 3 07:23:41 2023 From: jimdragongod at 126.com (jim) Date: Fri, 03 Nov 2023 07:23:41 -0000 Subject: Two Uncertain Technical Errors and Omissions of JLS 21 Message-ID: <242b8357.3b67.18b9410c773.Coremail.jimdragongod@126.com> Dear Authors of JLS 21? I've found two uncertain technical errors and omissions of ?The Java? Language Specification Java SE 21 Edition??as follows? ?1?uncertain omission The "Chapter 19. Syntax" says: "This chapter repeats the syntactic grammar given in Chapters 4, 6-10, 14, and 15, as well as key parts of the lexical grammar from Chapter 3, using the notation from ?2.4." I checked over all the repeated productions after Chapter 3, and found that the "Productions from ?14 (Blocks, Statements, and Patterns)" lacked the definition of production "VariableAccess", which is: VariableAccess: ExpressionName FieldAccess I think this may be an omission, because all other productions after Chapter 3 are present. ?2?uncertain error comment Sited from the two possible execution order "Example 17.4.5-1" in Chapter 17: 1: B = 1; 3: A = 2; 2: r2 = A; // sees initial write of 0 4: r1 = B; // sees initial write of 0 and 1: r2 = A; // sees write of A = 2 3: r1 = B; // sees write of B = 1 2: B = 1; 4: A = 2; I think there should be a swap between the above comments?is it right? Yours sincerely, Jim DG?a Chinese Java Programmer since 2008. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pietro.braione at unimib.it Tue Nov 21 21:42:55 2023 From: pietro.braione at unimib.it (Pietro Braione) Date: Tue, 21 Nov 2023 21:42:55 -0000 Subject: JVMS v8: possible ambiguity in definition of invokevirtual lookup Message-ID: <3231C3C1-F670-47D2-8188-9F760A5CDDF5@unimib.it> Hello to everyone. I am reading the JVMS v8 definition of the invokevirtual lookup procedure (section 6.5) in the case the method is not signature polymorphic, and I am somehow confused. The specification reports: "Let C be the class of objectref. The actual method to be invoked is selected by the following lookup procedure: 1. If C contains a declaration for an instance method m that overrides (?5.4.5) the resolved method, then m is the method to be invoked. 2. Otherwise, if C has a superclass, a search for a declaration of an instance method that overrides the resolved method is performed, starting with the direct superclass of C and continuing with the direct superclass of that class, and so forth, until an overriding method is found or no further superclasses exist. If an overriding method is found, it is the method to be invoked. 3. Otherwise, if there is exactly one maximally-specific method (?5.4.3.3) in the superinterfaces of C that matches the resolved method's name and descriptor and is not abstract, then it is the method to be invoked." The fact is, nothing in this specification prohibits C from not being a subclass of the resolved method?s class (say, M). In principle C could even be a superclass of M. In such case, e.g., point 3 would allow a superclass C of M, having one maximally-specific superinterface method that matches, to ?override? the implementation declared in the subclass M, quite an unnatural situation. I think it would be obvious to expect that C must be either a subclass of M or M itself, but I cannot find anything in the specification that enforces this invariant. I had a look at the specifications from versions 11 to 21 but, while different, do not seem to differ under this aspect. Am I misunderstanding something? Best, Pietro Braione University of Milano-Bicocca From pietro.braione at unimib.it Tue Nov 21 23:45:40 2023 From: pietro.braione at unimib.it (Pietro Braione) Date: Tue, 21 Nov 2023 23:45:40 -0000 Subject: Definition of maximally-specific superinterface methods Message-ID: <97A0EA4F-F7CE-43D2-8921-70CB9E9F6A06@unimib.it> Hello to everyone. In the definition of maximally-specific superinterface methods of a class C it is said (section 5.4.3.3) that "The method is declared in a superinterface (direct or indirect) of C?. Does this mean the superinterfaces of the superinterfaces? of the superinterfaces of C, or shall we also include the superinterfaces of the superinterfaces? of the superinterfaces of any superclass of C? Pietro