From: <pj...@us...> - 2009-05-07 02:14:34
|
Revision: 6311 http://jython.svn.sourceforge.net/jython/?rev=6311&view=rev Author: pjenvey Date: 2009-05-07 01:41:35 +0000 (Thu, 07 May 2009) Log Message: ----------- o enable javac Xlint warnings, minus serial and unchecked for now as we're violating those all over the place. plus fixes for most violations o un-deprecate Py.FixedFileWrapper and PyObject._callextra -- they may have been mistakenly deprecated as they're pretty important Modified Paths: -------------- trunk/jython/build.xml trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java trunk/jython/src/org/python/compiler/Code.java trunk/jython/src/org/python/core/InitModule.java trunk/jython/src/org/python/core/Py.java trunk/jython/src/org/python/core/PyObject.java trunk/jython/src/org/python/core/PyString.java trunk/jython/src/org/python/core/PySystemState.java trunk/jython/src/org/python/core/imp.java trunk/jython/src/org/python/core/util/StringUtil.java trunk/jython/src/org/python/modules/_csv/PyReader.java trunk/jython/src/org/python/modules/zipimport/zipimporter.java trunk/jython/src/org/python/util/JythoncAntTask.java trunk/jython/src/org/python/util/PythonInterpreter.java Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/build.xml 2009-05-07 01:41:35 UTC (rev 6311) @@ -117,9 +117,10 @@ <property name="build.compiler" value="modern" /> <property name="jdk.target.version" value="1.5" /> <property name="jdk.source.version" value="1.5" /> - <property name="deprecation" value="off" /> + <property name="deprecation" value="true" /> <property name="debug" value="true" /> <property name="nowarn" value="false" /> + <property name="javac.args" value="-Xlint -Xlint:-serial -Xlint:-unchecked"/> <!-- properties work.dir and jython.base.dir are also defined in full-preinit --> <property name="work.dir" value="${basedir}" /> @@ -413,6 +414,7 @@ deprecation="${deprecation}" nowarn="${nowarn}"> <include name="org/python/util/TemplateAntTask.java" /> + <compilerarg line="${javac.args}"/> </javac> </target> @@ -456,6 +458,7 @@ nowarn="${nowarn}" memoryMaximumSize="192m" fork="true"> + <compilerarg line="${javac.args}"/> <src path="${source.dir}"/> <src path="${gensrc.dir}"/> @@ -471,7 +474,9 @@ source="${jdk.source.version}" debug="${debug}" deprecation="${deprecation}" - nowarn="${nowarn}"/> + nowarn="${nowarn}"> + <compilerarg line="${javac.args}"/> + </javac> <!-- java files used by tests --> <javac srcdir="${test.source.dir}" @@ -480,7 +485,8 @@ source="${jdk.source.version}" debug="${debug}" deprecation="${deprecation}" - nowarn="${nowarn}"> + nowarn="${nowarn}"> + <compilerarg line="${javac.args}"/> <classpath refid="test.classpath" /> </javac> <javac srcdir="tests/data/initializer" @@ -490,6 +496,7 @@ debug="${debug}" deprecation="${deprecation}" nowarn="${nowarn}"> + <compilerarg line="${javac.args}"/> <classpath refid="test.classpath" /> </javac> <copy file="${source.dir}/org/python/modules/ucnhash.dat" Modified: trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -52,6 +52,7 @@ * @param type * @throws SQLException */ + @SuppressWarnings("fallthrough") public void setJDBCObject(PreparedStatement stmt, int index, PyObject object, int type) throws SQLException { if (DataHandler.checkNull(stmt, index, object, type)) { Modified: trunk/jython/src/org/python/compiler/Code.java =================================================================== --- trunk/jython/src/org/python/compiler/Code.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/compiler/Code.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -179,6 +179,7 @@ mv.visitVarInsn(arg0, arg1); } + @SuppressWarnings("fallthrough") private int sigSize(String sig, boolean includeReturn) { int stack = 0; int i = 0; Modified: trunk/jython/src/org/python/core/InitModule.java =================================================================== --- trunk/jython/src/org/python/core/InitModule.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/core/InitModule.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -9,7 +9,7 @@ * @deprecated This class is deprecated. See ClassDictInit for a replacement. * @see ClassDictInit */ - +@Deprecated public interface InitModule { public abstract void initModule(PyObject dict); } Modified: trunk/jython/src/org/python/core/Py.java =================================================================== --- trunk/jython/src/org/python/core/Py.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/core/Py.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -1915,7 +1915,7 @@ return (objs.toArray(dest)); } } -/** @deprecated */ + class FixedFileWrapper extends StdoutWrapper { private PyObject file; Modified: trunk/jython/src/org/python/core/PyObject.java =================================================================== --- trunk/jython/src/org/python/core/PyObject.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/core/PyObject.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -451,7 +451,6 @@ return __call__(arg0, arg1, arg2, arg3); } - /** @deprecated **/ public PyObject _callextra(PyObject[] args, String[] keywords, PyObject starargs, Modified: trunk/jython/src/org/python/core/PyString.java =================================================================== --- trunk/jython/src/org/python/core/PyString.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/core/PyString.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -765,6 +765,7 @@ throw Py.TypeError("bad operand type for unary ~"); } + @SuppressWarnings("fallthrough") public PyComplex __complex__() { boolean got_re = false; boolean got_im = false; @@ -2795,6 +2796,7 @@ return buf.toString(); } + @SuppressWarnings("fallthrough") public PyString format(PyObject args) { PyObject dict = null; this.args = args; Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/core/PySystemState.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -1038,7 +1038,8 @@ // we expect an URL like jar:file:/install_dir/jython.jar!/org/python/core/PySystemState.class if (url != null) { try { - String urlString = URLDecoder.decode(url.toString()); + String urlString = URLDecoder.decode(url.toString(), + Charset.defaultCharset().name()); int jarSeparatorIndex = urlString.lastIndexOf(JAR_SEPARATOR); if (urlString.startsWith(JAR_URL_PREFIX) && jarSeparatorIndex > 0) { jarFileName = urlString.substring(JAR_URL_PREFIX.length(), jarSeparatorIndex); Modified: trunk/jython/src/org/python/core/imp.java =================================================================== --- trunk/jython/src/org/python/core/imp.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/core/imp.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -827,6 +827,7 @@ * replaced by importFrom with level param. Kept for backwards compatibility. * @deprecated use importFrom with level param. */ + @Deprecated public static PyObject[] importFrom(String mod, String[] names, PyFrame frame) { return importFromAs(mod, names, null, frame, DEFAULT_LEVEL); @@ -845,6 +846,7 @@ * replaced by importFromAs with level param. Kept for backwards compatibility. * @deprecated use importFromAs with level param. */ + @Deprecated public static PyObject[] importFromAs(String mod, String[] names, PyFrame frame) { return importFromAs(mod, names, null, frame, DEFAULT_LEVEL); Modified: trunk/jython/src/org/python/core/util/StringUtil.java =================================================================== --- trunk/jython/src/org/python/core/util/StringUtil.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/core/util/StringUtil.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -37,6 +37,7 @@ * @param len the length * @return a new String corresponding to the bytes in buf */ + @SuppressWarnings("deprecation") public static String fromBytes(byte[] buf, int off, int len) { // Yes, I known the method is deprecated, but it is the fastest // way of converting between between byte[] and String Modified: trunk/jython/src/org/python/modules/_csv/PyReader.java =================================================================== --- trunk/jython/src/org/python/modules/_csv/PyReader.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/modules/_csv/PyReader.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -96,6 +96,7 @@ return fields; } + @SuppressWarnings("fallthrough") private void parse_process_char(char c) { switch (state) { case START_RECORD: Modified: trunk/jython/src/org/python/modules/zipimport/zipimporter.java =================================================================== --- trunk/jython/src/org/python/modules/zipimport/zipimporter.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/modules/zipimport/zipimporter.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -454,7 +454,10 @@ * @param time in milliseconds, a long value * @return an int, dos style date value */ + @SuppressWarnings("deprecation") private int epochToDosDate(long time) { + // This and the other conversion methods are cut and pasted from + // java.util.zip.ZipEntry: hence the use deprecated Date APIs Date d = new Date(time); int year = d.getYear() + 1900; if (year < 1980) { @@ -469,6 +472,7 @@ * @param time in milliseconds, a long value * @return an int, dos style time value */ + @SuppressWarnings("deprecation") private int epochToDosTime(long time) { Date d = new Date(time); return d.getHours() << 11 | d.getMinutes() << 5 | d.getSeconds() >> 1; @@ -482,6 +486,7 @@ * @param dosdate a dos style date integer * @return a long time (in milliseconds) value */ + @SuppressWarnings("deprecation") private long dosTimeToEpoch(int dosTime, int dosDate) { Date d = new Date(((dosDate >> 9) & 0x7f) + 80, ((dosDate >> 5) & 0x0f) - 1, Modified: trunk/jython/src/org/python/util/JythoncAntTask.java =================================================================== --- trunk/jython/src/org/python/util/JythoncAntTask.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/util/JythoncAntTask.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -496,7 +496,7 @@ //get dependencies list. if( srcDir == null ) { - srcDir = project.resolveFile("."); + srcDir = getProject().resolveFile("."); } DirectoryScanner scanner = super.getDirectoryScanner(srcDir); String[] dependencies = scanner.getIncludedFiles(); Modified: trunk/jython/src/org/python/util/PythonInterpreter.java =================================================================== --- trunk/jython/src/org/python/util/PythonInterpreter.java 2009-05-07 00:58:52 UTC (rev 6310) +++ trunk/jython/src/org/python/util/PythonInterpreter.java 2009-05-07 01:41:35 UTC (rev 6311) @@ -94,6 +94,7 @@ } /** @deprecated */ + @Deprecated public void setOut(java.io.Writer outStream) { setOut(new PyFileWriter(outStream)); } @@ -113,6 +114,7 @@ } /** @deprecated */ + @Deprecated public void setErr(java.io.Writer outStream) { setErr(new PyFileWriter(outStream)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |