-
-
Notifications
You must be signed in to change notification settings - Fork 142
Refactor - adding different scala object detecting #656
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: 2.17
Are you sure you want to change the base?
Refactor - adding different scala object detecting #656
Conversation
src/main/scala/com/fasterxml/jackson/module/scala/util/ScalaObject.scala
Outdated
Show resolved
Hide resolved
|
||
case object TestCaseObject | ||
|
||
class TestClass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not add to src/test/scala
? does this not work with scala 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it the classes with names ending in $
- maybe scala3 doesn't allow this?
It is weird to have classes ending in $
- is there any way not to use these in tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are not necessary in tests but they are used just to make sure ScalaObject.unapply do not detect classes with names that end with a $
as scala singleton objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These class names are probably legal in scala 2 but illegal in scala 3. Since I haven't seen anyone in their right mind to use such class names I'm deleting them.
build fails with
|
I've corrected clazz.getSimpleName to clazz.getName - I wasn't aware that classes from inside of scala singleton objects cant produce propper simple name :/ |
@marcinbelicki I've started #657 - I may grab more of the changes in this PR but there I don't like all the new classes in this PR |
Ok, I see your point |
@marcinbelicki #657 is merged and will appear in v2.16.1 release - thanks for driving this |
I'm adding
ScalaObject
along withScalaObjectTest
to detect whether givenClass[_]
is a scala singleton object. I'm not sure ifclazz
can be a null but I'm addingOption(clazz)
inScalaObjectDeserializerResolver
just in case.