New candidate JEP: 445: Flexible Main Methods and Anonymous Main Classes (Preview)

Remi Forax forax at univ-mlv.fr
Mon Apr 10 22:03:59 UTC 2023


> From: "Tesla Ice Zhang" <ice1000kotlin at foxmail.com>
> To: "Glavo" <zjx001202 at gmail.com>, "amber-dev" <amber-dev at openjdk.org>
> Sent: Monday, April 10, 2023 11:47:23 PM
> Subject: Re:Fwd: New candidate JEP: 445: Flexible Main Methods and Anonymous
> Main Classes (Preview)

>> not to allow instance methods to be main methods, and implicitly treat top-level
>> variable and method declarations as static and public -- just like interfaces
> > do.

> Strongly agree.

> Best regards,
> Tesla

Sadly, it's not how interfaces work. 
Interface does not make method declarations implicitly static, only field declarations are implicitly static. 

Rémi 

> ------------------ Original ------------------
> From: "Glavo" <zjx001202 at gmail.com>;
> Date: Tue, Apr 11, 2023 02:34 AM
> To: "amber-dev"<amber-dev at openjdk.org>;
> Subject: Fwd: New candidate JEP: 445: Flexible Main Methods and Anonymous Main
> Classes (Preview)

> ---------- Forwarded message ---------
> From: Glavo < [ mailto:zjx001202 at gmail.com | zjx001202 at gmail.com ] >
> Date: Tue, Apr 11, 2023 at 2:25 AM
> Subject: Re: New candidate JEP: 445: Flexible Main Methods and Anonymous Main
> Classes (Preview)
> To: [ mailto:amber-dev at openjdk.org | amber-dev at openjdk.org ] < [
> mailto:amber-dev at openjdk.org | amber-dev at openjdk.org ] >
> Cc: Ron Pressler < [ mailto:ron.pressler at oracle.com | ron.pressler at oracle.com ]
> >, [ mailto:amber-dev at openjdk.org | amber-dev at openjdk.org ] < [
> mailto:amber-dev at openjdk.org | amber-dev at openjdk.org ] >, [
> mailto:jdk-dev at openjdk.org | jdk-dev at openjdk.org ] < [
> mailto:jdk-dev at openjdk.org | jdk-dev at openjdk.org ] >

> I like some parts of this proposal, but I disagree with it. I think this
> proposal is too narrow and limits its usefulness.
> Is the implicit public and static modifiers strange? The interface has worked
> this way for many years, why is it not acceptable here?

> Personally, I'd prefer not to allow instance methods to be main methods, and
> implicitly treat top-level variable and method declarations as static and
> public -- just like interfaces do.
> I think this could be a step towards package-level declarations, whereas the
> current proposal limits the direction it can go.

> On Tue, Apr 11, 2023 at 1:37 AM Mark Reinhold < [
> mailto:mark.reinhold at oracle.com | mark.reinhold at oracle.com ] > wrote:

>> [ https://openjdk.org/jeps/445 | https://openjdk.org/jeps/445 ]

>> Summary: Evolve the Java language so that students can write their
>> first programs without needing to understand language features designed
>> for large programs. Far from using a separate dialect of Java, students
>> can write streamlined declarations for single-class programs and then
>> seamlessly expand their programs to use more advanced features as their
>> skills grow. This is a preview language feature.

>> - Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230411/c324e98e/attachment.htm>


More information about the amber-dev mailing list