Community
Participate
Working Groups
How to reproduce: Type: List a = new ArrayList(); a.toA and press Ctrl-Space. Proposition window comes up. Press Down Arrow and look up to the error log. The following trace is there: Java Model Exception: Java Model Status [Unknown javadoc format for toArray(T[]) [in List [in List.class [in java.util [in C:\Program Files\Java\jre1.5.0_05\lib\rt.jar [in External Plug-in Libraries]]]]]] at org.eclipse.jdt.internal.core.BinaryMethod.extractJavadoc(BinaryMethod.java:528) at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:469) at org.eclipse.jdt.ui.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:121) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:92) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:70) at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:54) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:438) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getAdditionalProposalInfo(LazyJavaCompletionProposal.java:236) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformation(AdditionalInfoController.java:222) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:821) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation(AbstractInformationControlManager.java:811) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run(AdditionalInfoController.java:174) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3323) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2969) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) I'm using Java 5 in Java 1.4 compatibility mode.
I can reproduce this using Sun 5.0_06 (http://java.sun.com/j2se/1.5.0/docs/api/). It seems that JDT Core cannot retrieve the Javadov for ArrayList.toArray(Object[]) It works for http://java.sun.com/j2se/1.4.2/docs/api/
Philippe, Candidate for RC2? I am investigating it.
Created attachment 39389 [details] Proposed fix The patch is extracting the right information out of the generic signature of the generic method when there is one. With this patch, I can successfully get the javadoc for all methods in java.util.List or java.util.Collections.
+1 for 3.2RC2. Jerome - pls review the patch
Created attachment 39421 [details] Better patch This patch reorganized the previous patch by moving the code into the Util class to build the anchor string.
Created attachment 39464 [details] Last patch This last patch is removing some check and add a try/catch in Util.toAnchor(...). If null is returned, this is logged as an unknown format so we can find out cases that would fail. I can successfully retrieve the javadocs for all methods from java.util.List or java.util.Collections. Merging these new append... methods with the existing one from Util isn't really useful. Actual methods return void and these methods need to return an int. This would not make the code more legible.
Added regression test18 in org.eclipse.jdt.core.tests.model.AttachedJavadocTests. It is disabled for now. Jérôme, please enable it once the patch is released.
I would not catch RuntimeException without logging. Since you're doing all the checks and throwing IllegalArgumentException, I would just catch IllegalArgumentException. Then no logging would be necessary.
I am logging. if (anchor == null) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, this)); This is enough to log that a problem happened opening a specific type, isn't it?
If the RuntimeException is not an IllegalArgumentException, you're losing this information. Why do you need to catch more than IllegalArgumentException ?
Since I removed the checks for the bounds I could also have AIOOBE. I can put the check back and then I don't expect anything else than IllegalArgumentException.
Yes that would be better
Created attachment 39534 [details] Patch with checks Jérôme, This patch has all the checks and catches only IllegalArgumentException. Ok to release?
OK to release
Fixed and released in HEAD. Regression test added in org.eclipse.jdt.core.tests.model.AttachedJavadocTests.test018
Verified with I20060427-1600 for 3.2RC2