public VisitorState withPath(TreePath path) { return new VisitorState( context, descriptionListener, severityMap, errorProneOptions, statisticsCollector, typeCache, path, suppressedState); }
public VisitorState withPathAndSuppression(TreePath path, SuppressedState suppressedState) { return new VisitorState( context, descriptionListener, severityMap, errorProneOptions, statisticsCollector, typeCache, path, suppressedState); }
/** * Return a VisitorState configured for a new compilation, including Error Prone configuration. */ public static VisitorState createConfiguredForCompilation( Context context, DescriptionListener listener, Map<String, SeverityLevel> severityMap, ErrorProneOptions errorProneOptions) { return new VisitorState( context, listener, severityMap, errorProneOptions, StatisticsCollector.createCollector(), null, null, SuppressedState.UNSUPPRESSED); }
/** * Return a VisitorState that has no Error Prone configuration, but can report findings to {@code * listener}. */ public static VisitorState createForCustomFindingCollection( Context context, DescriptionListener listener) { return new VisitorState( context, listener, ImmutableMap.of(), ErrorProneOptions.empty(), StatisticsCollector.createCollector(), null, null, SuppressedState.UNSUPPRESSED); }
/** * Return a VisitorState that has no Error Prone configuration, and can't report results. * * <p>If using this method, consider moving to using utility methods not needing VisitorSate */ public static VisitorState createForUtilityPurposes(Context context) { return new VisitorState( context, NULL_LISTENER, ImmutableMap.of(), ErrorProneOptions.empty(), // Can't use this VisitorState to report results, so no-op collector. StatisticsCollector.createNoOpCollector(), null, null, SuppressedState.UNSUPPRESSED); }
static VisitorState makeVisitorState(Tree target, Unifier unifier) { Context context = unifier.getContext(); TreePath path = TreePath.getPath(context.get(JCCompilationUnit.class), target); return new VisitorState(context).withPath(path); } }
@Override public Void visitClass(ClassTree node, InitializationContext init) { VisitorState state = new VisitorState(context).withPath(getCurrentPath()); if (isSuppressed(node)) { return null; } for (String annotation : IMPLICIT_VAR_CLASS_ANNOTATIONS) { if (ASTHelpers.hasAnnotation(getSymbol(node), annotation, state)) { return null; } } // reset the initialization context when entering a new declaration return super.visitClass(node, InitializationContext.NONE); }
@Override public Void visitMethod(MethodTree tree, Void v) { try { VisitorState state = new VisitorState(context); logger.log(FINE, "Discovered method with name {0}", tree.getName()); if (ASTHelpers.hasAnnotation(tree, Placeholder.class, state)) {
checkArgument( ASTHelpers.hasAnnotation( ASTHelpers.getSymbol(arg), Repeated.class, new VisitorState(context))); return template(arg);
public VisitorState withPath(TreePath path) { return new VisitorState( context, path, descriptionListener, severityMap, errorProneOptions, typeCache); }
private VisitorState createVisitorState() { return new VisitorState( state.context, (Description description) -> { ok[0] = false; }, ImmutableMap.of(), state.errorProneOptions()); } }.scan(state.getPath(), null);
/** Create a VisitorState object from a compilation unit. */ private VisitorState createVisitorState(Context context, DescriptionListener listener) { ErrorProneOptions options = requireNonNull(context.get(ErrorProneOptions.class)); return new VisitorState(context, listener, scanner().severityMap(), options); } }
static VisitorState makeVisitorState(Tree target, Unifier unifier) { Context context = unifier.getContext(); TreePath path = TreePath.getPath(context.get(JCCompilationUnit.class), target); return new VisitorState(context).withPath(path); } }
@Override public Void visitClass(ClassTree node, InitializationContext init) { VisitorState state = new VisitorState(context).withPath(getCurrentPath()); if (isSuppressed(node)) { return null; } for (String annotation : IMPLICIT_VAR_CLASS_ANNOTATIONS) { if (ASTHelpers.hasAnnotation(getSymbol(node), annotation, state)) { return null; } } // reset the initialization context when entering a new declaration return super.visitClass(node, InitializationContext.NONE); }
@Override public Void visitMethod(MethodTree tree, Void v) { try { VisitorState state = new VisitorState(context); logger.log(FINE, "Discovered method with name {0}", tree.getName()); if (ASTHelpers.hasAnnotation(tree, Placeholder.class, state)) {
checkArgument( ASTHelpers.hasAnnotation( ASTHelpers.getSymbol(arg), Repeated.class, new VisitorState(context))); return template(arg);