Bug 38133 - Strange behaviour of task "Nested block depth ...."
Summary: Strange behaviour of task "Nested block depth ...."
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-27 03:07 EDT by Erik Mattsson CLA
Modified: 2003-06-06 13:23 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Mattsson CLA 2003-05-27 03:07:16 EDT
Im not sure this is a bug, but Im getting a strange behaviour of one of the 
task entries. 

I had a nasty method that I got the following message about "Nested Block Depth 
6.0 is not in safe range [0 - 5.0]; use Extract-method to split the method up".
This I did, and it still reports the method of being not in the safe range. 
Code is added to this bugreport below. I can delete the whole method body in 
the offending method and still get the same error, what is wrong?

Ive shutdown eclipse, hoping to refresh the task cache; Ive recompiled the 
whole project hoping this will fix it. but no result, it still says that an 
empty method has a too high "nested block depth". Is this correct? Is there 
anything else in the class that is bad?

Code after doing the "extract method", the method RemoveMessage() was extracted 
to a new method, but it still reports the acknowledgeMessages() method as 
having a large Nested block depth.
============================================================
    /**
     * Finds the message in the Post office library.
     * @param id the messages id. 
     * @return the Message if it was found; null otherwise.
     */
    private Message findMessage( int id )
    {
        Message foundMessage = null;
        Collection messageList = PostOffice.getInstance().getLibrary
().getStoredMessages();
        for ( Iterator messages = messageList.iterator(); messages.hasNext() && 
(foundMessage == null ); )
        {
            Message message = (Message) messages.next();
            if ( message.hashCode() == id )
            {
                foundMessage = message;
            }
        }
        if ( foundMessage != null )
        {
            log.finest("Could not find the message id, " + id );
        }
        return foundMessage;
    }
    
    /**
     * Acknowledge the messages specified in the parameters list.
     * @param parameters all messages that are to be acknowledge (removed).
     */
    private void acknowledgeMessages( Map parameters )
    {
        for ( Iterator parameterKeys = parameters.keySet().iterator(); 
parameterKeys.hasNext(); )
        {
            String key = ((String) parameterKeys.next()).toLowerCase();
            String value = (String) parameters.get( key );
            if (  key.startsWith( FORM_MESSAGE_ID_STR ) && 
                  ( value != null ) && 
                  ( value.equalsIgnoreCase("on") ) )
            {
                removeMessage(key.substring( FORM_MESSAGE_ID_STR.length() ));
            }
        }
    }
Comment 1 Philipe Mulet CLA 2003-05-27 04:52:58 EDT
The offending message isn't generated by the Java compiler, thus recompiling 
have no effect on it.

Which tool did produce this message ? 
Comment 2 Philipe Mulet CLA 2003-05-27 04:55:03 EDT
Dirk - would this message ring a bell to you ? 
Comment 3 Dirk Baeumer CLA 2003-05-27 05:30:53 EDT
JDT/UI doesn't generate this message either.

Erik, do you have some inspection/code metric plug-ins install (like the one 
from instantiations) ? 

Comment 4 Erik Mattsson CLA 2003-05-27 06:17:39 EDT
You are so right, this was a stupid bugreport from my side. This was a bug (or 
feature) in the metrics plugin that ive downloaded. (im pretty sure I disabled 
it through their perference panel).

BTW, it would be nice be able to see which plugin that generated a certain 
task, for these occasions when the user are unsure on who is responsible.

Anyhow, sorry that I posted this invalid bug. 
Comment 5 Philipe Mulet CLA 2003-05-27 07:12:31 EDT
I thought the same about documenting tasks, and entered bug 38136.
Closing as invalid.
Comment 6 Frank Sauer CLA 2003-06-06 13:15:25 EDT
this one is caused by my plugin.
Please enter a bugreport at http://www.sourceforge.net/projects/metrics

Frank