You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "kc.baltz" <kc...@inforonics.com> on 2000/05/25 22:12:44 UTC

Taglib question

Why _does_ the following class compile?

-=-=-=-=-=-=-=-=-=-=-
package com.acme.mytags;

import javax.servlet.jsp.tagext.*;

/**
 * A simple TEI for the IterateTag
 * @author Magnus Rydin
 */

public class IterateTEI extends TagExtraInfo
{
 public IterateTEI() {}

 public VariableInfo[] getVariableInfo(TagData data)
 {
  return new VariableInfo[]
  {
   new VariableInfo(data.getAttributeString("name"), 
    data.getAttributeString("type"), 
    true, 
    VariableInfo.NESTED),  // <-- Why is this dangling comma not a problem?

    };
 }
}

I just compiled this and javac was quite happy to compile it.  I'd just like
to understand the syntactical magic behind it.  

K.C.

Re: Taglib question

Posted by Eduardo Pelegri--Llopart <Ed...@eng.sun.com>.
It is legal.  Check section 10.6 on page 196 of the JLS v1. (Java
Language Specification).

	- eduard/o

"kc.baltz" wrote:
> 
> Why _does_ the following class compile?
> 
> -=-=-=-=-=-=-=-=-=-=-
> package com.acme.mytags;
> 
> import javax.servlet.jsp.tagext.*;
> 
> /**
>  * A simple TEI for the IterateTag
>  * @author Magnus Rydin
>  */
> 
> public class IterateTEI extends TagExtraInfo
> {
>  public IterateTEI() {}
> 
>  public VariableInfo[] getVariableInfo(TagData data)
>  {
>   return new VariableInfo[]
>   {
>    new VariableInfo(data.getAttributeString("name"),
>     data.getAttributeString("type"),
>     true,
>     VariableInfo.NESTED),  // <-- Why is this dangling comma not a problem?
> 
>     };
>  }
> }
> 
> I just compiled this and javac was quite happy to compile it.  I'd just like
> to understand the syntactical magic behind it.
> 
> K.C.
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org