• Post Reply Bookmark Topic Watch Topic
  • New Topic

non-varargs call of varargs method with inexact argument type for last parameter  RSS feed

 
gourav chouhan
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
please help me
when i m running this code



I m getting this error

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] if (null != getMethod && getMethod.invoke(object, parameter) != null) {
[javac] ^
[javac] 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] result = getMethod.invoke(object, parameter);

what this error actually means?
 
Istvan Kovacs
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The signature of Method.invoke is:

However, you have:

args is converted to an Object[], but is not handled as such, it seems.

Class[] is not just an Object[] that happens to contain Class objects. It's a different type (a subtype of Object[]). If you tried to run this, you'd get an error:


Check this, it should give you a hint at the solution:



And next time, please IsolateTheProblem.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!