Package lombok.ast.grammar

Examples of lombok.ast.grammar.Source.parseCompilationUnit()


 
  @Test
  public void testBasicTypesMatch() {
    final AtomicInteger hit = new AtomicInteger();
    Source s = new Source(SIMPLE_SOURCE, "SimpleTypesMatchTest.java");
    s.parseCompilationUnit();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertTrue("typesMatch with star import should match but fails:" + node.astReturnTypeReference(),
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
        assertFalse("typesMatch with no relevant imports should fail but matches",
View Full Code Here


      "}\n";
 
  @Test
  public void testMethodLocalMaskingTypesMatch() {
    Source s = new Source(METHOD_LOCAL_MASKING_SOURCE, "MaskingTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit1 = new AtomicInteger();
    final AtomicInteger hit2 = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitVariableDefinitionEntry(VariableDefinitionEntry node) {
        if ("thisIsAUtilList".equals(node.astName().astValue())) {
View Full Code Here

      "}\n";
 
  @Test
  public void testInnerMaskingTypesMatch() {
    Source s = new Source(INNER_MASKING_SOURCE, "MaskingTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertFalse("typesMatch with star import but should fail due to inner masking, yet succeeds.",
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
View Full Code Here

      "class List {}\n";
 
  @Test
  public void testTopLevelMaskingTypesMatch() {
    Source s = new Source(TOP_LEVEL_MASKING_SOURCE, "MaskingTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertFalse("typesMatch with star import but should fail due to top level masking, yet succeeds.",
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
View Full Code Here

      "}";
 
  @Test
  public void testArrayTypesMatch() {
    Source s = new Source(ARRAYS_SOURCE, "ArrayTypesMatchTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertTrue("typesMatch with String[] should match java.lang.String[] but doesn't.",
            new Resolver().typesMatch("java.lang.String[]", node.astReturnTypeReference()));
View Full Code Here

      "}";
 
  @Test
  public void testImportedTypesMatch() {
    Source s = new Source(IMPORTS_SOURCE, "ImportsTest.java");
    s.parseCompilationUnit();
    final AtomicInteger hit = new AtomicInteger();
    s.getNodes().get(0).accept(new ForwardingAstVisitor() {
      @Override public boolean visitMethodDeclaration(MethodDeclaration node) {
        assertFalse("typesMatch with java.awt.List+java.util.* imported should NOT match java.util.List",
            new Resolver().typesMatch("java.util.List", node.astReturnTypeReference()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.