Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » NPE while using content assist in xtext generated editor(NPE in org.antlr.runtime(V3) in BaseRecognizer)
NPE while using content assist in xtext generated editor [message #654555] Wed, 16 February 2011 09:59 Go to next message
manasa  is currently offline manasa Friend
Messages: 32
Registered: October 2010
Member
Hi,

I am getting into an NPE when I type in a query with multiple nests, in the xtext generated editor.
I understand from earlier posts that issue is with BaseRecognizer of org.antlr.runtime version 3, where the system.arraycopy has a bug in it, that the entire array is not copied, like in the code below.

protected void pushFollow(BitSet fset) {
if ( (_fsp +1)>=following.length ) {
BitSet[] f = new BitSet[following.length*2];
System.arraycopy(following, 0, f, 0, following.length-1); following = f;
}
following[++_fsp] = fset;
}

Also i see that this is fixed in Version 3.2 of antlr from the bug, https://bugs.eclipse.org/bugs/show_bug.cgi?id=326509.
I want to confirm if this is already fixed in Version 3 of ANTLR too, if not I will proceed creating a bug for the same.

Thanks in advance.

Regards,
Manasa
Re: NPE while using content assist in xtext generated editor [message #654626 is a reply to message #654555] Wed, 16 February 2011 13:42 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 2961
Registered: July 2009
Senior Member
Hi Manasa,

the bug was fixed for Xtext 1.0.1 and Xtext 2.0 - no need to file a new
ticket.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 16.02.11 10:59, schrieb manasa:
> Hi,
>
> I am getting into an NPE when I type in a query with multiple nests, in
> the xtext generated editor. I understand from earlier posts that issue
> is with BaseRecognizer of org.antlr.runtime version 3, where the
> system.arraycopy has a bug in it, that the entire array is not copied,
> like in the code below.
>
> protected void pushFollow(BitSet fset) {
> if ( (_fsp +1)>=following.length ) {
> BitSet[] f = new BitSet[following.length*2];
> System.arraycopy(following, 0, f, 0, following.length-1); following = f;
> }
> following[++_fsp] = fset;
> }
>
> Also i see that this is fixed in Version 3.2 of antlr from the bug,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=326509
> I want to confirm if this is already fixed in Version 3 of ANTLR too, if
> not I will proceed creating a bug for the same.
>
> Thanks in advance.
>
> Regards,
> Manasa
Re: NPE while using content assist in xtext generated editor [message #654776 is a reply to message #654626] Thu, 17 February 2011 04:53 Go to previous messageGo to next message
manasa  is currently offline manasa Friend
Messages: 32
Registered: October 2010
Member
Thanks for the reply.
But we are using version 3 of ANTLR, and I see the issue exists.
Could you suggest how do we proceed here?

Thanks & Regards,
Manasa
Re: NPE while using content assist in xtext generated editor [message #654859 is a reply to message #654776] Thu, 17 February 2011 12:47 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 2961
Registered: July 2009
Senior Member
Hi Manasa,

Xtext 1.0.1 implements a workaround for that issue. What problems do you
see?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 17.02.11 05:53, schrieb manasa:
> Thanks for the reply. But we are using version 3 of ANTLR, and I see the
> issue exists. Could you suggest how do we proceed here?
>
> Thanks & Regards,
> Manasa
Re: NPE while using content assist in xtext generated editor [message #655032 is a reply to message #654859] Fri, 18 February 2011 05:22 Go to previous messageGo to next message
manasa  is currently offline manasa Friend
Messages: 32
Registered: October 2010
Member
Hi,

I am using XText version 1.0.1 and org.antlr.runtime version 3.0.0.
I try to type in the following query in the xtext based editor, using content assist.

LibrariesWithNests:
from Library as lib select lib where lib.books in (
from Book as b select b where b.instanceOf in (
from Manuscript as m select m where m.author in (
from

When I reach line 4, and try to use content assist, I get a NPE, like in the stack given below.


java.lang.NullPointerException
at org.antlr.runtime.BaseRecognizer.combineFollows(BaseRecogniz er.java:457)
at org.antlr.runtime.BaseRecognizer.computeContextSensitiveRule FOLLOW(BaseRecognizer.java:444)
at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedElemen t(BaseRecognizer.java:546)
at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Abs tractInternalContentAssistParser.recoverFromMismatchedToken( AbstractInternalContentAssistParser.java:182)
at org.antlr.runtime.BaseRecognizer.mismatch(BaseRecognizer.jav a:119)
at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Abs tractInternalContentAssistParser.mismatch(AbstractInternalCo ntentAssistParser.java:354)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:9 9)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__QueryExpression__Group__2__Impl( InternalQueryParser.java:9175)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__QueryExpression__Group__2(Intern alQueryParser.java:9140)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__QueryExpression__Group__1(Intern alQueryParser.java:9062)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__QueryExpression__Group__0(Intern alQueryParser.java:8989)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.ruleQueryExpression(InternalQueryParse r.java:1775)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__Expression__Alternatives(Interna lQueryParser.java:2214)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.ruleExpression(InternalQueryParser.jav a:1250)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__ExpressionWhereEntry__RhsAssignm ent_2(InternalQueryParser.java:10392)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__ExpressionWhereEntry__Group__2__ Impl(InternalQueryParser.java:8624)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__ExpressionWhereEntry__Group__2(I nternalQueryParser.java:8585)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__ExpressionWhereEntry__Group__1(I nternalQueryParser.java:8507)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__ExpressionWhereEntry__Group__0(I nternalQueryParser.java:8425)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.ruleExpressionWhereEntry(InternalQuery Parser.java:1100)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__ConcreteWhereEntry__Alternatives (InternalQueryParser.java:2012)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.ruleConcreteWhereEntry(InternalQueryPa rser.java:950)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__AndWhereEntry__Group__0__Impl(In ternalQueryParser.java:7734)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__AndWhereEntry__Group__0(Internal QueryParser.java:7694)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.ruleAndWhereEntry(InternalQueryParser. java:875)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__WhereEntry__Group__0__Impl(Inter nalQueryParser.java:7225)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__WhereEntry__Group__0(InternalQue ryParser.java:7185)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.ruleWhereEntry(InternalQueryParser.jav a:800)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__MQLquery__WhereEntryAssignment_6 _1(InternalQueryParser.java:9607)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__MQLquery__Group_6__1__Impl(Inter nalQueryParser.java:4331)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__MQLquery__Group_6__1(InternalQue ryParser.java:4292)
at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna l.InternalQueryParser.rule__MQLquery__Group_6__0(InternalQue ryParser.java:4223)

However, when i override pushFollow method in the generated InternalParser class in .ui project, i no more see the NPE occuring.

protected void pushFollow(BitSet fset) {
   if ( (_fsp +1)>=following.length ) {
      BitSet[] f = new BitSet[following.length*2];
//modified last parameter from following.length-1 to following.length      
System.arraycopy(following, 0, f, 0, following.length);      
following = f;
   }
   following[++_fsp] = fset;
}


I see that this bug is not fixed in xtext version 1.0.1 when used with antlr Version 3. If the workaround is in place, could you clarify how can we use it to fix this issue.

Thanks & Regards,
Manasa
Re: NPE while using content assist in xtext generated editor [message #655318 is a reply to message #655032] Sat, 19 February 2011 12:10 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 2961
Registered: July 2009
Senior Member
Hi Manasa,

sorry, I was wrong about the version. The fix made it into Xtext 1.0.2
which will be released in a couple of days. It is already available on
the nightly update site
http://download.eclipse.org/modeling/tmf/updates/nightly/

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 18.02.11 06:22, schrieb manasa:
> Hi,
>
> I am using XText version 1.0.1 and org.antlr.runtime version 3.0.0.
> I try to type in the following query in the xtext based editor, using
> content assist.
>
> LibrariesWithNests:
> from Library as lib select lib where lib.books in (
> from Book as b select b where b.instanceOf in (
> from Manuscript as m select m where m.author in (
> from
> When I reach line 4, and try to use content assist, I get a NPE, like in
> the stack given below.
>
>
> java.lang.NullPointerException
> at org.antlr.runtime.BaseRecognizer.combineFollows(BaseRecogniz
> er.java:457)
> at org.antlr.runtime.BaseRecognizer.computeContextSensitiveRule
> FOLLOW(BaseRecognizer.java:444)
> at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedElemen
> t(BaseRecognizer.java:546)
> at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Abs
> tractInternalContentAssistParser.recoverFromMismatchedToken(
> AbstractInternalContentAssistParser.java:182)
> at org.antlr.runtime.BaseRecognizer.mismatch(BaseRecognizer.jav a:119)
> at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Abs
> tractInternalContentAssistParser.mismatch(AbstractInternalCo
> ntentAssistParser.java:354)
> at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:9 9)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__QueryExpression__Group__2__Impl(
> InternalQueryParser.java:9175)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__QueryExpression__Group__2(Intern
> alQueryParser.java:9140)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__QueryExpression__Group__1(Intern
> alQueryParser.java:9062)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__QueryExpression__Group__0(Intern
> alQueryParser.java:8989)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.ruleQueryExpression(InternalQueryParse r.java:1775)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__Expression__Alternatives(Interna
> lQueryParser.java:2214)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.ruleExpression(InternalQueryParser.jav a:1250)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__ExpressionWhereEntry__RhsAssignm
> ent_2(InternalQueryParser.java:10392)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__ExpressionWhereEntry__Group__2__
> Impl(InternalQueryParser.java:8624)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__ExpressionWhereEntry__Group__2(I
> nternalQueryParser.java:8585)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__ExpressionWhereEntry__Group__1(I
> nternalQueryParser.java:8507)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__ExpressionWhereEntry__Group__0(I
> nternalQueryParser.java:8425)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.ruleExpressionWhereEntry(InternalQuery
> Parser.java:1100)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__ConcreteWhereEntry__Alternatives
> (InternalQueryParser.java:2012)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.ruleConcreteWhereEntry(InternalQueryPa rser.java:950)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__AndWhereEntry__Group__0__Impl(In
> ternalQueryParser.java:7734)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__AndWhereEntry__Group__0(Internal
> QueryParser.java:7694)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.ruleAndWhereEntry(InternalQueryParser. java:875)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__WhereEntry__Group__0__Impl(Inter
> nalQueryParser.java:7225)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__WhereEntry__Group__0(InternalQue
> ryParser.java:7185)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.ruleWhereEntry(InternalQueryParser.jav a:800)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__MQLquery__WhereEntryAssignment_6
> _1(InternalQueryParser.java:9607)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__MQLquery__Group_6__1__Impl(Inter
> nalQueryParser.java:4331)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__MQLquery__Group_6__1(InternalQue
> ryParser.java:4292)
> at org.eclipse.emf.query2.syntax.ui.contentassist.antlr.interna
> l.InternalQueryParser.rule__MQLquery__Group_6__0(InternalQue
> ryParser.java:4223)
>
> However, when i override pushFollow method in the generated
> InternalParser class in .ui project, i no more see the NPE occuring.
>
>
> protected void pushFollow(BitSet fset) {
> if ( (_fsp +1)>=following.length ) {
> BitSet[] f = new BitSet[following.length*2];
> //modified last parameter from following.length-1 to following.length
> System.arraycopy(following, 0, f, 0, following.length); following = f;
> }
> following[++_fsp] = fset;
> }
>
>
> I see that this bug is not fixed in xtext version 1.0.1 when used with
> antlr Version 3. If the workaround is in place, could you clarify how
> can we use it to fix this issue.
>
> Thanks & Regards,
> Manasa
Re: NPE while using content assist in xtext generated editor [message #655685 is a reply to message #655318] Tue, 22 February 2011 09:59 Go to previous message
manasa  is currently offline manasa Friend
Messages: 32
Registered: October 2010
Member
Ok.Thanks for the update.
Could you let me know when xtext 1.0.2 is expected to be released, or where can i check the latest updates about its release.

Thanks & Regards,
Manasa
Previous Topic:Xtext Grammer Issue
Next Topic:Generated Xtext FAQ
Goto Forum:
  


Current Time: Mon Dec 22 03:44:59 GMT 2014

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

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