Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 66529 - Property evaluation doesn't take visibility into account
Property evaluation doesn't take visibility into account
Status: VERIFIED FIXED
Product: java
Classification: Unclassified
Component: Beans
4.x
All All
: P3 (vote)
: 6.x
Assigned To: misterm
issues@java
OSLO
: NETFIX
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-11 21:20 UTC by _ deva
Modified: 2009-04-08 14:06 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Tentative fix (1.13 KB, patch)
2009-03-23 18:46 UTC, misterm
Details | Diff
Sample bean (424 bytes, text/plain)
2009-03-23 18:57 UTC, misterm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ deva 2005-10-11 21:20:29 UTC
1)Create a new java application project
2)Expand the main class and add a property by name "car" to the main class 
using beans pattern node's pop menu options
3)Make the getter/setter method to be private instead of public
Now in the property sheet, the property is shown as read/write even when the 
getter/setter are private

Java Studio Creator bug for reference, http://monaco.sfbay/detail.jsf?
cr=6214071
Comment 1 Jiri Prox 2007-09-03 13:34:08 UTC
Milestone is obsolete, please reevaluate
Comment 2 misterm 2009-03-20 17:16:53 UTC
It's broken for non-public classes as well, i.e., it finds properties for these cases.
Comment 3 misterm 2009-03-20 17:21:03 UTC
Raising priority for P3 (part of feature does not work). It is quite deceiving for the developer since any bean-based 
framework would claim properties don't exist, s/he thinks they do and the IDE seems to agree with them.

The IDE makes such occurences quite common since when use a class that doesn't exist, the hint it provides creates a 
non-public class.
Comment 4 misterm 2009-03-20 17:26:10 UTC
I would like to fix this issue as part of NetFIX:

http://wiki.netbeans.org/NetFIX
Comment 5 Jiri Kovalsky 2009-03-23 15:13:55 UTC
Jan Pokorsky is willing to review and integrate the fix. Michael, please attach the patch. Thanks!
Comment 6 misterm 2009-03-23 18:07:42 UTC
After reading the spec thoroughly, the visibility requirement is specified only for properties, events and methods. The 
class doesn't need to be public, but then its features are only accessible to classes in the same package, which is 
deceiving.

Therefore, I will fix it according to the spec - take visibility into account for property, events and methods - and 
file a separate issue to improve visual feedback for the non-public class use case.
Comment 7 misterm 2009-03-23 18:46:54 UTC
Created attachment 78674 [details]
Tentative fix
Comment 8 misterm 2009-03-23 18:51:31 UTC
Patched. When PatternAnalyzer does not use deepIntrospection mode, it calls ElementFilter.methodsIn, which returns all 
methods, which is not consistent with its call to BeanUtils.methodsIn, which only returns public methods.

This explains why BeanInfo editor works correctly but Navigator view is broken, for instance.
Comment 9 misterm 2009-03-23 18:57:14 UTC
Created attachment 78676 [details]
Sample bean
Comment 10 misterm 2009-03-23 19:00:00 UTC
I've attached a sample bean to make the issue easier to understand. 

Before the patch:
If you open it in the editor and choose Bean Patterns in Navigator, you will see a property and an event, which is 
wrong (methods have package-visibility). If you try to create a BeanInfo for the bean, it won't list any properties or 
events, which is correct.

After the patch:
Bean Patterns and BeanInfo editor behaviour is now consistent.

Please let me know if you have more questions.
Comment 11 misterm 2009-03-23 19:17:38 UTC
The non-public class use case will be handled here:

http://www.netbeans.org/issues/show_bug.cgi?id=160937
Comment 12 Jan Pokorsky 2009-03-24 15:49:44 UTC
The patch is fine. Thank you. Integrated as http://hg.netbeans.org/jet-main/rev/c3acc9c00be2.

You are right that Navigator's Bean Patterns and BeanInfo editor are consistent in this way but remember that the
navigator, as it is implemented now, computes patterns just from editing file. It does not introspect super classes and
it does not look for existing BeanInfos.

Comment 13 Quality Engineering 2009-03-25 09:31:55 UTC
Integrated into 'main-golden', will be available in build *200903250219* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c3acc9c00be2
User: Jan Pokorsky <jpokorsky@netbeans.org>
Log: #66529: collect only public property accessors
Comment 14 Michel Graciano 2009-03-25 13:56:55 UTC
v. 200903250219
Comment 15 pgebauer 2009-04-08 14:06:29 UTC
The status whiteboard "65fixes4-candidate" has been removed.
At this time our proactive patches for the NetBeans 6.5.x IDE have concluded.

If you own a Sun service plan contract for NetBeans, you may wish to contact
Sun Service http://www.sun.com/contact/support.jsp to request a fix via the
product defect escalation process.

For more information on purchasing a Sun service plan contract for NetBeans,
refer to the service plan item "Sun Software Service Plans (S3P) for Developers"
in the Sun Service table found on our NetBeans Support Resources
page http://www.netbeans.org/kb/support.html


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo