Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354766 - Javadoc content does not appear in content assist info window for non-static inner class constructors
Summary: Javadoc content does not appear in content assist info window for non-static ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7.2   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-15 15:19 EDT by Eddie Galvez CLA
Modified: 2012-01-19 08:24 EST (History)
6 users (show)

See Also:
amj87.iitr: review+
srikanth_sankaran: review+


Attachments
Proposed fix (7.08 KB, patch)
2011-08-18 17:23 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression test (10.48 KB, patch)
2011-08-18 17:53 EDT, Olivier Thomann CLA
no flags Details | Diff
bug354766.jar (2.37 KB, application/octet-stream)
2011-08-18 17:55 EDT, Olivier Thomann CLA
no flags Details
bug354766.jar javadoc (37.69 KB, application/octet-stream)
2011-08-18 17:56 EDT, Olivier Thomann CLA
no flags Details
Proposed fix + regression test (9.92 KB, patch)
2011-08-18 17:58 EDT, Olivier Thomann CLA
no flags Details | Diff
screenshot (15.40 KB, image/jpeg)
2011-08-23 04:21 EDT, Ayushman Jain CLA
no flags Details
patch for MethodProposalInfo (4.83 KB, patch)
2011-08-23 10:44 EDT, Markus Keller CLA
no flags Details | Diff
Complement + regression test. (4.21 KB, patch)
2011-08-23 10:55 EDT, Olivier Thomann CLA
no flags Details | Diff
patch2 for MethodProposalInfo (4.88 KB, patch)
2011-08-23 13:28 EDT, Markus Keller CLA
no flags Details | Diff
test project for verification (89.13 KB, application/octet-stream)
2011-10-28 03:37 EDT, Ayushman Jain CLA
no flags Details
patch for R_3_7_maintenance (6.78 KB, patch)
2011-10-28 05:30 EDT, Ayushman Jain CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eddie Galvez CLA 2011-08-15 15:19:47 EDT
Build Identifier: 20110615-0604

Bug 334652 missed fixing one spot -- the content-assist informational window does not display the javadoc, although the editor will be capable of doing so.

Hopefully this can find its way into 3.7.1 or 3.7.2 as it affects the usability of our commercial product; it makes it tricky for users to understand one of our API points, which method to call.

Reproducible: Always

Steps to Reproduce:

To reproduce, take the attachments from bug 334652 and simply add a new constructor, say:

/**
* javadoc for InnerFinalException(String property, Throwable cause)
* @param property the property argument
* @param cause the chained exception
*/
public InnerFinalException(String property, Throwable cause) {
}


then, you will notice that any call like

InnerFinalException e = new InnerFinalException([invoke-content-assist]

will display both constructors, but fail to display javadoc during the content
assist chooser.
Comment 1 Olivier Thomann CLA 2011-08-18 15:19:19 EDT
This is not limited to constructors. No methods inside a non-static member class gets any javadoc.
Will investigate. Depending on the fix it will target 3.7.1 (getting late for this one) or 3.7.2.
Comment 2 Olivier Thomann CLA 2011-08-18 17:17:10 EDT
Markus, a fix is required from the UI side in order to retrieve the right constructor.
Comment 3 Olivier Thomann CLA 2011-08-18 17:23:35 EDT
Created attachment 201749 [details]
Proposed fix

The change in JDT/Core is required to get the javadoc for methods that are not constructors.
The change in JDT/UI is required to select the right binary methods.

Markus,

There might be another way to fix the UI code. Let me know what you think.
Comment 4 Olivier Thomann CLA 2011-08-18 17:25:40 EDT
My mistake. This is not sufficient for source methods.
Comment 5 Olivier Thomann CLA 2011-08-18 17:53:55 EDT
Created attachment 201750 [details]
Proposed fix + regression test

This works better. The regression test won't run without some binary files that cannot be part of the patch.
Comment 6 Olivier Thomann CLA 2011-08-18 17:55:46 EDT
Created attachment 201751 [details]
bug354766.jar

Should be added to:
/org.eclipse.jdt.core.tests.model/workspace/AttachedJavadocProject
Comment 7 Olivier Thomann CLA 2011-08-18 17:56:58 EDT
Created attachment 201752 [details]
bug354766.jar javadoc

Corresponding javadoc zip to put into the same location.
Comment 8 Olivier Thomann CLA 2011-08-18 17:58:16 EDT
Created attachment 201753 [details]
Proposed fix + regression test

Same as previous patch but with all regression tests in org.eclipse.jdt.core.tests.model.AttachedJavadocTests enabled. The previous patch was enabling only the new test.
Comment 9 Olivier Thomann CLA 2011-08-18 22:59:50 EDT
Released the part of the fix related to JDT/Core.
Will release into 3.7.1 or 3.7.2 after review.

Ayushman, please review.
Comment 10 Olivier Thomann CLA 2011-08-22 14:56:04 EDT
I think we need an API method in the java model to ease the retrieval of IMethod inside an IType. The users should not have to go through the pain of checking the enclosing type (static or not, member type or not), the type of the method (constructor vs non-constructor), where it comes from (binary or source case).
I'll try to see where this method would fit the best.
Comment 11 Ayushman Jain CLA 2011-08-23 04:13:42 EDT
(In reply to comment #9)
> Released the part of the fix related to JDT/Core.
> Will release into 3.7.1 or 3.7.2 after review.
> 
> Ayushman, please review.

I have two comments:
1) I think the line 
anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index);
should be left as it is. This is because for constructors with no arguments, we still need to remove the synthetic argument. So, if I add this constructor to the attachments from bug 334652 

