[
https://issues.apache.org/jira/browse/LUCENE-7010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15130479#comment-15130479
]
Shai Erera commented on LUCENE-7010:
------------------------------------
How can you not find {{TestNoMergePolicy}}? It's been existed in the code since
{{NoMergePolicy}} was added. Here's the relevant test that I was talking about:
{code}
@Test
public void testMethodsOverridden() throws Exception {
// Ensures that all methods of MergePolicy are overridden. That's important
// to ensure that NoMergePolicy overrides everything, so that no unexpected
// behavior/error occurs
for (Method m : NoMergePolicy.class.getMethods()) {
// getDeclaredMethods() returns just those methods that are declared on
// NoMergePolicy. getMethods() returns those that are visible in that
// context, including ones from Object. So just filter out Object. If in
// the future MergePolicy will extend a different class than Object, this
// will need to change.
if (m.getName().equals("clone")) {
continue;
}
if (m.getDeclaringClass() != Object.class &&
!Modifier.isFinal(m.getModifiers())) {
assertTrue(m + " is not overridden ! ", m.getDeclaringClass() ==
NoMergePolicy.class);
}
}
}
{code}
I don't mind removing this particular test, but it's there to ensure that if MP
adds more methods in the future that NoMP should handle, we catch that.
> Create MergePolicyWrapper
> -------------------------
>
> Key: LUCENE-7010
> URL: https://issues.apache.org/jira/browse/LUCENE-7010
> Project: Lucene - Core
> Issue Type: Improvement
> Components: core/index
> Reporter: Shai Erera
> Assignee: Shai Erera
> Attachments: LUCENE-7010.patch
>
>
> We currently have two MergePolicy implementations that are wrappers around
> another MP: {{SortingMergePolicy}} and {{UpgradeIndexMergePolicy}}. A
> {{MergePolicyWrapper}} will simplify building additional such wrapping MPs by
> delegating all method calls to the wrapped instance, and allowing
> implementations to override only what they need.
> Also, this issue removes the {{final}} modifier from MP public methods so
> that they can be delegated properly. See LUCENE-7008 for a test failure that
> uncovered this issue.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]