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 1937 - Make BeanNode properly handle public properties implemented in private classes.
Summary: Make BeanNode properly handle public properties implemented in private classes.
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P4 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks: 29562
  Show dependency tree
 
Reported: 1999-05-26 06:29 UTC by Jesse Glick
Modified: 2008-12-23 11:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 1999-05-26 06:29:44 UTC
Perhaps this is a flaw in the standard Introspector, but it might be worth working around even if it is.

Create a BeanNode for some private class that extends a public class and overrides/implements the public methods with its own implementation. E.g.:

public abstract class Public {
  public abstract int getFoo ();
  private static class Private extends Public {
    public int getFoo () { return 5; }
  }
  public static Public getImpl () { return new Private (); }
}


Now create a new BeanNode (Public.getImpl ()). It will have a "foo" property; however, this property cannot be read, since the introspector makes a PropertyDescriptor referring to Private.getFoo, whic
h when invoked throws an IllegalAccessError.

The workaround would be to check all methods supplied in the property descriptors to make sure they are declared in a public class. If not, look for a public superclass that has the same method signat
ure and use that instead. If there is no such public declaration, discard the property. The methods are virtual, of course, so this is harmless.

An easier alternative would be to make BeanNode accept a Class argument specifying the (public) declared class to run introspection on, which the instance object must be assignable to. This might miss
 some properties that the actual instance had, if there were one or more public classes which were subclasses of the declared class but superclasses of the actual implementation class.

Easier still, just run introspection on the lowest public class found in the superclass chain of the object. There, I like that better.
Comment 1 Quality Engineering 2003-07-02 14:57:04 UTC
Resolved for 3.4.x or earlier, no new info since then -> verify.
Comment 2 Quality Engineering 2003-07-02 15:19:04 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.