[
https://issues.apache.org/jira/browse/FELIX-1868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778250#action_12778250
]
Marcel Offermans commented on FELIX-1868:
-----------------------------------------
A couple of comments here:
1) Of course one can argue, but I would not return new Date(), which is the
*current* date, as the default for a date that has not been supplied, but use
new Date(0) instead (the oldest possible date). Admittedly the Date class is
one of the most broken ones in the JDK. :)
This should be easy to fix.
2) Adding new interface types to a static map means that a reference to these
types stays in memory forever which hurts the ability to unload these classes
after an update.
Because of this I don't want to apply this as is.
3) I am a bit worried about adding recursion to the NullObject when it comes to
returning itself.
Needs further discussion, but if we can find cases where this leads to infinite
recursion, I don't think that's good behaviour for the "default" null object.
Of course, there always is the option to supply your own "default
implementation" in specialized cases where you *know* these things are not an
issue.
> DM/ NullObject improvement
> --------------------------
>
> Key: FELIX-1868
> URL: https://issues.apache.org/jira/browse/FELIX-1868
> Project: Felix
> Issue Type: Improvement
> Components: Dependency Manager
> Affects Versions: dependencymanager-2.0.1
> Reporter: Pierre De Rop
> Priority: Minor
> Attachments: DefaultNullObject.java
>
>
> Here are three improvements concerning the Default NullObject in DM:
> 1) support for a default Date return type
> 2) support for a default String return type
> 3) return a NullObject for method whose return type is not a primitive type.
> For example, currently, the following "MyService.getSomething()" method can't
> return a NullObject with the current DefaultNullObject: class:
> interface MyService {
> Something getSomething();
> }
> interface Something {
> }
>
> See attached patch
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.