Re[1]: xrefdb/semantic overlay bug

"Eric M. Ludlam" <[email protected]>
Newsgroups gmane.emacs.cedet,gmane.emacs.jdee
Message-ID <[email protected]>
Hi,

  I used the example below, put it in a java file, then put the cursor
  on the 'main' method, and typed:

M-x semantic-test-all-format-tag-functions

 and the piece I got was:

semantic-format-tag-prin1:
   ("main" function (:typemodifiers ("public" "static")
                     :arguments (("args" variable (:type "String[]")
		    (... blah blah blah)))))
 
with the [] on String.  In run I get as you suggest.

  I suspect this is related to line 722 in
cedet/semantic/wisent/wisent-java-tags.wy where [] is appended to
wherever this thing comes from.

  I don't know enough of Java to know if:

String[] args

 is different from

String args[]

 but either way, these [] could be stored as attributes on the tag,
 and then exposed later by whatever java specific function is needed
 to do the query described below.

 In the c/c++ these are stored in a :dereference attribute, and later
 extracted, and the [] are put in a consistent place.

 In the end, I think line 587 should be converted to 'cons', later in
 wisent-java-tags.el the function wisent-java-expand-tag would need to
 be tweaked to add this particular case... whatever that may be.

 I'll defer to David Ponce who wrote this as he may have had a reason
 to do it as he did.

Eric

>>> "Suraj Acharya" <[email protected]> seems to think that:
>CC'ing cedet-devel as this looks like a semantic bug.
>
>Suraj
>
>On 4/14/06, vedm <[email protected]> wrote:
>>
>>
>> If you have a java method taking an array argument in the form
>> "aMethod(String args[])" - instead of "aMethod(String[] args)" - then
>> the the function jde-xref-display-call-tree is confused and thinks that
>> the method takes an argument named "args[]" of type String, rather than
>> an argument named "args" of type String[], as it does in reality.
>>
>> Therefore the call tree does not display a correct result.
>>
>> Here is a simple test class:
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> package xref.tests;
>>
>> public  class XrefTest {
>>     public static void main(String[] args) {
>>         new XrefTest().run(args);
>>     }
>>     public void run(String args[]) {
>>         System.out.println("Runing, argument:" + args[0]);
>>     }
>> }
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>>
>> If I build the xref db for the above class, put the cursor inside the
>> "run" method and invoke function jde-xref-display-call-tree, it shows
>> this:
>>
>> [X] void xref.tests.XrefTest.run(String)
>>
>> i.e. it tells me that the "run(String) method is not called at all -
>> which is to be expected, as there is no "run(String)" method in the
>> code: instead the method is "run(String[])";
>>
>> You can see the root cause if you copy the following in your *scratch*
>> buffer and execute it, after putting the cursor in the "run" method:
>>
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> (let ((overlays (save-excursion
>>                   (set-buffer (get-buffer "XrefTest.java"))
>>                   (overlays-at (point)))))
>>   (print (overlay-get (car (cdr overlays)) 'semantic)))
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>>
>> When I do this I see something like this in the minibuffer:
>>
>> =3D=3D=3D=3D=3D=3D
>> ("run" function (:typemodifiers ("public") :arguments (("args[]"
>> variable (:type "String")....
>> =3D=3D=3D=3D=3D=3D
>>
>> i.e the "semantic" overlay says that the run method takes an argument
>> named "args[]" of type "String", which is wrong.
>>
>>
>> --
>> vedm
>>
>>
>


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Cedet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-devel

-- 
          Eric Ludlam:                 [email protected], [email protected]
   Home: http://www.ludlam.net            Siege: www.siege-engine.com
Emacs: http://cedet.sourceforge.net               GNU: www.gnu.org


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.