Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Question on ContentAssistProcessorTestBuilder#append
Question on ContentAssistProcessorTestBuilder#append [message #1758593] Thu, 30 March 2017 11:48 Go to next message
Akos Kitta is currently offline Akos KittaFriend
Messages: 25
Registered: November 2015
Junior Member
Could someone please explain to me why `ContentAssistProcessorTestBuilder` returns with a new instance instead of `this` when appending content? For example here: `org.eclipse.xtext.junit4.ui.ContentAssistProcessorTestBuilder.append(String)`. In other words, why is it required to clone the current instance.

I am using 2.11.0.

Thanks!
Re: Question on ContentAssistProcessorTestBuilder#append [message #1758628 is a reply to message #1758593] Thu, 30 March 2017 17:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the code is quite old. it was introduced with https://github.com/eclipse/xtext/commit/0dc1bb90af1317e50442256cda273b5121fedae1#diff-a4934d9e0e768ddbe95e43a12b17d65d
i dont see a obvious reason but neither why it could harm




Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Question on ContentAssistProcessorTestBuilder#append [message #1758630 is a reply to message #1758628] Thu, 30 March 2017 18:32 Go to previous message
Akos Kitta is currently offline Akos KittaFriend
Messages: 25
Registered: November 2015
Junior Member
Yeah, I can live with this too, I was just surprised when the below code was broken due to the new instance creation:

  protected def newBuilder(String content) {
    val builder = new ContentAssistProcessorTestBuilder(injector, this) {

      @Override
      override protected toString(ICompletionProposal proposal) {
        return super.toString(proposal).trim;
      }

    };
    builder.append(content);
    return builder;
  }


Long story short, I was just interested if that is on purpose or not.

Thanks for the answer and looking up the commit!
Previous Topic:Custom class reference in inferrer
Next Topic:[SOLVED] What is the generated file ".File.dslbin"?
Goto Forum:
  


Current Time: Thu Apr 25 06:28:10 GMT 2024

Powered by FUDForum. Page generated in 1.76354 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top