Repository navigation
Conversation
No recipe covered `com.twilio.sdk:twilio`. This raises it to 13.x, declares what the SDK stopped bringing along, and changes the calls that have a mechanical replacement. Calls that need a decision are left for the compiler.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No recipe migrated
com.twilio.sdk:twilioacross major versions.org.openrewrite.java.migrate.twilio.UpgradeTwilio_13takes an application on 7.x or later to 13.x.The breaking changes come from comparing the jars with japicmp at each major boundary, rather than from Twilio's upgrade guide alone. The guide misses several: for example,
AccessToken.Builderchanged its secret fromStringtobyte[]in the 10.8.0 minor release, which onlyCHANGES.mdmentions.What it changes
com.twilio.sdk:twilioto 13.x, including through properties and version ranges, on Maven and Gradle.AccessToken.Builder,ClientCapability.BuilderandTaskRouterCapability.Builderasbyte[](TwilioJwtSecretToByteArray, the only Java recipe). The SDK used to callgetBytes()itself. This usesStandardCharsets.UTF_8, which gives the same bytes for Twilio's ASCII secrets.NetworkHttpClientan HttpClient 5HttpClientBuilder, only in source files that pass one to it.ssml*methods ofSay.Builder,referSip,ConversationsGrant, andconfigurationProfileSidofVideoGrant.What it leaves alone, and why
ListenableFuturefrom the*Asyncmethods,Rangedate filters,getPrice()becoming aString, and real use of removed products. These need a decision, the compiler points each one out, and none of them occur in the repositories below.ChangeMethodInvocationReturnTypealso can't help with the futures, since its fixed type string would drop the type argument.UpgradeJavaVersionchanged Java settings in 11 of 17 repositories, none of them on Java 7. Most of that was1.8becoming8, and in two it turned<source>/<target>into<release>, which javac 8 rejects.AddDependencyraises them, taking Guava to 33.8 in 5 repositories, from as far back as 27.0, so each one is gated onDoesNotIncludeDependency.gradle.lockfile. I found no recipe that writes it again, so the description says to.The description also lists what no compiler reports: JJWT 0.12 refuses an HMAC secret under 256 bits, a mocked
TwilioRestClientneedsgetAccountSid()stubbed, and a plainObjectMapperneedsJavaTimeModuleon Java 17 or later with an old Jackson.Verification
./gradlew check recipeCsvValidatepasses, with 2,816 tests including 33 new ones.I ran the recipe locally over the 18 repositories a saved search found using the SDK (changeset
20261104205527-mYSzg), not as a run in Moderne.OpenUnisonis already on 13.0.2, so it changed 17, and I compiled each before and after, confirming that the classes of the sources importing Twilio were built:gradle.lockfileandJwts.parserBuilder()changed toJwts.parser(), as Twilio raises JJWT to 0.12; compiles once both are doneCDCgov/prime-simplereportsureshsk-hub/servicefile,devendra-suntechno/vedikamergeTests are thinner evidence. Only two repositories have tests that touch Twilio, and nothing here made a real Twilio API call. In
tedyoung/kid-bankall 121 pass. Insflpro/notifier, 17 of the 19 tests in its Twilio module pass with the recipe alone, and all 19 once its mock has the two stubs described above. Itsverifyneeds Docker, which that machine didn't have.The runtime behaviour was also checked outside any repository, by running the SDK's request, parsing, TwiML and token paths on the Jackson and HttpClient versions Spring Boot 2.1, 2.7, 3.3 and 3.5 pin. The real client works on all of them, so no Spring Boot change is needed.
Worth a look
rewrite-third-party, but that repository bundles recipes other projects publish (Adopt upstream sh.stubborn:stubborn-migration recipes and drop the copy in rewrite-spring rewrite-third-party#95), and Twilio publishes none. A library migration filed there was closed with the suggestion of a module of its own (Unirest 4.x rewrite-third-party#111). A migration this size seemed too small for one, and DataNucleus and fastjson2 live here, but say if you'd rather put it elsewhere.twilio-recordings-decryptergets anhttpclientdependency it no longer needs:AddDependencyscans before theNetworkHttpClientchange lands. It's harmless, and excluding it would mean listingorg.apache.httppackages one by one.recipes.csvhas only the 11 new rows.recipeCsvGeneratealso rewrites about 150 stale rows, which I left out of this diff.classpath.tsv.gzalso addsmockito-all:1.10.19, already declared inbuild.gradle.ktssince Fix legacy Mockito and Java 25 agent migration #1393 but missing from the committed table. No existing rows changed.