Bug 381538 - New and Noteworthy for 'Incomplete switch over enum' contains wrong information
Summary: New and Noteworthy for 'Incomplete switch over enum' contains wrong information
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Doc (show other bugs)
Version: 3.8   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.8 RC4   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2012-06-04 05:34 EDT by Jay Arthanareeswaran CLA
Modified: 2012-06-07 10:52 EDT (History)
5 users (show)

See Also:


Attachments
Screenshot (32.67 KB, image/png)
2012-06-05 04:19 EDT, Jay Arthanareeswaran CLA
no flags Details
combined section regarding switch (5.15 KB, patch)
2012-06-05 05:27 EDT, Stephan Herrmann CLA
no flags Details | Diff
Screenshots (42.04 KB, application/octet-stream)
2012-06-05 09:38 EDT, Jay Arthanareeswaran CLA
no flags Details
switch and resource leak sections combined (10.72 KB, patch)
2012-06-05 10:31 EDT, Stephan Herrmann CLA
no flags Details | Diff
combined changes: switch, resource leak, null annotations (15.67 KB, patch)
2012-06-05 11:23 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Arthanareeswaran CLA 2012-06-04 05:34:52 EDT
The instruction given in the section doesn't seem to match the behavior described. 
The error message given should be about the missing corresponding case and not about the default case. Or that's what I see in the IDE when I set the Error/Warnings options as specified.

Also note that both the compiler options and warning messages are incorrect at some places in the N&N doc. To be precise, it's "cases over enum" vs "cases on enum".
Comment 1 Srikanth Sankaran CLA 2012-06-04 07:52:31 EDT
Stephan, please follow up.

Build schedule available here: http://www.eclipse.org/eclipse/platform-releng/buildSchedule.html
Comment 2 Stephan Herrmann CLA 2012-06-04 09:21:56 EDT
Are we talking about this document: http://git.eclipse.org/c/platform/eclipse.platform.common.git/tree/bundles/org.eclipse.jdt.doc.user/whatsNew/jdt_whatsnew.html
?

Please note that if screenshots need updating, I need help from s.o. running on the windows platform that was set as the standard. I can only provide KDE/GTK screenshots :)
Comment 3 Jay Arthanareeswaran CLA 2012-06-04 10:02:05 EDT
(In reply to comment #2)
> Are we talking about this document:
> http://git.eclipse.org/c/platform/eclipse.platform.common.git/tree/bundles/org.eclipse.jdt.doc.user/whatsNew/jdt_whatsnew.html
> ?

Yes.

> Please note that if screenshots need updating, I need help from s.o. running on
> the windows platform that was set as the standard. I can only provide KDE/GTK
> screenshots :)

