You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by bu...@apache.org on 2007/02/20 09:48:01 UTC

DO NOT REPLY [Bug 41660] New: - Fields in Annotations and AnnotationEntry are private, should be protected

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660

           Summary: Fields in Annotations and AnnotationEntry are private,
                    should be protected
           Product: BCEL
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: bcel-dev@jakarta.apache.org
        ReportedBy: trevor@vocaro.com


I am using the new annotation support in the BCEL trunk to write a utility for processing custom 
annotations. This required extending the Annotations and AnnotationEntry classes, and the subclasses I 
created needed to access the fields in the superclasses. Unfortunately, this wasn't possible because 
these fields have private access. They should instead have protected access.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are private, should be protected

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660





------- Additional Comments From tcurdt@apache.org  2007-03-10 07:23 -------
Could you elaborate why you have to extend them?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are private, should be protected

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660





------- Additional Comments From trevor@vocaro.com  2007-06-13 12:21 -------
Can someone please review this patch? It's a very simple fix. If you like, I can submit another one that 
uses accessor methods instead of protected fields.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are private, should be protected

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660





------- Additional Comments From trevor@vocaro.com  2007-02-20 00:50 -------
Created an attachment (id=19614)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19614&action=view)
Simple patch that makes the private fields protected


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are private, should be protected

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660





------- Additional Comments From trevor@vocaro.com  2007-03-10 11:56 -------
I need to extend them in order to tell BCEL how to process non-standard annotations. Currently BCEL is 
hard-coded for the existing annotation names: RuntimeInvisibleAnnotations, 
RuntimeInvisibleAnnotations, RuntimeInvisibleParameterAnnotations, and 
RuntimeVisibleParameterAnnotations. However, with the JSR-308 proposal, new annotation names are 
likely on the way: RuntimeInvisibleTypeAnnotations/RuntimeVisibleTypeAnnotations and (possibly) 
RuntimeInvisibleStatementAnnotations/RuntimeVisibleStatementAnnotations.

Now, I'd like to use BCEL to parse and display these new annotation types. In fact, I've already written 
such a utility here:

http://volta.svn.sourceforge.net/viewvc/volta/util/dump-annotations/

However, the utility can't work with the current BCEL trunk because the Annotations and AnnotationEntry 
classes have private inaccessible fields. This makes extending those classes in any meaningful way 
impossible. But if I simply modify BCEL so that those fields are exposed to subclasses, then my utility 
works perfectly.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are private, should be protected

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660





------- Additional Comments From skitching@apache.org  2007-02-20 14:55 -------
Just as a general note, protected fields should be used with caution as they
have significant implications for binary compatibility; once added they become
part of the "public api" of the class and cannot be changed without potentially
breaking existing code.

Where possible, protected accessor methods are better than allowing direct
access to protected fields.

Note, however, that I haven't reviewed this patch to determine what the best
solution is for this particular case.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are private, should be protected

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660





------- Additional Comments From trevor@vocaro.com  2007-02-20 15:25 -------
I think accessor methods might also work in my case, but I would prefer protected members (possibly in 
addition to accessors) because it offers the most flexibility and control.

And yes, field access rights raise compatibility issues, which is why I hope this bug can be resolved 
before the annotation support in BCEL migrates from the trunk to an official release.

In any case, something must be changed, otherwise it will be impossible for users to extend BCEL's 
annotation support.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are private, should be protected

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660





------- Additional Comments From trevor@vocaro.com  2007-04-16 12:54 -------
So, is this patch acceptable for inclusion in the trunk, or does it need more work? Should I rewrite it to 
use accessor methods instead of protected fields?


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 41660] - Fields in Annotations and AnnotationEntry are inaccessible to subclasses

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41660>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41660


trevor@vocaro.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Fields in Annotations and   |Fields in Annotations and
                   |AnnotationEntry are private,|AnnotationEntry are
                   |should be protected         |inaccessible to subclasses




------- Additional Comments From trevor@vocaro.com  2007-09-15 03:09 -------
I found another example of why this bug needs to be fixed:

http://forum.java.sun.com/thread.jspa?threadID=775449

Note that Mathias has created two entirely new types of annotations 
(RuntimeVisibleLocalVariableAnnotations and RuntimeInvisibleLocalVariableAnnotations). Naturally, one 
might want to use BCEL to read these annotations from a class file, but that's currently impossible. 
Unless this bug is fixed, BCEL is effectively hard-coded for the standard annotation names.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org