-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
SimpleModule
not registered due to getTypeId()
returning an empty string
#5063
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
Comments
We ran into another related issue due to using the same Here is another example test that fails.
|
Ok: I think the first part -- not marking name as explicit when it is not -- makes sense. Would it make sense to change things so that if:
On using same name, that's... fundamentally difficult to change. But there is I think I'll consider this issue to be just for the originally reported problem, hence doing (1) from above. |
SimpleModule
not registered due to getTypeId()
returning an empty string
@seadbrane As per my comment, fixed the initial reported problem. I am not sure what to think about the second part -- I can see the concern, but at the same time, name as passed is assumed as unique type id and is by now the way things work so changing it might cause problems for existing use cases. But we could consider changes via another issue at any rate -- perhaps uniqueness check should start by checking implementation class and secondly given name. I think (could be wrong) that the change to use name was for sort of reverse purpose: ability for instances of same class to be distinguished as different modules. But the intent was not necessarily to make instances of different classes to be taken as "same" module. And in the end the whole unique/same checking is to try to help in accidental re-registrations, to guard against user error. |
Thanks for the fix. On the second part, there is really nothing that indicates that Related - not entirely sure what this is trying to say, although my interpretation is that it would probably return
|
Ok, open to Javadoc improvements as well. Will try to do first pass now. |
Oh boy. Yes, Javadocs and comments are seriously misaligned wrt actual code. Also looks like use of All of this said I think I'd like to keep behavior itself about as it is now for 2.x and correct Javadocs. For 3.0 more changes are possible. |
Search before asking
Describe the bug
I think the changes made for #3110 have resulted in some unintended behavior.
Specifically, the
new SimpleModule(Version)
constructor callsthis(version.getArtifactId(), version);
which sets_hasExplicitName = true
even though no explicit name was passed in. And sincegetArtifactId()
returns""
instead ofnull
, this results ingetTypeId()
returning the same""
for distinct modules.I think either
_hasExplicitName
name should not be set to true when it is not explicitly passed in, or_name
should be set to null ifgetArtifactId()
returns empty string. The former is probably easier since there validation in ObjectMapper to ensuregetModuleName()
is not null, although it doesn't really seem correct to implicitly set name to an empty string - especially when it can also result ingetTypeId()
being an empty string.Here is a simple test case:
Version Information
No response
Reproduction
<-- Any of the following
-->
// Your code here
Expected behavior
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: