This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 428311 - [Viewers] Warnings on ComboViewer - Statement unnecessarily nested on else clause
Summary: [Viewers] Warnings on ComboViewer - Statement unnecessarily nested on else cl...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 4.4 M6   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-17 00:11 EST by Jeanderson Candido CLA
Modified: 2014-03-04 21:01 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeanderson Candido CLA 2014-02-17 00:11:30 EST
Hello,

I'm proposing changes to remove warnings on the ComboViewer.
Eclipse complains about the following structure:

Example:

   @Override
	protected int[] listGetSelectionIndices() {
        if (combo == null) {
            return new int[] { ccombo.getSelectionIndex() };
        } else {
            return new int[] { combo.getSelectionIndex() };
        }
    }

In mentioned code, "the corresponding then clause does not complete normally".
By removing the else clause, the warning disappears:

    @Override
	protected int[] listGetSelectionIndices() {
        if (combo == null) {
            return new int[] { ccombo.getSelectionIndex() };
        }
        return new int[] { combo.getSelectionIndex() };
    }

Thanks in advance
Comment 1 Jeanderson Candido CLA 2014-02-17 00:51:44 EST
I'm trying to push my changes but for some reason my sign-off is not being recognized. When I amend the commit to fix and push it again, it appears without the sign-off.
Comment 2 Wojciech Sudol CLA 2014-02-17 03:38:48 EST
Are you trying to push the change to git or gerrit?
More information: http://wiki.eclipse.org/Platform_UI/How_to_Contribute .
Comment 3 Lars Vogel CLA 2014-02-17 04:48:40 EST
(In reply to Jeanderson Candido from comment #1)
> I'm trying to push my changes but for some reason my sign-off is not being
> recognized. When I amend the commit to fix and push it again, it appears
> without the sign-off.

You can press the "Sign-off" button in EGit to add the statement. See http://www.vogella.com/tutorials/Gerrit/article.html#eclipsegerritcontribution6
Comment 4 Jeanderson Candido CLA 2014-02-17 09:03:38 EST
(In reply to Wojciech Sudol from comment #2)
> Are you trying to push the change to git or gerrit?
> More information: http://wiki.eclipse.org/Platform_UI/How_to_Contribute .

I'm pushing to gerrit.
Comment 5 Jeanderson Candido CLA 2014-02-17 09:07:13 EST
(In reply to Lars Vogel from comment #3)
> (In reply to Jeanderson Candido from comment #1)
> > I'm trying to push my changes but for some reason my sign-off is not being
> > recognized. When I amend the commit to fix and push it again, it appears
> > without the sign-off.
> 
> You can press the "Sign-off" button in EGit to add the statement. See
> http://www.vogella.com/tutorials/Gerrit/article.
> html#eclipsegerritcontribution6

The weird thing is that I'm pressing the button (also Change-Id and making sure that they are in the footer of the commit message). When I use "git log" through the command-line, my rejected commit appears with signed-off-by.
Comment 6 Lars Vogel CLA 2014-02-17 09:10:58 EST
(In reply to Jeanderson Candido from comment #5)
> (In reply to Lars Vogel from comment #3)
> > (In reply to Jeanderson Candido from comment #1)
> > > I'm trying to push my changes but for some reason my sign-off is not being
> > > recognized. When I amend the commit to fix and push it again, it appears
> > > without the sign-off.
> > 
> > You can press the "Sign-off" button in EGit to add the statement. See
> > http://www.vogella.com/tutorials/Gerrit/article.
> > html#eclipsegerritcontribution6
> 
> The weird thing is that I'm pressing the button (also Change-Id and making
> sure that they are in the footer of the commit message). When I use "git
> log" through the command-line, my rejected commit appears with signed-off-by.

Typically this happens if you try to push several commits and one of them is missing the sign-off. Are you sure you have only one commit on top of origin/master? If not reset your master onto origin/master, cherry-pick the new commit and push again. See http://www.vogella.com/tutorials/EclipseGit/article.html#team_movecommit
Comment 7 Jeanderson Candido CLA 2014-02-17 09:14:36 EST
(In reply to Lars Vogel from comment #6)
> (In reply to Jeanderson Candido from comment #5)
> > (In reply to Lars Vogel from comment #3)
> > > (In reply to Jeanderson Candido from comment #1)
> > > > I'm trying to push my changes but for some reason my sign-off is not being
> > > > recognized. When I amend the commit to fix and push it again, it appears
> > > > without the sign-off.
> > > 
> > > You can press the "Sign-off" button in EGit to add the statement. See
> > > http://www.vogella.com/tutorials/Gerrit/article.
> > > html#eclipsegerritcontribution6
> > 
> > The weird thing is that I'm pressing the button (also Change-Id and making
> > sure that they are in the footer of the commit message). When I use "git
> > log" through the command-line, my rejected commit appears with signed-off-by.
> 
> Typically this happens if you try to push several commits and one of them is
> missing the sign-off. Are you sure you have only one commit on top of
> origin/master? If not reset your master onto origin/master, cherry-pick the
> new commit and push again. See
> http://www.vogella.com/tutorials/EclipseGit/article.html#team_movecommit

Interesting. I'm pushing only one commit but the problem might be related to this.

Thanks
Comment 8 Lars Vogel CLA 2014-02-17 09:18:58 EST
(In reply to Jeanderson Candido from comment #7)
> Interesting. I'm pushing only one commit but the problem might be related to
> this.

Git does not allow you to push only one commit. If A is the successor of B and you push A, B is also pushed if not available in the remote.
Comment 9 Jeanderson Candido CLA 2014-02-17 09:25:31 EST
...and here it is: https://git.eclipse.org/r/#/c/22095/

Thank you all.
Comment 10 Lars Vogel CLA 2014-02-17 10:05:19 EST
(In reply to Jeanderson Candido from comment #9)
> ...and here it is: https://git.eclipse.org/r/#/c/22095/
> 
> Thank you all.

Thanks for the patch. Fixed with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=96310df07446b72f9a84aed976ab15295f0cca92
Comment 11 Lars Vogel CLA 2014-03-04 04:22:06 EST
Combo still works in Build id: I20140303-2000 ;-)
Comment 12 Jeanderson Candido CLA 2014-03-04 21:01:09 EST
(In reply to Lars Vogel from comment #11)
> Combo still works in Build id: I20140303-2000 ;-)

I wish I could like your comment haha... thanks :)