Bug 80337 - NullPointerException in InternalCompletionProposal - was: Content assist method overriding broken
Summary: NullPointerException in InternalCompletionProposal - was: Content assist met...
Status: VERIFIED DUPLICATE of bug 78801
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 M4   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-07 00:35 EST by Gunnar Wagenknecht CLA
Modified: 2004-12-14 11:19 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2004-12-07 00:35:57 EST
Hi!

In 3.1M3 the overwriting of methods is broken. Example:

return new DragEditPartsTracker(this) {
  perf{cursor}
};

If I hit Ctrl+Space on the cursor position I can select a method of a super
class to overwrite. But if I select a method and hit ENTER, an invalid method
declation will be generated without a method body and without JavaDoc.

return new DragEditPartsTracker(this) {
   protected void performConditionalSelection(){cursor}
};

In 3.0 a complete method including JavaDoc and body which calls the super
implementation was generated. In 3.1M3 this is broken. Nothing is logged and no
exception occurs.
Comment 1 Dani Megert CLA 2004-12-07 11:47:40 EST
Maybe this type comes from a JAR which has no source?

please see also:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-text-home/development/bug-incomplete.htm
Comment 2 Gunnar Wagenknecht CLA 2004-12-08 00:54:55 EST
Well it comes from a jar but it has source attached (it's a plug-in jar added 
to the classpath by the PDE container).

Note that it works in regular types and non complicated typs I only have seen 
this in types with a lot source code and there only in anonymous inner types.

I tried to reproduce it but came across another issue:

Steps to repeat (3.1 M3):

1. Create new pluz-in project ("test")
2. Create new class "TestImpl" which implements "IWorkbenchAdapter" (don't 
overwrite any methods)

public class TestImpl implements IWorkbenchAdapter {

   get[cursor]    
}

3. Invoke content assist to overwrite "getChildren.."
-> works
4. go into get Children:

public Object[] getChildren(Object o) {
        
   Object anon = new Ob[cursor]
   // TODO Auto-generated method stub
   return null;
}

5. Invoke contant assist at cursor position, select "java.lang.Object", 
type "("

public Object[] getChildren(Object o) {
        
   Object anon = new Object([cursor])
   // TODO Auto-generated method stub
   return null;
}

6. Invoke contant assist at cursor position
-> exception:

java.lang.NullPointerException
at java.lang.String.<init>(Unknown Source)
at 
org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findMethodParame
terNames(InternalCompletionProposal.java:185)
at org.eclipse.jdt.core.CompletionProposal.findParameterNames
(CompletionProposal.java:1169)
at org.eclipse.jdt.internal.codeassist.CompletionRequestorWrapper.accept
(CompletionRequestorWrapper.java:223)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.findConstructors
(CompletionEngine.java:1350)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.findAnonymousType
(CompletionEngine.java:1158)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete
(CompletionEngine.java:706)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete
(CompletionEngine.java:1043)
at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:119)
at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete
(CompilationUnit.java:286)
at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete
(CompilationUnit.java:201)
at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete
(CompilationUnit.java:192)
at 
org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.internalComputeCo
mpletionProposals(JavaCompletionProcessor.java:358)
at 
org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.computeCompletion
Proposals(JavaCompletionProcessor.java:332)
at 
org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposal
s(ContentAssistant.java:1472)
at 
org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals
(CompletionProposalPopup.java:251)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$7
(CompletionProposalPopup.java:247)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run
(CompletionProposalPopup.java:206)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals
(CompletionProposalPopup.java:201)
at 
org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions
(ContentAssistant.java:1320)
at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewe
r.doOperation(CompilationUnitEditor.java:182)
at org.eclipse.ui.texteditor.ContentAssistAction$1.run
(ContentAssistAction.java:82)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)


Comment 3 Dani Megert CLA 2004-12-08 10:09:23 EST
What's the compiler compliance setting (1.4 or 5.0)?
If there was an NPE during content assist then the initially described behavior
is expected.

Moving to J Core to investigate the NPE.
Comment 4 Gunnar Wagenknecht CLA 2004-12-08 10:47:57 EST
1.4
Comment 5 David Audel CLA 2004-12-08 12:15:29 EST

*** This bug has been marked as a duplicate of 78801 ***
Comment 6 Frederic Fusier CLA 2004-12-14 11:19:09 EST
Verified for 3.1 M4 using build I200412140800.