/**
* javadoc for default const. InnerFinalException()
*/
public InnerFinalException() {
}

I still don't see any javadoc for this at the call site.

2) I don't think the variable 'depth' is needed anymore.
Comment 12 Ayushman Jain CLA 2011-08-23 04:21:21 EDT
Created attachment 201974 [details]
screenshot

On a related note, I observed that if I see the outline of a non-static inner class inside a JAR in the package explorer view, I see the constructors with the synthetic argument. While if I just go to the source of that class (assuming source is attached), and check the "outline" view, the constructors do not have the synthetic argument.

Markus, is this intended, or a bug?
Comment 13 Olivier Thomann CLA 2011-08-23 09:29:39 EDT
(In reply to comment #11)
> I have two comments:
> 1) I think the line 
> anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index);
> should be left as it is. This is because for constructors with no arguments, we
> still need to remove the synthetic argument. So, if I add this constructor to
> the attachments from bug 334652 
Thanks. I'll fix this. And add regression test for it.

> 2) I don't think the variable 'depth' is needed anymore.
ok.
A new patch will follow soon.
Comment 14 Markus Keller CLA 2011-08-23 10:44:46 EDT
Created attachment 202006 [details]
patch for MethodProposalInfo

(In reply to comment #12)
> On a related note, I observed that if I see the outline of a non-static inner
> class inside a JAR in the package explorer view, I see the constructors with
> the synthetic argument.

That's a long standing issue, see bug 47354, bug 257508, bug 99137. In general, I think synthetic parameters should not show up in the UI and in the IMethods. Note that IMethodBinding is already correct. However, we already have workarounds for this in place e.g. in the JavaElementLabelComposer, so I guess we shouldn't stir up too much here.

The changes in MethodProposalInfo look reasonable, although we should avoid allocating another array. See my patch for a simpler solution.
Comment 15 Olivier Thomann CLA 2011-08-23 10:52:13 EDT
(In reply to comment #14)
> The changes in MethodProposalInfo look reasonable, although we should avoid
> allocating another array. See my patch for a simpler solution.
Agreed. My patch was not meant to be released as is. It was a proof of concept that something was wrong in the way the argument were checked.
Comment 16 Olivier Thomann CLA 2011-08-23 10:55:21 EDT
Created attachment 202008 [details]
Complement + regression test.

This fixes the issue reported by Ayushman.
Ayushman, please review again.
Thanks.
Comment 17 Olivier Thomann CLA 2011-08-23 11:00:07 EDT
I released in HEAD the new binaries.
Comment 18 Ayushman Jain CLA 2011-08-23 11:34:19 EDT
(In reply to comment #16)
> Created attachment 202008 [details] [diff]
> Complement + regression test.
> 
> This fixes the issue reported by Ayushman.
> Ayushman, please review again.
> Thanks.

Looks good. +1.
Comment 19 Olivier Thomann CLA 2011-08-23 11:44:09 EDT
Daniel, let me know if you want to get this one for 3.7.2. I don't think this ever worked but I can understand that this is annoying for users with no workaround.
Comment 20 Eddie Galvez CLA 2011-08-23 11:52:41 EDT
FWIW, as I(In reply to comment #19)
> Daniel, let me know if you want to get this one for 3.7.2. I don't think this
> ever worked but I can understand that this is annoying for users with no
> workaround.

As the original reporter, please get this into as soon a maintenance release as possible. What you need to remember is the use case of a no-source-provided library, like our product's API library, where w/out the javadoc displaying when they are selecting a method/constructor from auto completion, they end up having a bad experience not knowing which to choose (and sadly, yes, one of the methods that made me discover this bug is one that has two strings, making it really tough for them to know which string takes which argument!)
Comment 21 Markus Keller CLA 2011-08-23 13:28:15 EDT
Created attachment 202020 [details]
patch2 for MethodProposalInfo

Here's a better patch for MethodProposalInfo that also works if the synthetic parameter disappears from IMethod APIs. Released to HEAD.
Comment 22 Dani Megert CLA 2011-08-24 03:55:04 EDT
> Daniel, let me know if you want to get this one for 3.7.2. I don't think this
> ever worked but I can understand that this is annoying for users with no
> workaround.
I don't understand the need for the new local variable 'depth'. Other than that I'm fine to fix it in 3.7.x.

> Here's a better patch for MethodProposalInfo that also works if the synthetic
> parameter disappears from IMethod APIs. Released to HEAD.
Is this needed in case we decide to backport this?(In reply to comment #19)
Comment 23 Olivier Thomann CLA 2011-08-24 10:00:10 EDT
(In reply to comment #22)
> I'm fine to fix it in 3.7.x.
Ok, targetting 3.7.2 as we are already in 3.7.1RC2.

> Is this needed in case we decide to backport this?(In reply to comment #19)
Yes, we need fixes from both JDT/UI and JDT/Core.
Comment 24 Olivier Thomann CLA 2011-08-25 09:19:52 EDT
Srikanth, please review for 3.7.2 inclusion. Thanks.
Comment 25 Olivier Thomann CLA 2011-09-28 10:48:38 EDT
Ayushman, please follow up for 3.7.2.
Comment 26 Srikanth Sankaran CLA 2011-10-28 00:35:53 EDT
(In reply to comment #24)
> Srikanth, please review for 3.7.2 inclusion. Thanks.

+1 for 3.7.2 inclusion, Ayush, please arrange to release in maintenance as
well as master.
Comment 27 Ayushman Jain CLA 2011-10-28 03:13:03 EDT
Released in HEAD for 3.8M4 via commit e8dcde7054627e60ae6e2210fd96dea3c0d1010e
Comment 28 Ayushman Jain CLA 2011-10-28 03:37:12 EDT
Created attachment 206108 [details]
test project for verification

Call InnerFinalException constructor from another project after adding the .jar file contained in above project and providing the javadoc location as the doc zip contained in this project.
Comment 29 Ayushman Jain CLA 2011-10-28 05:30:27 EDT
Created attachment 206119 [details]
patch for R_3_7_maintenance
Comment 30 Ayushman Jain CLA 2011-10-28 05:32:50 EDT
Released in R3_7_maintenance for 3.7.2 via commit d0c82e031dc6efcbc5ff95f96250ec28c20f0922
Comment 31 Ayushman Jain CLA 2011-10-28 05:33:28 EDT
Markus, please backport the jdt/ui part of the patch and then mark this as RESOLVED. Thanks!
Comment 32 Markus Keller CLA 2011-11-09 06:21:43 EST
Released comment 21 to R3_7_maintenance.

commit b9f7b7c3be13a73658d77367f2a5dc0c3782788e
Comment 33 Jay Arthanareeswaran CLA 2011-12-05 01:31:58 EST
Verified for 3.8M4 with build I20111202-0800.
Comment 34 Ayushman Jain CLA 2012-01-19 08:24:59 EST
Verified for 3.7.2RC2 using build 20120118-0800.