On Jan 16, 2009, at 3:21 PM, Gerald Rosenberg wrote:
> At 01:20 PM 1/16/2009, Jim Idle wrote: >> Gerald Rosenberg wrote: >>> Bug in the Java target code generation? -- possibly related to >>> ANTLR-357 >> Basically, the references are not really intended to be used like >> that, but you get away with it quite a lot of the time. You should >> really do this: >> >> CommonToken ct = $k.start; >> // Check for null and so on here >> gDecl.setName(ct.getStartIndex()); > > Thanks, Jim. I realize the work around is obvious. > > What is not so obvious is intent. To all appearances, the code gen > is intending to do the right thing -- it produces valid code, but > vulnerable to the run-time NPE. I just wanted to raise the issue so > that it might be noted by someone with Jira rights and hopefully > addressed as Antlr continues to evolve. hi. yeah, the problem is that $k.start must be NPE protected. Anything that uses that expression could get an NPE though :( I don't see past $k.start so I can't know what you're doing with it. Ter List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
