Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » AST resolve bindings without dependencies
AST resolve bindings without dependencies [message #1735078] Wed, 15 June 2016 11:27 Go to next message
Leander Kurscheidt is currently offline Leander KurscheidtFriend
Messages: 1
Registered: June 2016
Junior Member
Hello,
i want to use JDT to gather some metrics about different projects. The problem is i don't have the dependencies, only the source-code and i can't get the ASTParser to give me all the information that are possible to retrieve.
Example:
package xyz.exemplator.parser.java;

import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;

/**
 * @author LeanderK
 * @version 1.0
 */
public class Main {
    public static void main(String[] args) {
        String x = "a";
        ASTParser parser = ASTParser.newParser(AST.JLS8);
        parser.anotherMethod()
    }
}

without the jet dependency i can still gather the information that someone called org.eclipse.jdt.core.dom.ASTParser.newParser() and org.eclipse.jdt.core.dom.ASTParser.anotherMethod(). But when i try to resolve the binding i get RecoveredTypeBinding and getPackage() returns the package of main and not org.eclipse.jdt.core.dom.ASTParser
Re: AST resolve bindings without dependencies [message #1735349 is a reply to message #1735078] Fri, 17 June 2016 13:42 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Without the dependencies you can still parse the sources into an AST, right, but that's all - you're stuck at the syntactic level.
Any semantic analysis starting by resolving type bindings needs the dependencies to be present. I don't see a way around that.
How should JDT guess the type of anotherMethod() if its declaring class cannot be found??
Previous Topic:After update to Mars, project .class files do not refresh when project is run
Next Topic:using ASTParesr to get block of Expression
Goto Forum:
  


Current Time: Thu Apr 25 20:42:19 GMT 2024

Powered by FUDForum. Page generated in 0.03046 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top