protected boolean isSourceNewer ( URL source , Class cls ) throws IOException { long lastMod ; // Special handling for file:// protocol, as getLastModified() often reports // incorrect results (-1) if ( isFile ( source ) ) { // Coerce the file URL to a File // See ClassNodeResolver.isSourceNewer for another method that replaces '|' with ':'. // WTF: Why is this done and where is it documented? String path = source . getPath ( ) . replace ( ' ' , File . separatorChar ) . replace ( ' ' , ' ' ) ; File file = new File ( path ) ; lastMod = file . lastModified ( ) ; } else { URLConnection conn = source . openConnection ( ) ; lastMod = conn . getLastModified ( ) ; conn . getInputStream ( ) . close ( ) ; } long classTime = getTimeStamp ( cls ) ; return classTime + config . getMinimumRecompilationInterval ( ) < lastMod ; }
Decides if the given source is newer than a class .