[MDSAL-73] Java Bindings: do not generate underscores in identifiers Created: 05/Mar/15 Updated: 09/Mar/18 Resolved: 10/Mar/17 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | ||
| Reporter: | Robert Varga | Assignee: | Jakub Toth |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Issue Links: |
|
||||||||
| Description |
|
As per http://openjdk.java.net/jeps/213, using an underscore will become a hard error in JDK9. Update the binding specification to deal with this before the world breaks for us. |
| Comments |
| Comment by Vratko Polak [ 05/Mar/15 ] |
|
> In addition, using underscore ("_") as an identifier, which generates a warning as of Java SE 8, should be turned into an error in Java SE 9. > Complete the removal, begun in Java SE 8, of underscore from the set of legal identifier names. Current bug summary mentions "underscores in identifiers", which is way more general than "underscores as identifiers". |
| Comment by Robert Varga [ 05/Mar/15 ] |
|
Typo on my part. The headline is correct. |
| Comment by Vratko Polak [ 05/Apr/16 ] |
|
Link to the Java 9 technical task: https://bugs.openjdk.java.net/browse/JDK-8061549 |
| Comment by Martin Ciglan [ 13/Feb/17 ] |
|
just to confirm, underscores are allowed in constant names and enum values in generated Java code |
| Comment by Jakub Toth [ 13/Feb/17 ] |
| Comment by Vratko Polak [ 20/Feb/17 ] |
|
> https://git.opendaylight.org/gerrit/#/c/51132/ That fixes enums, but I do not think it fixes other identifies, such as leaf names. At least there are no unit tests for non-enum namespaces. |
| Comment by Martin Ciglan [ 21/Feb/17 ] |
|
Right, but given merged utility NonJavaCharsConverter.java: public static String convertIdentifier(final String identifier, final JavaIdentifier javaIdentifier) does the rest of the job. TODO: Jakub, please add more JUnit tests dealing with non enum inputs. |