We have been testing twitter4j-ads v2.1 with our project, upgrading from v1.0, and it has been quite a frustrating experience so far. Originally when we integrated in our project twitter4j-ads v1.0 we were already using twitter4j v4.0.5, so it was a kind of natural step for us, as twitter4j ads was based and used twitter4j-core. Literally the GitHub project for Twitter4j-ads states the following: “The Twitter4j-ads Java SDK is built on top of design of Twitter4j to allow for easy integration with both Ads API and Organic (REST) API.”
To our surprise twitter4j-ads v2.1 literally replicates many of the classes in twitter4j-core. An example of this (the first that came up in our tests) is the class TwitterException, but this is not problematic as that class is in different packages in twitter4j-core (twitter4j.TwitterException) and in twitter4j-ads (twitter4j.internal.models4j.TwitterException).
The real problem is when the replicated classes are located in the same package in both twitter4j-core and in twitter4j-ads. This happens for instance with twitter4j.conf.ConfigurationBuilder. We are using now twitter4j-core v4.0.6 (the latest available version) and we started to suffer runtime exceptions, so the replicated classes from twitter4j-core belong to an older version.
As a result we are not able to use the Ads API and Organic (REST) API simultaneously in our project as we could previously do. I guess using both APIs is quite a common scenario.
I can understand that replicating / adapting a large part of the twitter4j-core code could be required for a given reason, but I also understand that it could be done using a different package name (as it was done with TwitterException). Rightnow, it is not possible to use the Ads API and Organic (REST) API simultaneously, something that doesn’t make much sense.
I hope you can understand the current problem for both APIs users.