### Question:
JCTreeUtils { public boolean hasBody(final JCTree element) { Class bodyClass = JCTree.JCBlock.class; Class staClass = JCTree.JCStatement.class; Field[] declaredFields = element.getClass().getDeclaredFields(); return Arrays.stream(declaredFields) .filter(field -> field.getName().equals("body")) .filter(field -> field.getType().equals(bodyClass) || field.getType().equals(staClass)) .findAny().isPresent(); }  String getRepeatPart(String messagePattern); boolean hasBody(final JCTree element); @SneakyThrows JCTree.JCStatement getBody(final JCTree element); com.sun.tools.javac.util.List<JCTree.JCStatement> generateNewBody(JCTree parentheses, JCTree.JCStatement block, JCTree.JCStatement methodCall); String message(String[] valueFromAnn, ConfigurationKey<String> key, ClassContext context); static final String REPEAT_PATTERN; static final VoidAnnotation VOID_ANN; }### Answer:
@Test public void testHasBody() throws Exception { JCTree.JCBlock block = new JCTree.JCBlock(0, null) { }; class Method extends JCTree.JCMethodDecl { public Method(JCModifiers jcModifiers, Name name, JCExpression jcExpression, List<JCTypeParameter> list, JCVariableDecl jcVariableDecl, List<JCVariableDecl> list1, List<JCExpression> list2, JCBlock jcBlock, JCExpression jcExpression1, Symbol.MethodSymbol methodSymbol) { super(jcModifiers, name, jcExpression, list, jcVariableDecl, list1, list2, jcBlock, jcExpression1, methodSymbol); } }; Assertions.assertFalse(JCTreeUtils.hasBody(block)); }