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.

Bug 236373

Summary: Code completion should check BeanInfo class for properties
Product: javaee Reporter: bugmenot1
Component: Expression LanguageAssignee: Martin Fousek <marfous>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P3    
Version: 7.3.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description bugmenot1 2013-09-25 14:09:08 UTC
I have a Bean like

@Dependent
@Named
public class ViewDirectory {
  private static final View LOGIN = new View("/login");
}

Using NetBeans to generate a getter for the properties generates static getters, which is fine. I created a BeanInfo class to expose static getters like this:

public class ViewDirectoryBeanInfo extends SimpleBeanInfo {

    @Override
    public PropertyDescriptor[] getPropertyDescriptors() {
        final List<PropertyDescriptor> descriptors = new ArrayList<>();
        for (final Method method : CLASS.getMethods()) {
            if (method.getGenericParameterTypes().length > 0) {
                continue;
            }
            final String name = method.getName();
            for (final String prefix : new String[]{"get", "is"}) {
                if (!name.startsWith(prefix)) {
                    continue;
                }
                final String propertyName = Introspector.decapitalize(name.substring(prefix.length()));
                try {
                    descriptors.add(new PropertyDescriptor(propertyName, method, null));
                } catch (IntrospectionException ex) {
                    throw new RuntimeException(ex);
                }
            }
        }
        return descriptors.toArray(new PropertyDescriptor[descriptors.size()]);
    }
}

Together I can use the bean to reference my JSF views in EL:
<h:link outcome="#{viewDirectory.LOGIN}">Login</h:link>

However, code completion for LOGIN after #{viewDirectory. only works when I remove the "static" keyword from the generated getter. As the static getter works fine when the BeanInfo class is present, code completion should check the BeanInfo class for properties with getters like described above.
Comment 1 Martin Balin 2016-07-07 08:52:44 UTC
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