25 Ağustos 2011 Perşembe

warning: non-varargs call of varargs method with inexact argument type for last parameter

The method i explained in http://hilaltarakci.blogspot.com/2011/01/printing-object-with-reflection-api-for.html is my favorite debug mechanism..
However, it results in the following warning:


warning: non-varargs call of varargs method with inexact argument type for last parameter;
    [javac] cast to java.lang.Object for a varargs call
    [javac] cast to java.lang.Object[] for a non-varargs call and to suppress this warning
    [javac]                             logger.debug("METHOD: " + mBean[i].getName() + " : " + mBean[i].invoke(classItself, null));

In order to prevent the error, simply modify the following line by casting null to Object []:

System.out.println("METHOD: " + m[i].getName() + " : " + m[i].invoke(classItself, (Object [])null));

Hiç yorum yok:

Yorum Gönder