From: <fwi...@us...> - 2009-07-30 04:12:01
|
Revision: 6602 http://jython.svn.sourceforge.net/jython/?rev=6602&view=rev Author: fwierzbicki Date: 2009-07-30 04:11:55 +0000 (Thu, 30 Jul 2009) Log Message: ----------- Finished warnings in compiler package. Again, being extra careful to avoid messing with public interfaces. Deprecated LineNumberTable instead of deleting, even though I'm sure it isn't used. Modified Paths: -------------- trunk/jython/src/org/python/compiler/LineNumberTable.java trunk/jython/src/org/python/compiler/Module.java trunk/jython/src/org/python/compiler/ScopesCompiler.java Modified: trunk/jython/src/org/python/compiler/LineNumberTable.java =================================================================== --- trunk/jython/src/org/python/compiler/LineNumberTable.java 2009-07-30 03:38:40 UTC (rev 6601) +++ trunk/jython/src/org/python/compiler/LineNumberTable.java 2009-07-30 04:11:55 UTC (rev 6602) @@ -2,18 +2,19 @@ package org.python.compiler; -import java.io.*; -import java.util.*; +import java.util.Vector; +import java.io.DataOutputStream; +import java.io.IOException; +/** + * @Deprecated Not used. + */ public class LineNumberTable { int attName; - //ConstantPool pool; - Vector lines; + Vector<Short> lines; public LineNumberTable() throws IOException { - //this.pool = pool; - //attName = pool.UTF8("LineNumberTable"); - lines = new Vector(); + lines = new Vector<Short>(); } public void write(DataOutputStream stream) throws IOException { @@ -22,8 +23,8 @@ stream.writeInt(n * 2 + 2); stream.writeShort(n / 2); for (int i = 0; i < n; i += 2) { - Short startpc = (Short) lines.elementAt(i); - Short lineno = (Short) lines.elementAt(i+1); + Short startpc = lines.elementAt(i); + Short lineno = lines.elementAt(i+1); stream.writeShort(startpc.shortValue()); stream.writeShort(lineno.shortValue()); } Modified: trunk/jython/src/org/python/compiler/Module.java =================================================================== --- trunk/jython/src/org/python/compiler/Module.java 2009-07-30 03:38:40 UTC (rev 6601) +++ trunk/jython/src/org/python/compiler/Module.java 2009-07-30 04:11:55 UTC (rev 6602) @@ -301,7 +301,7 @@ public Constant mainCode; public boolean linenumbers; Future futures; - Hashtable scopes; + Hashtable<PythonTree,ScopeInfo> scopes; long mtime; public Module(String name, String filename, boolean linenumbers) { @@ -313,15 +313,15 @@ this.mtime = mtime; classfile = new ClassFile(name, "org/python/core/PyFunctionTable", ACC_SYNCHRONIZED | ACC_PUBLIC, mtime); - constants = new Hashtable(); + constants = new Hashtable<Constant,Constant>(); sfilename = filename; if (filename != null) this.filename = PyString(filename); else this.filename = null; - codes = new ArrayList(); + codes = new ArrayList<PyCodeConstant>(); futures = new Future(); - scopes = new Hashtable(); + scopes = new Hashtable<PythonTree,ScopeInfo>(); } public Module(String name) { @@ -329,7 +329,7 @@ } // This block of code handles the pool of Python Constants - Hashtable constants; + Hashtable<Constant,Constant> constants; private Constant findConstant(Constant c) { Constant ret = (Constant)constants.get(c); @@ -365,10 +365,10 @@ return findConstant(new PyLongConstant(value)); } - List codes; + List<PyCodeConstant> codes; //XXX: this can probably go away now that we can probably just copy the list. - private List<String> toNameAr(List names,boolean nullok) { + private List<String> toNameAr(List<String> names,boolean nullok) { int sz = names.size(); if (sz == 0 && nullok) return null; List<String> nameArray = new ArrayList<String>(); @@ -562,7 +562,7 @@ } for(int i=0; i<codes.size(); i++) { - PyCodeConstant pyc = (PyCodeConstant)codes.get(i); + PyCodeConstant pyc = codes.get(i); pyc.put(c); } @@ -589,7 +589,7 @@ code.tableswitch(0, labels.length - 1, def, labels); for(i=0; i<labels.length; i++) { code.label(labels[i]); - code.invokevirtual(classfile.name, ((PyCodeConstant)codes.get(i)).fname, "(" + $pyFrame + $threadState + ")" + $pyObj); + code.invokevirtual(classfile.name, (codes.get(i)).fname, "(" + $pyFrame + $threadState + ")" + $pyObj); code.areturn(); } code.label(def); Modified: trunk/jython/src/org/python/compiler/ScopesCompiler.java =================================================================== --- trunk/jython/src/org/python/compiler/ScopesCompiler.java 2009-07-30 03:38:40 UTC (rev 6601) +++ trunk/jython/src/org/python/compiler/ScopesCompiler.java 2009-07-30 04:11:55 UTC (rev 6602) @@ -34,17 +34,17 @@ private CompilationContext code_compiler; - private Stack scopes; + private Stack<ScopeInfo> scopes; private ScopeInfo cur = null; - private Hashtable nodeScopes; + private Hashtable<PythonTree,ScopeInfo> nodeScopes; private int level = 0; private int func_level = 0; - public ScopesCompiler(CompilationContext code_compiler, Hashtable nodeScopes) { + public ScopesCompiler(CompilationContext code_compiler, Hashtable<PythonTree,ScopeInfo> nodeScopes) { this.code_compiler = code_compiler; this.nodeScopes = nodeScopes; - scopes = new Stack(); + scopes = new Stack<ScopeInfo>(); } public void beginScope(String name, int kind, PythonTree node, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |