Skip to content

Conversation

Florian3k
Copy link
Contributor

Closes #20561

@Florian3k Florian3k requested a review from a team as a code owner October 5, 2025 22:58
@jchyb jchyb self-assigned this Oct 6, 2025
@jchyb jchyb self-requested a review October 6, 2025 09:38
Copy link
Contributor

@jchyb jchyb left a comment

Choose a reason for hiding this comment

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

Really great work!

I have some small nitpicks/suggestions, mostly connected to the tests.

I have also left one more general comment about the JavaRecordFields addition that isn't really actionable, but I still wanted to point this out in case you or anyone else from the compiler team have any better suggestions there.

def javaRecordFields(tp: Type)(using Context): List[Name] =
tp.typeSymbol.getAnnotation(defn.JavaRecordFieldsAnnot) match
case Some(JavaRecordFieldsAnnotation(fields)) => fields.map(termName)
case _ => assert(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't matter, but a little cleaner to just return Nil here in my opinion

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we would not need this, since we don't need that information pickled and it's only relevant for the current compilation run. We could add a property key for a tree, but that would only work for the situations where we use the JavaOutlineParser, when we read the classfiles we would not have access to a tree on which a property could be used. I see we can really only get this information out when parsing the tree, and we don't save it anywhere else, which I guess justifies the annotation here.

@jchyb jchyb assigned Florian3k and unassigned jchyb Oct 6, 2025
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.

Scala Pattern Matching on Java Records (JEP-440)
2 participants