Community
Participate
Working Groups
In my training sessions with people new to the Eclipse IDE, I frequently see people typing the .java extension. The error message "Type name must not be qualified" seems not to help them. I suggest to improve this for them via one of the following alternatives: 1.) Allow that .java is specified and at a warning "Specifying the .java file extension is not necessary" 2.) Or change the "Type name must not be qualified" message to "The file extension %1 in the Name field must not be specified" and to repalce %1 with the specified file extension.
In case it ends with ".java" I would issue an info message saying the ".java" should not be specified and will be ignored.
*** Bug 426001 has been marked as a duplicate of this bug. ***
New Gerrit change created: https://git.eclipse.org/r/76459
(In reply to Eclipse Genie from comment #3) > New Gerrit change created: https://git.eclipse.org/r/76459 The fix is not good as: - NewTypeWizardPage.getTypeName() used to return the file name without any extension on Finish. With the patch, it returns the file name with extension. This causes problems at the clients like NewTestCaseWizard which add the extension .java explicitly to the returned file name. - The extension checks should use String#endsWith instead of #contains and #replaceAll. Otherwise invalid extensions like ".java.java123" are also accepted. - The added message should be an info instead of warning. Also note that the fix has to go in NewTypeWizardPage which can be used for any Type that may have some other extension instead of .java. With this fix we will just be handling the .java case and for any other extension, we will still get the "Type name must not be qualified" message. I will provide a patch for this.
Fixed with: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=2ccdc77c86e7bbc9304e84aac053a2dc66d6d3fa
Regarding the new message, I found the "should not be specified" part to be confusing. It begs the question why it shouldn't, why Eclipse allows it, and why it's being ignored. It creates a thinking moment. I recommend cutting out that part of the message.
(In reply to Paul Benedict from comment #6) > Regarding the new message, I found the "should not be specified" part to be > confusing. It begs the question why it shouldn't, why Eclipse allows it, and > why it's being ignored. It creates a thinking moment. I recommend cutting > out that part of the message. Fixed with: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=f653f9a350f14aa731798aeee4bb12a687d0c342
I think a better message would be something simular to: "Specifying .java is not nececcary."
(In reply to Lars Vogel from comment #8) > I think a better message would be something simular to: "Specifying .java is > not nececcary." That doesn't imply that we ignore it.
(In reply to Dani Megert from comment #9) > (In reply to Lars Vogel from comment #8) > > I think a better message would be something simular to: "Specifying .java is > > not nececcary." > > That doesn't imply that we ignore it. I think the message that .java is ignored is misleading for the user. The resulting file has the extension .java. The current message shows implementation details to the user, which IMHO is not the best approach.
Thought Puzzle: If even the shortened message is confusing, then perhaps the fix started on the wrong assumption. My understanding regarding allowing ".java" was because it made it easy for users to paste in qualified names. So why not capture the paste event and automatically trim away the ".java" suffix? It will never be seen. That would be much better than changing the validation of the input box. No one should seriously be typing a file name extension; Eclipse should be helping the poor user (a certain newbie) from making that error. Let's separate out the typing vs. pasting? Restore the input validation error and trim away the suffix on a paste?
(In reply to Paul Benedict from comment #11) > Thought Puzzle: If even the shortened message is confusing, then perhaps the > fix started on the wrong assumption. My understanding regarding allowing > ".java" was because it made it easy for users to paste in qualified names. > So why not capture the paste event and automatically trim away the ".java" > suffix? It will never be seen. That would be much better than changing the > validation of the input box. No one should seriously be typing a file name > extension; Eclipse should be helping the poor user (a certain newbie) from > making that error. Let's separate out the typing vs. pasting? Restore the > input validation error and trim away the suffix on a paste? The original bug was about typing. The paste case would be a new bug report.
(In reply to Lars Vogel from comment #10) > (In reply to Dani Megert from comment #9) > > (In reply to Lars Vogel from comment #8) > > > I think a better message would be something simular to: "Specifying .java is > > > not nececcary." > > > > That doesn't imply that we ignore it. > > I think the message that .java is ignored is misleading for the user. The > resulting file has the extension .java. > > The current message shows implementation details to the user, which IMHO is > not the best approach. It's not an implementation detail when the name is different than what's in the input field. How about this: File extension '.java' will be removed from the name.
(In reply to Dani Megert from comment #13) > How about this: > > File extension '.java' will be removed from the name. -2, this would be very misleading. I would read this as "The .java extension will be removed from the generated file" which is not what is happening.
IMHO the best solution possibilities are: 1.) Do not show a message, if the user types in .java 2.) Tell the user that this extension is not necessary, e.g. by saying: "Specifying the .java file extension is not necessary"
(In reply to Lars Vogel from comment #14) > (In reply to Dani Megert from comment #13) > > How about this: > > > > File extension '.java' will be removed from the name. > > -2, this would be very misleading. I would read this as "The .java extension > will be removed from the generated file" which is not what is happening. But on the other hand, you expect that it will be there in the file name when you don't even type it? That sounds strange. How about The file extension '.java' will not be part of the class name.
(In reply to Dani Megert from comment #16) > The file extension '.java' will not be part of the class name. +1 This is better than the current text. Maybe you can use a shorter form: "The '.java' extension will not be part of the class name."
Updated the message to: The file extension '.java' will not be part of the type name. Replaced "class" with "type" as this message is applicable to all the types. Released with: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=286f3d7ce46ed43436f36af1a2e4e046a18d745c