Add forRemoval=true and since to @deprecated elements; fixes #812 + fix deprecation warnings across the code base post JDK baseline shift to 11#830
Open
rhusar wants to merge 3 commits into
Conversation
…an#812 Also add @deprecated Javadoc with replacement guidance to all deprecated elements, add missing @deprecated annotation to TestDeployment constructor, un-deprecate TestResult#setStatus which is still actively used, and migrate AbstractJMXProtocol from getContext() to getContexts(). Signed-off-by: Radoslav Husar <radosoft@gmail.com>
Replace new Integer(int) with Integer.valueOf(int), Class.newInstance() with getDeclaredConstructor().newInstance(), and File.toURL() with File.toURI().toURL(). Signed-off-by: Radoslav Husar <radosoft@gmail.com>
…move when dropping JUnit 5.13 support Signed-off-by: Radoslav Husar <radosoft@gmail.com>
Reviewer's GuideThis PR modernizes deprecation handling and removes Java 11+ deprecation warnings by adding explicit forRemoval/since metadata and replacement guidance to deprecated APIs, tightening their usage, and updating various call sites and utility code to non‑deprecated alternatives. Sequence diagram for updated JMX executor context resolutionsequenceDiagram
participant AbstractJMXProtocol
participant ProtocolMetaData
participant JMXContext
participant MBeanServerConnection
AbstractJMXProtocol->>ProtocolMetaData: hasContext(JMXContext.class)
alt JMXContext available
AbstractJMXProtocol->>ProtocolMetaData: getContexts(JMXContext.class)
ProtocolMetaData-->>AbstractJMXProtocol: Collection~JMXContext~
AbstractJMXProtocol->>JMXContext: iterator().next()
JMXContext-->>AbstractJMXProtocol: JMXContext
AbstractJMXProtocol->>JMXContext: getConnection()
JMXContext-->>AbstractJMXProtocol: MBeanServerConnection
AbstractJMXProtocol->>MBeanServerConnection: use for remote test execution
else no JMXContext
AbstractJMXProtocol-->>AbstractJMXProtocol: handle missing JMXContext
end
Class diagram for updated deprecation metadata and usageclassDiagram
class ProtocolMetaData {
- List~Object~ contexts
+ boolean hasContext(Class clazz)
+ <T> T getContext(Class clazz) <<deprecated>>
+ <T> Collection~T~ getContexts(Class clazz)
}
class AbstractJMXProtocol {
+ ProtocolDescription getDescription()
+ ContainerMethodExecutor getExecutor(Object config, ProtocolMetaData metaData, CommandCallback callback)
}
class JMXContext {
+ MBeanServerConnection getConnection()
}
class ContainerRegistryCreator {
<<utility>>
+ static String ARQUILLIAN_LAUNCH_PROPERTY
+ static String ARQUILLIAN_LAUNCH_DEFAULT
+ static String ARQUILLIAN_LAUNCH_DEFAULT_DEPRECATED <<deprecated>>
- Logger log
- void validateConfiguration(ArquillianDescriptor desc)
- String getActivatedConfiguration()
}
class DeployableContainer {
<<interface>>
+ void start() throws LifecycleException
+ void stop() throws LifecycleException
+ void deploy(Archive archive) throws DeploymentException
+ void undeploy(Archive archive) throws DeploymentException
+ void deploy(Descriptor descriptor) throws DeploymentException <<deprecated>>
+ void undeploy(Descriptor descriptor) throws DeploymentException <<deprecated>>
}
class JMXTestRunnerMBean {
<<interface>>
+ byte[] runTestMethod(String className, String methodName) <<deprecated>>
+ byte[] runTestMethod(String className, String methodName, Map protocolProps)
}
class JMXTestRunner {
+ void registerMBean(MBeanServer mbeanServer) throws JMException
+ void unregisterMBean(MBeanServer mbeanServer) throws JMException
+ byte[] runTestMethod(String className, String methodName)
+ byte[] runTestMethod(String className, String methodName, Map protocolProps)
- TestResult runTestMethodInternal(String className, String methodName, Map protocolProps)
}
class JUnitJupiterTestClassLifecycleManager {
<<suppress_deprecation>>
- static String MANAGER_KEY
- TestRunnerAdaptor adaptor
+ void close()
}
class MethodParameters {
<<suppress_deprecation>>
- Map~Integer, Object~ parameters
+ void close()
}
class ExtensionContextStoreCloseableResource {
<<interface>>
}
class ExtensionContext
class Store
ProtocolMetaData --> JMXContext : provides
AbstractJMXProtocol --> ProtocolMetaData : uses
AbstractJMXProtocol --> JMXContext : uses
JMXTestRunnerMBean <|.. JMXTestRunner
DeployableContainer <|.. SomeConcreteDeployableContainer
ExtensionContextStoreCloseableResource <|.. JUnitJupiterTestClassLifecycleManager
ExtensionContextStoreCloseableResource <|.. MethodParameters
ExtensionContext ..> ExtensionContextStoreCloseableResource : nested type
ExtensionContext ..> Store : nested type
ContainerRegistryCreator ..> ArquillianDescriptor : validates
ContainerRegistryCreator ..> SecurityActions : uses
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In TestResult, the setStatus(Status) method had its @deprecated annotation removed while other deprecated members were made more explicit; if this was not an intentional undeprecation, consider restoring @deprecated(forRemoval = true, since = ...) and a replacement hint, or otherwise updating its Javadoc to reflect its intended lifecycle.
- For methods now annotated with @SuppressWarnings("removal"), consider limiting the suppression to the minimal scope (e.g., a local variable or a helper method) where feasible to avoid masking future accidental uses of other removal-deprecated APIs.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In TestResult, the setStatus(Status) method had its @Deprecated annotation removed while other deprecated members were made more explicit; if this was not an intentional undeprecation, consider restoring @Deprecated(forRemoval = true, since = ...) and a replacement hint, or otherwise updating its Javadoc to reflect its intended lifecycle.
- For methods now annotated with @SuppressWarnings("removal"), consider limiting the suppression to the minimal scope (e.g., a local variable or a helper method) where feasible to avoid masking future accidental uses of other removal-deprecated APIs.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Quick test,
mvn clean install | grep WARNING | grep deprecated | grep -v AccessibleObjectis now empty result.Summary by Sourcery
Clarify and harden deprecations after moving to a newer JDK baseline, while updating legacy APIs and usages to avoid deprecation warnings.
Bug Fixes:
Enhancements:
Tests: