Package com.google.errorprone

Examples of com.google.errorprone.Scanner


    assertCompiles(memberSelectMatches(false, new InstanceMethod(
        Matchers.<ExpressionTree>anything(), "count")));
  }

  private Scanner memberSelectMatches(final boolean shouldMatch, final InstanceMethod toMatch) {
    return new Scanner() {
      @Override
      public Void visitMemberSelect(MemberSelectTree node, VisitorState visitorState) {
        if (getCurrentPath().getParentPath().getLeaf().getKind() == Kind.METHOD_INVOCATION) {
          assertTrue(node.toString(),
              !shouldMatch ^ toMatch.matches(node, visitorState));
View Full Code Here


    );
    assertCompiles(methodInvocationMatches(true, new StaticMethod("com.google.A", "count")));
  }

  private Scanner methodInvocationMatches(final boolean shouldMatch, final StaticMethod toMatch) {
    return new Scanner() {
      @Override
      public Void visitMethodInvocation(MethodInvocationTree node, VisitorState visitorState) {
        ExpressionTree methodSelect = node.getMethodSelect();
        if (!methodSelect.toString().equals("super")) {
          assertTrue(methodSelect.toString(),
View Full Code Here

          Matchers.<ExpressionTree>isArrayType())));
  }

  private Scanner compoundAssignmentMatches(
      final boolean shouldMatch, final CompoundAssignment toMatch) {
    return new Scanner() {
      @Override
      public Void visitCompoundAssignment(CompoundAssignmentTree node, VisitorState visitorState) {
        assertTrue(node.toString(),
            !shouldMatch ^ toMatch.matches(node, visitorState));
        return super.visitCompoundAssignment(node, visitorState);
View Full Code Here

    assertCompiles(methodInvocationMatches(false, Matchers.methodReturnsNonNull()));
  }
 
  private Scanner methodInvocationMatches(
      final boolean shouldMatch, final Matcher<ExpressionTree> toMatch) {
    return new Scanner() {
      @Override
      public Void visitMethodInvocation(MethodInvocationTree node, VisitorState visitorState) {
        ExpressionTree methodSelect = node.getMethodSelect();
        if (!methodSelect.toString().equals("super")) {
          assertTrue(methodSelect.toString(), !shouldMatch ^ toMatch.matches(node, visitorState));
View Full Code Here

    assertCompiles(nonNullLiteralMatches(false, Matchers.nonNullLiteral()));
  }
 
  private Scanner nonNullLiteralMatches(
      final boolean shouldMatch, final Matcher<ExpressionTree> toMatch) {
    return new Scanner() {
      @Override
      public Void visitLiteral(LiteralTree node, VisitorState visitorState) {
        assertTrue(node.toString(), !shouldMatch ^ toMatch.matches(node, visitorState));
        return super.visitLiteral(node, visitorState);
      }
View Full Code Here

        "public class B implements i.I2 {",
        "  public void count() {",
        "  }",
        "}"
    );
    assertCompilesWithLocalDisk(new Scanner());
    clearSourceFiles();
    writeFileToLocalDisk("C.java",
        "public class C {",
        "  public void test(b.B b) {",
        "    b.count();",
View Full Code Here

    assertCompiles(methodInvocationMatches(false, Matchers.methodReturnsNonNull()));
  }
 
  private Scanner methodInvocationMatches(
      final boolean shouldMatch, final Matcher<ExpressionTree> toMatch) {
    return new Scanner() {
      @Override
      public Void visitMethodInvocation(MethodInvocationTree node, VisitorState visitorState) {
        ExpressionTree methodSelect = node.getMethodSelect();
        if (!methodSelect.toString().equals("super")) {
          assertTrue(methodSelect.toString(), !shouldMatch ^ toMatch.matches(node, visitorState));
View Full Code Here

    );
  }
 
  private Scanner methodInvocationMatches(
      final boolean shouldMatch, final Matcher<ExpressionTree> toMatch) {
    return new Scanner() {
      @Override
      public Void visitMethodInvocation(MethodInvocationTree node, VisitorState visitorState) {
        ExpressionTree methodSelect = node.getMethodSelect();
        if (!methodSelect.toString().equals("super")) {
          assertTrue(methodSelect.toString(), !shouldMatch ^ toMatch.matches(node, visitorState));
View Full Code Here

        "public class A{}");
    assertCompiles(annotationMatches(true, new AnnotationHasArgumentWithValue("value", stringLiteral("unchecked"))));
  }

  private Scanner annotationMatches(final boolean shouldMatch, final AnnotationHasArgumentWithValue toMatch) {
    return new Scanner() {
      @Override
      public Void visitAnnotation(AnnotationTree node, VisitorState visitorState) {
        assertTrue(node.toString(), !shouldMatch ^ toMatch.matches(node, visitorState));
        return super.visitAnnotation(node, visitorState);
      }
View Full Code Here

TOP

Related Classes of com.google.errorprone.Scanner

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.