From: <cg...@us...> - 2009-09-05 23:50:20
|
Revision: 6757 http://jython.svn.sourceforge.net/jython/?rev=6757&view=rev Author: cgroves Date: 2009-09-05 23:50:14 +0000 (Sat, 05 Sep 2009) Log Message: ----------- Use imp.NO_MTIME instead of returning -1 directly Modified Paths: -------------- branches/customizable-proxymaker/src/org/python/core/ClasspathPyImporter.java branches/customizable-proxymaker/src/org/python/core/PyProxy.java branches/customizable-proxymaker/src/org/python/core/imp.java branches/customizable-proxymaker/src/org/python/core/util/importer.java branches/customizable-proxymaker/src/org/python/modules/zipimport/zipimporter.java Modified: branches/customizable-proxymaker/src/org/python/core/ClasspathPyImporter.java =================================================================== --- branches/customizable-proxymaker/src/org/python/core/ClasspathPyImporter.java 2009-09-05 23:48:38 UTC (rev 6756) +++ branches/customizable-proxymaker/src/org/python/core/ClasspathPyImporter.java 2009-09-05 23:50:14 UTC (rev 6757) @@ -65,8 +65,7 @@ @Override protected long getSourceMtime(String path) { - // Can't determine this easily - return -1; + return imp.NO_MTIME; // Can't determine this from the information exposed by the classpath } @Override Modified: branches/customizable-proxymaker/src/org/python/core/PyProxy.java =================================================================== --- branches/customizable-proxymaker/src/org/python/core/PyProxy.java 2009-09-05 23:48:38 UTC (rev 6756) +++ branches/customizable-proxymaker/src/org/python/core/PyProxy.java 2009-09-05 23:50:14 UTC (rev 6757) @@ -3,14 +3,14 @@ /** * Common methods for all generated proxy classes. + * <p> * * Proxy classes are created whenever a python class inherits from a java class. Instances of such a * python class consists of two objects: * <ul> - * <li>An instance of the proxy class. The _getPyInstance() will return a reference to the - * PyInstance. - * <li>An instance of PyInstance. The PyInstance.javaProxy contains a reference to the proxy class - * instance. + * <li>An instance of the proxy class. {@link #_getPyInstance()} will return a reference to the + * PyObject. + * <li>An instance of PyObject. {@link PyObject#getJavaProxy} returns the proxy class instance. * </ul> * * All proxy classes implement this interface. Modified: branches/customizable-proxymaker/src/org/python/core/imp.java =================================================================== --- branches/customizable-proxymaker/src/org/python/core/imp.java 2009-09-05 23:48:38 UTC (rev 6756) +++ branches/customizable-proxymaker/src/org/python/core/imp.java 2009-09-05 23:50:14 UTC (rev 6757) @@ -163,8 +163,7 @@ } } if (testing && mtime != NO_MTIME) { - long time = ar.getMTime(); - if (mtime != time) { + if (mtime != ar.getMTime()) { return null; } } Modified: branches/customizable-proxymaker/src/org/python/core/util/importer.java =================================================================== --- branches/customizable-proxymaker/src/org/python/core/util/importer.java 2009-09-05 23:48:38 UTC (rev 6756) +++ branches/customizable-proxymaker/src/org/python/core/util/importer.java 2009-09-05 23:50:14 UTC (rev 6757) @@ -133,7 +133,7 @@ * matching .py file. * * @param path to the compiled file - * @return long mtime of the .py, or -1 if no source is available + * @return long mtime of the .py, or {@link imp#NO_MTIME} if no source is available */ protected abstract long getSourceMtime(String path); @@ -189,15 +189,12 @@ boolean isPackage = entry.type.contains(EntryType.IS_PACKAGE); boolean isBytecode = entry.type.contains(EntryType.IS_BYTECODE); - long mtime = -1; - if (isBytecode) { - mtime = getSourceMtime(searchPath); - } Bundle bundle = makeBundle(searchPath, tocEntry); byte[] codeBytes; try { if (isBytecode) { + long mtime = getSourceMtime(searchPath); try { codeBytes = imp.readCode(fullname, bundle.inputStream, true, mtime); } catch (IOException ioe) { Modified: branches/customizable-proxymaker/src/org/python/modules/zipimport/zipimporter.java =================================================================== --- branches/customizable-proxymaker/src/org/python/modules/zipimport/zipimporter.java 2009-09-05 23:48:38 UTC (rev 6756) +++ branches/customizable-proxymaker/src/org/python/modules/zipimport/zipimporter.java 2009-09-05 23:50:14 UTC (rev 6757) @@ -20,6 +20,7 @@ import org.python.core.PySystemState; import org.python.core.PyTuple; import org.python.core.PyType; +import org.python.core.imp; import org.python.core.util.FileUtil; import org.python.core.util.StringUtil; import org.python.core.util.importer; @@ -305,7 +306,7 @@ String sourcePath = path.substring(0, path.length() - 9) + ".py"; PyObject sourceTocEntry = files.__finditem__(sourcePath); if (sourceTocEntry == null) { - return -1; + return imp.NO_MTIME; } int time; @@ -317,8 +318,8 @@ if (!pye.match(Py.TypeError)) { throw pye; } - time = -1; - date = -1; + time = imp.NO_MTIME; + date = imp.NO_MTIME; } return dosTimeToEpoch(time, date); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |