You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2020/02/04 15:13:50 UTC

[activemq-artemis] branch master updated: NO-JIRA Fix compiler warning in FederationStreamConnectMessage v2

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new ba4e52c  NO-JIRA Fix compiler warning in FederationStreamConnectMessage v2
     new a2ed463  This closes #2969
ba4e52c is described below

commit ba4e52ca40aaf8ce4a5340233a6f3a0ff38b14c0
Author: Sebastian Thomschke <se...@users.noreply.github.com>
AuthorDate: Mon Feb 3 19:22:04 2020 +0100

    NO-JIRA Fix compiler warning in FederationStreamConnectMessage v2
    
    Second attempt to fix the following compiler warning that is reported in Travis builds, this time using the correct cast type `Class<?>[]` which prevents temporary object allocation because of var-args handling:
    
    ```java
    /home/travis/build/apache/activemq-artemis/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/FederationStreamConnectMessage.java:151: warning: non-varargs call of varargs method with inexact argument type for last parameter;
    
             return (FederationPolicy) Class.forName(clazz).getConstructor(null).newInstance();
    
      cast to Class<?> for a varargs call
      cast to Class<?>[] for a non-varargs call and to suppress this warning
    ```
---
 .../protocol/core/impl/wireformat/FederationStreamConnectMessage.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/FederationStreamConnectMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/FederationStreamConnectMessage.java
index 1b2a28d..ac867dc 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/FederationStreamConnectMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/FederationStreamConnectMessage.java
@@ -148,7 +148,7 @@ public abstract class FederationStreamConnectMessage <T extends FederationStream
 
    private FederationPolicy getFederationPolicy(String clazz) {
       try {
-         return (FederationPolicy) Class.forName(clazz).getConstructor(null).newInstance();
+         return (FederationPolicy) Class.forName(clazz).getConstructor((Class<?>[]) null).newInstance();
       } catch (Exception e) {
          throw new IllegalStateException("Error. Unable to instantiate FederationPolicy: " + e.getMessage(), e);
       }