openrewrite / rewrite-migrate-java

OpenRewrite recipes for migrating to newer versions of Java.
Apache License 2.0
102 stars 71 forks source link

Migrate StringTokenizer #488

Open delanym opened 4 months ago

delanym commented 4 months ago

StringTokenizer is a legacy class and can be replaced entirely with String.split

StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead. https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/StringTokenizer.html

timtebeek commented 4 months ago

Thanks for the suggestion @delanym ; I've moved this to rewrite-migrate-java, as that's where we also have other recipes that adopt features added in later Java versions. I see some usage examples here, which could help shape any recipe implementation and tests.