Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [recommenders-dev] Need help to collect completion proposals made by code recommenders programetically

Hi Marcel,
Good day. I am very close to collect all the required information to
make a query. Just a question regarding overriding context. I have
found that objectUsage query object takes two parameters
(overrideFirst and overrideSuper). I am using an example here. Lets
say I have created a class that is inherited  from javax.swing.JFrame
and override the method createRootPane(). The top most declaration of
this method is in JFrame  and I use the information for overrideFirst
. Lets say that I override another method getCursorType. Since the
method comes from java.awt.frame (jframe override the method), so that
should be the correct location for creating overrideFirst. Right?

Is it the case that for overridesuper I should use the method
declaration in JFrame for the second example. Am I missing something?
Please let me know.


Thanks again for your help and support throughout the time. I will
share the result and code with you when I finish the code and complete
data collection.

-Muhammad Asaduzzaman


On Wed, Aug 7, 2013 at 2:47 PM, Marcel Bruch
<marcel.bruch@xxxxxxxxxxxxxx> wrote:
> Sounds reasonable. A few more words on what code recommenders (at eclipse.org) does:
>
>> Can I create an appropriate query for each method call?
>
> Sure,  it depends on what you want to test but it's generally possible. For its recommendations it considers the following information:
>
> The information how a variable was defined (by method_return, by new, by a field, as method parameter).
> If possible the name of the method that defined the object (in the case of method return, new, or parameter).
> The methods that were already invoked on the object
> And last what we call the override context, i.e., when code completion is triggered in an overridden method we use the topmost declaration of the overridden method to refine the recommendations ("how to use a text widget differs whether you are in Dialog.open or Dialog.close).
>
> If you want to evaluate what recommendations it returns after you created the text widget, simply "observe" the definitionKind=NEW, the definingMethod=new Text(…) and ask the ICallModel for it's recommendations by calling m.recommendCalls(). If you want how recommendations change after setText is observed simply call m.setCalled(setText()) (disclaimer: something along these lines ;-)) Check the documentation of ICallModel for details.
>
> When you get to an evaluation, feel free to share the results and the evaluation code with me so I can ensure that the API is used correctly. There are one or two et undocumented specialties in the code that clients should be aware of :-)
>
>
> Please note:
> Code Recommender models *heavily* use clustering to create reasonable sized models. This makes them difficult to compare with other approaches or the results in the research paper published 4 years ago. We accept a loss in quality for better performance and especially reasonable low memory consumption for industrial use.
>
> Hope this helps,
> Marcel
>
>
>
>
> On Aug 7, 2013, at 8:54 PM, Muhammad Asaduzzaman <parvez.usask@xxxxxxxxx> wrote:
>
>> Hi Marcel,
>> Thanks again. To explain what I want to do and make sure I am doing
>> that correctly here is a simple scenario.
>>
>> Class A{
>>       public A(){
>>       Text T=new Text();
>>       T.setText();
>>       T.setLayout();
>>       }
>>
>> }
>>
>> Lets say a file A.java contain a class and there are two method calls
>> in there (T.setText and T.setLayout()). Lets say, I am in the position
>> of first method call and I will determine what completion proposals
>> are made by code recommender at that point and continue the steps with
>> all other method calls. (for now, I will only focus on the methods
>> belongs to swt classes and ignore other method calls).
>>
>> Can I create an appropriate query for each method call? If its
>> possible then I can use the recommender.computeRecommendations(query)
>> to collect the completion proposals.
>> After taking a look on the ObjectUsage class, It appears to me that it
>> takes the following input:
>> calls (list of method calls), definition, kind, overridesFirst,
>> overridesSuper and type. If I can fill this information for each
>> method calls then I can call the computeRecommendations(query)
>> method.
>>
>> Sorry for my long mail. I try to explain what I am planning to do.
>> Please correct me if I am wrong.
>>
>> After reading your paper (Learning from example to improve code
>> completion systems), it appears to me that you also considered various
>> statements before the target method call. Does Code Recommenders also
>> considers them (like object creation.. )?
>>
>> Thanks again for your kind help and support. I will take a look on
>> those classes.
>>
>> -Muhammad Asaduzzaman
>>
>>
>>
>>
>>
>> On Wed, Aug 7, 2013 at 12:15 PM, Marcel Bruch
>> <marcel.bruch@xxxxxxxxxxxxxx> wrote:
>>> Great. Update to the latest version of master to get rid of the NPE.
>>>
>>>
>>>> Now I need to create the right query and call
>>>> the recommender.computeRecommendations(query) method.
>>>
>>> I'm not sure what you want to do, but please note that the ObjectUsage class and the method EclipseOrgCallRecommender are *solely for demo purpose*.
>>>
>>>
>>> To make clear:
>>> The API to look at is ICallModel. Forget about the rest if you want to learn *how* recommendations are computed and what information is considered when computing recommendations.
>>>
>>>
>>>
>>> If you are interested to learn where the inputs into ICallModel *in Eclipse* come from:
>>> Have a look at org.eclipse.recommenders.internal.calls.rcp.CallCompletionSessionProcessor.java or org.eclipse.recommenders.internal.calls.rcp.CallsApidocProvider.handle(IJavaElement, String, String, JavaElementSelectionEvent, Composite). The show how clients of ICallModel look like.
>>>
>>>
>>> Let me know if you need more information. I'll update the documentation accordingly.
>>>
>>> HTH
>>> Marcel
>>>
>>>
>>> _______________________________________________
>>> recommenders-dev mailing list
>>> recommenders-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/recommenders-dev
>> _______________________________________________
>> recommenders-dev mailing list
>> recommenders-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/recommenders-dev
>
> _______________________________________________
> recommenders-dev mailing list
> recommenders-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/recommenders-dev


Back to the top