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 Muhammad,

your classpath is apparently incomplete. You have set the target platform before and let eclipse find out which jars you need. Please follow steps 2-4 as described here [1] and then start the main method.


Regarding event simulation:

To get the completion event locations:  Since you want to run this in the IDE, you have to write an AST visitor that traverses all compilation units in a given project and identifies the locations where method invocations happen. Sven wrote such a vistor during his thesis. If he gives the permission to open source this, I could share this one with you. 

Triggering code completion, is a bit more complex. Given the invocation offset (found from the visitor above), you have to find out how to trigger jdt's completion programmatically. This is something you should ask on the JDT forum. You should stress that you need all proposal computers to be run - not only JDT core's computer. As a workaround you can create your own instance of the intelligent code completion computer und use this. But this requires a lot more work. Let's see if JDT has an API for triggering all proposal computers first at a given location.

Best,
Marcel




On Aug 5, 2013, at 8:31 AM, Muhammad Asaduzzaman <parvez.usask@xxxxxxxxx> wrote:

Hi All,
Good day. I am involved with a research project where we are are
comparing performance of code completion engines including code
recommenders. The reason is that there are other completion engines
(at least in the form of research prototype) but they compare their
performance/accuracy differently. What I need is the method calls
(after typing object name and dot) performed by the developers in a
java code and the completion proposals made by code recommenders at
that point.

Marcel pointed me to a headless api in the master branch:
https://git.eclipse.org/c/recommenders/org.eclipse.recommenders.git/tree/plugins/org.eclipse.recommenders.calls/examples/org/eclipse/recommenders/examples/calls

I have collected the code via: git clone
https://eclipse.googlesource.com/recommenders/org.eclipse.recommenders
Add required  jars and run the EclipseOrgCallRecommenderMain file as a
java application, but it gives me the following error:
+++++++++++++++++++++++++ Output+++++++++++++
Setting up recommender and model repository (downloads search index
the first time).
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/maven/model/building/ModelBuildingException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.newInstance0(Class.java:343)
at java.lang.Class.newInstance(Class.java:325)
at org.sonatype.aether.impl.internal.DefaultServiceLocator.getServices(DefaultServiceLocator.java:160)
at org.sonatype.aether.impl.internal.DefaultServiceLocator.getService(DefaultServiceLocator.java:133)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.initService(DefaultRepositorySystem.java:146)
at org.sonatype.aether.impl.internal.DefaultServiceLocator.getServices(DefaultServiceLocator.java:181)
at org.sonatype.aether.impl.internal.DefaultServiceLocator.getService(DefaultServiceLocator.java:133)
at org.eclipse.recommenders.models.AetherModelRepository.createRepositorySystem(AetherModelRepository.java:262)
at org.eclipse.recommenders.models.AetherModelRepository.<init>(AetherModelRepository.java:102)
at org.eclipse.recommenders.models.AetherModelRepository.<init>(AetherModelRepository.java:135)
at org.eclipse.recommenders.examples.calls.EclipseOrgCallRecommenderMain.main(EclipseOrgCallRecommenderMain.java:26)
Caused by: java.lang.ClassNotFoundException:
org.apache.maven.model.building.ModelBuildingException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 14 more
++++++++++++++++++++++++++++++++++++++++++++++
Can anyone help me to solve this problem?

Marcel also pointed me to Eclipse Code Recommenders Proposal Computer
API  (is it part org.eclipse.recommenders.completion.rcp.sandbox or
org.eclipse.recommenders.completion.rcp).  How can I collect the code.
They are not part of the master branch, if I am correct.

My program need to traverse a java source file (may be in the form of
a compilation unit), find the method call made by developers  and
check what completion proposals made by code recommenders at that
time. It would be really helpful for me if I get some help from you.

Thanks.

-Muhammad Asaduzzaman
Graduate Student
Department of Computer Science
University of Saskatchewan
_______________________________________________
recommenders-dev mailing list
recommenders-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/recommenders-dev


Back to the top