Skip to content
New issue

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

[Bug]: A NullPointerException is generated when running bal doc #43504

Open
nipunayf opened this issue Oct 11, 2022 · 0 comments
Open

[Bug]: A NullPointerException is generated when running bal doc #43504

nipunayf opened this issue Oct 11, 2022 · 0 comments

Comments

@nipunayf
Copy link
Contributor

Description

The following NullPointerException message is generated when running the bal doc command after exposing a union type through a public type.

# Description
public type PublicType PrivateType;

type PrivateType string|int;
Generating API Documentation
ballerina: Oh no, something really went wrong. Bad. Sad.

We appreciate it if you can report the code that broke Ballerina in
https://github.com/ballerina-platform/ballerina-lang/issues with the
log you get below and your sample code.

We thank you for helping make us better.

[2022-10-11 13:09:51,987] SEVERE {b7a.log.crash} - null 
java.lang.NullPointerException
        at org.ballerinalang.docgen.Generator.addTypeDefinition(Generator.java:192)
        at org.ballerinalang.docgen.Generator.setModuleFromSyntaxTree(Generator.java:122)
        at org.ballerinalang.docgen.docs.BallerinaDocGenerator.getDocsGenModel(BallerinaDocGenerator.java:484)
        at org.ballerinalang.docgen.docs.BallerinaDocGenerator.generateAPIDocs(BallerinaDocGenerator.java:195)
        at io.ballerina.cli.task.CreateDocsTask.execute(CreateDocsTask.java:60)
        at io.ballerina.cli.TaskExecutor.executeTasks(TaskExecutor.java:40)
        at io.ballerina.cli.cmd.DocCommand.execute(DocCommand.java:185)
        at java.base/java.util.Optional.ifPresent(Optional.java:183)
        at io.ballerina.cli.launcher.Main.main(Main.java:51)

However, the command works if the PrivateType is public or it only consists of one type as, type PrivateType int;

Steps to Reproduce

  1. Create a new package and add the following lines in the main.bal
# Description
public type PublicType PrivateType;

type PrivateType string|int;
  1. Run the bal doc command on the package.

Affected Version(s)

2201.2.1

OS, DB, other environment details and versions

OS - Ubuntu 22.04.1 LTS

Related area

-> API Docs

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot transferred this issue from ballerina-platform/ballerina-lang Oct 11, 2022
@anupama-pathirage anupama-pathirage transferred this issue from ballerina-platform/ballerina-dev-tools Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants