Skip to content

Commit

Permalink
refactor: Move @Nullable method annotations to the return type
Browse files Browse the repository at this point in the history
  • Loading branch information
2 people authored and app committed Jul 16, 2024
1 parent 040c501 commit c8a33eb
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,7 @@ private Set<String> getImportsAsStrings(Map<TemplateDescriptor, Set<String>> imp

/* Generate the minimal precondition that would allow to match each before template individually. */
@SuppressWarnings("SameParameterValue")
@Nullable
private String generatePreconditions(List<TemplateDescriptor> beforeTemplates, int indent) {
private @Nullable String generatePreconditions(List<TemplateDescriptor> beforeTemplates, int indent) {
Map<String, Set<String>> preconditions = new LinkedHashMap<>();
for (TemplateDescriptor beforeTemplate : beforeTemplates) {
int arity = beforeTemplate.getArity();
Expand Down Expand Up @@ -670,8 +669,7 @@ private Class<? extends JCTree> getType(JCTree.JCMethodDecl method) {
return returnExpression != null ? returnExpression.getClass() : method.getBody().getStatements().last().getClass();
}

@Nullable
private JCTree.JCExpression getReturnExpression(JCTree.JCMethodDecl method) {
private @Nullable JCTree.JCExpression getReturnExpression(JCTree.JCMethodDecl method) {
JCTree.JCStatement statement = method.getBody().getStatements().last();
if (statement instanceof JCTree.JCReturn) {
return ((JCTree.JCReturn) statement).expr;
Expand All @@ -681,8 +679,7 @@ private JCTree.JCExpression getReturnExpression(JCTree.JCMethodDecl method) {
return null;
}

@Nullable
private RuleDescriptor getRuleDescriptor(JCTree.JCClassDecl tree, Context context, JCCompilationUnit cu) {
private @Nullable RuleDescriptor getRuleDescriptor(JCTree.JCClassDecl tree, Context context, JCCompilationUnit cu) {
RuleDescriptor result = new RuleDescriptor(tree, cu, context);
for (JCTree member : tree.getMembers()) {
if (member instanceof JCTree.JCMethodDecl) {
Expand Down Expand Up @@ -715,8 +712,7 @@ public RuleDescriptor(JCTree.JCClassDecl classDecl, JCCompilationUnit cu, Contex
this.context = context;
}

@Nullable
private RefasterTemplateProcessor.RuleDescriptor validate() {
private @Nullable RefasterTemplateProcessor.RuleDescriptor validate() {
if (beforeTemplates.isEmpty()) {
return null;
}
Expand Down Expand Up @@ -939,8 +935,7 @@ private boolean resolve() {
return method != null;
}

@Nullable
private JCTree.JCMethodDecl resolve(JCTree.JCMethodDecl method) {
private @Nullable JCTree.JCMethodDecl resolve(JCTree.JCMethodDecl method) {
JavacResolution res = new JavacResolution(context);
try {
classDecl.defs = classDecl.defs.prepend(method);
Expand Down

0 comments on commit c8a33eb

Please sign in to comment.