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 268069

Summary: [82cat] Auto complete suggestions don't show first time
Product: java Reporter: mclaborn <mclaborn>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: dump file mentioned in the error

Description mclaborn 2016-09-16 17:50:00 UTC
Product Version = NetBeans IDE 8.2 RC (Build 201609140952)
Operating System = Linux version 4.4.0-36-generic running on amd64
Java; VM; Vendor = 1.8.0_102
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.102-b14

Reproducibility: Happens every time

Typing in a Java class, enter a portion of a variable name and press Ctrl + Space. A list of possibilities should display.  The first time I press Ctrl+Space I get "No suggestions". The second time, I get the proper list of suggestions. 

This does not happen in a very simple class, but does happen consistently in the file list below. 

I'm seeing the following error at the time this happens. 

Annotation: An error occurred during parsing of '/home/mclaborn/projects/NetBeans/MMGUI/MiscMaint/src/com/csc/mm/miscmaint/PanelOperatorManager.java'. Please report a bug against java/source and attach dump file '/home/mclaborn/.netbeans/8.2rc/var/log/PanelOperatorManager_18.dump'.
Annotation: An error occurred during parsing of '/home/mclaborn/projects/NetBeans/MMGUI/MiscMaint/src/com/csc/mm/miscmaint/PanelOperatorManager.java'. Please report a bug against java/source and attach dump file '/home/mclaborn/.netbeans/8.2rc/var/log/PanelOperatorManager_18.dump'.
An error occurred during parsing of '/home/mclaborn/projects/NetBeans/MMGUI/MiscMaint/src/com/csc/mm/miscmaint/PanelOperatorManager.java'. Please report a bug against java/source and attach dump file '/home/mclaborn/.netbeans/8.2rc/var/log/PanelOperatorManager_18.dump'.
An error occurred during parsing of '/home/mclaborn/projects/NetBeans/MMGUI/MiscMaint/src/com/csc/mm/miscmaint/PanelOperatorManager.java'. Please report a bug against java/source and attach dump file '/home/mclaborn/.netbeans/8.2rc/var/log/PanelOperatorManager_18.dump'.
Caused: java.lang.AssertionError: isSameType UNKNOWN
	at com.sun.tools.javac.code.Types$SameTypeVisitor.visitType(Types.java:1283)
	at com.sun.tools.javac.code.Types$SameTypeVisitor.visitType(Types.java:1255)
	at com.sun.tools.javac.code.Type.accept(Type.java:214)
	at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4699)
	at com.sun.tools.javac.code.Types$SameTypeVisitor.visitType(Types.java:1262)
	at com.sun.tools.javac.code.Types$SameTypeVisitor.visitType(Types.java:1255)
	at com.sun.tools.javac.code.Type.accept(Type.java:214)
	at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4699)
	at com.sun.tools.javac.code.Types$SameTypeVisitor.visitMethodType(Types.java:1344)
	at com.sun.tools.javac.code.Types$SameTypeVisitor.visitMethodType(Types.java:1255)
	at com.sun.tools.javac.code.Type$MethodType.accept(Type.java:1459)
	at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4699)
	at com.sun.tools.javac.code.Types.isSameType(Types.java:1252)
	at com.sun.tools.javac.code.Types.isSameType(Types.java:1247)
	at org.netbeans.modules.java.source.PostFlowAnalysis.visitMethodDef(PostFlowAnalysis.java:169)
	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:842)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at org.netbeans.modules.java.source.PostFlowAnalysis.scan(PostFlowAnalysis.java:124)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
	at com.sun.tools.javac.tree.TreeScanner.visitClassDef(TreeScanner.java:83)
	at org.netbeans.modules.java.source.PostFlowAnalysis.visitClassDef(PostFlowAnalysis.java:136)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:748)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at org.netbeans.modules.java.source.PostFlowAnalysis.scan(PostFlowAnalysis.java:124)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
	at com.sun.tools.javac.tree.TreeScanner.visitTopLevel(TreeScanner.java:66)
	at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:511)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at org.netbeans.modules.java.source.PostFlowAnalysis.scan(PostFlowAnalysis.java:124)
	at org.netbeans.modules.java.source.PostFlowAnalysis.analyze(PostFlowAnalysis.java:110)
	at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:641)
	at org.netbeans.modules.java.source.parsing.CompilationInfoImpl.toPhase(CompilationInfoImpl.java:382)
	at org.netbeans.api.java.source.CompilationController.toPhase(CompilationController.java:109)
	at org.netbeans.modules.java.completion.JavaCompletionTask.getSmartTypes(JavaCompletionTask.java:4609)
	at org.netbeans.modules.java.completion.JavaCompletionTask.addLocalMembersAndVars(JavaCompletionTask.java:2777)
	at org.netbeans.modules.java.completion.JavaCompletionTask.localResult(JavaCompletionTask.java:2683)
	at org.netbeans.modules.java.completion.JavaCompletionTask.insideBlock(JavaCompletionTask.java:1269)
	at org.netbeans.modules.java.completion.JavaCompletionTask.resolve(JavaCompletionTask.java:326)
	at org.netbeans.modules.java.completion.BaseTask.run(BaseTask.java:93)
	at org.netbeans.modules.java.completion.JavaCompletionTask.run(JavaCompletionTask.java:80)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:609)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:153)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:137)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:204)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:201)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:176)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:360)
	at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:141)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:88)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:201)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:104)
	at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.query(JavaCompletionProvider.java:234)
	at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:223)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Comment 1 Jiri Prox 2016-09-18 16:32:25 UTC
