Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.CompilationUnit


  // Assume that we are using a class where every method has a unique name
  static Map<String, MethodDeclaration> methods = new HashMap<String, MethodDeclaration>();

  @BeforeClass
  static public void setup() throws CoreException {
    CompilationUnit compUnit = CFGTestUtils.parseCode(Try.class.getName());
    methods = CFGTestUtils.createMethodNameMap(compUnit);
  }
View Full Code Here


  // Assume that we are using a class where every method has a unique name
  static Map<String, MethodDeclaration> methods = new HashMap<String, MethodDeclaration>();

  @BeforeClass
  static public void setup() throws CoreException {
    CompilationUnit compUnit = CFGTestUtils.parseCode(For.class.getName());
    methods = CFGTestUtils.createMethodNameMap(compUnit);
  }
View Full Code Here

      }
     
      if(!lookCloser)
        continue;
     
      CompilationUnit cu =
          (CompilationUnit) WorkspaceUtilities.getASTNodeFromCompilationUnit(icu);
      Option<TestType> tt_ = findTestType(cu);

      if (tt_.isSome()) {
        // These two array elements correspond to the two parameters
View Full Code Here

    return (Statement) stmts.get(stmts.size()-1);
  }
 
  public static CompilationUnit parseCode(String qualifiedCompUnitName, String code) throws CoreException {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    CompilationUnit node;
   
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("CrystalTest");
    project.open(null /* IProgressMonitor */);
   
    IJavaProject javaProject = JavaCore.create(project);

    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setProject(javaProject);
    parser.setSource(code.toCharArray());
    parser.setUnitName("/CrystalTest/" + qualifiedCompUnitName);
    parser.setResolveBindings(true);
    node = (CompilationUnit) parser.createAST(null);
   
    Message[] msgs = node.getMessages();
    if(msgs.length > 0) {
      StringBuffer errs = new StringBuffer();
      errs.append("Compiler problems for ");
      errs.append(qualifiedCompUnitName);
      for(Message m : msgs) {
View Full Code Here

public class EclipseTACTargetSelectionTest {

  @Test
  public void testFactorial() throws Exception {
    CompilationUnit simple = EclipseTACSimpleTestDriver.parseCode("Factorial", FACTORIAL);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(simple);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
   
    ConditionalExpression cond = (ConditionalExpression) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    Variable r = tac.variable(cond);
View Full Code Here

    "    }" +
    "}";
 
  @Test
  public void testInitializers() throws Exception {
    CompilationUnit simple = EclipseTACSimpleTestDriver.parseCode("Initializers", INITIALIZERS);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(simple);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
   
    List<Statement> stmts = m.getBody().statements();
    Assert.assertTrue(stmts.size() == 5);
View Full Code Here

  static public CompilationUnit parseCode(String qualifiedCompUnitName)
      throws CoreException {
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
        PROJECT);
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    CompilationUnit node;

    project.open(null);

    IJavaProject javaProject = JavaCore.create(project);
    ICompilationUnit source = javaProject.findType(qualifiedCompUnitName)
View Full Code Here

  // Assume that we are using a class where every method has a unique name
  static Map<String, MethodDeclaration> methods = new HashMap<String, MethodDeclaration>();

  @BeforeClass
  static public void setup() throws CoreException {
    CompilationUnit compUnit = CFGTestUtils
        .parseCode(While.class.getName());
    methods = CFGTestUtils.createMethodNameMap(compUnit);
  }
View Full Code Here

  // Assume that we are using a class where every method has a unique name
  static Map<String, MethodDeclaration> methods = new HashMap<String, MethodDeclaration>();

  @BeforeClass
  static public void setup() throws CoreException {
    CompilationUnit compUnit = CFGTestUtils.parseCode(Do.class.getName());
    methods = CFGTestUtils.createMethodNameMap(compUnit);
  }
View Full Code Here

  // Assume that we are using a class where every method has a unique name
  static Map<String, MethodDeclaration> methods = new HashMap<String, MethodDeclaration>();

  @BeforeClass
  static public void setup() throws CoreException {
    CompilationUnit compUnit = CFGTestUtils.parseCode(Try.class.getName());
    methods = CFGTestUtils.createMethodNameMap(compUnit);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.CompilationUnit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.