public String resolveMainClassName() { return javaSourceContext.getClassName(); }
public JavaSourceContext(File file) { String packageName = parsePackage(file); File rootDirectory = file.getParentFile(); if (packageName != null) { String[] pathTokens = packageName.split("\\."); for(int i = pathTokens.length - 1; i >= 0; i--) { String token = pathTokens[i]; if (!token.equals(rootDirectory.getName())) { throw new RuntimeException("Package structure does not match directory structure: " + token + " != " + rootDirectory.getName()); } rootDirectory = rootDirectory.getParentFile(); } } sourceRoot = rootDirectory; String fileName = file.getName(); String className = fileName.substring(0, fileName.length() - Kind.SOURCE.extension.length()); if (packageName != null) { className = packageName + '.' + className; } this.className = className; }
this.javaSourceContext = new JavaSourceContext(sourceFile); standardFileManager.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(javaSourceContext.getSourceRoot())); fileManager = new MemoryFileManager(loader, standardFileManager);
this.javaSourceContext = new JavaSourceContext(sourceFile); standardFileManager.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(javaSourceContext.getSourceRoot())); fileManager = new MemoryFileManager(loader, standardFileManager);
public String resolveMainClassName() { return javaSourceContext.getClassName(); }
public JavaSourceContext(File file) { String packageName = parsePackage(file); File rootDirectory = file.getParentFile(); if (packageName != null) { String[] pathTokens = packageName.split("\\."); for(int i = pathTokens.length - 1; i >= 0; i--) { String token = pathTokens[i]; if (!token.equals(rootDirectory.getName())) { throw new RuntimeException("Package structure does not match directory structure: " + token + " != " + rootDirectory.getName()); } rootDirectory = rootDirectory.getParentFile(); } } sourceRoot = rootDirectory; String fileName = file.getName(); String className = fileName.substring(0, fileName.length() - Kind.SOURCE.extension.length()); if (packageName != null) { className = packageName + '.' + className; } this.className = className; }