Question referring to the Java Language Specification (Java SE 15 and below)
I MA
computaionalmb at gmail.com
Mon Mar 15 21:33:42 UTC 2021
Hello to everyone,
https://docs.oracle.com/javase/specs/jls/se15/html/jls-4.html#jls-4.10.2
states:
Given a non-generic type declaration C, the *direct supertypes* of the type
C are all of the following:
- The direct superclass of C (§8.1.4
<https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.4>
).
- The direct superinterfaces of C (§8.1.5
<https://docs.oracle.com/javase/specs/jls/se15/html/jls-8.html#jls-8.1.5>
).
- *The type Object, if C is an interface type with no direct
superinterfaces* (§9.1.3
<https://docs.oracle.com/javase/specs/jls/se15/html/jls-9.html#jls-9.1.3>
).
https://docs.oracle.com/javase/specs/jls/se15/html/jls-9.html#jls-9.6.4.4
states
(in the second box): For the interface declaration, consider that while *an
interface does not have Object as a supertype*, an interface does have
*public* *abstract* members that correspond to the *public* members of
*Object* (§9.2
<https://docs.oracle.com/javase/specs/jls/se15/html/jls-9.html#jls-9.2>).
This seems contradictory to me so I would like to ask you the following
question:
*Is java.lang.Object considered the (implicit) supertype of an interface
type (that has no direct superinterfaces) or not?*
Thanks in advance
cmb
More information about the java-se-spec-comments
mailing list