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

Hello World tutorial on fresh Eclipse installation resulting in unnamed package in named module #1309

Closed
danthe1st opened this issue Apr 3, 2024 · 3 comments · Fixed by eclipse-jdt/eclipse.jdt#99
Assignees
Labels
bug Something isn't working

Comments

@danthe1st
Copy link

danthe1st commented Apr 3, 2024

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).
    image
  • 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.
    image
  • 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.


I originally mentioned that in the eclipse-dev mailing list.

@danthe1st 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 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
@jjohnstn jjohnstn self-assigned this Apr 4, 2024
@vogella
Copy link
Contributor

vogella commented Apr 5, 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.

@danthe1st
Copy link
Author

danthe1st commented Apr 5, 2024

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?).

Also I didn't find the relevant text anyways.

@jjohnstn
Copy link
Contributor

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?).

Hi @danthe1st I created #1328.

Also I didn't find the relevant text anyways.

They were in eclipse-jdt/eclipse.jdt

Thanks for reporting the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants