From aaron.fihn at gmail.com Thu Feb 20 14:27:02 2020 From: aaron.fihn at gmail.com (Aaron Fihn) Date: Thu, 20 Feb 2020 14:27:02 -0000 Subject: Grammatical error in JLS Message-ID: Hi, I found a minor grammatical error in section 8.4.2 of the Java Language Specification, SE 13 edition. The word "the" is used twice consecutively. See below: "Two methods or constructors, M and N, have the *same signature* if they have the same name, the same type parameters (if any) (?8.4.4 ), and, after adapting the formal parameter types of N to *the the* type parameters of M, the same formal parameter types." Thanks, Aaron Fihn From Lukas.P at seznam.cz Sat Feb 29 13:15:11 2020 From: Lukas.P at seznam.cz (Lukas.P at seznam.cz) Date: Sat, 29 Feb 2020 13:15:11 -0000 Subject: JLS does not allow method call on Primary of array type Message-ID: <9BV.8sGc.4fffxjLOYc9.1UMcFK@seznam.cz> Dear JLS Team, when reading the JLS of Java 13, I think I found an omission in the section "15.12. Method Invocation Expressions". Because of that omission it is not possible to invoke methods of array type objects. Example code: ?new int[0].clone(); When trying to find out the semantics of such a statement I go to section 15.12, as the clone identifier should identify a method to be called. That section of the specification states that determining the method to be called progresses through several steps. The section 15.12.1 gives the first step. Here, there are six cases considered. For the given example above, I think the following case applies: > If the form is Primary . [TypeArguments] Identifier, then let T be > the type of the Primary expression. The class or interface to search > is T if T is a class or interface type, or the upper bound of T if T > is a type variable. Now, the type of the primary expression is an array type with component type int, T is int[], T is not class or interface type, T is not a type variable. So, this case does not provide us with any class or interface to search, and the compile time determination cannot continue with any further steps. Here, one possibility would be to consider that array type is a class type, but looking at chapter 10, we see at section 10.8: > Although an array type is not a class, the Class object of every > array acts as if ... I assume this means that array types and class types should be regarded as different notions. I think the specification should be augmented to specify where to search for a method when T is an array type. Kind Regards, Lukas