[ 
https://issues.apache.org/jira/browse/DERBY-4880?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-4880:
--------------------------------------

    Attachment: deprecated.diff

The attached patch makes the warnings go away.

In the VTI demos we only need to change the type of some variables from Class 
to Class<?> to silence the compiler.

In JMXManagementService the only way I found to silence it, was to annotate the 
expression that caused the warning with @SuppressWarnings("unchecked"). 
Changing to generic data types was not an option (at least not as far as I 
could see), because the variables that were converted unchecked came from the 
method signature, and that signature could not use generics because it had to 
match the signature in the ManagementService interface. And the 
ManagementService interface has to be compilable against the Java 1.4 
libraries, so we can't switch to generics in the interface either.

I think it's OK to suppress the warning in this case, since a type mismatch 
will be detected immediately (StandardMBean's javadoc says that a 
NotCompliantMBeanException will be raised in such a case), and the unchecked 
warning is just about that -- that the compiler cannot guarantee that a type 
mismatch is detected immediately.

> Unchecked warnings in JMXManagementService and VTI demos
> --------------------------------------------------------
>
>                 Key: DERBY-4880
>                 URL: https://issues.apache.org/jira/browse/DERBY-4880
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts, JMX
>    Affects Versions: 10.7.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: deprecated.diff
>
>
> These warnings I only see if java15compile.classpath points to Java 6 class 
> libraries (either set explicitly in ant.properties, or implicitly by the 
> property setter):
>     [javac] 
> /code/derby/trunk2/java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java:215:
>  warning: [unchecked] unchecked conversion
>     [javac] found   : java.lang.Class
>     [javac] required: java.lang.Class<java.lang.Object>
>     [javac]                 new StandardMBean(bean, beanInterface) {
>     [javac]                                         ^
>     [javac] 
> /code/derby/trunk2/java/engine/org/apache/derby/impl/services/jmx/JMXManagementService.java:215:
>  warning: [unchecked] unchecked method invocation: 
> <T>StandardMBean(T,java.lang.Class<T>) in javax.management.StandardMBean is 
> applied to (java.lang.Object,java.lang.Class)
>     [javac]                 new StandardMBean(bean, beanInterface) {
>     [javac]                 ^
>     [javac] 2 warnings
>     [javac] 
> /code/derby/trunk2/java/demo/vtis/java/org/apache/derbyDemo/vtis/core/QueryVTIHelper.java:185:
>  warning: [unchecked] unchecked call to 
> getMethod(java.lang.String,java.lang.Class<?>...) as a member of the raw type 
> java.lang.Class
>     [javac]                 ( methodName, new Class[] { String.class } );
>     [javac]                 ^
>     [javac] 
> /code/derby/trunk2/java/demo/vtis/java/org/apache/derbyDemo/vtis/core/XmlVTI.java:253:
>  warning: [unchecked] unchecked call to 
> getMethod(java.lang.String,java.lang.Class<?>...) as a member of the raw type 
> java.lang.Class
>     [javac]                 ( methodName, new Class[] { String.class } );
>     [javac]                 ^
>     [javac] 
> /code/derby/trunk2/java/demo/vtis/java/org/apache/derbyDemo/vtis/core/XmlVTI.java:260:
>  warning: [unchecked] unchecked call to getConstructor(java.lang.Class<?>...) 
> as a member of the raw type java.lang.Class
>     [javac]                 ( new Class[] { String.class, String.class, 
> String[].class } );
>     [javac]                 ^
>     [javac] 
> /code/derby/trunk2/java/demo/vtis/java/org/apache/derbyDemo/vtis/snapshot/Subscription.java:278:
>  warning: [unchecked] unchecked call to 
> getMethod(java.lang.String,java.lang.Class<?>...) as a member of the raw type 
> java.lang.Class
>     [javac]                 ( methodName, new Class[] {} );
>     [javac]                 ^
>     [javac] 4 warnings

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to