From: <fwi...@us...> - 2009-07-30 04:40:23
|
Revision: 6603 http://jython.svn.sourceforge.net/jython/?rev=6603&view=rev Author: fwierzbicki Date: 2009-07-30 04:40:15 +0000 (Thu, 30 Jul 2009) Log Message: ----------- Oops, created new cast warnings in compiler package, fixed. Also fixed some of the warnings in the antlr package, but things are a little tricky there. Modified Paths: -------------- trunk/jython/src/org/python/antlr/GrammarActions.java trunk/jython/src/org/python/antlr/PythonTokenSource.java trunk/jython/src/org/python/antlr/PythonTree.java trunk/jython/src/org/python/compiler/CodeCompiler.java trunk/jython/src/org/python/compiler/Module.java Modified: trunk/jython/src/org/python/antlr/GrammarActions.java =================================================================== --- trunk/jython/src/org/python/antlr/GrammarActions.java 2009-07-30 04:11:55 UTC (rev 6602) +++ trunk/jython/src/org/python/antlr/GrammarActions.java 2009-07-30 04:40:15 UTC (rev 6603) @@ -217,7 +217,7 @@ return new For(t, target, iter, b, o); } - stmt makeTryExcept(Token t, List body, List handlers, List orelse, List finBody) { + stmt makeTryExcept(Token t, List body, List<excepthandler> handlers, List orelse, List finBody) { List<stmt> b = castStmts(body); List<excepthandler> e = handlers; List<stmt> o = castStmts(orelse); @@ -695,7 +695,7 @@ if (isTuple) { List<slice> st; - List etypes = new ArrayList(); + List<expr> etypes = new ArrayList<expr>(); for (Object o : sltypes) { if (o instanceof Index) { Index i = (Index)o; @@ -706,8 +706,7 @@ } } if (!extslice) { - List<expr> es = etypes; - expr t = new Tuple(begin, es, expr_contextType.Load); + expr t = new Tuple(begin, etypes, expr_contextType.Load); s = new Index(begin, t); } } else if (sltypes.size() == 1) { Modified: trunk/jython/src/org/python/antlr/PythonTokenSource.java =================================================================== --- trunk/jython/src/org/python/antlr/PythonTokenSource.java 2009-07-30 04:11:55 UTC (rev 6602) +++ trunk/jython/src/org/python/antlr/PythonTokenSource.java 2009-07-30 04:40:15 UTC (rev 6603) @@ -83,7 +83,7 @@ int sp=-1; // grow upwards /** The queue of tokens */ - Vector tokens = new Vector(); + Vector<Token> tokens = new Vector<Token>(); /** We pull real tokens from this lexer */ CommonTokenStream stream; @@ -134,7 +134,7 @@ public Token nextToken() { // if something in queue, just remove and return it if (tokens.size() > 0) { - Token t = (Token)tokens.firstElement(); + Token t = tokens.firstElement(); tokens.removeElementAt(0); //System.out.println(filename + t); return t; @@ -264,7 +264,7 @@ } } } - List hiddenTokens = stream.getTokens(lastTokenAddedIndex + 1,t.getTokenIndex() - 1); + List<Token> hiddenTokens = stream.getTokens(lastTokenAddedIndex + 1,t.getTokenIndex() - 1); if (hiddenTokens != null) { tokens.addAll(hiddenTokens); } Modified: trunk/jython/src/org/python/antlr/PythonTree.java =================================================================== --- trunk/jython/src/org/python/antlr/PythonTree.java 2009-07-30 04:11:55 UTC (rev 6602) +++ trunk/jython/src/org/python/antlr/PythonTree.java 2009-07-30 04:40:15 UTC (rev 6603) @@ -251,19 +251,19 @@ } //XXX: From here down copied from org.antlr.runtime.tree.BaseTree - protected List children; + protected List<PythonTree> children; public PythonTree getChild(int i) { if ( children==null || i>=children.size() ) { return null; } - return (PythonTree)children.get(i); + return children.get(i); } /** Get the children internal List; note that if you directly mess with * the list, do so at your own risk. */ - public List getChildren() { + public List<PythonTree> getChildren() { return children; } @@ -333,7 +333,7 @@ } /** Add all elements of kids list as children of this node */ - public void addChildren(List kids) { + public void addChildren(List<PythonTree> kids) { for (int i = 0; i < kids.size(); i++) { PythonTree t = (PythonTree) kids.get(i); addChild(t); @@ -382,13 +382,13 @@ int replacingHowMany = stopChildIndex - startChildIndex + 1; int replacingWithHowMany; PythonTree newTree = (PythonTree)t; - List newChildren = null; + List<PythonTree> newChildren = null; // normalize to a list of children to add: newChildren if ( newTree.isNil() ) { newChildren = newTree.children; } else { - newChildren = new ArrayList(1); + newChildren = new ArrayList<PythonTree>(1); newChildren.add(newTree); } replacingWithHowMany = newChildren.size(); @@ -432,8 +432,8 @@ } /** Override in a subclass to change the impl of children list */ - protected List createChildrenList() { - return new ArrayList(); + protected List<PythonTree> createChildrenList() { + return new ArrayList<PythonTree>(); } /** Set the parent and child index values for all child of t */ Modified: trunk/jython/src/org/python/compiler/CodeCompiler.java =================================================================== --- trunk/jython/src/org/python/compiler/CodeCompiler.java 2009-07-30 04:11:55 UTC (rev 6602) +++ trunk/jython/src/org/python/compiler/CodeCompiler.java 2009-07-30 04:40:15 UTC (rev 6603) @@ -555,7 +555,7 @@ doFinallysDownTo(bcfLevel); - code.goto_((Label)breakLabels.peek()); + code.goto_(breakLabels.peek()); return null; } @@ -568,7 +568,7 @@ doFinallysDownTo(bcfLevel); - code.goto_((Label)continueLabels.peek()); + code.goto_(continueLabels.peek()); return Exit; } @@ -691,7 +691,7 @@ code.astore(locals); for (int i = 0; i < v.size(); i++) { - String type = (String) v.elementAt(i); + String type = v.elementAt(i); if (type == null) continue; code.aload(locals); @@ -717,8 +717,7 @@ Label end = new Label(); code.label(end); for (int i = 0; i < exceptionHandlers.size(); ++i) { - ExceptionHandler handler = - (ExceptionHandler)exceptionHandlers.elementAt(i); + ExceptionHandler handler = exceptionHandlers.elementAt(i); handler.exceptionEnds.addElement(end); } } @@ -728,8 +727,7 @@ Label start = new Label(); code.label(start); for (int i = 0; i < exceptionHandlers.size(); ++i) { - ExceptionHandler handler = - (ExceptionHandler)exceptionHandlers.elementAt(i); + ExceptionHandler handler = exceptionHandlers.elementAt(i); handler.exceptionStarts.addElement(start); } } @@ -742,7 +740,7 @@ code.astore(locals); for (int i = 0; i < v.size(); i++) { - String type = (String) v.elementAt(i); + String type = v.elementAt(i); if (type == null) continue; code.aload(locals); @@ -1063,8 +1061,8 @@ @Override public Object visitWhile(While node) throws Exception { int savebcf = beginLoop(); - Label continue_loop = (Label)continueLabels.peek(); - Label break_loop = (Label)breakLabels.peek(); + Label continue_loop = continueLabels.peek(); + Label break_loop = breakLabels.peek(); Label start_loop = new Label(); @@ -1097,8 +1095,8 @@ @Override public Object visitFor(For node) throws Exception { int savebcf = beginLoop(); - Label continue_loop = (Label)continueLabels.peek(); - Label break_loop = (Label)breakLabels.peek(); + Label continue_loop = continueLabels.peek(); + Label break_loop = breakLabels.peek(); Label start_loop = new Label(); Label next_loop = new Label(); @@ -1280,14 +1278,12 @@ private void doFinallysDownTo(int level) throws Exception { Stack<ExceptionHandler> poppedHandlers = new Stack<ExceptionHandler>(); while (exceptionHandlers.size() > level) { - ExceptionHandler handler = - (ExceptionHandler)exceptionHandlers.pop(); + ExceptionHandler handler = exceptionHandlers.pop(); inlineFinally(handler); poppedHandlers.push(handler); } while (poppedHandlers.size() > 0) { - ExceptionHandler handler = - (ExceptionHandler)poppedHandlers.pop(); + ExceptionHandler handler = poppedHandlers.pop(); reenterProtectedBody(handler); exceptionHandlers.push(handler); } Modified: trunk/jython/src/org/python/compiler/Module.java =================================================================== --- trunk/jython/src/org/python/compiler/Module.java 2009-07-30 04:11:55 UTC (rev 6602) +++ trunk/jython/src/org/python/compiler/Module.java 2009-07-30 04:40:15 UTC (rev 6603) @@ -475,7 +475,7 @@ yields[0] = start; for (int i = 1; i < yields.length; i++) { - yields[i] = (Label) compiler.yields.get(i-1); + yields[i] = compiler.yields.get(i-1); } c.tableswitch(0, yields.length - 1, start, yields); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |