Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经弄清楚如何创建方法并添加到方法的主体中。我还需要做的是为生成的方法添加注释,例如@Test等,我将如何实现这一点?
@Test
如果您想在推断器中推断注释,您可以执行类似的操作
members += greeting.toMethod("testHello" + greeting.name, typeRef(Void.TYPE)) [ annotations += "org.junit.Test".annotationRef() body = ''' // TODO ''' ]