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

Generate Random Class With Constructors #15

Open
volodya-lombrozo opened this issue Nov 29, 2023 · 2 comments
Open

Generate Random Class With Constructors #15

volodya-lombrozo opened this issue Nov 29, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers syntax This issues are related to syntax generation

Comments

@volodya-lombrozo
Copy link
Owner

As a developer I would like to test compilation of java classes with constructors:

public class SimpleClass {
    private int value;

    // Constructor
    public SimpleClass(int value) {
        this.value = value;
    }
}
@volodya-lombrozo volodya-lombrozo changed the title Generate Java Class With Constructors Generate Random Class With Constructors Nov 29, 2023
@volodya-lombrozo
Copy link
Owner Author

In order to add constructor support, you might need to modify the Java8ReducedLexer.g4 grammar. This change will alter the output of the RandomJavaClass. The full Java8Lexer.g4 grammar might also be helpful as a guide. For now, it will be sufficient to add constructors with an empty body:

public SimpleClass(int value) {}

private SimpleClass() {}

public SimpleClass(String some, int[] value) {}

We also shouldn't forget to add unit tests for this case. Additionally, you might encounter some performance issues along the way, which would be better to log directly in the issues or create another puzzle for it.

@0pdd
Copy link

0pdd commented Jan 29, 2025

@volodya-lombrozo the puzzle #124 is still not solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers syntax This issues are related to syntax generation
Projects
None yet
Development

No branches or pull requests

2 participants