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.
Opening this bug subsequent to my discussion with Pavel Flaska. I have some code that tries to find out if for a given getter method, an appropriate setter method exists or not? A getter method is of type *T getXXX()*. If I find a non static method like *void setXXX(T t)* in the class, I consider that to be the matching setter method. Code below does this. When I have a class that has methods like these: class Department { Collection<Employee> employees; public Collection<Employee> getEmployees() { return employees; } public void setEmployees(Collection<Engineer> employees) { // this.employees = employees; // won't work, hence commented for(Employee e : employees) { this.employees.add(e); } } } it returns setEmployees as the corresponding setter for getEmployees(). Is this not incorrect, even when Engineer extends Employee? My code exists in: org.netbeans.modules.j2ee.verification.persistence.Introspector.class: -------------------------------------------------------------------------------------- public static Method getSetter(Method getter) { String setterName; final String getterName = getter.getName(); if(getterName.startsWith(IS_PREFIX)) { setterName = SET_PREFIX + getterName.substring(IS_PREFIX_SIZE); } else { setterName = SET_PREFIX + getterName.substring(GET_PREFIX_SIZE); } tmpDbg(setterName); Method setter = getter.getDeclaringClass().getMethod( setterName, Arrays.asList(getter.getType()), true); if (setter!=null) { tmpDbg(setter.getType().getName()); // check to see if it meets other requirements like // correct return type, nonstatic. if(setter.getType().getName().equals(Constants.VOID) && !Modifier.isStatic(setter.getModifiers())) { return setter; } } return null; }
FWIW: Collection<Engineer> employees is not a subtype of Collection<Employee> even when Engineer is subclass of Employee. See: Generics and Subtyping (Section 3) in http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf Sorry fop butting in.
Referring to the commnt made by sandipchitale: That's precisely the point and hence the bug has been filed.
Javacore module was replaced by Retouche infrastructure. This bug is not valid in trunk any more.
Reorganization of java component