You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Hans Bergsten <ha...@gefionsoftware.com> on 2000/12/10 07:05:23 UTC

Re: cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler BeanGenerator.java JspParseEventListener.java ParserXJspSaxHandler.java

pierred@locus.apache.org wrote:
> 
> pierred     00/12/09 21:56:44
> 
>   Modified:    jasper/src/share/org/apache/jasper Constants.java
>                jasper/src/share/org/apache/jasper/compiler
>                         BeanGenerator.java JspParseEventListener.java
>                         ParserXJspSaxHandler.java
>   Log:
>   Take 2 on the default list of imports for JSP generated classes.
>   Removed java.io.IOException, java.beans.Beans, and org.apache.jasper.Exception.
>   All that's left is org.apache.jasper.runtime.*.
>   That will be in take 3 (eventually :-))
>   [Thanks to Craig for "waking me up" on this...]

Sorry, but I don't see what difference this change make. You're not
removing dependencies, just removing imports and replacing them with
FQCNs in the code. Why?

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

Re: cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler BeanGenerator.java JspParseEventListener.java ParserXJspSaxHandler.java

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Pierre Delisle wrote:
> Hans Bergsten wrote:
> > [...]
> > In general, I prefer imports for the reason you mention; it makes it easier
> > to see all dependencies. In generated JSP compilation classes, the important
> > thing is not to have other complete package imports than the ones in the
> > spec, but FQCN imports can't hurt anything. So, yeah, I think it's better
> > to keep imports like java.beans.Beans and org.apache.jasper.Exception.
> 
> Actually, it could make a difference.
> 
> Assuming tomcat puts the import 'java.beans.Beans' in all generated
> JSP servlet classes, then a developer using Tomcat can use
> 'Beans' in a scriptlet without having to worry about the import.
> 
> However, when porting the JSP page to another engine, the compile could
> fail if the target JSP container uses a FQCN in the generated
> code rather than an import statement as tomcat does.
> 
> Given this, it then makes sense to limit the import list to the
> 'default' one mentioned in the spec. Container specific FQCN imports
> are also OK, but anything else should not be part of the import list.
> 
> Does that make sense?

Yes, you're right, of course :-)

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

Re: cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler BeanGenerator.java JspParseEventListener.java ParserXJspSaxHandler.java

Posted by Pierre Delisle <pi...@sun.com>.

Hans Bergsten wrote:
> 
> Pierre Delisle wrote:
> >
> > Hans Bergsten wrote:
> > >
> > > pierred@locus.apache.org wrote:
> > > >
> > > > pierred     00/12/09 21:56:44
> > > >
> > > >   Modified:    jasper/src/share/org/apache/jasper Constants.java
> > > >                jasper/src/share/org/apache/jasper/compiler
> > > >                         BeanGenerator.java JspParseEventListener.java
> > > >                         ParserXJspSaxHandler.java
> > > >   Log:
> > > >   Take 2 on the default list of imports for JSP generated classes.
> > > >   Removed java.io.IOException, java.beans.Beans, and org.apache.jasper.Exception.
> > > >   All that's left is org.apache.jasper.runtime.*.
> > > >   That will be in take 3 (eventually :-))
> > > >   [Thanks to Craig for "waking me up" on this...]
> > >
> > > Sorry, but I don't see what difference this change make. You're not
> > > removing dependencies, just removing imports and replacing them with
> > > FQCNs in the code. Why?
> >
> > Agree. Does not make a difference besides having a shorter import list.
> > [Craig had made a comment about "java.Beans.*", but in fact I was only
> > importing java.beans.Beans.]
> >
> > Might be better to leave those in the import list to make the
> > dependency clear. What do you think?
> 
> In general, I prefer imports for the reason you mention; it makes it easier
> to see all dependencies. In generated JSP compilation classes, the important
> thing is not to have other complete package imports than the ones in the
> spec, but FQCN imports can't hurt anything. So, yeah, I think it's better
> to keep imports like java.beans.Beans and org.apache.jasper.Exception.

Actually, it could make a difference.

Assuming tomcat puts the import 'java.beans.Beans' in all generated 
JSP servlet classes, then a developer using Tomcat can use 
'Beans' in a scriptlet without having to worry about the import.

However, when porting the JSP page to another engine, the compile could 
fail if the target JSP container uses a FQCN in the generated 
code rather than an import statement as tomcat does.

Given this, it then makes sense to limit the import list to the 
'default' one mentioned in the spec. Container specific FQCN imports
are also OK, but anything else should not be part of the import list.

Does that make sense?

    -- Pierre

Re: cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler BeanGenerator.java JspParseEventListener.java ParserXJspSaxHandler.java

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Pierre Delisle wrote:
> 
> Hans Bergsten wrote:
> >
> > pierred@locus.apache.org wrote:
> > >
> > > pierred     00/12/09 21:56:44
> > >
> > >   Modified:    jasper/src/share/org/apache/jasper Constants.java
> > >                jasper/src/share/org/apache/jasper/compiler
> > >                         BeanGenerator.java JspParseEventListener.java
> > >                         ParserXJspSaxHandler.java
> > >   Log:
> > >   Take 2 on the default list of imports for JSP generated classes.
> > >   Removed java.io.IOException, java.beans.Beans, and org.apache.jasper.Exception.
> > >   All that's left is org.apache.jasper.runtime.*.
> > >   That will be in take 3 (eventually :-))
> > >   [Thanks to Craig for "waking me up" on this...]
> >
> > Sorry, but I don't see what difference this change make. You're not
> > removing dependencies, just removing imports and replacing them with
> > FQCNs in the code. Why?
> 
> Agree. Does not make a difference besides having a shorter import list.
> [Craig had made a comment about "java.Beans.*", but in fact I was only
> importing java.beans.Beans.]
> 
> Might be better to leave those in the import list to make the
> dependency clear. What do you think?

In general, I prefer imports for the reason you mention; it makes it easier
to see all dependencies. In generated JSP compilation classes, the important
thing is not to have other complete package imports than the ones in the
spec, but FQCN imports can't hurt anything. So, yeah, I think it's better
to keep imports like java.beans.Beans and org.apache.jasper.Exception.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

Re: cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler BeanGenerator.java JspParseEventListener.java ParserXJspSaxHandler.java

Posted by Pierre Delisle <pi...@sun.com>.

Hans Bergsten wrote:
> 
> pierred@locus.apache.org wrote:
> >
> > pierred     00/12/09 21:56:44
> >
> >   Modified:    jasper/src/share/org/apache/jasper Constants.java
> >                jasper/src/share/org/apache/jasper/compiler
> >                         BeanGenerator.java JspParseEventListener.java
> >                         ParserXJspSaxHandler.java
> >   Log:
> >   Take 2 on the default list of imports for JSP generated classes.
> >   Removed java.io.IOException, java.beans.Beans, and org.apache.jasper.Exception.
> >   All that's left is org.apache.jasper.runtime.*.
> >   That will be in take 3 (eventually :-))
> >   [Thanks to Craig for "waking me up" on this...]
> 
> Sorry, but I don't see what difference this change make. You're not
> removing dependencies, just removing imports and replacing them with
> FQCNs in the code. Why?

Agree. Does not make a difference besides having a shorter import list.
[Craig had made a comment about "java.Beans.*", but in fact I was only
importing java.beans.Beans.]

Might be better to leave those in the import list to make the 
dependency clear. What do you think? 

    -- Pierre


> 
> Hans
> --
> Hans Bergsten           hans@gefionsoftware.com
> Gefion Software         http://www.gefionsoftware.com
> Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com