Itamar,

Perhaps I'm wrong, but I think subclassing isn't (easy) solution: 

Related IndexWriter's methods are private, not protected, so I cannot call them 
even from subclass.
I also cannot copy the code, as segmentsInfos methods are used inside, and 
segmentInfos class is not exported so I'm not able to link.

Maybe protected will be good trade-off(?)

If methods remain private, I have to remove a lot of checks from tests. I can 
do that, of course, but I'm not sure if such test are still usefull.

And the last point - if methods remain private, we should simply remove them as 
a whole, because it is just a chunk of dead code.

Borek

> -----Original Message-----
> From: Itamar Syn-Hershko [mailto:ita...@code972.com]
> Sent: Monday, August 16, 2010 10:47 PM
> To: clucene-developers@lists.sourceforge.net
> Subject: Re: [CLucene-dev] IndexWriter's private methods for tests
> 
> Borek,
> 
> I had answered this in Jun 24th [1][2]. We pretty much agreed
> "friend"ing won't do much good.
> 
> I'd still prefer exposing this code only in the test suite and not in
> core, since it is only being used there - this can be achieved easily by
> subclassing. No reason to have them in core if all they are used for is
> tests, and I wouldn't want to add more compile switches...
> 
> Itamar.
> 
> [1] http://permalink.gmane.org/gmane.comp.jakarta.lucene.clucene.devel/3484
> [2] The whole discussion:
> http://comments.gmane.org/gmane.comp.jakarta.lucene.clucene.devel/3472
> 
> On 16/8/2010 4:00 PM, Kostka Bořivoj wrote:
> > In tests I'm porting following set of methods from IndexWriter is used:
> >
> >    //for test purposes
> >    int32_t getDocCount(int32_t i);
> >    int32_t getNumBufferedDocuments();
> >    int32_t getSegmentCount();
> >    int32_t getBufferedDeleteTermsSize();
> >    int32_t getNumBufferedDeleteTerms();
> >    SegmentInfo* newestSegment();
> >
> > The problem is all methods are marked private. In JLucene methods are 
> > without
> public/private definition,
> > so they are accessible from classes in same package (and test are in same
> package).
> > Such thing is not possible in C++, so I think methods should be changed to 
> > public.
> Otherwise tests cannot
> > be ported.
> >
> > Any other opinion?
> >
> > Borek
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > This SF.net email is sponsored by
> >
> > Make an app they can't live without
> > Enter the BlackBerry Developer Challenge
> > http://p.sf.net/sfu/RIM-dev2dev
> > _______________________________________________
> > CLucene-developers mailing list
> > CLucene-developers@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/clucene-developers
> >
> >
> >
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
> 
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> CLucene-developers mailing list
> CLucene-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/clucene-developers
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to