@Test public void getSourceFile() throws Exception { Method getSourceFileMethod = CompilableFiles.class.getDeclaredMethod("getSourceFile", PropFile.Prop.class, String.class); getSourceFileMethod.setAccessible(true); CompilableFiles compilableFiles = new CompilableFiles(); PropFile.Prop prop = new PropFile(Context.named("test"), PropFile.Loc.AdHoc).add("net.ocheyedan.ply.script.CompilerScript", ""); String sourceFilePath = (String) getSourceFileMethod.invoke(compilableFiles, prop, "foo"); assertTrue(sourceFilePath.endsWith("foo/net/ocheyedan/ply/script/CompilerScript.java")); prop = new PropFile(Context.named("test"), PropFile.Loc.AdHoc).add("net.ocheyedan.ply.script.CompilerScript$1", ""); sourceFilePath = (String) getSourceFileMethod.invoke(compilableFiles, prop, "foo"); assertTrue(sourceFilePath.endsWith("foo/net/ocheyedan/ply/script/CompilerScript.java")); prop = new PropFile(Context.named("test"), PropFile.Loc.AdHoc).add("net.ocheyedan.ply.script.CompilerScript$InnerName", ""); sourceFilePath = (String) getSourceFileMethod.invoke(compilableFiles, prop, "foo"); assertTrue(sourceFilePath.endsWith("foo/net/ocheyedan/ply/script/CompilerScript.java")); }
private String getSourceFile(PropFile.Prop dependentClass, String sourceDir) { File dependentClassSourcePath; if (dependentClass.name.contains("$")) { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.substring(0, dependentClass.name.indexOf('$')) .replace('.', File.separatorChar) + ".java"); } else { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.replace('.', File.separatorChar) + ".java"); } return dependentClassSourcePath.getAbsolutePath(); }
CompilableFiles { private String getSourceFile(PropFile.Prop dependentClass, String sourceDir) { File dependentClassSourcePath; if (dependentClass.name.contains("$")) { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.substring(0, dependentClass.name.indexOf('$')) .replace('.', File.separatorChar) + ".java"); } else { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.replace('.', File.separatorChar) + ".java"); } return dependentClassSourcePath.getAbsolutePath(); } }
CompilableFiles { private String getSourceFile(PropFile.Prop dependentClass, String sourceDir) { File dependentClassSourcePath; if (dependentClass.name.contains("$")) { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.substring(0, dependentClass.name.indexOf('$')) .replace('.', File.separatorChar) + ".java"); } else { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.replace('.', File.separatorChar) + ".java"); } return dependentClassSourcePath.getAbsolutePath(); }  }
CompilableFiles { private String getSourceFile(PropFile.Prop dependentClass, String sourceDir) { File dependentClassSourcePath; if (dependentClass.name.contains("$")) { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.substring(0, dependentClass.name.indexOf('$')) .replace('.', File.separatorChar) + ".java"); } else { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.replace('.', File.separatorChar) + ".java"); } return dependentClassSourcePath.getAbsolutePath(); }  PropFile compute(PropFile changedFiles, Scope scope, String srcDirPath, String buildDirPath); }
CompilableFiles { private String getSourceFile(PropFile.Prop dependentClass, String sourceDir) { File dependentClassSourcePath; if (dependentClass.name.contains("$")) { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.substring(0, dependentClass.name.indexOf('$')) .replace('.', File.separatorChar) + ".java"); } else { dependentClassSourcePath = FileUtil.fromParts(sourceDir, dependentClass.name.replace('.', File.separatorChar) + ".java"); } return dependentClassSourcePath.getAbsolutePath(); }  PropFile compute(PropFile changedFiles, Scope scope, String srcDirPath, String buildDirPath);  }