Bug 84750 - [perf] BinaryMethod.getParameterNames does not follow IMethod API contract
Summary: [perf] BinaryMethod.getParameterNames does not follow IMethod API contract
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 98154
  Show dependency tree
 
Reported: 2005-02-08 18:26 EST by Dan Kehn CLA
Modified: 2005-12-12 12:18 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch for parameter names from attached javadoc (3.67 KB, patch)
2005-11-10 10:35 EST, Olivier Thomann CLA
no flags Details | Diff
Proposed patch for parameter names from attached javadoc (3.67 KB, patch)
2005-11-10 13:24 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Kehn CLA 2005-02-08 18:26:00 EST
See bug 84728.

The IMethod.getParameterNames API documentation says, "Returns the names of 
parameters in this method. For binary types, these names are invented 
as 'arg'+i, where i starts at 1 (even if source is associated with the 
binary)."

The last part is not true (see 
org.eclipse.jdt.internal.core.BinaryMethod.getParameterNames). The JVE uses 
this API to retrieve parameter names and the invocations associated with the 
rt.jar reads in 23.6M of data out of src.zip and costs us a considerable 
performance hit. Note that the src.zip file itself is only 11.8M, so 
apparently the JDT is reading it multiple times.
Comment 1 Dan Kehn CLA 2005-02-08 18:27:18 EST
Note: The above data was collected with FileMon, available at 
http://www.sysinternals.com/ntw2k/source/filemon.shtml.  It is a very easy to 
use utility for capturing I/O events.
Comment 2 Jerome Lanneluc CLA 2005-02-23 11:43:37 EST
I see 2 ways to solve this problem:
- Fix the spec to say that the attached source is used, and provide another
method (e.g. getRawParameterNames()) that return the invented named for binary
methods
- Fix the implementation, and provide another method (e.g.
getSourceParameterNames()) that return the names from the attached source
Comment 3 Gili Mendel CLA 2005-02-24 10:44:25 EST
Given the APIs docs., we will vote for the first option, as to not break those
that are relying on the current implementation.
Comment 4 Gili Mendel CLA 2005-02-24 10:46:16 EST
We now calling this in a lazy manner, for which time we will always want the
src. name.
Comment 5 Olivier Thomann CLA 2005-11-10 10:29:19 EST
Jérôme,
Now that bug 110173 is fixed, it would be possible to get the parameter names
from the attached javadoc.
I will attach a patch for this.
Comment 6 Olivier Thomann CLA 2005-11-10 10:35:09 EST
Created attachment 29699 [details]
Proposed patch for parameter names from attached javadoc

Now we simply need to add the getRawParameterNames() throws JavaModelException
method and this PR can be closed.
Comment 7 Olivier Thomann CLA 2005-11-10 10:35:55 EST
Once this is done, let me know. I have some regression tests that could be
enabled in the AttachedJavadocTests suite.
Comment 8 Olivier Thomann CLA 2005-11-10 13:24:13 EST
Created attachment 29719 [details]
Proposed patch for parameter names from attached javadoc

I changed the API to reflect the fact that the naming starts at arg0 and not
arg1, when no name can be retrieved. This is the actual behavior.
Comment 9 Jerome Lanneluc CLA 2005-11-15 10:30:55 EST
Applied patch (thanks Olivier) and added IMethod#getRawParameterNames().
Added tests ClassFileTests#testParameterNames01/02 and testRawParameterNames01/02.
Comment 10 David Audel CLA 2005-12-12 12:18:33 EST
Verified for 3.2 M4 using build I20051212-0010