Community
Participate
Working Groups
Created attachment 91791 [details] This is the source code file Im working on Build ID: M20071023-1652 Steps To Reproduce: It is not that easy to reproduce it only happens with a source file I'm working on, it fails with the source->override / implement dialog, and also by editing the code manually with the code expansion Ctrl+SPACE I'm pasting the class code bellow, hope it helps: import android.app.ListActivity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.Menu; import android.widget.SimpleCursorAdapter; public class Notepadv1 extends ListActivity { private NotesDbAdapter mDbHelper; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); this.setContentView(R.layout.notepad_list); this.mDbHelper = new NotesDbAdapter(this); this.mDbHelper.open(); this.fillData(); } @Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, 0, R.string.menu_insert, new Runnable() { @Override public void run() { Notepadv1.this.createNote(); } }); menu.add(0, 0, R.string.menu_delete, new Runnable() { @Override public void run() { Notepadv1.this.deleteNote(); } }); return result; } @Override protected void onActivityResult(int requestCode, int resultCode, String data, Bundle extras) { super.onActivityResult(requestCode, resultCode, data, extras); } } , when I try to override the method: @Override protected void onListItemClick(android.widget.ListView l, android.view.View v, int position, long id) { ..... } it fails with the given message in the summary. Thanks. More information: The log message says: !ENTRY org.eclipse.ui 4 0 2008-03-06 17:36:52.300 !MESSAGE 1 !STACK 0 java.lang.ArrayIndexOutOfBoundsException: 1 at org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findMethodParameterNames(InternalCompletionProposal.java:122) at org.eclipse.jdt.core.CompletionProposal.findParameterNames(CompletionProposal.java:1854) at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.appendUnboundedParameterList(CompletionProposalLabelProvider.java:96) at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createMethodProposalLabel(CompletionProposalLabelProvider.java:255) at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createLabel(CompletionProposalLabelProvider.java:512) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.computeDisplayString(LazyJavaCompletionProposal.java:227) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getDisplayString(LazyJavaCompletionProposal.java:217) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.isValidPrefix(AbstractJavaCompletionProposal.java:710) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.isValidPrefix(LazyJavaCompletionProposal.java:340) at org.eclipse.jdt.internal.ui.text.java.JavaMethodCompletionProposal.isValidPrefix(JavaMethodCompletionProposal.java:209) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.validate(AbstractJavaCompletionProposal.java:677) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.apply(AbstractJavaCompletionProposal.java:431) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:806) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$21(CompletionProposalPopup.java:770) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:417) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
Could you please check if this works with 3.3.2 ?
I don't reproduce the problems. The problem is not only in code assist (ctrl+space) because the source->override / implement dialog doesn't call code assist code. The stacktrace given in comment 0 is created when a completion of a method reference and not a completion of a method declaration. The preference 'Java/Editor/Content Assist/Insert single proposals automatically' is probably enabled and the preference 'Java/Editor/Content Assist/Fill argument names on completion' is probably disabled. Could you confirm my supposition ? example 1 - completion of a method reference: class Notepadv1 extends ListActivity { void foo() { onListItemClick| // do ctrl+space at | } } example 2 - completion of a method declaration: class Notepadv1 extends ListActivity { void foo() { } onListItemClick| // do ctrl+space at | } In your project 'ListActivity' is probably inside a classfile. Does this classfile has source attachment ? Does this classfile has javadoc attachment ? The exception could occur if the method 'onListItemClick' has four arguments in the classfile and if this method has less arguments in the source attachment or the javadoc attachment. Is it true in your workspace ?
Sorry Oliver sorry but I don't have eclipse 3.3.2 installed. I think that the issue is something related to what David says. The class file is part of a library provided by a plugin, actually it is provided by the Android SDK. This library doesn't provide source attachment but it provides the Javadoc binding. The method I'm trying to override takes 4 arguments, accessing the Javadoc also fails to show the comments, maybe the method is not present in the Javadoc or it is with a different signature (which makes is a different method). I also tried inspecting the class hierarchy and I can't also find the method there. Anyway I know that the method is there because the decompiler shows it and if I override it manually with the @Override annotation if compiles fine. Thanks. (In reply to comment #2) > I don't reproduce the problems. > > The problem is not only in code assist (ctrl+space) because the > source->override / implement dialog doesn't call code assist code. > > The stacktrace given in comment 0 is created when a completion of a method > reference and not a completion of a method declaration. The preference > 'Java/Editor/Content Assist/Insert single proposals automatically' is probably > enabled and the preference 'Java/Editor/Content Assist/Fill argument names on > completion' is probably disabled. > > Could you confirm my supposition ? > > example 1 - completion of a method reference: > class Notepadv1 extends ListActivity { > void foo() { > onListItemClick| // do ctrl+space at | > } > } > > example 2 - completion of a method declaration: > class Notepadv1 extends ListActivity { > void foo() { > } > onListItemClick| // do ctrl+space at | > } > > > In your project 'ListActivity' is probably inside a classfile. > Does this classfile has source attachment ? > Does this classfile has javadoc attachment ? > > The exception could occur if the method 'onListItemClick' has four arguments in > the classfile and if this method has less arguments in the source attachment or > the javadoc attachment. > > Is it true in your workspace ? >
Pablo - Does the attached javadoc for ListActivity looks like standard javadoc ? If no, does it looks like http://code.google.com/android/reference/android/app/ListActivity.html ?
(In reply to comment #4) David, the attached javadoc is like the link you provided, besides how it looks (I think that it is just a css change) it has some little structural differences with the standard one, some of them are related to how it shows the class summary.
I found the problem. BinaryMethod#extractJavadoc() is unable to extract the javadoc of the method because 'onListItemClick' is the last method in the html file and there is no other <A> tag after that location. When extractJavadoc() fails, BinaryMethod#getParameterNames() returns invalid results and can cause the ArrayIndexOutOfBoundsException. BinaryMethod#extractJavadoc() should be improved to support this case. BinaryMethod#getParameterNames() should return default parameter names when extractJavadoc() fails.
Created attachment 92443 [details] Proposed patch
Created attachment 92552 [details] Proposed patch + regression test
Released for 3.4M6. Test added AttachedJavadocTests#test023()
*** Bug 207496 has been marked as a duplicate of this bug. ***
Verified for 3.4M6 using I20080325-0100