Package lombok.ast.grammar

Examples of lombok.ast.grammar.Source


      "  }\n" +
      "}\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())) {
          assertTrue("thisIsAUtilList isn't matched to java.util.List, but should.",
              new Resolver().typesMatch("java.util.List<?>", node.upToVariableDefinition().astTypeReference()));
          hit1.incrementAndGet();
View Full Code Here


      "  class List {}\n" +
      "}\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()));
        hit.incrementAndGet();
        return true;
View Full Code Here

      "\n" +
      "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()));
        hit.incrementAndGet();
        return true;
View Full Code Here

      "  String[] test(String x) {}\n" +
      "}";
 
  @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()));
        assertFalse("typesMatch with String[] should NOT match java.lang.String[][] but does.",
            new Resolver().typesMatch("java.lang.String[][]", node.astReturnTypeReference()));
View Full Code Here

      "  List test() {}\n" +
      "}";
 
  @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()));
        assertTrue("typesMatch with java.awt.List+java.util.* imported SHOULD match java.awt.List",
            new Resolver().typesMatch("java.awt.List", node.astReturnTypeReference()));
View Full Code Here

TOP

Related Classes of lombok.ast.grammar.Source

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.