Skip to content

problem with string concatenation with parboiled java 1.4.1 #203

@plamaiziere

Description

@plamaiziere

Hello,

I use parboiled since a long time to parse some routers configuration files. I've got a lot of test cases to test the parsers results.
With version 1.4.1 few test cases fail when, in the parser rules, i use string concatenation wih the '+' operator.
If I replace the '+' operator with the String.concat method this works fine.

Exemple:

public Rule AceTcpOldFlag() {
return
	Sequence(
		FirstOf(
			String("ack"),
			String("fin"),
			String("psh"),
			String("rst"),
			String("syn"),
			String("urg")
		),
		_ace.getTcpFlags().add("+" + match()), // ace.getTcpflags is a String list
		_ace.setTcpKeyword("match-any"),
		SkipSpaces()
	);
}

In a test case for this rule like "ack rst psh fin syn urg", flags are set with the match() value, (ie ack, fin, psh etc), but without the "+" at the start as if the string + operator does nothing.
If I replace the + operator with String.concat it works fine : _ace.getTcpFlags().add("+".concat(match()))

I tried with jdk11, jdk16 with the same problem. Also tried to use asm 9.3 instead asm 9.2.
All works fine if I specify 8 in the maven compiler plugin.

I think there is something wrong with the String + operator and ASM but I cannot reproduce this problem with a simple test parser
Any clue?

Thanks regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions