8306854: javac with '-source 7' should honor default methods in implemented Java 8 interfaces
Volker Simonis
volker.simonis at gmail.com
Wed Apr 26 16:49:21 UTC 2023
On Wed, Apr 26, 2023 at 4:50 PM Archie Cobbs <archie.cobbs at gmail.com> wrote:
>
> On Wed, Apr 26, 2023 at 9:41 AM Volker Simonis <volker.simonis at gmail.com> wrote:
>>
>> On Wed, Apr 26, 2023 at 4:14 PM Brian Goetz <brian.goetz at oracle.com> wrote:
>> > It's not OK to consider, use, or interpret a default method in B.class
>> > (version >= Java 8) when compiling C.java with `-source 7`.
>>
>> I could fully accept your answer if 'javac -source 7' would plainly reject to process Java 8 class files.
>
>
> An observation from a neutral observer...
>
> I think there is a basic confusion here about what exactly the "-source" flag is supposed to mean.
>
> A basic question: what, if anything, does "-source" have to do with how CLASS files are interpreted??
>
> Brian seems to be implying that it only affects how SOURCE files are interpreted.
>
> Volker seems to be implying that it should also affect how CLASS files are interpreted.
>
> Maybe clarifying this question would help.
That's exactly the problem, that the semantics of the '-source' flag
aren't specified anywhere else except in the implementation. So the
discussion here is about how to exactly handle class files which are
newer than the version given with '-source' because the fact that they
are already handled in some way is a matter of fact.
I'm not saying that the '-source X' flags is a great idea. I'm happy
to remove it altogether or to restrict it to class files <=X because
otherwise it is probably impossible to get its semantics right. The
current documentation/implementation is just creating the wrong
expectations among developers.
>
> -Archie
>
> --
> Archie L. Cobbs
More information about the compiler-dev
mailing list