@Overridepublicbooleanprocess(Set<?extendsTypeElement>annotations,RoundEnvironmentroundEnv){Set<?extendsElement>set=roundEnv.getElementsAnnotatedWith(Test.class);for(Elementelement:set){if(element.getKind()!=ElementKind.CLASS){processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,"only support class");}MethodSpecmain=MethodSpec.methodBuilder("main").addModifiers(Modifier.PUBLIC,Modifier.STATIC).returns(void.class).addParameter(String[].class,"args").addStatement("$T.out.println($S)",System.class,"Hello, JavaPoet!").build();TypeSpechelloWorld=TypeSpec.classBuilder("HelloWorld").addModifiers(Modifier.PUBLIC,Modifier.FINAL).addMethod(main).build();JavaFilejavaFile=JavaFile.builder("com.lighters.apt",helloWorld).build();try{javaFile.writeTo(processingEnv.getFiler());}catch(IOExceptione){e.printStackTrace();}}returnfalse;}