Is it possible to separate the indexing capabilities of Eclipse code?

I want to write a static analyzer for a university class. To provide more features for the tool, I would like to be able to search the hierarchy of calls (like Ctrl + Alt + H in Eclipse). It should also be a quick operation, so the search should probably be done against the index, and not bytecode scanning.

However, writing an Eclipse plugin would be too ambitious, which I expect. Instead, I would rather separate the parts of Eclipse that create the code index, and use the library to search. The user interface will be on the command line to simplify the implementation.

I read that Eclipse uses Lucene for indexing [1], however for Lucene to work with Eclipse features there must be considerable work.

The question is, is it possible to separate the Eclipse indexing capabilities for reuse? If not, are there other available libraries available that could do the processing I described?

[1] Lucene In Action (IIRC)


EDIT

I think there was some misunderstanding. I do not want to check the hierarchy of classes, I want to check the hierarchy of calls. That is why search and indexing come into the discussion (some, although maybe not the right one). Checking the class hierarchy is probably much cheaper than checking the hierarchy of calls.

Eclipse, , , , , , . , , , .

, Eclipse, , , API -.

!

+5
9

. Java . , - [1] eclipse. , Eclipse , , API Eclipse.

[1] http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-1326.html

+4

, , . . .

Eclipse ( , ), JDT. AST (Abstract Syntax Tree) Visitor, . JDT.

.

+1

, ASM, , . , :

public class Analyzer {
    public static void main(String[] args) throws IOException {
        ClassReader classReader;
        ClassNode classNode;
        String fullyQualifiedClassName = args[0];
        String callHierarchy = "";
        while (null != fullyQualifiedClassName) {
            callHierarchy = " > " + fullyQualifiedClassName + callHierarchy;
            classReader = new ClassReader(fullyQualifiedClassName);
            classNode = new ClassNode();
            classReader.accept(classNode, 0);
            if (null != classNode.superName) {
                fullyQualifiedClassName = classNode.superName.replace('/', '.');
            } else {
                fullyQualifiedClassName = null;
            }
        }
        System.out.println(callHierarchy);
    }
}

java.util.TreeMap ,

> java.lang.Object > java.util.AbstractMap > java.util.TreeMap

, -, , , ASM , , , , ( imo).

, :)

+1

IBM WALA framework. , Call Graph (CG) . , WALA CG. .

+1

Eclipse: .

, -. , invokeinstance, invokestatic invokespecial bytecodes (. JVM). / , Map<FuncRef,Set<FuncRef>>, FuncRef - , .

BCEL -.

, , invokeinstance, , . , , , , - .

+1
0

Eclipse ; , .

, Eclipse IDE. ( JDT, , ).

You can then provide your plugins to all eclipse users, rather than developing another standalone tool.

0
source

I suspect you will find it easier to write a plugin for which Eclipse is designed and documented than to extract bits that should be internal and create something else from them.

0
source

All Articles