Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Cannot introduce getSize(0 method to java.util.Collection

> I have tried to introduce the method:
> public aspect JstlCollectionWrapper {
> 
>     public int ArrayList.getSize() {

You can't declare a method on a class that is outside ajc's
scope.  For information on what code to include for
specific language features, see the Programming Guide
Implementation appendix:

  http://www.eclipse.org/aspectj/doc/released/progguide/implementation.html

Wes


On Thu, 16 Mar 2006 08:31:41 -0500
 "Stearns, Randy" <RStearns@xxxxxxxxxxxxxxxxxx> wrote:
> I'm trying to get the size of a list in a jsp page:
> <c:out value="Number of modules:
> ${viewableModules.size}"/>
> 
> As JSTL uses java bean properties (i.e. size is accessed
> as getSize()),
> this doesn't work:
> 
>
ServletRequest;Ljavax/servlet/http/HttpServletResponse;)V()
> - Could not
> complete request
> javax.servlet.ServletException: An error occurred while
> evaluating
> custom action attribute "value" with value "Number of
>  modules: ${viewableModules.size}": The "." operator was
> supplied with
> an index value of type "java.lang.String" to be a
> pplied to a List or array, but that value cannot be
> converted to an
> integer.
> 
> I have tried to introduce the method:
> public aspect JstlCollectionWrapper {
> 
>     public int ArrayList.getSize() {
>         return size();
>     }
> }
> 
> But it still fails with that same error. Can someone
> explain what might
> be wrong?
> 
> Thanks.
> 
> Randy
> 
> ****DISCLAIMER
> The information contained in this e-mail and attachments,
> if any, is confidential and may be subject to legal
> privilege.  If you are not the intended recipient, you
> must not use, copy, distribute or disclose the e-mail and
> its attachment, or any part of its content or take any
> action in reliance of it.  If you have received this
> e-mail in error, please e-mail the message back to the
> sender by replying and then deleting it.  We cannot
> accept responsibility for loss or damage arising from the
> use of this e-mail or attachments, and recommend that you
> subject these to your virus checking procedures prior to
> use



Back to the top