The use of getLastModified() caught my eye, and I was wondering if there's a pseudo file descriptor leak on Solaris as described in this issue I filed with Findbugs:
[ 2017517 ] Solaris getLastModified() File Descriptor Leak detection https://sourceforge.net/tracker/?func=detail&atid=614693&aid=2017517&group_id=96405 Fred Sauer [EMAIL PROTECTED] On Fri, Aug 29, 2008 at 2:42 PM, <[EMAIL PROTECTED]> wrote: > > Author: [EMAIL PROTECTED] > Date: Fri Aug 29 13:41:29 2008 > New Revision: 3597 > > Modified: > trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java > trunk/dev/core/src/com/google/gwt/dev/javac/JavaSourceFile.java > > trunk/dev/core/src/com/google/gwt/dev/javac/impl/FileCompilationUnit.java > > trunk/dev/core/src/com/google/gwt/dev/javac/impl/JavaSourceOracleImpl.java > > > trunk/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java > trunk/dev/core/src/com/google/gwt/dev/resource/Resource.java > trunk/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java > > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java > > trunk/dev/core/src/com/google/gwt/dev/shell/StandardGeneratorContext.java > trunk/dev/core/test/com/google/gwt/dev/javac/MockCompilationUnit.java > > trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockJavaSourceFile.java > trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockResource.java > > > trunk/dev/core/test/com/google/gwt/dev/resource/impl/MockAbstractResource.java > > > trunk/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java > > > trunk/tools/api-checker/test/com/google/gwt/tools/apichecker/ApiContainerTest.java > > Log: > Adds getLastModified() to CompilationUnit and its dependencies. > > Review by: bobv (TBR) > > Modified: trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java > > ============================================================================== > --- trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java > (original) > +++ trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java Fri > Aug 29 13:41:29 2008 > @@ -149,6 +149,11 @@ > public abstract String getDisplayLocation(); > > /** > + * Returns the last modified time of the compilation unit. > + */ > + public abstract long getLastModified(); > + > + /** > * Returns the source code for this unit. > */ > public abstract String getSource(); > > Modified: trunk/dev/core/src/com/google/gwt/dev/javac/JavaSourceFile.java > > ============================================================================== > --- trunk/dev/core/src/com/google/gwt/dev/javac/JavaSourceFile.java > (original) > +++ trunk/dev/core/src/com/google/gwt/dev/javac/JavaSourceFile.java Fri > Aug > 29 13:41:29 2008 > @@ -29,6 +29,11 @@ > } > > /** > + * Returns the last modified time of the compilation unit. > + */ > + public abstract long getLastModified(); > + > + /** > * Returns the user-relevant location of the source file. No > programmatic > * assumptions should be made about the return value. > */ > > Modified: > trunk/dev/core/src/com/google/gwt/dev/javac/impl/FileCompilationUnit.java > > ============================================================================== > --- > trunk/dev/core/src/com/google/gwt/dev/javac/impl/FileCompilationUnit.java > (original) > +++ > trunk/dev/core/src/com/google/gwt/dev/javac/impl/FileCompilationUnit.java > Fri Aug 29 13:41:29 2008 > @@ -45,6 +45,11 @@ > } > > @Override > + public long getLastModified() { > + return file.lastModified(); > + } > + > + @Override > public String getSource() { > return Util.readFileAsString(file); > } > > Modified: > trunk/dev/core/src/com/google/gwt/dev/javac/impl/JavaSourceOracleImpl.java > > ============================================================================== > --- > trunk/dev/core/src/com/google/gwt/dev/javac/impl/JavaSourceOracleImpl.java > (original) > +++ > trunk/dev/core/src/com/google/gwt/dev/javac/impl/JavaSourceOracleImpl.java > Fri Aug 29 13:41:29 2008 > @@ -60,6 +60,11 @@ > } > > @Override > + public long getLastModified() { > + return resource.getLastModified(); > + } > + > + @Override > public String getLocation() { > return location; > } > > Modified: > > trunk/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java > > ============================================================================== > --- > > trunk/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java > (original) > +++ > > trunk/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java > Fri Aug 29 13:41:29 2008 > @@ -36,6 +36,11 @@ > } > > @Override > + public long getLastModified() { > + return sourceFile.getLastModified(); > + } > + > + @Override > public String getSource() { > if (sourceCode == null) { > sourceCode = sourceFile.readSource(); > @@ -61,5 +66,5 @@ > protected void dumpSource() { > sourceCode = null; > } > - > + > } > > Modified: trunk/dev/core/src/com/google/gwt/dev/resource/Resource.java > > ============================================================================== > --- trunk/dev/core/src/com/google/gwt/dev/resource/Resource.java > (original) > +++ trunk/dev/core/src/com/google/gwt/dev/resource/Resource.java Fri > Aug 29 > 13:41:29 2008 > @@ -32,6 +32,11 @@ > } > > /** > + * Returns the last modified time of the compilation unit. > + */ > + public abstract long getLastModified(); > + > + /** > * Returns the user-relevant location of the resource. No programmatic > * assumptions should be made about the return value. > */ > > Modified: > trunk/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java > > ============================================================================== > --- trunk/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java > (original) > +++ trunk/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java > Fri Aug 29 13:41:29 2008 > @@ -47,6 +47,11 @@ > } > > @Override > + public long getLastModified() { > + return file.lastModified(); > + } > + > + @Override > public String getLocation() { > return file.getAbsoluteFile().toURI().toString(); > } > > Modified: > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java > > ============================================================================== > --- > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java > (original) > +++ > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java > Fri Aug 29 13:41:29 2008 > @@ -89,6 +89,11 @@ > } > > @Override > + public long getLastModified() { > + return resource.getLastModified(); > + } > + > + @Override > public String getLocation() { > return resource.getLocation(); > } > > Modified: > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java > > ============================================================================== > --- > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java > (original) > +++ > trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java > Fri Aug 29 13:41:29 2008 > @@ -41,8 +41,16 @@ > } > > @Override > + public long getLastModified() { > + // Questionable: maybe we should do something with the jar's time > instead. > + return zipEntry.getTime(); > + } > + > + @Override > public String getLocation() { > + // CHECKSTYLE_OFF > String proto = zipEntry instanceof JarEntry ? "jar:" : "zip:"; > + // CHECKSTYLE_ON > return proto + classPathEntry.getLocation() + "!/" + getPath(); > } > > > Modified: > trunk/dev/core/src/com/google/gwt/dev/shell/StandardGeneratorContext.java > > ============================================================================== > --- > trunk/dev/core/src/com/google/gwt/dev/shell/StandardGeneratorContext.java > (original) > +++ > trunk/dev/core/src/com/google/gwt/dev/shell/StandardGeneratorContext.java > Fri Aug 29 13:41:29 2008 > @@ -60,6 +60,8 @@ > */ > private static class GeneratedUnitWithFile extends CompilationUnit { > > + private long creationTime; > + > private File file; > > private PrintWriter pw; > @@ -83,6 +85,7 @@ > source = sw.toString(); > pw = null; > sw = null; > + creationTime = System.currentTimeMillis(); > } > > @Override > @@ -92,6 +95,11 @@ > } else { > return file.getAbsoluteFile().toURI().toString(); > } > + } > + > + @Override > + public long getLastModified() { > + return creationTime; > } > > @Override > > Modified: > trunk/dev/core/test/com/google/gwt/dev/javac/MockCompilationUnit.java > > ============================================================================== > --- trunk/dev/core/test/com/google/gwt/dev/javac/MockCompilationUnit.java > (original) > +++ trunk/dev/core/test/com/google/gwt/dev/javac/MockCompilationUnit.java > Fri Aug 29 13:41:29 2008 > @@ -35,6 +35,11 @@ > } > > @Override > + public long getLastModified() { > + return 0; > + } > + > + @Override > public String getSource() { > assert source != null; > return source; > @@ -47,4 +52,4 @@ > public boolean isGenerated() { > return true; > } > -} > \ No newline at end of file > +} > > Modified: > trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockJavaSourceFile.java > > ============================================================================== > --- > trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockJavaSourceFile.java > (original) > +++ > trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockJavaSourceFile.java > Fri Aug 29 13:41:29 2008 > @@ -45,6 +45,11 @@ > } > > @Override > + public long getLastModified() { > + return 0; > + } > + > + @Override > public String getLocation() { > return location; > } > > Modified: > trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockResource.java > > ============================================================================== > --- trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockResource.java > (original) > +++ trunk/dev/core/test/com/google/gwt/dev/javac/impl/MockResource.java Fri > Aug 29 13:41:29 2008 > @@ -33,6 +33,11 @@ > } > > @Override > + public long getLastModified() { > + return 0; > + } > + > + @Override > public String getLocation() { > return "/mock/" + path; > } > > Modified: > > trunk/dev/core/test/com/google/gwt/dev/resource/impl/MockAbstractResource.java > > ============================================================================== > --- > > trunk/dev/core/test/com/google/gwt/dev/resource/impl/MockAbstractResource.java > (original) > +++ > > trunk/dev/core/test/com/google/gwt/dev/resource/impl/MockAbstractResource.java > Fri Aug 29 13:41:29 2008 > @@ -36,6 +36,11 @@ > } > > @Override > + public long getLastModified() { > + return 0; > + } > + > + @Override > public String getLocation() { > return this.mockClassPathEntry.pathRoot + "/" + path; > } > > Modified: > > trunk/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java > > ============================================================================== > --- > > trunk/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java > (original) > +++ > > trunk/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java > Fri Aug 29 13:41:29 2008 > @@ -100,6 +100,11 @@ > return new Resource() { > > @Override > + public long getLastModified() { > + return 0; > + } > + > + @Override > public String getLocation() { > return "/mock/onPublicPath.txt"; > } > > Modified: > > trunk/tools/api-checker/test/com/google/gwt/tools/apichecker/ApiContainerTest.java > > ============================================================================== > --- > > trunk/tools/api-checker/test/com/google/gwt/tools/apichecker/ApiContainerTest.java > (original) > +++ > > trunk/tools/api-checker/test/com/google/gwt/tools/apichecker/ApiContainerTest.java > Fri Aug 29 13:41:29 2008 > @@ -50,6 +50,11 @@ > } > > @Override > + public long getLastModified() { > + return 0; > + } > + > + @Override > public String getSource() { > return String.valueOf(source); > } > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---