You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/11/23 22:29:47 UTC
svn commit: r720049 [1/2] - in /tomcat/trunk/java/org/apache/jasper: ./
compiler/ runtime/ servlet/ xmlparser/
Author: markt
Date: Sun Nov 23 13:29:46 2008
New Revision: 720049
URL: http://svn.apache.org/viewvc?rev=720049&view=rev
Log:
Fix generics in o.a.jasper & o.a.jasper.compiler. Also a few knock-on changes in other jasper packages.
Modified:
tomcat/trunk/java/org/apache/jasper/EmbeddedServletOptions.java
tomcat/trunk/java/org/apache/jasper/JspC.java
tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
tomcat/trunk/java/org/apache/jasper/Options.java
tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java
tomcat/trunk/java/org/apache/jasper/compiler/BeanRepository.java
tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java
tomcat/trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java
tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
tomcat/trunk/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java
tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java
tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java
tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
tomcat/trunk/java/org/apache/jasper/compiler/Mark.java
tomcat/trunk/java/org/apache/jasper/compiler/Node.java
tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java
tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java
tomcat/trunk/java/org/apache/jasper/compiler/Parser.java
tomcat/trunk/java/org/apache/jasper/compiler/ParserController.java
tomcat/trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java
tomcat/trunk/java/org/apache/jasper/compiler/SmapGenerator.java
tomcat/trunk/java/org/apache/jasper/compiler/SmapStratum.java
tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java
tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java
tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
tomcat/trunk/java/org/apache/jasper/compiler/TagPluginManager.java
tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
tomcat/trunk/java/org/apache/jasper/compiler/Validator.java
tomcat/trunk/java/org/apache/jasper/runtime/JspSourceDependent.java
tomcat/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java
Modified: tomcat/trunk/java/org/apache/jasper/EmbeddedServletOptions.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/EmbeddedServletOptions.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/EmbeddedServletOptions.java (original)
+++ tomcat/trunk/java/org/apache/jasper/EmbeddedServletOptions.java Sun Nov 23 13:29:46 2008
@@ -22,6 +22,7 @@
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
+import javax.servlet.jsp.tagext.TagLibraryInfo;
import org.apache.jasper.compiler.TldLocationsCache;
import org.apache.jasper.compiler.JspConfig;
@@ -357,7 +358,7 @@
return false;
}
- public Map getCache() {
+ public Map<String, TagLibraryInfo> getCache() {
return null;
}
@@ -387,9 +388,9 @@
// Ignore
}
- Enumeration enumeration=config.getInitParameterNames();
+ Enumeration<String> enumeration=config.getInitParameterNames();
while( enumeration.hasMoreElements() ) {
- String k=(String)enumeration.nextElement();
+ String k=enumeration.nextElement();
String v=config.getInitParameter( k );
setProperty( k, v);
}
Modified: tomcat/trunk/java/org/apache/jasper/JspC.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspC.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspC.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspC.java Sun Nov 23 13:29:46 2008
@@ -40,6 +40,8 @@
import java.util.StringTokenizer;
import java.util.Vector;
+import javax.servlet.jsp.tagext.TagLibraryInfo;
+
import org.apache.jasper.compiler.Compiler;
import org.apache.jasper.compiler.JspConfig;
import org.apache.jasper.compiler.JspRuntimeContext;
@@ -157,7 +159,8 @@
protected boolean smapSuppressed = true;
protected boolean smapDumped = false;
protected boolean caching = true;
- protected Map cache = new HashMap();
+ protected Map<String, TagLibraryInfo> cache =
+ new HashMap<String, TagLibraryInfo>();
protected String compiler = null;
@@ -176,12 +179,12 @@
* The file extensions to be handled as JSP files.
* Default list is .jsp and .jspx.
*/
- protected List extensions;
+ protected List<String> extensions;
/**
* The pages.
*/
- protected List pages = new Vector();
+ protected List<String> pages = new Vector<String>();
/**
* Needs better documentation, this data member does.
@@ -440,7 +443,7 @@
/**
* @see Options#getCache()
*/
- public Map getCache() {
+ public Map<String, TagLibraryInfo> getCache() {
return cache;
}
@@ -540,13 +543,13 @@
return scratchDir;
}
- public Class getJspCompilerPlugin() {
- // we don't compile, so this is meanlingless
+ public Class<?> getJspCompilerPlugin() {
+ // we don't compile, so this is meaningless
return null;
}
public String getJspCompilerPath() {
- // we don't compile, so this is meanlingless
+ // we don't compile, so this is meaningless
return null;
}
@@ -637,7 +640,7 @@
*
* @return The list of extensions
*/
- public List getExtensions() {
+ public List<String> getExtensions() {
return extensions;
}
@@ -650,7 +653,7 @@
protected void addExtension(final String extension) {
if(extension != null) {
if(extensions == null) {
- extensions = new Vector();
+ extensions = new Vector<String>();
}
extensions.add(extension);
@@ -1094,7 +1097,7 @@
throw new JasperException(
Localizer.getMessage("jsp.error.jspc.missingTarget"));
}
- String firstJsp = (String) pages.get( 0 );
+ String firstJsp = pages.get( 0 );
File firstJspF = new File( firstJsp );
if (!firstJspF.exists()) {
throw new JasperException(
@@ -1126,7 +1129,7 @@
initWebXml();
- Iterator iter = pages.iterator();
+ Iterator<String> iter = pages.iterator();
while (iter.hasNext()) {
String nextjsp = iter.next().toString();
File fjsp = new File(nextjsp);
Modified: tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java Sun Nov 23 13:29:46 2008
@@ -85,7 +85,7 @@
protected URLClassLoader jspLoader;
protected URL baseUrl;
- protected Class servletClass;
+ protected Class<?> servletClass;
protected boolean isTagFile;
protected boolean protoTypeMode;
@@ -307,7 +307,7 @@
}
- public Set getResourcePaths(String path) {
+ public Set<String> getResourcePaths(String path) {
return context.getResourcePaths(canonicalURI(path));
}
@@ -606,7 +606,7 @@
// ==================== Manipulating the class ====================
- public Class load()
+ public Class<?> load()
throws JasperException, FileNotFoundException
{
try {
Modified: tomcat/trunk/java/org/apache/jasper/Options.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/Options.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/Options.java (original)
+++ tomcat/trunk/java/org/apache/jasper/Options.java Sun Nov 23 13:29:46 2008
@@ -20,6 +20,8 @@
import java.io.File;
import java.util.Map;
+import javax.servlet.jsp.tagext.TagLibraryInfo;
+
import org.apache.jasper.compiler.JspConfig;
import org.apache.jasper.compiler.TagPluginManager;
import org.apache.jasper.compiler.TldLocationsCache;
@@ -190,6 +192,6 @@
*
* @return the Map(String uri, TreeNode tld) instance.
*/
- public Map getCache();
+ public Map<String, TagLibraryInfo> getCache();
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java Sun Nov 23 13:29:46 2008
@@ -324,13 +324,15 @@
/**
* Thread <-> PrintStream associations.
*/
- protected static ThreadLocal streams = new ThreadLocal();
+ protected static ThreadLocal<PrintStream> streams =
+ new ThreadLocal<PrintStream>();
/**
* Thread <-> ByteArrayOutputStream associations.
*/
- protected static ThreadLocal data = new ThreadLocal();
+ protected static ThreadLocal<ByteArrayOutputStream> data =
+ new ThreadLocal<ByteArrayOutputStream>();
// --------------------------------------------------------- Public Methods
@@ -354,8 +356,7 @@
* Stop capturing thread's output and return captured data as a String.
*/
public static String unsetThread() {
- ByteArrayOutputStream baos =
- (ByteArrayOutputStream) data.get();
+ ByteArrayOutputStream baos = data.get();
if (baos == null) {
return null;
}
@@ -372,7 +373,7 @@
* Find PrintStream to which the output must be written to.
*/
protected PrintStream findStream() {
- PrintStream ps = (PrintStream) streams.get();
+ PrintStream ps = streams.get();
if (ps == null) {
ps = wrapped;
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/BeanRepository.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/BeanRepository.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/BeanRepository.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/BeanRepository.java Sun Nov 23 13:29:46 2008
@@ -53,9 +53,9 @@
beanTypes.put(s, type);
}
- public Class getBeanType(String bean)
+ public Class<?> getBeanType(String bean)
throws JasperException {
- Class clazz = null;
+ Class<?> clazz = null;
try {
clazz = loader.loadClass(beanTypes.get(bean));
} catch (ClassNotFoundException ex) {
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java Sun Nov 23 13:29:46 2008
@@ -444,14 +444,14 @@
return false;
}
- List depends = jsw.getDependants();
+ List<String> depends = jsw.getDependants();
if (depends == null) {
return false;
}
- Iterator it = depends.iterator();
+ Iterator<String> it = depends.iterator();
while (it.hasNext()) {
- String include = (String) it.next();
+ String include = it.next();
try {
URL includeUrl = ctxt.getResource(include);
if (includeUrl == null) {
Modified: tomcat/trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/ELFunctionMapper.java Sun Nov 23 13:29:46 2008
@@ -167,7 +167,7 @@
// First locate all unique functions in this EL
Fvisitor fv = new Fvisitor();
el.visit(fv);
- ArrayList functions = fv.funcs;
+ ArrayList<ELNode.Function> functions = fv.funcs;
if (functions.size() == 0) {
return;
@@ -198,7 +198,7 @@
// Setup arguments for either getMapForFunction or mapFunction
for (int i = 0; i < functions.size(); i++) {
- ELNode.Function f = (ELNode.Function)functions.get(i);
+ ELNode.Function f = functions.get(i);
FunctionInfo funcInfo = f.getFunctionInfo();
String key = f.getPrefix()+ ":" + f.getName();
ds.append(funcMethod + "(\"" + key + "\", " +
@@ -250,13 +250,13 @@
* @return A previous generated function mapper name that can be used
* by this EL; null if none found.
*/
- private String matchMap(ArrayList functions) {
+ private String matchMap(ArrayList<ELNode.Function> functions) {
String mapName = null;
for (int i = 0; i < functions.size(); i++) {
- ELNode.Function f = (ELNode.Function)functions.get(i);
- String temName = (String) gMap.get(f.getPrefix() + ':' +
- f.getName() + ':' + f.getUri());
+ ELNode.Function f = functions.get(i);
+ String temName = gMap.get(f.getPrefix() + ':' + f.getName() +
+ ':' + f.getUri());
if (temName == null) {
return null;
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Generator.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Generator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Generator.java Sun Nov 23 13:29:46 2008
@@ -35,6 +35,7 @@
import javax.el.MethodExpression;
import javax.el.ValueExpression;
+import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagAttributeInfo;
import javax.servlet.jsp.tagext.TagInfo;
import javax.servlet.jsp.tagext.TagVariableInfo;
@@ -69,7 +70,7 @@
class Generator {
- private static final Class[] OBJECT_CLASS = { Object.class };
+ private static final Class<?>[] OBJECT_CLASS = { Object.class };
private static final String VAR_EXPRESSIONFACTORY =
System.getProperty("org.apache.jasper.compiler.Generator.VAR_EXPRESSIONFACTORY", "_el_expressionfactory");
@@ -78,7 +79,7 @@
private ServletWriter out;
- private ArrayList methodsBuffered;
+ private ArrayList<GenBuffer> methodsBuffered;
private FragmentHelperClass fragmentHelperClass;
@@ -247,14 +248,14 @@
class TagHandlerPoolVisitor extends Node.Visitor {
- private Vector names;
+ private Vector<String> names;
/*
* Constructor
*
* @param v Vector of tag handler pool names to populate
*/
- TagHandlerPoolVisitor(Vector v) {
+ TagHandlerPoolVisitor(Vector<String> v) {
names = v;
}
@@ -316,10 +317,10 @@
class ScriptingVarVisitor extends Node.Visitor {
- private Vector vars;
+ private Vector<String> vars;
ScriptingVarVisitor() {
- vars = new Vector();
+ vars = new Vector<String>();
}
public void visit(Node.CustomTag n) throws JasperException {
@@ -438,7 +439,7 @@
if (isPoolingEnabled) {
for (int i = 0; i < tagHandlerPoolNames.size(); i++) {
- out.printin((String) tagHandlerPoolNames.elementAt(i));
+ out.printin(tagHandlerPoolNames.elementAt(i));
out.println(".release();");
}
}
@@ -464,10 +465,10 @@
* generation)
*/
private void genPreambleImports() throws JasperException {
- Iterator iter = pageInfo.getImports().iterator();
+ Iterator<String> iter = pageInfo.getImports().iterator();
while (iter.hasNext()) {
out.printin("import ");
- out.print((String) iter.next());
+ out.print(iter.next());
out.println(";");
}
@@ -486,8 +487,8 @@
// Static data for getDependants()
out.printil("private static java.util.List _jspx_dependants;");
out.println();
- List dependants = pageInfo.getDependants();
- Iterator iter = dependants.iterator();
+ List<String> dependants = pageInfo.getDependants();
+ Iterator<String> iter = dependants.iterator();
if (!dependants.isEmpty()) {
out.printil("static {");
out.pushIndent();
@@ -496,7 +497,7 @@
out.println(");");
while (iter.hasNext()) {
out.printin("_jspx_dependants.add(\"");
- out.print((String) iter.next());
+ out.print(iter.next());
out.println("\");");
}
out.popIndent();
@@ -723,9 +724,9 @@
* handlers: <key>: tag short name <value>: introspection info of tag
* handler for <prefix:shortName> tag
*/
- private Hashtable handlerInfos;
+ private Hashtable<String,Hashtable<String,TagHandlerInfo>> handlerInfos;
- private Hashtable tagVarNumbers;
+ private Hashtable<String,Integer> tagVarNumbers;
private String parent;
@@ -743,7 +744,7 @@
private ServletWriter out;
- private ArrayList methodsBuffered;
+ private ArrayList<GenBuffer> methodsBuffered;
private FragmentHelperClass fragmentHelperClass;
@@ -755,13 +756,13 @@
private int charArrayCount;
- private HashMap textMap;
+ private HashMap<String,String> textMap;
/**
* Constructor.
*/
public GenerateVisitor(boolean isTagFile, ServletWriter out,
- ArrayList methodsBuffered,
+ ArrayList<GenBuffer> methodsBuffered,
FragmentHelperClass fragmentHelperClass, ClassLoader loader,
TagInfo tagInfo) {
@@ -772,9 +773,10 @@
this.loader = loader;
this.tagInfo = tagInfo;
methodNesting = 0;
- handlerInfos = new Hashtable();
- tagVarNumbers = new Hashtable();
- textMap = new HashMap();
+ handlerInfos =
+ new Hashtable<String,Hashtable<String,TagHandlerInfo>>();
+ tagVarNumbers = new Hashtable<String,Integer>();
+ textMap = new HashMap<String,String>();
}
/**
@@ -794,7 +796,7 @@
* attributes that aren't EL expressions)
*/
private String attributeValue(Node.JspAttribute attr, boolean encode,
- Class expectedType) {
+ Class<?> expectedType) {
String v = attr.getValue();
if (!attr.isNamedAttribute() && (v == null))
return "";
@@ -1100,7 +1102,7 @@
if (beanInfo.checkVariable(name)) {
// Bean is defined using useBean, introspect at compile time
- Class bean = beanInfo.getBeanType(name);
+ Class<?> bean = beanInfo.getBeanType(name);
String beanName = JspUtil.getCanonicalName(bean);
java.lang.reflect.Method meth = JspRuntimeLibrary
.getReadMethod(bean, property);
@@ -1232,7 +1234,7 @@
String canonicalName = null; // Canonical name for klass
if (klass != null) {
try {
- Class bean = ctxt.getClassLoader().loadClass(klass);
+ Class<?> bean = ctxt.getClassLoader().loadClass(klass);
if (klass.indexOf('$') >= 0) {
// Obtain the canonical type name
canonicalName = JspUtil.getCanonicalName(bean);
@@ -1859,7 +1861,7 @@
// Compute attribute value string for XML-style and named
// attributes
- Hashtable map = new Hashtable();
+ Hashtable<String,String> map = new Hashtable<String,String>();
Node.JspAttribute[] attrs = n.getJspAttributes();
for (int i = 0; attrs != null && i < attrs.length; i++) {
String attrStr = null;
@@ -1882,10 +1884,10 @@
out.print(" + " + elemName);
// Write remaining attributes
- Enumeration enumeration = map.keys();
+ Enumeration<String> enumeration = map.keys();
while (enumeration.hasMoreElements()) {
- String attrName = (String) enumeration.nextElement();
- out.print((String) map.get(attrName));
+ String attrName = enumeration.nextElement();
+ out.print(map.get(attrName));
}
// Does the <jsp:element> have nested tags other than
@@ -1954,11 +1956,11 @@
charArrayBuffer = new GenBuffer();
caOut = charArrayBuffer.getOut();
caOut.pushIndent();
- textMap = new HashMap();
+ textMap = new HashMap<String,String>();
} else {
caOut = charArrayBuffer.getOut();
}
- String charArrayName = (String) textMap.get(text);
+ String charArrayName = textMap.get(text);
if (charArrayName == null) {
charArrayName = "_jspx_char_array_" + charArrayCount++;
textMap.put(text, charArrayName);
@@ -2150,14 +2152,15 @@
private TagHandlerInfo getTagHandlerInfo(Node.CustomTag n)
throws JasperException {
- Hashtable handlerInfosByShortName = (Hashtable) handlerInfos.get(n
- .getPrefix());
+ Hashtable<String,TagHandlerInfo> handlerInfosByShortName =
+ handlerInfos.get(n.getPrefix());
if (handlerInfosByShortName == null) {
- handlerInfosByShortName = new Hashtable();
+ handlerInfosByShortName =
+ new Hashtable<String,TagHandlerInfo>();
handlerInfos.put(n.getPrefix(), handlerInfosByShortName);
}
- TagHandlerInfo handlerInfo = (TagHandlerInfo) handlerInfosByShortName
- .get(n.getLocalName());
+ TagHandlerInfo handlerInfo =
+ handlerInfosByShortName.get(n.getLocalName());
if (handlerInfo == null) {
handlerInfo = new TagHandlerInfo(n, n.getTagHandlerClass(), err);
handlerInfosByShortName.put(n.getLocalName(), handlerInfo);
@@ -2180,7 +2183,8 @@
String tagEvalVar, String tagPushBodyCountVar)
throws JasperException {
- Class tagHandlerClass = handlerInfo.getTagHandlerClass();
+ Class<?> tagHandlerClass =
+ handlerInfo.getTagHandlerClass();
out.printin("// ");
out.println(n.getQName());
@@ -2447,7 +2451,8 @@
TagHandlerInfo handlerInfo, String tagHandlerVar)
throws JasperException {
- Class tagHandlerClass = handlerInfo.getTagHandlerClass();
+ Class<?> tagHandlerClass =
+ handlerInfo.getTagHandlerClass();
n.setBeginJavaLine(out.getJavaLine());
out.printin("// ");
@@ -2520,7 +2525,7 @@
private void declareScriptingVars(Node.CustomTag n, int scope) {
- Vector vec = n.getScriptingVars(scope);
+ Vector<Object> vec = n.getScriptingVars(scope);
if (vec != null) {
for (int i = 0; i < vec.size(); i++) {
Object elem = vec.elementAt(i);
@@ -2744,7 +2749,7 @@
synchronized (tagVarNumbers) {
varName = prefix + "_" + shortName + "_";
if (tagVarNumbers.get(fullName) != null) {
- Integer i = (Integer) tagVarNumbers.get(fullName);
+ Integer i = tagVarNumbers.get(fullName);
varName = varName + i.intValue();
tagVarNumbers.put(fullName, new Integer(i.intValue() + 1));
} else {
@@ -2778,7 +2783,7 @@
String localName = attr.getLocalName();
Method m = null;
- Class[] c = null;
+ Class<?>[] c = null;
if (attr.isDynamic()) {
c = OBJECT_CLASS;
} else {
@@ -3047,8 +3052,8 @@
* attribute is a named attribute (that is, specified using the
* jsp:attribute standard action), and false otherwise
*/
- private String convertString(Class c, String s, String attrName,
- Class propEditorClass, boolean isNamedAttribute)
+ private String convertString(Class<?> c, String s, String attrName,
+ Class<?> propEditorClass, boolean isNamedAttribute)
throws JasperException {
String quoted = s;
@@ -3286,7 +3291,7 @@
private void genCommonPostamble() {
// Append any methods that were generated in the buffer.
for (int i = 0; i < methodsBuffered.size(); i++) {
- GenBuffer methodBuffer = (GenBuffer) methodsBuffered.get(i);
+ GenBuffer methodBuffer = methodsBuffered.get(i);
methodBuffer.adjustJavaLines(out.getJavaLine() - 1);
out.printMultiLn(methodBuffer.toString());
}
@@ -3350,7 +3355,7 @@
*/
Generator(ServletWriter out, Compiler compiler) {
this.out = out;
- methodsBuffered = new ArrayList();
+ methodsBuffered = new ArrayList<GenBuffer>();
charArrayBuffer = null;
err = compiler.getErrorDispatcher();
ctxt = compiler.getCompilationContext();
@@ -3374,7 +3379,7 @@
beanInfo = pageInfo.getBeanRepository();
breakAtLF = ctxt.getOptions().getMappedFile();
if (isPoolingEnabled) {
- tagHandlerPoolNames = new Vector();
+ tagHandlerPoolNames = new Vector<String>();
}
}
@@ -3838,11 +3843,11 @@
*/
private static class TagHandlerInfo {
- private Hashtable methodMaps;
+ private Hashtable<String, Method> methodMaps;
- private Hashtable propertyEditorMaps;
+ private Hashtable<String, Class<?>> propertyEditorMaps;
- private Class tagHandlerClass;
+ private Class<?> tagHandlerClass;
/**
* Constructor.
@@ -3855,11 +3860,11 @@
* @param err
* Error dispatcher
*/
- TagHandlerInfo(Node n, Class tagHandlerClass, ErrorDispatcher err)
- throws JasperException {
+ TagHandlerInfo(Node n, Class<?> tagHandlerClass,
+ ErrorDispatcher err) throws JasperException {
this.tagHandlerClass = tagHandlerClass;
- this.methodMaps = new Hashtable();
- this.propertyEditorMaps = new Hashtable();
+ this.methodMaps = new Hashtable<String, Method>();
+ this.propertyEditorMaps = new Hashtable<String, Class<?>>();
try {
BeanInfo tagClassInfo = Introspector
@@ -3887,20 +3892,20 @@
* XXX
*/
public Method getSetterMethod(String attrName) {
- return (Method) methodMaps.get(attrName);
+ return methodMaps.get(attrName);
}
/**
* XXX
*/
- public Class getPropertyEditorClass(String attrName) {
- return (Class) propertyEditorMaps.get(attrName);
+ public Class<?> getPropertyEditorClass(String attrName) {
+ return propertyEditorMaps.get(attrName);
}
/**
* XXX
*/
- public Class getTagHandlerClass() {
+ public Class<?> getTagHandlerClass() {
return tagHandlerClass;
}
}
@@ -4017,7 +4022,7 @@
// True if the helper class should be generated.
private boolean used = false;
- private ArrayList fragments = new ArrayList();
+ private ArrayList<Fragment> fragments = new ArrayList<Fragment>();
private String className;
@@ -4113,7 +4118,7 @@
ServletWriter out = this.classBuffer.getOut();
// Generate all fragment methods:
for (int i = 0; i < fragments.size(); i++) {
- Fragment fragment = (Fragment) fragments.get(i);
+ Fragment fragment = fragments.get(i);
fragment.getGenBuffer().adjustJavaLines(out.getJavaLine() - 1);
out.printMultiLn(fragment.getGenBuffer().toString());
}
@@ -4182,7 +4187,7 @@
public void adjustJavaLines(int offset) {
for (int i = 0; i < fragments.size(); i++) {
- Fragment fragment = (Fragment) fragments.get(i);
+ Fragment fragment = fragments.get(i);
fragment.getGenBuffer().adjustJavaLines(offset);
}
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java Sun Nov 23 13:29:46 2008
@@ -52,11 +52,11 @@
private static final String IMPLICIT_TLD = "implicit.tld";
// Maps tag names to tag file paths
- private Hashtable tagFileMap;
+ private Hashtable<String,String> tagFileMap;
private ParserController pc;
private PageInfo pi;
- private Vector vec;
+ private Vector<TagFileInfo> vec;
/**
* Constructor.
@@ -70,8 +70,8 @@
super(prefix, null);
this.pc = pc;
this.pi = pi;
- this.tagFileMap = new Hashtable();
- this.vec = new Vector();
+ this.tagFileMap = new Hashtable<String,String>();
+ this.vec = new Vector<TagFileInfo>();
// Implicit tag libraries have no functions:
this.functions = new FunctionInfo[0];
@@ -94,11 +94,11 @@
}
// Populate mapping of tag names to tag file paths
- Set dirList = ctxt.getResourcePaths(tagdir);
+ Set<String> dirList = ctxt.getResourcePaths(tagdir);
if (dirList != null) {
- Iterator it = dirList.iterator();
+ Iterator<String> it = dirList.iterator();
while (it.hasNext()) {
- String path = (String) it.next();
+ String path = it.next();
if (path.endsWith(TAG_FILE_SUFFIX)
|| path.endsWith(TAGX_FILE_SUFFIX)) {
/*
@@ -131,10 +131,10 @@
}
// Process each child element of our <taglib> element
- Iterator list = tld.findChildren();
+ Iterator<TreeNode> list = tld.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("tlibversion".equals(tname) // JSP 1.1
@@ -184,7 +184,7 @@
TagFileInfo tagFile = super.getTagFile(shortName);
if (tagFile == null) {
- String path = (String) tagFileMap.get(shortName);
+ String path = tagFileMap.get(shortName);
if (path == null) {
return null;
}
@@ -210,8 +210,8 @@
}
public TagLibraryInfo[] getTagLibraryInfos() {
- Collection coll = pi.getTaglibs();
- return (TagLibraryInfo[]) coll.toArray(new TagLibraryInfo[0]);
+ Collection<TagLibraryInfo> coll = pi.getTaglibs();
+ return coll.toArray(new TagLibraryInfo[0]);
}
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java Sun Nov 23 13:29:46 2008
@@ -81,7 +81,8 @@
final ClassLoader classLoader = ctxt.getJspLoader();
String[] fileNames = new String[] {sourceFile};
String[] classNames = new String[] {targetClassName};
- final ArrayList problemList = new ArrayList();
+ final ArrayList<JavacErrorDetail> problemList =
+ new ArrayList<JavacErrorDetail>();
class CompilationUnit implements ICompilationUnit {
@@ -266,7 +267,7 @@
final IErrorHandlingPolicy policy =
DefaultErrorHandlingPolicies.proceedWithAllProblems();
- final Map settings = new HashMap();
+ final Map<String,String> settings = new HashMap<String,String>();
settings.put(CompilerOptions.OPTION_LineNumberAttribute,
CompilerOptions.GENERATE);
settings.put(CompilerOptions.OPTION_SourceFileAttribute,
@@ -419,7 +420,7 @@
if (!problemList.isEmpty()) {
JavacErrorDetail[] jeds =
- (JavacErrorDetail[]) problemList.toArray(new JavacErrorDetail[0]);
+ problemList.toArray(new JavacErrorDetail[0]);
errDispatcher.javacError(jeds);
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JavacErrorDetail.java Sun Nov 23 13:29:46 2008
@@ -220,13 +220,13 @@
*/
private String[] readFile(InputStream s) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(s));
- List lines = new ArrayList();
+ List<String> lines = new ArrayList<String>();
String line;
while ( (line = reader.readLine()) != null ) {
lines.add(line);
}
- return (String[]) lines.toArray( new String[lines.size()] );
+ return lines.toArray( new String[lines.size()] );
}
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java Sun Nov 23 13:29:46 2008
@@ -46,7 +46,7 @@
// Logger
private Log log = LogFactory.getLog(JspConfig.class);
- private Vector jspProperties = null;
+ private Vector<JspPropertyGroup> jspProperties = null;
private ServletContext ctxt;
private boolean initialized = false;
@@ -100,26 +100,27 @@
return;
}
- jspProperties = new Vector();
- Iterator jspPropertyList = jspConfig.findChildren("jsp-property-group");
+ jspProperties = new Vector<JspPropertyGroup>();
+ Iterator<TreeNode> jspPropertyList =
+ jspConfig.findChildren("jsp-property-group");
while (jspPropertyList.hasNext()) {
- TreeNode element = (TreeNode) jspPropertyList.next();
- Iterator list = element.findChildren();
+ TreeNode element = jspPropertyList.next();
+ Iterator<TreeNode> list = element.findChildren();
- Vector urlPatterns = new Vector();
+ Vector<String> urlPatterns = new Vector<String>();
String pageEncoding = null;
String scriptingInvalid = null;
String elIgnored = null;
String isXml = null;
- Vector includePrelude = new Vector();
- Vector includeCoda = new Vector();
+ Vector<String> includePrelude = new Vector<String>();
+ Vector<String> includeCoda = new Vector<String>();
String deferredSyntaxAllowedAsLiteral = null;
String trimDirectiveWhitespaces = null;
while (list.hasNext()) {
- element = (TreeNode) list.next();
+ element = list.next();
String tname = element.getName();
if ("url-pattern".equals(tname))
@@ -149,7 +150,7 @@
// Add one JspPropertyGroup for each URL Pattern. This makes
// the matching logic easier.
for( int p = 0; p < urlPatterns.size(); p++ ) {
- String urlPattern = (String)urlPatterns.elementAt( p );
+ String urlPattern = urlPatterns.elementAt( p );
String path = null;
String extension = null;
@@ -289,8 +290,8 @@
uriExtension = uri.substring(index+1);
}
- Vector includePreludes = new Vector();
- Vector includeCodas = new Vector();
+ Vector<String> includePreludes = new Vector<String>();
+ Vector<String> includeCodas = new Vector<String>();
JspPropertyGroup isXmlMatch = null;
JspPropertyGroup elIgnoredMatch = null;
@@ -299,10 +300,10 @@
JspPropertyGroup deferedSyntaxAllowedAsLiteralMatch = null;
JspPropertyGroup trimDirectiveWhitespacesMatch = null;
- Iterator iter = jspProperties.iterator();
+ Iterator<JspPropertyGroup> iter = jspProperties.iterator();
while (iter.hasNext()) {
- JspPropertyGroup jpg = (JspPropertyGroup) iter.next();
+ JspPropertyGroup jpg = iter.next();
JspProperty jp = jpg.getJspProperty();
// (arrays will be the same length)
@@ -419,10 +420,10 @@
uriExtension = uri.substring(index+1);
}
- Iterator iter = jspProperties.iterator();
+ Iterator<JspPropertyGroup> iter = jspProperties.iterator();
while (iter.hasNext()) {
- JspPropertyGroup jpg = (JspPropertyGroup) iter.next();
+ JspPropertyGroup jpg = iter.next();
JspProperty jp = jpg.getJspProperty();
String extension = jpg.getExtension();
@@ -475,14 +476,14 @@
private String elIgnored;
private String scriptingInvalid;
private String pageEncoding;
- private Vector includePrelude;
- private Vector includeCoda;
+ private Vector<String> includePrelude;
+ private Vector<String> includeCoda;
private String deferedSyntaxAllowedAsLiteral;
private String trimDirectiveWhitespaces;
public JspProperty(String isXml, String elIgnored,
String scriptingInvalid, String pageEncoding,
- Vector includePrelude, Vector includeCoda,
+ Vector<String> includePrelude, Vector<String> includeCoda,
String deferedSyntaxAllowedAsLiteral,
String trimDirectiveWhitespaces) {
@@ -512,11 +513,11 @@
return pageEncoding;
}
- public Vector getIncludePrelude() {
+ public Vector<String> getIncludePrelude() {
return includePrelude;
}
- public Vector getIncludeCoda() {
+ public Vector<String> getIncludeCoda() {
return includeCoda;
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Sun Nov 23 13:29:46 2008
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.jar.JarFile;
+import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagFileInfo;
import javax.servlet.jsp.tagext.TagInfo;
import javax.servlet.jsp.tagext.TagLibraryInfo;
@@ -228,11 +229,11 @@
* This is used to implement the include-prelude and include-coda
* subelements of the jsp-config element in web.xml
*/
- private void addInclude(Node parent, List files) throws SAXException {
+ private void addInclude(Node parent, List<String> files) throws SAXException {
if (files != null) {
- Iterator iter = files.iterator();
+ Iterator<String> iter = files.iterator();
while (iter.hasNext()) {
- String file = (String)iter.next();
+ String file = iter.next();
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "file", "file", "CDATA", file);
@@ -1166,7 +1167,7 @@
throw new SAXException(
Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri));
}
- Class tagHandlerClass = null;
+ Class<?> tagHandlerClass = null;
if (tagInfo != null) {
String handlerClassName = tagInfo.getTagClassName();
try {
@@ -1254,7 +1255,7 @@
String[] location = ctxt.getTldLocation(uri);
if (location != null || !isPlainUri) {
if (ctxt.getOptions().isCaching()) {
- result = (TagLibraryInfoImpl) ctxt.getOptions().getCache().get(uri);
+ result = ctxt.getOptions().getCache().get(uri);
}
if (result == null) {
/*
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspReader.java Sun Nov 23 13:29:46 2008
@@ -68,7 +68,7 @@
/**
* The list of source files.
*/
- private List sourceFiles;
+ private List<String> sourceFiles;
/**
* The current file ID (-1 indicates an error or no file).
@@ -134,7 +134,7 @@
this.context = ctxt;
this.err = err;
- sourceFiles = new Vector();
+ sourceFiles = new Vector<String>();
currFileId = 0;
size = 0;
singleFile = false;
@@ -156,7 +156,7 @@
* @return The file at that position, if found, null otherwise
*/
String getFile(final int fileid) {
- return (String) sourceFiles.get(fileid);
+ return sourceFiles.get(fileid);
}
/**
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java Sun Nov 23 13:29:46 2008
@@ -240,9 +240,9 @@
* Process a "destory" event for this web application context.
*/
public void destroy() {
- Iterator servlets = jsps.values().iterator();
+ Iterator<JspServletWrapper> servlets = jsps.values().iterator();
while (servlets.hasNext()) {
- ((JspServletWrapper) servlets.next()).destroy();
+ servlets.next().destroy();
}
}
@@ -336,7 +336,7 @@
// protocol URL's to the classpath.
if( urls[i].getProtocol().equals("file") ) {
- cpath.append((String)urls[i].getFile()+sep);
+ cpath.append(urls[i].getFile()+sep);
}
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Mark.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Mark.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Mark.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Mark.java Sun Nov 23 13:29:46 2008
@@ -47,7 +47,7 @@
* stack of stream and stream state of streams that have included
* current stream
*/
- private Stack includeStack = null;
+ private Stack<IncludeState> includeStack = null;
// encoding of current file
private String encoding = null;
@@ -80,7 +80,7 @@
this.fileName = name;
this.baseDir = inBaseDir;
this.encoding = inEncoding;
- this.includeStack = new Stack();
+ this.includeStack = new Stack<IncludeState>();
}
@@ -101,7 +101,7 @@
this.encoding = other.encoding;
// clone includeStack without cloning contents
- includeStack = new Stack();
+ includeStack = new Stack<IncludeState>();
for ( int i=0; i < other.includeStack.size(); i++ ) {
includeStack.addElement( other.includeStack.elementAt(i) );
}
@@ -168,7 +168,7 @@
}
// get previous state in stack
- IncludeState state = (IncludeState) includeStack.pop( );
+ IncludeState state = includeStack.pop( );
// set new variables
cursor = state.cursor;
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Node.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Node.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Node.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Node.java Sun Nov 23 13:29:46 2008
@@ -31,6 +31,7 @@
import javax.servlet.jsp.tagext.IterationTag;
import javax.servlet.jsp.tagext.JspIdConsumer;
import javax.servlet.jsp.tagext.SimpleTag;
+import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagAttributeInfo;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagFileInfo;
@@ -590,7 +591,7 @@
*/
public static class PageDirective extends Node {
- private Vector imports;
+ private Vector<String> imports;
public PageDirective(Attributes attrs, Mark start, Node parent) {
this(JSP_PAGE_DIRECTIVE_ACTION, attrs, null, null, start, parent);
@@ -601,7 +602,7 @@
Mark start, Node parent) {
super(qName, PAGE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
- imports = new Vector();
+ imports = new Vector<String>();
}
public void accept(Visitor v) throws JasperException {
@@ -631,7 +632,7 @@
}
}
- public List getImports() {
+ public List<String> getImports() {
return imports;
}
}
@@ -676,7 +677,7 @@
* Represents a tag directive
*/
public static class TagDirective extends Node {
- private Vector imports;
+ private Vector<String> imports;
public TagDirective(Attributes attrs, Mark start, Node parent) {
this(JSP_TAG_DIRECTIVE_ACTION, attrs, null, null, start, parent);
@@ -687,7 +688,7 @@
Mark start, Node parent) {
super(qName, TAG_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
- imports = new Vector();
+ imports = new Vector<String>();
}
public void accept(Visitor v) throws JasperException {
@@ -717,7 +718,7 @@
}
}
- public List getImports() {
+ public List<String> getImports() {
return imports;
}
}
@@ -1405,7 +1406,7 @@
private TagFileInfo tagFileInfo;
- private Class tagHandlerClass;
+ private Class<?> tagHandlerClass;
private VariableInfo[] varInfos;
@@ -1425,11 +1426,11 @@
private boolean implementsDynamicAttributes;
- private Vector atBeginScriptingVars;
+ private Vector<Object> atBeginScriptingVars;
- private Vector atEndScriptingVars;
+ private Vector<Object> atEndScriptingVars;
- private Vector nestedScriptingVars;
+ private Vector<Object> nestedScriptingVars;
private Node.CustomTag customTagParent;
@@ -1454,7 +1455,7 @@
*/
public CustomTag(String qName, String prefix, String localName,
String uri, Attributes attrs, Mark start, Node parent,
- TagInfo tagInfo, Class tagHandlerClass) {
+ TagInfo tagInfo, Class<?> tagHandlerClass) {
this(qName, prefix, localName, uri, attrs, null, null, start,
parent, tagInfo, tagHandlerClass);
}
@@ -1465,7 +1466,7 @@
public CustomTag(String qName, String prefix, String localName,
String uri, Attributes attrs, Attributes nonTaglibXmlnsAttrs,
Attributes taglibAttrs, Mark start, Node parent,
- TagInfo tagInfo, Class tagHandlerClass) {
+ TagInfo tagInfo, Class<?> tagHandlerClass) {
super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
start, parent);
@@ -1605,11 +1606,11 @@
return tagFileInfo != null;
}
- public Class getTagHandlerClass() {
+ public Class<?> getTagHandlerClass() {
return tagHandlerClass;
}
- public void setTagHandlerClass(Class hc) {
+ public void setTagHandlerClass(Class<?> hc) {
tagHandlerClass = hc;
}
@@ -1661,7 +1662,7 @@
return this.numCount;
}
- public void setScriptingVars(Vector vec, int scope) {
+ public void setScriptingVars(Vector<Object> vec, int scope) {
switch (scope) {
case VariableInfo.AT_BEGIN:
this.atBeginScriptingVars = vec;
@@ -1679,8 +1680,8 @@
* Gets the scripting variables for the given scope that need to be
* declared.
*/
- public Vector getScriptingVars(int scope) {
- Vector vec = null;
+ public Vector<Object> getScriptingVars(int scope) {
+ Vector<Object> vec = null;
switch (scope) {
case VariableInfo.AT_BEGIN:
@@ -2004,7 +2005,7 @@
*/
public static class TemplateText extends Node {
- private ArrayList extraSmap = null;
+ private ArrayList<Integer> extraSmap = null;
public TemplateText(String text, Mark start, Node parent) {
super(null, null, text, start, parent);
@@ -2064,12 +2065,12 @@
*/
public void addSmap(int srcLine) {
if (extraSmap == null) {
- extraSmap = new ArrayList();
+ extraSmap = new ArrayList<Integer>();
}
extraSmap.add(new Integer(srcLine));
}
- public ArrayList getExtraSmap() {
+ public ArrayList<Integer> getExtraSmap() {
return extraSmap;
}
}
@@ -2311,19 +2312,19 @@
*/
public static class Nodes {
- private List list;
+ private List<Node> list;
private Node.Root root; // null if this is not a page
private boolean generatedInBuffer;
public Nodes() {
- list = new Vector();
+ list = new Vector<Node>();
}
public Nodes(Node.Root root) {
this.root = root;
- list = new Vector();
+ list = new Vector<Node>();
list.add(root);
}
@@ -2355,9 +2356,9 @@
* The visitor used
*/
public void visit(Visitor v) throws JasperException {
- Iterator iter = list.iterator();
+ Iterator<Node> iter = list.iterator();
while (iter.hasNext()) {
- Node n = (Node) iter.next();
+ Node n = iter.next();
n.accept(v);
}
}
@@ -2369,7 +2370,7 @@
public Node getNode(int index) {
Node n = null;
try {
- n = (Node) list.get(index);
+ n = list.get(index);
} catch (ArrayIndexOutOfBoundsException e) {
}
return n;
Modified: tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/PageDataImpl.java Sun Nov 23 13:29:46 2008
@@ -518,7 +518,7 @@
if (n.getImports().size() > 0) {
// Concatenate names of imported classes/packages
boolean first = true;
- ListIterator iter = n.getImports().listIterator();
+ ListIterator<String> iter = n.getImports().listIterator();
while (iter.hasNext()) {
if (first) {
first = false;
@@ -526,7 +526,7 @@
} else {
buf.append(",");
}
- buf.append(JspUtil.getExprInXml((String) iter.next()));
+ buf.append(JspUtil.getExprInXml(iter.next()));
}
buf.append("\"\n");
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/PageInfo.java Sun Nov 23 13:29:46 2008
@@ -38,14 +38,14 @@
class PageInfo {
- private Vector imports;
- private Vector dependants;
+ private Vector<String> imports;
+ private Vector<String> dependants;
private BeanRepository beanRepository;
- private HashMap taglibsMap;
- private HashMap jspPrefixMapper;
- private HashMap xmlPrefixMapper;
- private HashMap nonCustomTagPrefixMap;
+ private HashMap<String,TagLibraryInfo> taglibsMap;
+ private HashMap<String, String> jspPrefixMapper;
+ private HashMap<String, LinkedList<String>> xmlPrefixMapper;
+ private HashMap<String, Mark> nonCustomTagPrefixMap;
private String jspFile;
private String defaultLanguage = "java";
private String language;
@@ -86,28 +86,28 @@
private boolean isJspPrefixHijacked;
// Set of all element and attribute prefixes used in this translation unit
- private HashSet prefixes;
+ private HashSet<String> prefixes;
private boolean hasJspRoot = false;
- private Vector includePrelude;
- private Vector includeCoda;
- private Vector pluginDcls; // Id's for tagplugin declarations
+ private Vector<String> includePrelude;
+ private Vector<String> includeCoda;
+ private Vector<String> pluginDcls; // Id's for tagplugin declarations
PageInfo(BeanRepository beanRepository, String jspFile) {
this.jspFile = jspFile;
this.beanRepository = beanRepository;
- this.taglibsMap = new HashMap();
- this.jspPrefixMapper = new HashMap();
- this.xmlPrefixMapper = new HashMap();
- this.nonCustomTagPrefixMap = new HashMap();
- this.imports = new Vector();
- this.dependants = new Vector();
- this.includePrelude = new Vector();
- this.includeCoda = new Vector();
- this.pluginDcls = new Vector();
- this.prefixes = new HashSet();
+ this.taglibsMap = new HashMap<String, TagLibraryInfo>();
+ this.jspPrefixMapper = new HashMap<String, String>();
+ this.xmlPrefixMapper = new HashMap<String, LinkedList<String>>();
+ this.nonCustomTagPrefixMap = new HashMap<String, Mark>();
+ this.imports = new Vector<String>();
+ this.dependants = new Vector<String>();
+ this.includePrelude = new Vector<String>();
+ this.includeCoda = new Vector<String>();
+ this.pluginDcls = new Vector<String>();
+ this.prefixes = new HashSet<String>();
// Enter standard imports
for(int i = 0; i < Constants.STANDARD_IMPORTS.length; i++)
@@ -126,7 +126,7 @@
return false;
}
- public void addImports(List imports) {
+ public void addImports(List<String> imports) {
this.imports.addAll(imports);
}
@@ -134,7 +134,7 @@
this.imports.add(imp);
}
- public List getImports() {
+ public List<String> getImports() {
return imports;
}
@@ -147,7 +147,7 @@
dependants.add(d);
}
- public List getDependants() {
+ public List<String> getDependants() {
return dependants;
}
@@ -171,19 +171,19 @@
return scriptingInvalid;
}
- public List getIncludePrelude() {
+ public List<String> getIncludePrelude() {
return includePrelude;
}
- public void setIncludePrelude(Vector prelude) {
+ public void setIncludePrelude(Vector<String> prelude) {
includePrelude = prelude;
}
- public List getIncludeCoda() {
+ public List<String> getIncludeCoda() {
return includeCoda;
}
- public void setIncludeCoda(Vector coda) {
+ public void setIncludeCoda(Vector<String> coda) {
includeCoda = coda;
}
@@ -274,7 +274,7 @@
* @return Tag library corresponding to the given URI
*/
public TagLibraryInfo getTaglib(String uri) {
- return (TagLibraryInfo) taglibsMap.get(uri);
+ return taglibsMap.get(uri);
}
/*
@@ -282,7 +282,7 @@
*
* @return Collection of tag libraries that are associated with a URI
*/
- public Collection getTaglibs() {
+ public Collection<TagLibraryInfo> getTaglibs() {
return taglibsMap.values();
}
@@ -316,9 +316,9 @@
* @param uri The URI to be pushed onto the stack
*/
public void pushPrefixMapping(String prefix, String uri) {
- LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
+ LinkedList<String> stack = xmlPrefixMapper.get(prefix);
if (stack == null) {
- stack = new LinkedList();
+ stack = new LinkedList<String>();
xmlPrefixMapper.put(prefix, stack);
}
stack.addFirst(uri);
@@ -331,7 +331,7 @@
* @param prefix The prefix whose stack of URIs is to be popped
*/
public void popPrefixMapping(String prefix) {
- LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
+ LinkedList<String> stack = xmlPrefixMapper.get(prefix);
if (stack == null || stack.size() == 0) {
// XXX throw new Exception("XXX");
}
@@ -349,11 +349,11 @@
String uri = null;
- LinkedList stack = (LinkedList) xmlPrefixMapper.get(prefix);
+ LinkedList<String> stack = xmlPrefixMapper.get(prefix);
if (stack == null || stack.size() == 0) {
- uri = (String) jspPrefixMapper.get(prefix);
+ uri = jspPrefixMapper.get(prefix);
} else {
- uri = (String) stack.getFirst();
+ uri = stack.getFirst();
}
return uri;
@@ -678,7 +678,7 @@
}
public Mark getNonCustomTagPrefix(String prefix) {
- return (Mark) nonCustomTagPrefixMap.get(prefix);
+ return nonCustomTagPrefixMap.get(prefix);
}
public String getDeferredSyntaxAllowedAsLiteral() {
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Parser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Parser.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Parser.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Parser.java Sun Nov 23 13:29:46 2008
@@ -382,11 +382,11 @@
* Add a list of files. This is used for implementing include-prelude and
* include-coda of jsp-config element in web.xml
*/
- private void addInclude(Node parent, List files) throws JasperException {
+ private void addInclude(Node parent, List<String> files) throws JasperException {
if (files != null) {
- Iterator iter = files.iterator();
+ Iterator<String> iter = files.iterator();
while (iter.hasNext()) {
- String file = (String) iter.next();
+ String file = iter.next();
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "file", "file", "CDATA", file);
@@ -1230,7 +1230,7 @@
if (tagInfo == null && tagFileInfo == null) {
err.jspError(start, "jsp.error.bad_tag", shortTagName, prefix);
}
- Class tagHandlerClass = null;
+ Class<?> tagHandlerClass = null;
if (tagInfo != null) {
// Must be a classic tag, load it here.
// tag files will be loaded later, in TagFileProcessor
Modified: tomcat/trunk/java/org/apache/jasper/compiler/ParserController.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/ParserController.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/ParserController.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/ParserController.java Sun Nov 23 13:29:46 2008
@@ -58,7 +58,7 @@
* A stack to keep track of the 'current base directory'
* for include directives that refer to relative paths.
*/
- private Stack baseDirStack = new Stack();
+ private Stack<String> baseDirStack = new Stack<String>();
private boolean isEncodingSpecifiedInProlog;
private boolean isBomPresent;
@@ -534,7 +534,7 @@
String fileName = inFileName.replace('\\', '/');
boolean isAbsolute = fileName.startsWith("/");
fileName = isAbsolute ? fileName
- : (String) baseDirStack.peek() + fileName;
+ : baseDirStack.peek() + fileName;
String baseDir =
fileName.substring(0, fileName.lastIndexOf("/") + 1);
baseDirStack.push(baseDir);
Modified: tomcat/trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/ScriptingVariabler.java Sun Nov 23 13:29:46 2008
@@ -58,11 +58,11 @@
static class ScriptingVariableVisitor extends Node.Visitor {
private ErrorDispatcher err;
- private Hashtable scriptVars;
+ private Hashtable<String,Integer> scriptVars;
public ScriptingVariableVisitor(ErrorDispatcher err) {
this.err = err;
- scriptVars = new Hashtable();
+ scriptVars = new Hashtable<String,Integer>();
}
public void visit(Node.CustomTag n) throws JasperException {
@@ -81,7 +81,7 @@
return;
}
- Vector vec = new Vector();
+ Vector<Object> vec = new Vector<Object>();
Integer ownRange = null;
if (scope == VariableInfo.AT_BEGIN
@@ -104,7 +104,7 @@
}
String varName = varInfos[i].getVarName();
- Integer currentRange = (Integer) scriptVars.get(varName);
+ Integer currentRange = scriptVars.get(varName);
if (currentRange == null
|| ownRange.compareTo(currentRange) > 0) {
scriptVars.put(varName, ownRange);
@@ -127,7 +127,7 @@
}
}
- Integer currentRange = (Integer) scriptVars.get(varName);
+ Integer currentRange = scriptVars.get(varName);
if (currentRange == null
|| ownRange.compareTo(currentRange) > 0) {
scriptVars.put(varName, ownRange);
Modified: tomcat/trunk/java/org/apache/jasper/compiler/SmapGenerator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/SmapGenerator.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/SmapGenerator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/SmapGenerator.java Sun Nov 23 13:29:46 2008
@@ -47,8 +47,8 @@
private String outputFileName;
private String defaultStratum = "Java";
- private List strata = new ArrayList();
- private List embedded = new ArrayList();
+ private List<SmapStratum> strata = new ArrayList<SmapStratum>();
+ private List<String> embedded = new ArrayList<String>();
private boolean doEmbedded = true;
//*********************************************************************
@@ -129,7 +129,7 @@
// print our StratumSections, FileSections, and LineSections
int nStrata = strata.size();
for (int i = 0; i < nStrata; i++) {
- SmapStratum s = (SmapStratum) strata.get(i);
+ SmapStratum s = strata.get(i);
out.append(s.getString());
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/SmapStratum.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/SmapStratum.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/SmapStratum.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/SmapStratum.java Sun Nov 23 13:29:46 2008
@@ -115,9 +115,9 @@
// Private state
private String stratumName;
- private List fileNameList;
- private List filePathList;
- private List lineData;
+ private List<String> fileNameList;
+ private List<String> filePathList;
+ private List<LineInfo> lineData;
private int lastFileID;
//*********************************************************************
@@ -131,9 +131,9 @@
*/
public SmapStratum(String stratumName) {
this.stratumName = stratumName;
- fileNameList = new ArrayList();
- filePathList = new ArrayList();
- lineData = new ArrayList();
+ fileNameList = new ArrayList<String>();
+ filePathList = new ArrayList<String>();
+ lineData = new ArrayList<LineInfo>();
lastFileID = 0;
}
@@ -180,8 +180,8 @@
//outputLineIncrement, if possible
int i = 0;
while (i < lineData.size() - 1) {
- LineInfo li = (LineInfo)lineData.get(i);
- LineInfo liNext = (LineInfo)lineData.get(i + 1);
+ LineInfo li = lineData.get(i);
+ LineInfo liNext = lineData.get(i + 1);
if (!liNext.lineFileIDSet
&& liNext.inputStartLine == li.inputStartLine
&& liNext.inputLineCount == 1
@@ -203,8 +203,8 @@
//inputLineCount, if possible
i = 0;
while (i < lineData.size() - 1) {
- LineInfo li = (LineInfo)lineData.get(i);
- LineInfo liNext = (LineInfo)lineData.get(i + 1);
+ LineInfo li = lineData.get(i);
+ LineInfo liNext = lineData.get(i + 1);
if (!liNext.lineFileIDSet
&& liNext.inputStartLine == li.inputStartLine + li.inputLineCount
&& liNext.outputLineIncrement == li.outputLineIncrement
@@ -308,7 +308,7 @@
out.append("+ " + i + " " + fileNameList.get(i) + "\n");
// Source paths must be relative, not absolute, so we
// remove the leading "/", if one exists.
- String filePath = (String)filePathList.get(i);
+ String filePath = filePathList.get(i);
if (filePath.startsWith("/")) {
filePath = filePath.substring(1);
}
@@ -322,7 +322,7 @@
out.append("*L\n");
bound = lineData.size();
for (int i = 0; i < bound; i++) {
- LineInfo li = (LineInfo)lineData.get(i);
+ LineInfo li = lineData.get(i);
out.append(li.getString());
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java Sun Nov 23 13:29:46 2008
@@ -74,7 +74,7 @@
pageNodes.visit(psVisitor);
} catch (JasperException ex) {
}
- HashMap map = psVisitor.getMap();
+ HashMap<String, SmapStratum> map = psVisitor.getMap();
// set up our SMAP generator
SmapGenerator g = new SmapGenerator();
@@ -123,11 +123,11 @@
smapInfo[1] = g.getString();
int count = 2;
- Iterator iter = map.entrySet().iterator();
+ Iterator<Map.Entry<String,SmapStratum>> iter = map.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- String innerClass = (String) entry.getKey();
- s = (SmapStratum) entry.getValue();
+ Map.Entry<String,SmapStratum> entry = iter.next();
+ String innerClass = entry.getKey();
+ s = entry.getValue();
s.optimizeLineSection();
g = new SmapGenerator();
g.setOutputFileName(unqualify(ctxt.getServletJavaFileName()));
@@ -385,7 +385,7 @@
}
int readU1() {
- return ((int)orig[origPos++]) & 0xFF;
+ return orig[origPos++] & 0xFF;
}
int readU2() {
@@ -495,7 +495,7 @@
public static void evaluateNodes(
Node.Nodes nodes,
SmapStratum s,
- HashMap innerClassMap,
+ HashMap<String, SmapStratum> innerClassMap,
boolean breakAtLF) {
try {
nodes.visit(new SmapGenVisitor(s, breakAtLF, innerClassMap));
@@ -507,9 +507,9 @@
private SmapStratum smap;
private boolean breakAtLF;
- private HashMap innerClassMap;
+ private HashMap<String, SmapStratum> innerClassMap;
- SmapGenVisitor(SmapStratum s, boolean breakAtLF, HashMap map) {
+ SmapGenVisitor(SmapStratum s, boolean breakAtLF, HashMap<String, SmapStratum> map) {
this.smap = s;
this.breakAtLF = breakAtLF;
this.innerClassMap = map;
@@ -519,7 +519,7 @@
SmapStratum smapSave = smap;
String innerClass = n.getInnerClassName();
if (innerClass != null) {
- this.smap = (SmapStratum) innerClassMap.get(innerClass);
+ this.smap = innerClassMap.get(innerClass);
}
super.visitBody(n);
smap = smapSave;
@@ -628,13 +628,13 @@
iOutputLineIncrement);
// Output additional mappings in the text
- java.util.ArrayList extraSmap = n.getExtraSmap();
+ java.util.ArrayList<Integer> extraSmap = n.getExtraSmap();
if (extraSmap != null) {
for (int i = 0; i < extraSmap.size(); i++) {
iOutputStartLine += iOutputLineIncrement;
smap.addLineData(
- iInputStartLine+((Integer)extraSmap.get(i)).intValue(),
+ iInputStartLine+extraSmap.get(i).intValue(),
fileName,
1,
iOutputStartLine,
@@ -712,7 +712,7 @@
private static class PreScanVisitor extends Node.Visitor {
- HashMap map = new HashMap();
+ HashMap<String, SmapStratum> map = new HashMap<String, SmapStratum>();
public void doVisit(Node n) {
String inner = n.getInnerClassName();
@@ -721,7 +721,7 @@
}
}
- HashMap getMap() {
+ HashMap<String, SmapStratum> getMap() {
return map;
}
}
Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagFileProcessor.java Sun Nov 23 13:29:46 2008
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.net.URLClassLoader;
import java.util.Iterator;
-import java.util.List;
import java.util.Vector;
import java.util.HashMap;
@@ -49,7 +48,7 @@
class TagFileProcessor {
- private Vector tempVector;
+ private Vector<Compiler> tempVector;
/**
* A visitor the tag file
@@ -116,9 +115,9 @@
private String example = null;
- private Vector attributeVector;
+ private Vector<TagAttributeInfo> attributeVector;
- private Vector variableVector;
+ private Vector<TagVariableInfo> variableVector;
private static final String ATTR_NAME = "the name attribute of the attribute directive";
@@ -130,9 +129,11 @@
private static final String TAG_DYNAMIC = "the dynamic-attributes attribute of the tag directive";
- private HashMap nameTable = new HashMap();
+ private HashMap<String,NameEntry> nameTable =
+ new HashMap<String,NameEntry>();
- private HashMap nameFromTable = new HashMap();
+ private HashMap<String,NameEntry> nameFromTable =
+ new HashMap<String,NameEntry>();
public TagFileDirectiveVisitor(Compiler compiler,
TagLibraryInfo tagLibInfo, String name, String path) {
@@ -140,8 +141,8 @@
this.tagLibInfo = tagLibInfo;
this.name = name;
this.path = path;
- attributeVector = new Vector();
- variableVector = new Vector();
+ attributeVector = new Vector<TagAttributeInfo>();
+ variableVector = new Vector<TagVariableInfo>();
}
public void visit(Node.TagDirective n) throws JasperException {
@@ -351,14 +352,14 @@
* Returns the vector of attributes corresponding to attribute
* directives.
*/
- public Vector getAttributesVector() {
+ public Vector<TagAttributeInfo> getAttributesVector() {
return attributeVector;
}
/*
* Returns the vector of variables corresponding to variable directives.
*/
- public Vector getVariablesVector() {
+ public Vector<TagVariableInfo> getVariablesVector() {
return variableVector;
}
@@ -443,8 +444,8 @@
private void checkUniqueName(String name, String type, Node n,
TagAttributeInfo attr) throws JasperException {
- HashMap table = (type == VAR_NAME_FROM) ? nameFromTable : nameTable;
- NameEntry nameEntry = (NameEntry) table.get(name);
+ HashMap<String, NameEntry> table = (type == VAR_NAME_FROM) ? nameFromTable : nameTable;
+ NameEntry nameEntry = table.get(name);
if (nameEntry != null) {
if (type != TAG_DYNAMIC || nameEntry.getType() != TAG_DYNAMIC) {
int line = nameEntry.getNode().getStart().getLineNumber();
@@ -461,12 +462,11 @@
*/
void postCheck() throws JasperException {
// Check that var.name-from-attributes has valid values.
- Iterator iter = nameFromTable.keySet().iterator();
+ Iterator<String> iter = nameFromTable.keySet().iterator();
while (iter.hasNext()) {
- String nameFrom = (String) iter.next();
- NameEntry nameEntry = (NameEntry) nameTable.get(nameFrom);
- NameEntry nameFromEntry = (NameEntry) nameFromTable
- .get(nameFrom);
+ String nameFrom = iter.next();
+ NameEntry nameEntry = nameTable.get(nameFrom);
+ NameEntry nameFromEntry = nameFromTable.get(nameFrom);
Node nameFromNode = nameFromEntry.getNode();
if (nameEntry == null) {
err.jspError(nameFromNode,
@@ -529,13 +529,12 @@
/**
* Compiles and loads a tagfile.
*/
- private Class loadTagFile(Compiler compiler, String tagFilePath,
+ private Class<?> loadTagFile(Compiler compiler, String tagFilePath,
TagInfo tagInfo, PageInfo parentPageInfo) throws JasperException {
JspCompilationContext ctxt = compiler.getCompilationContext();
JspRuntimeContext rctxt = ctxt.getRuntimeContext();
- JspServletWrapper wrapper = (JspServletWrapper) rctxt
- .getWrapper(tagFilePath);
+ JspServletWrapper wrapper = rctxt.getWrapper(tagFilePath);
synchronized (rctxt) {
if (wrapper == null) {
@@ -556,7 +555,7 @@
wrapper.getJspEngineContext().setTagInfo(tagInfo);
}
- Class tagClazz;
+ Class<?> tagClazz;
int tripCount = wrapper.incTripCount();
try {
if (tripCount > 0) {
@@ -585,10 +584,10 @@
try {
Object tagIns = tagClazz.newInstance();
if (tagIns instanceof JspSourceDependent) {
- Iterator iter = ((List) ((JspSourceDependent) tagIns)
- .getDependants()).iterator();
+ Iterator<String> iter = ((JspSourceDependent) tagIns)
+ .getDependants().iterator();
while (iter.hasNext()) {
- parentPageInfo.addDependant((String) iter.next());
+ parentPageInfo.addDependant(iter.next());
}
}
} catch (Exception e) {
@@ -633,7 +632,7 @@
} else {
pageInfo.addDependant(tagFilePath);
}
- Class c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),
+ Class<?> c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),
pageInfo);
n.setTagHandlerClass(c);
}
@@ -650,7 +649,7 @@
public void loadTagFiles(Compiler compiler, Node.Nodes page)
throws JasperException {
- tempVector = new Vector();
+ tempVector = new Vector<Compiler>();
page.visit(new TagFileLoaderVisitor(compiler));
}
@@ -662,9 +661,9 @@
* If non-null, remove only the class file with with this name.
*/
public void removeProtoTypeFiles(String classFileName) {
- Iterator iter = tempVector.iterator();
+ Iterator<Compiler> iter = tempVector.iterator();
while (iter.hasNext()) {
- Compiler c = (Compiler) iter.next();
+ Compiler c = iter.next();
if (classFileName == null) {
c.removeGeneratedClassFiles();
} else if (classFileName.equals(c.getCompilationContext()
Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java?rev=720049&r1=720048&r2=720049&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java Sun Nov 23 13:29:46 2008
@@ -201,8 +201,8 @@
}
public TagLibraryInfo[] getTagLibraryInfos() {
- Collection coll = pi.getTaglibs();
- return (TagLibraryInfo[]) coll.toArray(new TagLibraryInfo[0]);
+ Collection<TagLibraryInfo> coll = pi.getTaglibs();
+ return coll.toArray(new TagLibraryInfo[0]);
}
/*
@@ -212,9 +212,9 @@
*/
private void parseTLD(JspCompilationContext ctxt, String uri,
InputStream in, URL jarFileUrl) throws JasperException {
- Vector tagVector = new Vector();
- Vector tagFileVector = new Vector();
- Hashtable functionTable = new Hashtable();
+ Vector<TagInfo> tagVector = new Vector<TagInfo>();
+ Vector<TagFileInfo> tagFileVector = new Vector<TagFileInfo>();
+ Hashtable<String, FunctionInfo> functionTable = new Hashtable<String, FunctionInfo>();
// Create an iterator over the child elements of our <taglib> element
ParserUtils pu = new ParserUtils();
@@ -226,10 +226,10 @@
this.jspversion = tld.findAttribute("version");
// Process each child element of our <taglib> element
- Iterator list = tld.findChildren();
+ Iterator<TreeNode> list = tld.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("tlibversion".equals(tname) // JSP 1.1
@@ -293,9 +293,9 @@
this.functions = new FunctionInfo[functionTable.size()];
int i = 0;
- Enumeration enumeration = functionTable.elements();
+ Enumeration<FunctionInfo> enumeration = functionTable.elements();
while (enumeration.hasMoreElements()) {
- this.functions[i++] = (FunctionInfo) enumeration.nextElement();
+ this.functions[i++] = enumeration.nextElement();
}
}
@@ -358,11 +358,11 @@
String largeIcon = null;
boolean dynamicAttributes = false;
- Vector attributeVector = new Vector();
- Vector variableVector = new Vector();
- Iterator list = elem.findChildren();
+ Vector<TagAttributeInfo> attributeVector = new Vector<TagAttributeInfo>();
+ Vector<TagVariableInfo> variableVector = new Vector<TagVariableInfo>();
+ Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("name".equals(tname)) {
@@ -413,7 +413,8 @@
TagExtraInfo tei = null;
if (teiClassName != null && !teiClassName.equals("")) {
try {
- Class teiClass = ctxt.getClassLoader().loadClass(teiClassName);
+ Class<?> teiClass =
+ ctxt.getClassLoader().loadClass(teiClassName);
tei = (TagExtraInfo) teiClass.newInstance();
} catch (Exception e) {
err.jspError("jsp.error.teiclass.instantiation", teiClassName,
@@ -451,9 +452,9 @@
String name = null;
String path = null;
- Iterator list = elem.findChildren();
+ Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
- TreeNode child = (TreeNode) list.next();
+ TreeNode child = list.next();
String tname = child.getName();
if ("name".equals(tname)) {
name = child.getBody();
@@ -494,9 +495,9 @@
String methodSignature = null;
boolean required = false, rtexprvalue = false, reqTime = false, isFragment = false, deferredValue = false, deferredMethod = false;
- Iterator list = elem.findChildren();
+ Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("name".equals(tname)) {
@@ -593,9 +594,9 @@
boolean declare = true;
int scope = VariableInfo.NESTED;
- Iterator list = elem.findChildren();
+ Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("name-given".equals(tname))
nameGiven = element.getBody();
@@ -635,11 +636,11 @@
throws JasperException {
String validatorClass = null;
- Map initParams = new Hashtable();
+ Map<String,Object> initParams = new Hashtable<String,Object>();
- Iterator list = elem.findChildren();
+ Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("validator-class".equals(tname))
validatorClass = element.getBody();
@@ -659,7 +660,7 @@
TagLibraryValidator tlv = null;
if (validatorClass != null && !validatorClass.equals("")) {
try {
- Class tlvClass = ctxt.getClassLoader()
+ Class<?> tlvClass = ctxt.getClassLoader()
.loadClass(validatorClass);
tlv = (TagLibraryValidator) tlvClass.newInstance();
} catch (Exception e) {
@@ -676,9 +677,9 @@
String[] createInitParam(TreeNode elem) {
String[] initParam = new String[2];
- Iterator list = elem.findChildren();
+ Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("param-name".equals(tname)) {
initParam[0] = element.getBody();
@@ -702,9 +703,9 @@
String klass = null;
String signature = null;
- Iterator list = elem.findChildren();
+ Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
- TreeNode element = (TreeNode) list.next();
+ TreeNode element = list.next();
String tname = element.getName();
if ("name".equals(tname)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org