We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1.When I copy these codes: MethodSpec main = 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();
TypeSpec helloWorld = TypeSpec.classBuilder("HelloWorld") .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addMethod(main) .build(); JavaFile javaFile = JavaFile.builder("com.example.helloworld", helloWorld) .build(); javaFile.writeTo(System.out);
2.The editor appears:The method addModifiers(Modifier...) in the type TypeSpec.Builder is not applicable for the arguments (int, int)
The text was updated successfully, but these errors were encountered:
You probably didn't import the correct Modifier class. You need javax.lang.model.element.Modifier, not java.lang.reflect.Modifier.
Modifier
javax.lang.model.element.Modifier
java.lang.reflect.Modifier
Sorry, something went wrong.
No branches or pull requests
1.When I copy these codes:
MethodSpec main = 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();
2.The editor appears:The method addModifiers(Modifier...) in the type TypeSpec.Builder is not applicable for the arguments (int, int)
The text was updated successfully, but these errors were encountered: