You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When following the "Create a Hello World application" interactive tutorial on the welcome screen of a new Eclipse IDE for Java Developers (2024-03) installation and a new workspace, one would create a Java project with a module-info.java and then create a class in the unnamed package in that project.
Since the unnamed package is not allowed in named modules, this results in an error after creating the class.
Steps to reproduce
Download and install Eclipse IDE for Java Developers (2024-03)
Create a new Workspace
From the Welcome screen, select the tutorial Create a Hello World application and follow it
In the step Create a Java project, the option Create module-info.java file is ticked by default in the project creation dialog (since it's a new workspace).
In the next step, it asks the user to create a class. This doesn't mention anything about setting a package which suggests using the default package.
After creating the class, an error occurs in the class file due to a class being created in the unnamed package of a named module.
Suggestions
I suggest to change the to tutorial to mention that users should deselect the option Create module-info.java file when creating the project.
Aside from that, it may be a good idea to prevent creating any classes in the default package as long as the project is modularized in order to prevent confusion about the error happening after that. Instead of a warning saying the use of the default package would be discouraged, I suggest adding an error saying the default package cannot be used in a named module/project with a module-info.java.
The text was updated successfully, but these errors were encountered:
danthe1st
changed the title
Hello World tutorial on fresh Eclipse installation resulting in unnamed package in named module
Bug: Hello World tutorial on fresh Eclipse installation resulting in unnamed package in named module
Apr 3, 2024
danthe1st
changed the title
Bug: Hello World tutorial on fresh Eclipse installation resulting in unnamed package in named module
Hello World tutorial on fresh Eclipse installation resulting in unnamed package in named module
Apr 3, 2024
Thanks @danthe1st for the report. Could you maybe provide a PR for this update? Looks like @jjohnstn plans to look into it, but as you spend so much time to report it, you should also get the fame for fixing it.
Let me know if you want, this fix should be simple: Just fork repo, clone it, search for a text from the tutorial to find the correct place and change the text and provide PR.
Would be great to see you improving the documentation.
I can try writing changing the tutorial. However, I don't want to do it if someone else is already at it and there's still my second suggestion of not allowing to create unnamed classes in named packages altogether (though that might be better as a separate issue?).
I can try writing changing the tutorial. However, I don't want to do it if someone else is already at it and there's still my second suggestion of not allowing to create unnamed classes in named packages altogether (though that might be better as a separate issue?).
When following the "Create a Hello World application" interactive tutorial on the welcome screen of a new Eclipse IDE for Java Developers (2024-03) installation and a new workspace, one would create a Java project with a
module-info.java
and then create a class in the unnamed package in that project.Since the unnamed package is not allowed in named modules, this results in an error after creating the class.
Steps to reproduce
Eclipse IDE for Java Developers
(2024-03)Create a Hello World application
and follow itCreate a Java project
, the optionCreate module-info.java file
is ticked by default in the project creation dialog (since it's a new workspace).Suggestions
I suggest to change the to tutorial to mention that users should deselect the option
Create module-info.java
file when creating the project.Aside from that, it may be a good idea to prevent creating any classes in the default package as long as the project is modularized in order to prevent confusion about the error happening after that. Instead of a warning saying the use of the default package would be discouraged, I suggest adding an error saying the default package cannot be used in a named module/project with a
module-info.java
.I originally mentioned that in the
eclipse-dev
mailing list.The text was updated successfully, but these errors were encountered: