Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle annotations in TypeFromExpressionVisitor; fixes #5435 #5442

Merged
merged 4 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions checker/tests/tainting/Issue5435.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Issue5435 {
public @interface A1 {}

public @interface A2 {
A1[] m() default {@A1()};
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.checkerframework.framework.type;

import com.sun.source.tree.AnnotatedTypeTree;
import com.sun.source.tree.AnnotationTree;
import com.sun.source.tree.ArrayAccessTree;
import com.sun.source.tree.ArrayTypeTree;
import com.sun.source.tree.AssignmentTree;
Expand Down Expand Up @@ -74,6 +75,11 @@
*/
class TypeFromExpressionVisitor extends TypeFromTreeVisitor {

@Override
public AnnotatedTypeMirror visitAnnotation(AnnotationTree node, AnnotatedTypeFactory f) {
return f.type(node);
}

@Override
public AnnotatedTypeMirror visitBinary(BinaryTree node, AnnotatedTypeFactory f) {
return f.type(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public AnnotatedTypeMirror defaultAction(Tree node, AnnotatedTypeFactory f) {
throw new BugInCF("TypeFromTree.defaultAction: null tree");
}
throw new BugInCF(
"TypeFromTree.defaultAction: conversion undefined for tree type " + node.getKind());
this.getClass().getCanonicalName()
+ ": conversion undefined for tree type "
+ node.getKind());
}
}