Skip to content

Java parses leading annotation #20064

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

Closed
wants to merge 1 commit into from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Apr 2, 2024

Motivated by #20026

if in.token == PACKAGE then
if !leadingAnnots.isEmpty then
//if (unit.source.file.name != "package-info.java")
// syntaxError(pos, "package annotations must be in file package-info.java")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure scalac needs to enforce this javac rule if the annotations are not used

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think generally we don't add code to enforce Java rules that don't affect us in any way.

@som-snytt som-snytt marked this pull request as ready for review April 2, 2024 13:15
@som-snytt som-snytt force-pushed the issue/20026-java-parse branch from 9fca170 to 637e421 Compare April 2, 2024 13:17
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


object Test extends App {
println {
new JTest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same remark as in scala 2) add reference to JFun and KTest?

if in.token == PACKAGE then
if !leadingAnnots.isEmpty then
//if (unit.source.file.name != "package-info.java")
// syntaxError(pos, "package annotations must be in file package-info.java")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think generally we don't add code to enforce Java rules that don't affect us in any way.

@som-snytt som-snytt marked this pull request as draft April 3, 2024 00:02
@som-snytt
Copy link
Contributor Author

Drafting to forward port the related annotations commits from Scala 2.

@SethTisue
Copy link
Member

@som-snytt I've merged the Scala 2 one. Does this one need to be updated or is it ready to go?

@som-snytt som-snytt marked this pull request as ready for review April 8, 2024 21:53
@som-snytt
Copy link
Contributor Author

@SethTisue I assume there is more annotations work to forward port, but I haven't had a chance (will) to look at it. Undrafting because it fixes something. I guess a solar eclipse can result in either a burst of productivity or a shadowed malaise.

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

Successfully merging this pull request may close these issues.

3 participants