Resolve as many build warnings as possible. #128
Merged
Merged
Conversation
…d due to reflection. Signed-off-by: berryware <231598+berryware@users.noreply.github.com>
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.
Summary
1. Cassandra "too many sessions" leak (the original ask)
CpoAdapterFactoryManager.java(cpo-core): added an idempotency guard so a redundant reload with an unchanged config path is a no-op — fixes the static-initializer +CassandraSuiteListener's explicitloadAdapters()call doubling every datasource's session at suite start.CpoMetaDescriptor.java: added a stable, name-basedtoString()(was identity-hash) soCassandraCpoAdapter's adapter-cache key stays consistent across reloads instead of minting a fresh key (and a fresh session) every time.ClusterDataSource.java,CassandraCpoAdapter.java: added realclose()methods, wired intoCassandraSuiteListener.java'sonFinish()for the three test datasources.ClusterDataSourceInfoTest.java,CassandraCpoConfigProcessorTest.java,cpoConfig.xml(cassandra test resources): raisedsessionLeakThresholdto 20 — these tests legitimately build many short-lived sessions concurrently, which was tripping the driver's default advisory threshold of 4 as a separate, unrelated false alarm.2. Removed all 12
@SuppressWarnings, fixed 65 of the 105 warnings that were hiding underneathserialVersionUID: added toCpoException,CpoFunctionGroupBean, and a test helper class.this-escape (9 of 13 fixed): made classes/methods with no real subclassesfinal(CassandraCpoAdapter,ClassJdbcDataSourceInfo,JdbcCallableStatementFactory,JdbcPreparedStatementFactory,CassandraBoundStatementFactory,JdbcCpoTrxAdapter, plusBindableCpoWhere's setters andCpoBaseAdapter's datasource getters/setters).AbstractJdbcDataSourceInfo/JdbcCpoConfigProcessor— JDBC'sDataSourceInfowas raw where Cassandra'sClusterDataSourceInfowas already properly parameterized; fixing that one inconsistency cascaded into 11 warnings at once. Also parameterizedMethodMapper's return types (CpoStatementFactory,JdbcPreparedStatementFactory,CassandraBoundStatementFactory,JdbcMethodMapper,CassandraMethodMapper), fixed several bareClass/Class[]reflection sites, and usedClass.cast()instead of an unchecked cast inXmlHelper.XmlHelper's two casts were genuinely avoidable.Method,CpoTransform)transientinCpoAttribute/MethodMapEntry; declaredCpoClass/CpoFunctionGroup/CpoFunction's collection fields as their concrete (HashMap/ArrayList) type instead of the non-serializableMap/Listinterface.CpoBaseXaResource,ConfigInstantiator, the*CpoData.transformOut()dispatch,CpoMetaDescriptor's legitimate overridable-hook constructor,JdbcCpoAdapter's real-subclass constructors) or would risk silent data loss if markedtransient(live datasources, an arbitrary WHERE-clause value, a meta descriptor).3. Removed
coalescerMaxRunsentirelyIt was a deprecated, driver-4.6.1-removed no-op option with no fixable warning path. Removed the XSD element, the field/getter/setter and driver-wiring in
ClusterDataSourceInfo, the config-processor wiring, and the test references.Verified: full
mvn install(all modules) passes clean —BUILD SUCCESS, zero test failures, coverage gate met, zero@SuppressWarningsremaining. Main-source javac warnings: 105 → 39.Deferred to a separate session: fixing the ~20 warnings in
cpo-plugin-generated classes (rawList/Map/Setand non-transient collection fields) by having the generator use Cassandra's existingkeyType/valueTypemetadata to emit properly-parameterized types.Closes #23