Skip to content

Drop scala 2.13#1524

Merged
olabusayoT merged 1 commit intoapache:mainfrom
olabusayoT:daf-3016-drop-scala213
Aug 11, 2025
Merged

Drop scala 2.13#1524
olabusayoT merged 1 commit intoapache:mainfrom
olabusayoT:daf-3016-drop-scala213

Conversation

@olabusayoT
Copy link
Contributor

  • remove specific scala-2 folders and move contents scala-3 folders into main scala
  • update import ._ to .*
  • update import rename => to as, and remove braces
  • update type wildcard _ to ?
  • update anonymous type param * to _
  • update vararg :* or @* to *

DAFFODIL-3016, DAFFODIL-3011

Copy link
Contributor

@mbeckerle mbeckerle left a comment

Choose a reason for hiding this comment

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

+1

These changes in Scala really are improvements, and they remove spurious differences from Java that were always unnecessary.

I suppose before Scala had its own identity there was a tendency to want it to be differentiated from Java syntax, but now that Scala is more widespread, there's no reason not to use the same syntax as Java for the same concepts. Everyone who learns Scala will either have learned Java before, or will learn Java after, so matching syntax for the same concepts helps, and eliminating the overloading of the same symbols like "=>" for multiple purposes is just a good idea.

I've been using Scala for 15 years and I've always wondered whether there was yet another overloading of the "_" character hidden somewhere in the syntax. :-)

Copy link
Member

@stevedlawrence stevedlawrence left a comment

Choose a reason for hiding this comment

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

+1, one minor suggestion

try {
// TODO scala 2.12 phase out, we can remove the check for the plain name, and always
// check the lazy name version instead
clazz.getDeclaredField(fieldName)
Copy link
Member

Choose a reason for hiding this comment

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

Should we keep this try/catch, just with a tweak to the comment?

This function is about using reflection to find a specific field of a class, so ideally it would work regardless if the field is lazy. With this change it only works for lazy fields.

Currently we only use it for parents, which is lazy and so everything works, but if we ever change parents to be non-lazy or use this function for some other non-lazy field it won't work as expected.

- remove specific scala-2 folders and move contents scala-3 folders into main scala
- update import ._ to .*
- update import rename => to as, and remove braces
- update type wildcard _ to ?
- update anonymous type param * to _
- update vararg :_* or @_* to *

DAFFODIL-3016, DAFFODIL-3011
@olabusayoT olabusayoT force-pushed the daf-3016-drop-scala213 branch from 26f7504 to 68f2b05 Compare August 11, 2025 16:39
@olabusayoT olabusayoT merged commit 74e58a4 into apache:main Aug 11, 2025
12 checks passed
@olabusayoT olabusayoT deleted the daf-3016-drop-scala213 branch August 11, 2025 16:58
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