Open GoogleCodeExporter opened 9 years ago
Thanks !
(in fact they one should be required getter or setter, property without any setter or getter make no sense)
Original comment by elaat...@gmail.com
on 16 Oct 2013 at 8:50
Any reason this was not fixed in 1.4.5?
Original comment by l.brueni...@googlemail.com
on 16 Sep 2014 at 12:37
I came here seeing the same problem.
@Test
public void testInline() {
Assert.assertTrue(Pattern.compile("([\\w]+)\\:\\{\\s*([\\w\\(\\)'\"\\% ]+)\\s*\\|\\s*([\\w\\(\\)'\"\\%, ]+)\\s*\\|?\\s*(?:(?:type=)([\\w.\\$ \\<\\>]+))?\\}").matcher("propName:{getInt('propName')|setInt('propName', '%s')|type=java.lang.String}").matches());
Assert.assertTrue(Pattern.compile("([\\w]+)\\:\\{\\s*([\\w\\(\\)'\"\\% ]+)\\s*\\|\\s*([\\w\\(\\)'\"\\%, ]+)\\s*\\|?\\s*(?:(?:type=)([\\w.\\$ \\<\\>]+))?\\}").matcher("propName:{getInt('propName')|setInt('propName', '%s')}").matches());
Assert.assertTrue(Pattern.compile("([\\w]+)\\:\\{\\s*([\\w\\(\\)'\"\\% ]+)\\s*\\|\\s*([\\w\\(\\)'\"\\%, ]+)\\s*\\|?\\s*(?:(?:type=)([\\w.\\$ \\<\\>]+))?\\}").matcher("propName:{|setInt('propName', '%s')}").matches());
Assert.assertTrue(Pattern.compile("([\\w]+)\\:\\{\\s*([\\w\\(\\)'\"\\% ]+)\\s*\\|\\s*([\\w\\(\\)'\"\\%, ]+)\\s*\\|?\\s*(?:(?:type=)([\\w.\\$ \\<\\>]+))?\\}").matcher("propName:{getInt('propName')}").matches());
}
First two lines pass, second two lines fail
Original comment by dodts...@gmail.com
on 26 Feb 2015 at 11:26
This test will pass if you update the pattern. Updated pattern is included in
the test.
@Test
public void testInline() {
String pattern = "([\\w]+)\\:\\{(?:(?:\\s*([\\w\\(\\)'\"\\% ]+)\\s*)|(?:\\|\\s*([\\w\\(\\)'\"\\%, ]+)\\s*)){1,2}\\s*(?:(?:\\|type=)([\\w.\\$ \\<\\>]+))?\\}";
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{getInt('propName')|setInt('propName', '%s')|type=java.lang.String}").matches());
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{getInt('propName')|setInt('propName', '%s')}").matches());
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{|setInt('propName', '%s')}").matches());
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{getInt('propName')}").matches());
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{getInt('propName')|setInt('propName', '%s')|type=java.lang.String}").matches());
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{getInt('propName')|setInt('propName', '%s')}").matches());
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{|setInt('propName', '%s')}").matches());
Assert.assertFalse(Pattern.compile(pattern).matcher("propName:{}").matches());
Assert.assertFalse(Pattern.compile(pattern).matcher("propName:{|}").matches());
Assert.assertFalse(Pattern.compile(pattern).matcher("propName:{||}").matches());
Assert.assertFalse(Pattern.compile(pattern).matcher("propName:{||type=}").matches());
Assert.assertFalse(Pattern.compile(pattern).matcher("propName:{||type=java.lang.String}").matches());
Assert.assertFalse(Pattern.compile(pattern).matcher("propName:{|type=java.lang.String}").matches());
//False positive
Assert.assertTrue(Pattern.compile(pattern).matcher("propName:{|setInt('propName', '%s')|setInt('propName', '%s')|type=java.lang.String}").matches());
}
Original comment by dodts...@gmail.com
on 26 Feb 2015 at 11:47
Can you please make a pull request on github including the test
Original comment by elaat...@gmail.com
on 27 Feb 2015 at 3:34
Original issue reported on code.google.com by
l.brueni...@googlemail.com
on 9 Oct 2013 at 8:57