This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 191365 - No tooltip evaluation in Java editor
Summary: No tooltip evaluation in Java editor
Status: RESOLVED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 6.x
Hardware: Other Linux
: P1 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords: REGRESSION
Depends on: 187208
Blocks:
  Show dependency tree
 
Reported: 2010-10-26 15:04 UTC by Jaroslav Tulach
Modified: 2010-11-03 03:57 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2010-10-26 15:04:48 UTC
Product Version: NetBeans IDE Dev (Build 101025-696dca0c280b)
Java: 1.6.0_20; OpenJDK Client VM 17.0-b16
System: Linux version 2.6.35-22-generic-pae running on i386; UTF-8; en_US (nb)

I don't see tooltips when hovering on variables in editor. I guess that is a regression (I am just not sure if it is regression of Kubuntu 10.10 or NetBeans).
Comment 1 Jaroslav Tulach 2010-10-26 15:15:20 UTC
I have NetBeans on tag "release69_base". I have breakpoint in core.startup ModuleList line 1600. I am attaching to NetBeans IDE started with -Xdebug.... I see no variable values.
Comment 2 Martin Entlicher 2010-10-27 10:42:43 UTC
Reproduced.
getAttachedAnnotatable() returns null, therefore we do not have the appropriate Line.Part. It's not clear where is the problem yet...
Comment 3 Martin Entlicher 2010-10-27 13:21:19 UTC
This is caused by dismiss of the tooltip in parallel with it's setup.

By debugger I've discovered there two threads:
"Folder recognizer"
org.netbeans.modules.editor.NbToolTip$Request.resolveTooltipText(NbToolTip.java:443)
org.netbeans.modules.editor.NbToolTip$Request.run(NbToolTip.java:413)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1426)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1968)

This is going to attach the Line.Part to the annotatable and then asking the annotatable for a short description.

In parallel with this runs:
"AWT-EventQueue-0"
org.openide.text.Annotation.detach(Annotation.java:135)
org.netbeans.modules.editor.NbToolTip$Request.dismiss(NbToolTip.java:530)
org.netbeans.modules.editor.NbToolTip$Request.propertyChange(NbToolTip.java:554)
java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
org.netbeans.editor.ext.ToolTipSupport.firePropertyChange(ToolTipSupport.java:922)
org.netbeans.editor.ext.ToolTipSupport.setStatus(ToolTipSupport.java:592)
org.netbeans.editor.ext.ToolTipSupport.setToolTipVisible(ToolTipSupport.java:562)
org.netbeans.editor.ext.ToolTipSupport$Listener.mouseMoved(ToolTipSupport.java:1103)
java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:330)
java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:329)
java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:329)
java.awt.Component.processMouseMotionEvent(Component.java:6479)
javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3339)
java.awt.Component.processEvent(Component.java:6203)
java.awt.Container.processEvent(Container.java:2203)
java.awt.Component.dispatchEventImpl(Component.java:4790)
java.awt.Container.dispatchEventImpl(Container.java:2261)
java.awt.Component.dispatchEvent(Component.java:4616)
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4803)
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4476)
java.awt.LightweightDispatcher.dispatchEvent(Container.java:4393)
java.awt.Container.dispatchEventImpl(Container.java:2247)
java.awt.Window.dispatchEventImpl(Window.java:2671)
java.awt.Component.dispatchEvent(Component.java:4616)
java.awt.EventQueue.dispatchEvent(EventQueue.java:662)
org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:137)
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:209)
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:118)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

which clears the Line.Part from Annotation. Therefore when getShortDescription() is called, it's null already.
Comment 4 Jan Lahoda 2010-10-27 18:19:22 UTC
I have seen this in cases but unfortunatelly not in simple test cases, so evaluation is likely to take a while. Workaround seems to be to select the variable (or use Watches).
Comment 5 Jan Lahoda 2010-11-01 08:53:17 UTC
Simple reproducible test case:
--------------------------------------
package javaapplication2;

public class JavaApplication2 {
    public static void main(String[] args) {
        new Impl().run();
    }
    private static final class Impl implements Runnable {

        public void run() {
            int i = 5;
            System.err.println(i);//breakpoint here
        }
    }
}
--------------------------------------
place the breakpoint at commented line, debug and try to show value tooltip for "i" - will not work. Cause:
debugger.jpda.projects/src/org/netbeans/modules/debugger/jpda/projects/ToolTipAnnotation.java:474 (isValidTooltipLocation):
if (!superTypeNames.contains(className[0])) return false;
className[0] is a binary name (i.e. with '$' to separate inner classes), but superTypeNames contains class names with '.'. So isValidTooltipLocation returns false.

(I have added log messages to NbToolTip$Request to see the queries&dismisses and the order and timing of these seemed correct. Of couse, as soon as the mouse moves, the request is canceled/dismissed.)
Comment 6 Martin Entlicher 2010-11-02 11:01:57 UTC
Ah, I see. Thanks for the explanation, thus the code is not much debuggable...

I thought that I've fixed already the problem with inner classes in issue #187208. Apparently that was not sufficient... :-( I'll look at it...
It's a regression of NB 6.9.
Comment 7 Martin Entlicher 2010-11-02 14:56:25 UTC
Fixed in changeset:   180994:e4724334ec50
http://hg.netbeans.org/main/rev/e4724334ec50
Comment 8 Jaroslav Tulach 2010-11-02 17:03:27 UTC
Having unit test for this kind of fragile behavior could prevent future regressions.
Comment 9 Quality Engineering 2010-11-03 03:57:27 UTC
Integrated into 'main-golden', will be available in build *201011030000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e4724334ec50
User: mentlicher@netbeans.org
Log: #191365 Compare binary class names.