Can you please attach home/mclaborn/.netbeans/8.2rc/var/log/PanelOperatorManager_18.dump?

Thanks
Comment 2 mclaborn 2016-09-18 20:05:35 UTC
Created attachment 162100 [details]
dump file mentioned in the error
Comment 3 Dusan Balek 2016-09-19 13:30:15 UTC
Unfortunately, I cannot reproduce the issue. Is the problem reproducible when starting NB with a fresh userdir?
Comment 4 Dusan Balek 2016-09-19 13:31:40 UTC
An attempt for "blind" fix.

http://hg.netbeans.org/jet-main/rev/47d552b2340f
Comment 5 mclaborn 2016-09-19 14:07:34 UTC
The problem IS reproducible with a fresh user dir. 
I noticed that the problem does not happen everywhere in that particular file, but it does happen consistently in one of the methods.  

Can you let me know when the fix is available in a dev build, and I will download and test.
Comment 6 Dusan Balek 2016-09-19 14:14:26 UTC
Sure, I'll let you know.

Meanwhile, could you please specify the exact place in your source where the issue is reproducible? Thanks.
Comment 7 mclaborn 2016-09-19 14:24:36 UTC
I'm happy to send you the source file and show you where. How can I get it to you privately?
Comment 8 mclaborn 2016-09-19 17:36:26 UTC
Source file sent privately.
Comment 9 Quality Engineering 2016-09-21 01:59:56 UTC
Integrated into 'main-silver', will be available in build *201609210002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/47d552b2340f
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #268069 - Auto complete suggestions don't show first time - attempt to fix.
Comment 10 Dusan Balek 2016-09-21 13:14:37 UTC
Unfortunately, I cannot reproduce the issue even when tested with the privately sent source file. Could you please download the build *201609210002* from http://bits.netbeans.org/dev/nightly/ and test it again?

Thanks.
Comment 11 mclaborn 2016-09-21 15:52:15 UTC
The dev build did not correct the problem, but I was able to narrow it done significantly. 

See the method below. As shown, the test case (typing "lbl" and ctrl + space in the body of the panelShownFirstTime() method) fails.  But if I remove the txtCustomerID.addDocumentListener statement, then it works as it should. 

MyDocumentListener is an abstract inner class. See it's definition below.

I tried making MyDocumentListener not abstract - did not help. 

Moving MyDocumentListener from an inner class to a stand alone class DID make the problem go away. 

I tried a simple test case file based on inner classes but could not reproduce. 




  /**
   * First time in, load the data
   */
  @Override
  protected void panelShownFirstTime() {
    
    
    
    if (getMMFrame() == null) {
      return;
    }
    // load data
    loadEmployees();
    loadOperators(null);
    
    
    txtCustomerID.addDocumentListener(new MyDocumentListener() {
      @Override
      void doit() {
        operator.setAssociatedCustomerid(txtCustomerID.getInteger());
      }
    });

  }




  /**
   * Simple class to use as listener for text field changes.
   * Take action only when there is an operator and the keeper is empty
   */
  private abstract class MyDocumentListener extends MMTextFieldDocumentListener {
    @Override
    public void documentUpdated(DocumentEvent e) {
      if (operator != null && keeperEdit.isEmpty()) {
        doit();
        setComponentStatus();
      }
    }

    /**
     * Take some action.  Current operator is not null and the keeper is empty
     */
    abstract void doit();
  }
Comment 12 Dusan Balek 2017-05-11 12:00:52 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/7723d5ada2ce
Comment 13 Quality Engineering 2017-05-13 02:10:30 UTC
Integrated into 'main-silver', will be available in build *201705130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7723d5ada2ce
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #268069 - [82cat] Auto complete suggestions don't show first time - fixed.