public boolean generateNegation() { return annotations().containsKey(AlsoNegation.class); }
boolean autoboxing() { return !annotations().containsKey(NoAutoboxing.class); }
/** Parameters which must be referenced in any tree matched to this placeholder. */ Set<UVariableDecl> requiredParameters() { return Maps.filterValues( annotatedParameters(), (ImmutableClassToInstanceMap<Annotation> annotations) -> !annotations.containsKey(MayOptionallyUse.class)) .keySet(); }
if (annotationMap.containsKey(AllowCodeBetweenLines.class)) { List<UBlank> blanks = new ArrayList<>(); for (int i = 0; i < beforeTemplates.size(); i++) { if (afterTemplate.annotations().containsKey(AlsoNegation.class)) { negatedAfterTemplates.add(((ExpressionTemplate) afterTemplate).negation());
Inliner inliner = match.createInliner(); Context context = inliner.getContext(); if (annotations().containsKey(UseImportPolicy.class)) { ImportPolicy.bind(context, annotations().getInstance(UseImportPolicy.class).value()); } else {
/** * Generates a {@link SuggestedFix} replacing the specified match (usually of another template) * with this template. */ @Override public Fix replace(ExpressionTemplateMatch match) { Inliner inliner = match.createInliner(); Context context = inliner.getContext(); if (annotations().containsKey(UseImportPolicy.class)) { ImportPolicy.bind(context, annotations().getInstance(UseImportPolicy.class).value()); } else { ImportPolicy.bind(context, ImportPolicy.IMPORT_TOP_LEVEL); } int prec = getPrecedence(match.getLocation(), context); SuggestedFix.Builder fix = SuggestedFix.builder(); try { StringWriter writer = new StringWriter(); pretty(inliner.getContext(), writer).printExpr(expression().inline(inliner), prec); fix.replace(match.getLocation(), writer.toString()); } catch (CouldNotResolveImportException e) { logger.log(SEVERE, "Failure to resolve in replacement", e); } catch (IOException e) { throw new RuntimeException(e); } return addImports(inliner, fix); }
public boolean generateNegation() { return annotations().containsKey(AlsoNegation.class); }
boolean autoboxing() { return !annotations().containsKey(NoAutoboxing.class); }
/** Parameters which must be referenced in any tree matched to this placeholder. */ Set<UVariableDecl> requiredParameters() { return Maps.filterValues( annotatedParameters(), (ImmutableClassToInstanceMap<Annotation> annotations) -> !annotations.containsKey(MayOptionallyUse.class)) .keySet(); }
if (annotationMap.containsKey(AllowCodeBetweenLines.class)) { List<UBlank> blanks = new ArrayList<>(); for (int i = 0; i < beforeTemplates.size(); i++) { if (afterTemplate.annotations().containsKey(AlsoNegation.class)) { negatedAfterTemplates.add(((ExpressionTemplate) afterTemplate).negation());
Inliner inliner = match.createInliner(); Context context = inliner.getContext(); if (annotations().containsKey(UseImportPolicy.class)) { ImportPolicy.bind(context, annotations().getInstance(UseImportPolicy.class).value()); } else {
/** * Generates a {@link SuggestedFix} replacing the specified match (usually of another template) * with this template. */ @Override public Fix replace(ExpressionTemplateMatch match) { Inliner inliner = match.createInliner(); Context context = inliner.getContext(); if (annotations().containsKey(UseImportPolicy.class)) { ImportPolicy.bind(context, annotations().getInstance(UseImportPolicy.class).value()); } else { ImportPolicy.bind(context, ImportPolicy.IMPORT_TOP_LEVEL); } int prec = getPrecedence(match.getLocation(), context); SuggestedFix.Builder fix = SuggestedFix.builder(); try { StringWriter writer = new StringWriter(); pretty(inliner.getContext(), writer).printExpr(expression().inline(inliner), prec); fix.replace(match.getLocation(), writer.toString()); } catch (CouldNotResolveImportException e) { logger.log(SEVERE, "Failure to resolve in replacement", e); } catch (IOException e) { throw new RuntimeException(e); } return addImports(inliner, fix); }