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

Dear Marcel,
Good day. I have used my code to create completion proposals for Code
Recommenders. For example, here is a code fragment and the
corresponding query parameters I have obtained.

JFrame frame;
        frame = new JFrame();
        frame.setSize(100,100);
        frame.getContentPane().add(new JLabel());
        frame.pack();

There are four method calls here.

+++++++For target method setSize:+++++
Kind: NEW
Type: Ljavax/swing/JFrame
Defining Method: Ljavax/swing/JFrame.<init>()V
OverrideFirst: Ljava/awt/Component.setSize(II)V
Total Method Calls: 0

+++++++For target method getContentPane++++
Kind: NEW
Type: Ljavax/swing/JFrame
Defining Method: Ljavax/swing/JFrame.<init>()V
OverrideFirst: LECR.unknown()V
Total Method Calls: 1
List of Method Calls
call[0] setSize

+++++++For target Method add++++++
Kind: METHOD_RETURN
Type: Ljava/awt/Container
Defining Method: Ljavax/swing/JFrame.getContentPane()Ljava/awt/Container;
OverrideFirst: Ljava/awt/Component.add(Ljava/awt/PopupMenu;)V
Total Method Calls: 0
List of Method Calls

++++++++++For target Method pack+++++
Kind: NEW
Type: Ljavax/swing/JFrame
Defining Method: Ljavax/swing/JFrame.<init>()V
OverrideFirst: LECR.unknown()V
Total Method Calls: 2
List of Method Calls
call[0] getContentPane
call[1] setSize

++++++++++++++++++++++++++++++++++++++++++

The program generated result is different than the completion
proposals proposed by the code recommender plug-in (for the later case
I write down the code and invoke method completion manually). The
version of code recommender source code I am using is 1.0 whereas the
plug-in version number is 2.0.
The model file I am using is jre-1.0.0-call.zip in my program.

Could you please take a look on my following questions and let me know
your comment/suggestions:

i) How can I obtain the new model for the swing, AWT and java.io
library? Among these three I have only model for swing.
ii) Do you think the result is different because I am using old
version of code recommender or old model file or my calculation is
wrong?.
iii) Can I use the same git link to download the new version of code
recommender source?

If you need, I can also send you the code. Thanks again for your help
and support.

-Muhammad Asaduzzaman




On Sun, Oct 27, 2013 at 12:33 AM, Marcel Bruch
<marcel.bruch@xxxxxxxxxxxxxx> wrote:
> Hi Muhammad,
>
> that's great!
>
> i) Even if I configure that I need 5 completion proposals, the number of
> recommendations is frequently less
>  than five. Is there any design decision behind this?. My guess is that for
> the other recommendations the relevance value is less than the threshold. Am
> I correct?
>
>
> It depends on which level you plug-in. On the lower level (JayesCallModel
> there is no threshold. On the Completion Engine level there is one (by
> default 1% or 10% - pls check the preferences). In addition, sometimes there
> might be less than 5 methods actually used by clients (although hundreds of
> methods may exist). In these cases, we can only recommend what we have seen.
> There would be no point to recommend methods with a likelihood of zero.
>
>
> ii) Right now I am using a model available in this file: jre-1.0.0-call.zip.
> My understanding is that this model helps to calculate method call for jdk
> (like swing or awt).
>
>
> Yes, although for swing and awt we don't have many examples for. For your
> paper: if you let us know which types you evaluate, we can provide you with
> some numbers like how many examples we learned this model from etc.).
>
> I want to use eclipse as a subject system where I plan to consider method
> calls to SWT. How can I obtain the corresponding model?.
>
>
> You can use the ModelRepository API for that. But I guess downloading the
> file once may work well enough. For SWT you may use this URL:
> http://download.eclipse.org/recommenders/models/luna-m2/org/eclipse/swt/org.eclipse.swt.cocoa.macosx.x86_64/3.0.0-SNAPSHOT/org.eclipse.swt.cocoa.macosx.x86_64-3.0.0-20130907.000259-1-call.zip
>
>
> Please note that next week we'll publish the official 2.0.0 models
> (hopefully around Tuesday if all goes well)
>
>
> I will share  my code and results with you, but I need a few days more to
> restructure the code and collect the complete results.
>
>
> We'll be glad to review and reproduce your results to support your research
> claims. If you want us to do so, I'd kindly ask to create an easy-to-use
> setup to run your tool from within Eclipse (e.g., a single main routine or a
> junit test suite to start from within Eclipse would be good enough -
> something along these lines) ;-)
>
> Best,
> Marcel
>
>
> Am 27.10.2013 um 06:57 schrieb Muhammad Asaduzzaman
> <parvez.usask@xxxxxxxxx>:
>
> Hi Marcel,
> Good day. I am happy to inform you that I have successfully created code
> completion queries and collect the results for a few source files without
> any exception/problem. I have used AstDefUseFinder class and write some
> other codes to complete the task. I will conduct my experiment now on a
> large system now. Can you please take a look on the following questions:
> i) Even if I configure that I need 5 completion proposals, the number of
> recommendations is frequently less
>  than five. Is there any design decision behind this?. My guess is that for
> the other recommendations the relevance value is less than the threshold. Am
> I correct?
>
> ii) Right now I am using a model available in this file: jre-1.0.0-call.zip.
> My understanding is that this model helps to calculate method call for jdk
> (like swing or awt). I want to use eclipse as a subject system where I plan
> to consider method calls to SWT. How can I obtain the corresponding model?.
> Can you please help me in this regard.
>
> I will share  my code and results with you, but I need a few days more to
> restructure the code and collect the complete results. Please let me know
> your comments/suggestion.
> Thank you again for your kind help and support.
>
>
> -Muhammad Asaduzzaman
>
>
>
> On Fri, Oct 4, 2013 at 2:12 AM, Marcel Bruch <marcel.bruch@xxxxxxxxxxxxxx>
> wrote:
>>
>> Hi Muhammad,
>>
>>
>> Am 04.10.2013 um 09:45 schrieb Muhammad Asaduzzaman
>> <parvez.usask@xxxxxxxxx>:
>>
>> > Hi Marcel,
>> > Good day. I am very close to collect all the required information to
>> > make a query.
>>
>> great.
>>
>> > Just a question regarding overriding context. I have
>> > found that objectUsage query object takes two parameters
>> > (overrideFirst and overrideSuper).
>>
>> You are working on 1.0 code, do you?
>>
>> > 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?
>>
>> Right. The naming in 1.0 is a bit unpleasant. "first" means first - or
>> topmost - declaration in the inheritance hierarchy. "super" is the closest
>> overridden declaration.
>>
>> >
>> > 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.
>>
>>
>> Not sure I get you right but I believe yes.
>>
>> To suggest method *calls*, we take into account the root/first method as
>> overrides information. For recommending which methods to override we only
>> look at the super methods. It doesn't make sense to use root/first methods
>> here.
>>
>> I hope that helps. Please let me know if you have further questions.
>>
>> Best,
>> Marcel
>>
>> > 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
>> > _______________________________________________
>> > 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
>
>
>
> _______________________________________________
> recommenders-dev mailing list
> recommenders-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/recommenders-dev
>


Back to the top