Tolerate redundant '.' before '[' in properties file

See: https://www.pivotaltracker.com/story/show/175147973
This commit is contained in:
Kris De Volder
2020-10-19 10:56:55 -07:00
parent 089591266b
commit 3180b5daf0
2 changed files with 17 additions and 0 deletions

View File

@@ -78,6 +78,9 @@ public class PropertyNavigator {
if (type!=null) {
if (offset<region.getEnd()) {
char navOp = getChar(offset);
if (navOp=='.' && getChar(offset+1)=='[') {
navOp = '['; // just skip the redundant '.'. See: https://www.pivotaltracker.com/story/show/175147973
}
if (navOp=='.') {
if (typeUtil.isDotable(type)) {
return dotNavigate(offset, type);

View File

@@ -583,6 +583,20 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
//no other problems
);
}
@Test public void test_PT_175147973_tolerate_extra_dot_before_lbrack() throws Exception {
//See: https://www.pivotaltracker.com/story/show/175147973
IJavaProject p = createPredefinedMavenProject("map-of-pojo");
useProject(p);
Editor editor = newEditor(
"my.map.[foo.bar].age=foo-age\n" +
"my.map[foo.bar].age=bar-age\n"
);
editor.assertProblems(
"foo-age|'int'",
"bar-age|'int'"
);
}
@Test public void test_GH_534() throws Exception {
IJavaProject p = createPredefinedMavenProject("map-of-pojo");