Java – is this vague method error eclipse Juno wrong?

I've been playing eclipse Juno today From Helios, this is a good upgrade Everything is fine except for a new compilation error

We use Java Net framework 'fuse', we call the following methods:

ResourceInjector.get().inject(true,this);

Eclipse tells us:

The method inject(Object[]) is ambiguous for the type ResourceInjector

The following methods conflict:

inject(Object... components);
inject(boolean arg0,Object... arg1);

It works well in eclipse Helios (using java 1.6.0.25), but now it provides a compilation error and no longer needs to run In our opinion, this is an error in eclipse Juno. If we use Maven to build correctly... Does anyone know a job to do so?

Solution

This is actually an error in Java 5 and Java 6 This has been fixed in Java 7, and eclipse now checks for this "bug"

More about the errors here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6886431

What method should be used in the following cases?

inject(true);

Both can be applied, but is the original Boolean a better match? Non compliance with Java language specification (JLS):

>According to 15.12 2.5. Neither is more specific than the other (int <: object is not true) solution (we cannot change the fuse itself):

ResourceInjector. get(). inject(true,new Object [] {this});

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>