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

Generating parser code from bnf creates multiple @NotNull annotations #251

Closed
slideclimb opened this issue Nov 14, 2020 · 1 comment
Closed

Comments

@slideclimb
Copy link

As of Grammar-Kit 2020.3, the generate parser code action on a bnf file creates two @NotNull annotations in a lot of Impl class constructors. This results in an exception:

error: NotNull is not a repeatable annotation type 
public LatexParameterImpl(@NotNull @NotNull ASTNode node) {

Unfortunately, I have not been able to reproduce this behaviour anywhere else than the project where I encountered it, TeXiFy-IDEA. For example, it does not happen when running this action on the bnf in the Simple language plugin example.

When generating the parser code on Latex.bnf it generates, among others, the following constructor (for LatexParameterImpl):

public LatexParameterImpl(@NotNull @NotNull ASTNode node) {
    super(node);
}

For TeXiFy, it does this in all Latex...Impl classes except LatexCommandsImpl, where the constructors are

public LatexCommandsImpl(@NotNull LatexCommandsStub stub, @NotNull IStubElementType type) {
    super(stub, type);
}

public LatexCommandsImpl(@NotNull ASTNode node) {
    super(node);
}

public LatexCommandsImpl(LatexCommandsStub stub, IElementType type, ASTNode node) {
    super(stub, type, node);
}

as expected. This class is the only class that has a Mixin, which is the only difference I could find between this and the other classes/elements. I have no idea if this has something to do with it.

This behaviour did not exist in Grammar-Kit 2020.1, so I will downgrade to that version for now.

gregsh added a commit that referenced this issue Nov 16, 2020
ClsParameterImpl returns different annotation instances.
To reproduce set SDK ASTWrapperPsiElement as a base class.
@gregsh
Copy link
Collaborator

gregsh commented Nov 16, 2020

Thanks, fixed. Feel free to grab the latest dev build.
As a workaround - use your own base element class instead of ASTWrapperPsiElement.

@gregsh gregsh closed this as completed Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants