This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
if I have a class Class1<B> and another class Class2<B, V, C>, and a class Class3 with a method public boolean meth(final Class2<? extends B, ?, ? extends Class1<? extends B>>); when I call the method meth from an other class the editor shows me an error message: "incompatible types: found Class3.meth, required boolean" The compiler works, but the editor shows me the error
Could you please try to find a small reproducible test case and attach it to this issue? Thanks.
File Base.java public class Base { } File Model.java public class Model<B extends Base> { } File Contribution.java public abstract class Contribution <B extends Base, V, C extends Model<?>> extends Model<B> { public Contribution(){ } } File Manager.java public class Manager { public boolean createContribution(final Contribution<? extends Base, ?, ? extends Model<? extends Base>> contribution) { return false; } } File Main.java public class Main { public static void main (String[] args){ final Contribution <?, ?, ?> contr = new Contribution () {}; Manager man = new Manager(); if (man.createContribution(contr)){ //It shows the error here!!!!!!!!!!!!!!!!! System.out.println("Ciao"); } } } It shows an error: Incompatible types: required boolean, found createContribution. But it compiles and run
Still reproducable with build 200910261401, although with a different error message. But external javac from JDK 1.6 also gives an error. There is a simple workaround though, just declare createContribution as: public boolean createContribution(final Contribution<?, ?, ?> contribution) It can be taken as a general coding rule that one shouldn't repeat type parameter bounds in wildcard arguments. For example it's redundant to write Model<? extends Base>, as the "extends Base" is already implicit in "Model<?>", because Model is defined as "Model<B extends Base>". Likewise, it's redundant to write "Contribution<? extends Base, ?, ? extends Model<? extends Base>>", because all these bounds are already implicit in "Contribution<?, ?, ?>". Of course javac should still be fixed to correctly recognize those equivalencies.
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss