Intelligent search and generation of Java code, preferably using Python?

Basically, I do a lot of one-time code generation, large-scale refactoring, etc. etc. in java.

My choice tool language is Python, but I will take any solutions you can offer.


Here is a simplified illustration of what I would like in pseudo code

Creating an implementation for an interface

search within my project:
  for each Interface as iName:
    write class(name=iName+"Impl", implements=iName)
    search within the body of iName:
      for each Method as mName:
        write method(name=mName, body="// TODO implement this...")

Basically, the tool I'm looking for will allow me to:

  • analyze files according to the Java structure ("search for interfaces")
  • search for words contextualized by language elements and types ("variables of type SomeClass", "doStuff () method calls instances of SomeClass")
  • to start a search with a structural context ("inside the body of the current result")
  • ( , , , " Foo", " Blah.Blah()" ..).

, , , . - , grep. , - , , .

/, ?


,

  • Python ; . , .
  • IDE; , .
  • , ( ), . , , , , .
+3
3

-, , Python, Java, Google .

-, , Java Python . Java (lexer/parser, AST builder ) Python, , . , ... , .

-, (, , ) , , , . , , OP ...

, :

Java IDE (, NetBeans, Eclipse, IDEA ..) . OP Python, , , . , IDE 95% , , ( ), . , , IDE , ; , /, , , , ..

( , IDE (@WizardOfOdds - OP !), IDE, .)

, , . , , (), - . , , - Eclipse EMF . EMF , XML, , , .. EMF , 50-100 . EMF .

+2

Java, NetBeans IDE. ​​ . Eclipse ( NetBeans). , , , , .

0

Java , - .

; Eclipse, Netbeans, Intellij - IDE. . Eclipse Netbeans, , Intellij Eclipse

, FindBugs, CheckTyle .., - , .

If you really want to use your Python skills, take a look at Jython. Its Python interpreter is written in Java.

0
source

Source: https://habr.com/ru/post/1742539/


All Articles