This piece of Stratego code makes JSGLR throw a ClassCastException:


module runtime_exception
rules
r:
t -> t
with
rules(
R :+= $( // missing parenthesis
);
rules (
R :+= $()
)

The exception:


org.spoofax.jsglr.FilterException: Runtime exception when applying filters
at org.strategoxt.imp.runtime.parser.JSGLRI.doParseNoImplode(JSGLRI.java:151)
at org.strategoxt.imp.runtime.parser.JSGLRI.doParseNoImplode(JSGLRI.java:110)
at org.strategoxt.imp.runtime.parser.AbstractSGLRI.parseNoImplode(AbstractSGLRI.java:183)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parseNoImplode(SGLRParseController.java:351)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:286)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:1)
at org.strategoxt.imp.runtime.dynamicloading.DynamicParseController.parse(DynamicParseController.java:166)
at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:86)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.spoofax.jsglr.FilterException: Runtime exception when applying filters
at org.spoofax.jsglr.Disambiguator.applyFilters(Disambiguator.java:207)
at org.spoofax.jsglr.SGLR.sglrParse(SGLR.java:338)
at org.spoofax.jsglr.SGLR.sglrParse(SGLR.java:315)
at org.spoofax.jsglr.SGLR.parse(SGLR.java:241)
at org.strategoxt.imp.runtime.parser.JSGLRI.doParseNoImplode(JSGLRI.java:140)
… 8 more
Caused by: java.lang.ClassCastException: org.spoofax.jsglr.Amb cannot be cast to org.spoofax.jsglr.ParseNode
at org.spoofax.jsglr.Disambiguator.applyRightAssociativeFilter(Disambiguator.java:485)
at org.spoofax.jsglr.Disambiguator.applyAssociativityPriorityFilter(Disambiguator.java:439)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:380)
at org.spoofax.jsglr.Disambiguator.filterAmbiguities(Disambiguator.java:715)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:358)
at org.spoofax.jsglr.Disambiguator.filterAmbiguities(Disambiguator.java:715)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:351)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:364)
at org.spoofax.jsglr.Disambiguator.applyFilters(Disambiguator.java:199)
… 12 more

Also, an IndexOutOfBoundsException can be triggered by inserting "] at the place where the ) is missing.


Caused by: java.lang.IndexOutOfBoundsException: Index: 4,Size: 4
at java.util.SubList.rangeCheck(AbstractList.java:746)
at java.util.SubList.get(AbstractList.java:619)
at org.spoofax.jsglr.Disambiguator.computeDistinctArguments(Disambiguator.java:1097)
at org.spoofax.jsglr.Disambiguator.filterOnIndirectPrefers(Disambiguator.java:987)
at org.spoofax.jsglr.Disambiguator.filter(Disambiguator.java:791)
at org.spoofax.jsglr.Disambiguator.filterAmbiguityList(Disambiguator.java:753)
at org.spoofax.jsglr.Disambiguator.filterAmbiguities(Disambiguator.java:726)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:358)
at org.spoofax.jsglr.Disambiguator.filterAmbiguities(Disambiguator.java:715)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:351)
at org.spoofax.jsglr.Disambiguator.filterTree(Disambiguator.java:397)

Submitted by Tobi Vollebregt on 13 December 2010 at 12:51

On 13 December 2010 at 12:53 Tobi Vollebregt tagged parser

On 14 December 2010 at 11:47 Lennart Kats tagged 1.0

On 14 December 2010 at 11:48 Lennart Kats tagged @lennartkats

On 14 December 2010 at 15:11 Lennart Kats commented:

This seems to be a deployment bug; apparently a local test version of JSGLR was shipped with 0.6.0.1 and possibly with some of the earlier unstables. 0.6.0.2 should fix this.


On 14 December 2010 at 15:11 Lennart Kats closed this issue.

On 14 December 2010 at 15:11 Lennart Kats tagged 0.6

On 14 December 2010 at 15:11 Lennart Kats tagged 0.6.0.2

On 14 December 2010 at 15:11 Lennart Kats removed tag 0.6

On 14 December 2010 at 15:11 Lennart Kats removed tag 1.0

On 16 December 2010 at 15:43 Lennart Kats tagged 0.6.0

On 16 December 2010 at 15:43 Lennart Kats removed tag 0.6.0.2

Log in to post comments