[ 
https://issues.apache.org/jira/browse/OAK-11656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Reschke updated OAK-11656:
---------------------------------
    Description: 
Can be relatively easy replaced, such as with:

{code}
    @Nullable private DocumentStore memoizedDocumentStore = null;
    protected Supplier<DocumentStore> documentStoreSupplier = () -> 
memoizedDocumentStore = Objects.requireNonNullElse(memoizedDocumentStore, new 
MemoryDocumentStore());
{code}

or by the classical:

{code}
    @Nullable private DocumentStore memoizedDocumentStore = null;
    @NonNull DocumentStore getDocumentStore() {
        memoizedDocumentStore = 
Objects.requireNonNullElse(memoizedDocumentStore, new MemoryDocumentStore()):
        return memoizedDocumentStore;
   }
{code}

Both variants require a visible local variable though.

...but we only have 8 instances outside tests.



  was:
Can be relatively easy replaced, such as with:

{code}
    private DocumentStore memoizedDocumentStore = null;
    protected Supplier<DocumentStore> documentStoreSupplier = () -> 
memoizedDocumentStore = Objects.requireNonNullElse(memoizedDocumentStore, new 
MemoryDocumentStore());
{code}

or by the classical:

{code}
    private DocumentStore memoizedDocumentStore = null;
    protected Supplier<DocumentStore> documentStoreSupplier = () -> 
memoizedDocumentStore = Objects.requireNonNullElse(memoizedDocumentStore, new 
MemoryDocumentStore());
{code}




> Remove usage of Guava Suppliers.memoize
> ---------------------------------------
>
>                 Key: OAK-11656
>                 URL: https://issues.apache.org/jira/browse/OAK-11656
>             Project: Jackrabbit Oak
>          Issue Type: Technical task
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>            Priority: Minor
>
> Can be relatively easy replaced, such as with:
> {code}
>     @Nullable private DocumentStore memoizedDocumentStore = null;
>     protected Supplier<DocumentStore> documentStoreSupplier = () -> 
> memoizedDocumentStore = Objects.requireNonNullElse(memoizedDocumentStore, new 
> MemoryDocumentStore());
> {code}
> or by the classical:
> {code}
>     @Nullable private DocumentStore memoizedDocumentStore = null;
>     @NonNull DocumentStore getDocumentStore() {
>         memoizedDocumentStore = 
> Objects.requireNonNullElse(memoizedDocumentStore, new MemoryDocumentStore()):
>         return memoizedDocumentStore;
>    }
> {code}
> Both variants require a visible local variable though.
> ...but we only have 8 instances outside tests.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to