Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.
This repository was archived by the owner on Oct 10, 2024. It is now read-only.

example error #900

@ZhanChaoHan

Description

@ZhanChaoHan

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions