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

Java annotation is treated as Boa modifier causing stack empty exception #174

Open
nguyenhoan opened this issue Feb 7, 2018 · 5 comments

Comments

@nguyenhoan
Copy link
Contributor

sb.setExpression(expressions.pop());

When the default expression is an annotation.
A modifier will be generated instead of an expression.

@nguyenhoan
Copy link
Contributor Author

An ugly solution is to check all relevant global stacks and pop the one that is not empty.
Any others?

@psybers
Copy link
Member

psybers commented Feb 7, 2018

Why not test the type of getDefault() and pop the modifiers if its an annotation, or pop expression otherwise?

@nguyenhoan
Copy link
Contributor Author

That's ugly :).
We might need to check all locations of pop() to make sure we did not miss anything.

@psybers
Copy link
Member

psybers commented Feb 7, 2018

It's ugly, but less ugly than your suggestion (which is actually wrong - it's possible other stacks might not be empty at that point due to nested classes). And it actually makes sense if they child could be multiple things. The question is though, if we get a modifier what do we stick into Boa's AST?

@nguyenhoan
Copy link
Contributor Author

I thought it was a statement but it is actually a method.

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

2 participants