paypal / butterfly

Application transformation tool
https://paypal.github.io/butterfly/
MIT License
47 stars 50 forks source link

Allow numbers in extension property #371

Closed badalsarkar closed 3 years ago

badalsarkar commented 3 years ago

Fixes #359 . The extension property name used with "-p" option, now allows numbers. I have also updated the test. Thank you.

badalsarkar commented 3 years ago

Travis CI is failing. I compiled my code with JDK 11 and all tests passed. But Travis is using JDK 8. I changed my JDK to 8 and I see one test is failing. Following is the reason which seems interesting. I am investigating.

lang.AssertionError: expected [The following properties are invalid: [, , 1a, -a, #a, a, b%]] but found [The following properties are invalid: [1a, , a, -a, b%, #a, ]]

I am putting the values in Properties in following order-

            Properties properties = new Properties();
            properties.put("", "v1");
            properties.put(" ", "v2");
            properties.put("1a", "v3");
            properties.put("-a", "v4");
            properties.put("#a", "v5");
            properties.put("a", new Object());
            properties.put("b%", "v6");

But while retrieving it is returning like [1a, , a, -a, b%, #a, ]

badalsarkar commented 3 years ago

Found it. In Java 11, the documentation says following-

The iterators returned by the iterator method of this class's "collection views" (that is, entrySet(), keySet(), and values()) may not fail-fast (unlike the Hashtable implementation). These iterators are guaranteed to traverse elements as they existed upon construction exactly once, and may (but are not guaranteed to) reflect any modifications subsequent to construction.

In Java 8, the order in not guaranteed. I will modify the test case and push it.