diff --git a/framework/src/main/java/org/checkerframework/common/basetype/BaseTypeVisitor.java b/framework/src/main/java/org/checkerframework/common/basetype/BaseTypeVisitor.java index fa370c6948b..3205e3881e1 100644 --- a/framework/src/main/java/org/checkerframework/common/basetype/BaseTypeVisitor.java +++ b/framework/src/main/java/org/checkerframework/common/basetype/BaseTypeVisitor.java @@ -2262,9 +2262,8 @@ public Void visitReturn(ReturnTree tree, Void p) { AnnotatedTypeMirror ret = null; if (enclosing.getKind() == Tree.Kind.METHOD) { - - MethodTree enclosingMethod = TreePathUtil.enclosingMethod(getCurrentPath()); - boolean valid = validateTypeOf(enclosing); + MethodTree enclosingMethod = (MethodTree) enclosing; + boolean valid = validateTypeOf(enclosingMethod); if (valid) { ret = atypeFactory.getMethodReturnType(enclosingMethod, tree); }