Bug 15977

Summary: NPE in Code Assist
Product: [Eclipse Project] JDT Reporter: Peter Burka <peter_burka>
Component: CoreAssignee: David Audel <david_audel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: Olivier_Thomann
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Peter Burka CLA 2002-05-14 17:24:00 EDT
Build M5

Everytime I ask for Code Assist for an instance of a particular class, I get 
the attached walkback.

Code Assist for static members of that class works OK.

Note that this is the same class (FlowCommonUtils) that was causing problems 
in Bug 15972.

java.lang.NullPointerException

Stack trace:
   java/lang/Throwable.<init>()V
   java/lang/Throwable.<init>(Ljava/lang/String;)V
   java/lang/NullPointerException.<init>(Ljava/lang/String;)V
   java/lang/StringBuffer.append([C)Ljava/lang/StringBuffer;
   org/eclipse/jdt/internal/ui/text/java/ResultCollector.getParameterSignature
([[C[[C)Ljava/lang/String;
   org/eclipse/jdt/internal/ui/text/java/ResultCollector.createMethodCompletion
([C[C[[C[[C[C[CIII)
Lorg/eclipse/jdt/internal/ui/text/java/JavaCompletionProposal;
   
org/eclipse/jdt/internal/ui/text/java/ResultCollector.createMethodCallCompletio
n([C[C[[C[[C[C[CIII)
Lorg/eclipse/jdt/internal/ui/text/java/JavaCompletionProposal;
   org/eclipse/jdt/internal/ui/text/java/ResultCollector.acceptMethod([C[C[C[[C
[[C[[C[C[C[CIIII)V
   org/eclipse/jdt/internal/core/CompletionRequestorWrapper.acceptMethod([C[C[C
[[C[[C[[C[C[C[CIIII)V
   org/eclipse/jdt/internal/codeassist/CompletionEngine.findLocalMethods([C
[Lorg/eclipse/jdt/internal/compiler/lookup/TypeBinding;
[Lorg/eclipse/jdt/internal/compiler/lookup/MethodBinding;Lorg/eclipse/jdt/inter
nal/compiler/lookup/Scope;Lorg/eclipse/jdt/internal/compiler/util/ObjectVector;
ZZLorg/eclipse/jdt/internal/compiler/lookup/ReferenceBinding;Lorg/eclipse/jdt/i
nternal/compiler/lookup/InvocationSite;Lorg/eclipse/jdt/internal/compiler/looku
p/Scope;Z)V
   org/eclipse/jdt/internal/codeassist/CompletionEngine.findMethods([C
[Lorg/eclipse/jdt/internal/compiler/lookup/TypeBinding;Lorg/eclipse/jdt/interna
l/compiler/lookup/ReferenceBinding;Lorg/eclipse/jdt/internal/compiler/lookup/Sc
ope;Lorg/eclipse/jdt/internal/compiler/util/ObjectVector;ZZZLorg/eclipse/jdt/in
ternal/compiler/lookup/InvocationSite;Lorg/eclipse/jdt/internal/compiler/lookup
/Scope;Z)V
   org/eclipse/jdt/internal/codeassist/CompletionEngine.findFieldsAndMethods
([CLorg/eclipse/jdt/internal/compiler/lookup/TypeBinding;Lorg/eclipse/jdt/inter
nal/compiler/lookup/Scope;Lorg/eclipse/jdt/internal/compiler/lookup/InvocationS
ite;Lorg/eclipse/jdt/internal/compiler/lookup/Scope;Z)V
   org/eclipse/jdt/internal/codeassist/CompletionEngine.complete
(Lorg/eclipse/jdt/internal/compiler/ast/AstNode;Lorg/eclipse/jdt/internal/compi
ler/lookup/Binding;Lorg/eclipse/jdt/internal/compiler/lookup/Scope;)V
   org/eclipse/jdt/internal/codeassist/CompletionEngine.complete
(Lorg/eclipse/jdt/internal/compiler/env/ICompilationUnit;II)V
   org/eclipse/jdt/internal/core/Openable.codeComplete
(Lorg/eclipse/jdt/internal/compiler/env/ICompilationUnit;Lorg/eclipse/jdt/inter
nal/compiler/env/ICompilationUnit;ILorg/eclipse/jdt/core/ICompletionRequestor;)
V
   org/eclipse/jdt/internal/core/CompilationUnit.codeComplete
(ILorg/eclipse/jdt/core/ICompletionRequestor;)V
   
org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.computeCompletion
Proposals(Lorg/eclipse/jface/text/ITextViewer;I)
[Lorg/eclipse/jface/text/contentassist/ICompletionProposal;
   
org/eclipse/jface/text/contentassist/ContentAssistant.computeCompletionProposal
s(Lorg/eclipse/jface/text/ITextViewer;I)
[Lorg/eclipse/jface/text/contentassist/ICompletionProposal;
   
org/eclipse/jface/text/contentassist/CompletionProposalPopup.computeProposals
(I)[Lorg/eclipse/jface/text/contentassist/ICompletionProposal;
   org/eclipse/jface/text/contentassist/CompletionProposalPopup.access$3
(Lorg/eclipse/jface/text/contentassist/CompletionProposalPopup;I)
[Lorg/eclipse/jface/text/contentassist/ICompletionProposal;
   org/eclipse/jface/text/contentassist/CompletionProposalPopup$1.run()V
   org/eclipse/swt/custom/BusyIndicator.showWhile
(Lorg/eclipse/swt/widgets/Display;Ljava/lang/Runnable;)V
   org/eclipse/jface/text/contentassist/CompletionProposalPopup.showProposals
(Z)Ljava/lang/String;
   
org/eclipse/jface/text/contentassist/ContentAssistant.showPossibleCompletions()
Ljava/lang/String;
   
org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor$AdaptedSourceViewe
r.doOperation(I)V
   org/eclipse/ui/texteditor/TextOperationAction.run()V
   org/eclipse/ui/texteditor/RetargetTextEditorAction.run()V
   org/eclipse/jface/action/Action.runWithEvent
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/jface/action/ActionContributionItem.access$0
(Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Even
t;)V
   org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/swt/widgets/EventTable.sendEvent
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/swt/widgets/Widget.notifyListeners
(ILorg/eclipse/swt/widgets/Event;)V
   org/eclipse/swt/widgets/Display.runDeferredEvents()Z
   org/eclipse/swt/widgets/Display.readAndDispatch()Z
   org/eclipse/ui/internal/Workbench.runEventLoop()V
   org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object;
   org/eclipse/core/internal/boot/InternalBootLoader.run
(Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;)
Ljava/lang/Object;
   org/eclipse/core/boot/BootLoader.run
(Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;)
Ljava/lang/Object;
   java/lang/reflect/AccessibleObject.invokeL(Ljava/lang/Object;
[Ljava/lang/Object;)Ljava/lang/Object;
   java/lang/reflect/Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)
Ljava/lang/Object;
   org/eclipse/core/launcher/Main.basicRun([Ljava/lang/String;)
Ljava/lang/Object;
   org/eclipse/core/launcher/Main.run([Ljava/lang/String;)Ljava/lang/Object;
   org/eclipse/core/launcher/UIMain.main([Ljava/lang/String;)V
Comment 1 Erich Gamma CLA 2002-05-16 11:04:35 EDT
looks like parameterTypeNames or parameterNames is null. According the javadoc 
this should not occur. We can make the result collector code robust, but to 
know for how to handle this case we should now when this happens, i.e., should 
such a proposal be ignored, shown without a parameters? If it should be ignored 
can CORE not propose it in the first place.

Moving to JDT CORE
Comment 2 David Audel CLA 2002-05-16 15:00:28 EDT
The problem occur when a parameter type of a binary method is unresolved.

The bugs is in BinaryTypeBinding#availableMethods.
The correct code must be 'return availableMethods;' and not 'return methods;'

Fixed.