I can do that. But can you please confirm that the documentation indeed needs correction? The text part of the doc requires a minor change too.
Comment 4 Stephan Herrmann CLA 2012-06-05 04:08:41 EDT
(In reply to comment #3)
> I can do that. But can you please confirm that the documentation indeed needs
> correction? The text part of the doc requires a minor change too.

I think the problem originates from the two-step process of improving these diagnostics. It's probably best to merge the two sections into one.
I'll provide a patch for that.
Comment 5 Deepak Azad CLA 2012-06-05 04:16:01 EDT
(In reply to comment #4)
> It's probably best to merge the two sections into one.
That's true for other items in N&N as well e.g. resource leak. CCing Markus as well, since I think he is/was working on the N&N doc.
Comment 6 Jay Arthanareeswaran CLA 2012-06-05 04:19:49 EDT
Created attachment 216812 [details]
Screenshot

Stephan, can you please check is this screenshot is okay? 

Markus, I tried to follow the Doc Style guide. But used a slightly lower resolution than recommended (1024 x 768), since my machine has a different ration. Please let me know if this okay. When Stephan confirms, this image with another minor text correction should go into the doc. Just FYI.
Comment 7 Jay Arthanareeswaran CLA 2012-06-05 04:23:05 EDT
(In reply to comment #6)
> Created attachment 216812 [details]
> Screenshot

I attached it anyway since I already had it. Stephan, feel free to ignore it if it is not required with the re-arrangement.
Comment 8 Stephan Herrmann CLA 2012-06-05 05:27:18 EDT
Created attachment 216815 [details]
combined section regarding switch

(In reply to comment #4)
> I think the problem originates from the two-step process of improving these
> diagnostics. It's probably best to merge the two sections into one.
> I'll provide a patch for that.

Here's a version that combines the two sections regarding switch statements.

The new switch-case-enum.png actually fits well (provided it's suitable cropped).

I think the last image switch-missing-default.png would drive its point home even better, if it contained cases for all three colors from the previous examples.

Do you still see inconsistencies?

Jay, do you want to commit this after a final touch on the screenshot(s)?
Comment 9 Stephan Herrmann CLA 2012-06-05 05:32:45 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > It's probably best to merge the two sections into one.
> That's true for other items in N&N as well e.g. resource leak. CCing Markus as
> well, since I think he is/was working on the N&N doc.

At a quick glance I didn't see any strict inconsistencies, so the easiest
fix for this might be to just put the paragraphs into order:
- New options to detect resource leaks
- Resource leak detection improved and enabled by default
- Smarter resource leak detection

How about a link to ../tasks/task-avoiding_resource_leaks.htm ?
I already added a similar link to the switch paragraph (patch in comment 8)
Comment 10 Deepak Azad CLA 2012-06-05 06:40:48 EDT
(In reply to comment #9)
> At a quick glance I didn't see any strict inconsistencies, so the easiest
> fix for this might be to just put the paragraphs into order:
> - New options to detect resource leaks
> - Resource leak detection improved and enabled by default
> - Smarter resource leak detection

Inconsistencies is not the only thing. There should really be 1 entry for 1 item i.e. a user does not need to know that we made something 'smarter' after the initial implementation. 
 
> How about a link to ../tasks/task-avoiding_resource_leaks.htm ?
> I already added a similar link to the switch paragraph (patch in comment 8)
Works for me. 

Also I think you can release any changes you have to master. Markus is not working on JDT N&N right now.
Comment 11 Jay Arthanareeswaran CLA 2012-06-05 09:38:04 EDT
Created attachment 216834 [details]
Screenshots

I recreated all three screen-shots of code examples. Can you quickly glance them and see if they are fine? I will release the changes in a bit.
Comment 12 Stephan Herrmann CLA 2012-06-05 09:46:47 EDT
(In reply to comment #11)
> Created attachment 216834 [details]
> Screenshots
> 
> I recreated all three screen-shots of code examples. Can you quickly glance
> them and see if they are fine? I will release the changes in a bit.

Screenshots look good to me, thanks!


(In reply to comment #10)
> Inconsistencies is not the only thing. There should really be 1 entry for 1
> item i.e. a user does not need to know that we made something 'smarter' after
> the initial implementation. 
> ...
> Also I think you can release any changes you have to master. Markus is not
> working on JDT N&N right now.

OK, I'll re-arrange the section on resource leaks now.
Comment 13 Jay Arthanareeswaran CLA 2012-06-05 09:54:20 EDT
(In reply to comment #12)
> OK, I'll re-arrange the section on resource leaks now.

I guess I will wait for you to make those changes as well. Can you combine it with the previous patch if that's not a problem?
Comment 14 Stephan Herrmann CLA 2012-06-05 10:31:33 EDT
Created attachment 216837 [details]
switch and resource leak sections combined

This patch combines the changes for switch and resource leak sections.

I also added a link to background information in the null analysis section, 
but: it seems that part needs some merging too:
I'm planing to combine these paragraphs:
- Annotation-based null analysis
- Improved messages for null analysis problems
Comment 15 Stephan Herrmann CLA 2012-06-05 10:43:25 EDT
The screenshot null-prefs.png needs an update, please.
Comment 16 Stephan Herrmann CLA 2012-06-05 10:58:31 EDT
Also the following screenshots are out-of-date:

- null-annotation-problems1.png
  old error message and also missing: link to quick fix

- null-annotation-problems2.png
  error message is OK, but quick fixes are missing
Comment 17 Stephan Herrmann CLA 2012-06-05 11:23:46 EDT
Created attachment 216845 [details]
combined changes: switch, resource leak, null annotations

This patch combines all my text changes regarding incomplete switch, resource leaks and null annotations.

Please let me know if you see more work for me.
Comment 18 Deepak Azad CLA 2012-06-05 11:41:45 EDT
(In reply to comment #17)
> Created attachment 216845 [details] [diff]
> combined changes: switch, resource leak, null annotations
> 
> This patch combines all my text changes regarding incomplete switch, resource
> leaks and null annotations.
I took a very quick look and it looks OK to me. Stephan, I think you can release the patch.

Jay, I guess you will take care of the screenshots?
 
> Please let me know if you see more work for me.
I am just wondering if some of the screenshots for resource-leak, null-annotations, enum-switch should also find their way to the 'Improving Java code quality' pages?
Comment 19 Stephan Herrmann CLA 2012-06-05 11:54:48 EDT
(In reply to comment #18)
> (In reply to comment #17)
> > Created attachment 216845 [details] [diff]
> > combined changes: switch, resource leak, null annotations
> > 
> > This patch combines all my text changes regarding incomplete switch, resource
> > leaks and null annotations.
> I took a very quick look and it looks OK to me. Stephan, I think you can
> release the patch.

Released via commit c4ba4dc673da57960b1c70b2c271d964454e6e9e

> I am just wondering if some of the screenshots for resource-leak,
> null-annotations, enum-switch should also find their way to the 'Improving Java
> code quality' pages?

I don't think that many of the exact same screenshots would fit.
We might (some day) think of replacing code listings with new
screenshots, but with the different focus (education about some
backgrounds rather than eye-catching) I don't think screenshots
are essential there.
Actually, I'd probably prefer pretty printed text, because then
users can still copy-n-paste those snippets into an editor ...
Comment 20 Deepak Azad CLA 2012-06-05 13:00:56 EDT
Jay, the screenshots have some issues
- All 3 switch*.png are too wide. The max width needs to be 519, so that a horizontal scroll bar does not appear in a default sized help window
- null-annotation-problems1.png - comment in the second line of bar(..) needs to be 'cannot assign null value'
- null-annotation-problems2.png - there is a typo 'methos'
Comment 21 Deepak Azad CLA 2012-06-05 13:42:04 EDT
(In reply to comment #15)
> The screenshot null-prefs.png needs an update, please.

Jay, this is also remaining.
Comment 22 Jay Arthanareeswaran CLA 2012-06-05 14:38:16 EDT
(In reply to comment #20)
> Jay, the screenshots have some issues

I have adjusted the width so that the scrollbars don't appear. Also fixed the other errors. The screenshots have already been pushed to master and integration.
Comment 23 Stephan Herrmann CLA 2012-06-05 18:15:39 EDT
(In reply to comment #22)
> (In reply to comment #20)
> > Jay, the screenshots have some issues
> 
> I have adjusted the width so that the scrollbars don't appear. Also fixed the
> other errors. The screenshots have already been pushed to master and
> integration.

Thanks, Jay!
Comment 24 Deepak Azad CLA 2012-06-06 01:04:22 EDT
Jay, in general a screenshot should not include the blue line highlight, unless of course you really want to highlight something :-) Though, I think we can let the screenshots be at this point.

I also released a couple of minor edits to 2 screenshots.
Comment 25 Jay Arthanareeswaran CLA 2012-06-06 01:21:37 EDT
(In reply to comment #24)
> Jay, in general a screenshot should not include the blue line highlight, unless
> of course you really want to highlight something :-) Though, I think we can let
> the screenshots be at this point.

Thanks, I will keep that in mind. I noticed immediately after releasing them last night. But then it was very late and I didn't want to go through another iteration. The first batch of screenshots didn't have them, I think :(

Btw, any idea why I am not seeing the changes in I20120605-1900.
Comment 26 Deepak Azad CLA 2012-06-06 01:31:19 EDT
(In reply to comment #25)
> Btw, any idea why I am not seeing the changes in I20120605-1900.
That's the 4.2 build, and as I mentioned yesterday there is a separate branch for that R4_HEAD which is merged with master from time to time. The last merge happened sometime yesterday evening.