Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23] JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview) #2474

Closed
Tracked by #2212
mpalat opened this issue May 22, 2024 · 2 comments
Closed
Tracked by #2212
Assignees
Milestone

Comments

@mpalat
Copy link
Contributor

mpalat commented May 22, 2024

ref: https://openjdk.org/jeps/477

Summary
Evolve the Java programming language so that beginners can write their first programs without needing to understand language features designed for large programs. Far from using a separate dialect of the language, beginners can write streamlined declarations for single-class programs and then seamlessly expand their programs to use more advanced features as their skills grow. Experienced developers can likewise enjoy writing small programs succinctly, without the need for constructs intended for programming in the large. This is a preview language feature.

Latest Spec Changes : https://cr.openjdk.org/~gbierman/jep477/latest/

Predecessor: #1640

@jarthana
Copy link
Member

I see two major changes since the last iteration:
Every simple compilation unit implicitly imports on demand every public class or interface declared in all the packages exported by the predefined module java.base, as if the declaration import module java.base; appeared at the beginning of each simple compilation unit ([7.5.5](https://cr.openjdk.org/~gbierman/jep477/jep477-20240507/specs/import-module-declarations-jls.html#jls-7.5.5)). As a result, the names of all those classes and interfaces are available as simple names in every simple compilation unit.
and
Every simple compilation unit implicitly imports all the static members from the class java.io.IO, as if the declaration import static java.io.IO.*; appeared at the beginning of the simple compilation unit immediately after the declaration that imports module java.base;. As a result, the names of all those static members are available as simple names in every simple compilation unit.

Probably in a first, there is a dependency between preview features. This one depends on #2383

@jarthana
Copy link
Member

jarthana commented Jul 9, 2024

This can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants