// Path: src/java/main/br/ufpe/cin/groundhog/parser/Parser.java
// public interface Parser<T> {
// 
// 	public T parser();
// 	
// }
// 
// Path: src/java/main/br/ufpe/cin/groundhog/parser/ParserException.java
// public class ParserException extends GroundhogException {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 2115582632203381099L;
// 
// 	public ParserException(String msg, Throwable cause) {
// 		super(msg, cause);
// 	}
// 	
// 	public ParserException() {
// 		super();
// 	}
// 
// 	public ParserException(String msg) {
// 		super(msg);
// 	}
// 
// 	public ParserException(Throwable cause) {
// 		super(cause);
// 	}
// }


import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import javax.tools.JavaCompiler;
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import br.ufpe.cin.groundhog.parser.Parser;
import br.ufpe.cin.groundhog.parser.ParserException;
		StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
		Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(filesList);
		
		List<String> options = new ArrayList<String>();
		options.add("-g:none"); // Do not generate any debugging information
		options.add("-nowarn"); // Disable warning messages
		options.add("-implicit:none"); // Suppress class file generation
		options.add("-proc:only"); // Only annotation processing is done, without any subsequent compilation
		
		CompilationTask task = compiler.getTask(null, fileManager, null, options, null, compilationUnits);
		CodeAnalyzerProcessor processor = new CodeAnalyzerProcessor();
		task.setProcessors(Arrays.asList(processor));
		task.call();
		fileManager.close();
		
		return processor.getCounters();
	}
	
	/**
	 * Parses all Java source files inside this.folder and returns extracted
	 * metrics.
	 * 
	 * @return a map of metrics to another map of metric value and count.
	 */
	public HashMap<String, HashMap<String, MutableInt>> parser() {
		logger.info("Running java parser..");
		searchForJavaFiles(folder);
		try {
			return invokeProcessor();
		} catch (IOException e) {
// Path: src/java/main/br/ufpe/cin/groundhog/parser/Parser.java
// public interface Parser<T> {
// 
// 	public T parser();
// 	
// }
// 
// Path: src/java/main/br/ufpe/cin/groundhog/parser/ParserException.java
// public class ParserException extends GroundhogException {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 2115582632203381099L;
// 
// 	public ParserException(String msg, Throwable cause) {
// 		super(msg, cause);
// 	}
// 	
// 	public ParserException() {
// 		super();
// 	}
// 
// 	public ParserException(String msg) {
// 		super(msg);
// 	}
// 
// 	public ParserException(Throwable cause) {
// 		super(cause);
// 	}
// }


// Path: src/java/main/br/ufpe/cin/groundhog/parser/java/JavaParser.java
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import javax.tools.JavaCompiler;
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import br.ufpe.cin.groundhog.parser.Parser;
import br.ufpe.cin.groundhog.parser.ParserException;

		StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
		Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(filesList);
		
		List<String> options = new ArrayList<String>();
		options.add("-g:none"); // Do not generate any debugging information
		options.add("-nowarn"); // Disable warning messages
		options.add("-implicit:none"); // Suppress class file generation
		options.add("-proc:only"); // Only annotation processing is done, without any subsequent compilation
		
		CompilationTask task = compiler.getTask(null, fileManager, null, options, null, compilationUnits);
		CodeAnalyzerProcessor processor = new CodeAnalyzerProcessor();
		task.setProcessors(Arrays.asList(processor));
		task.call();
		fileManager.close();
		
		return processor.getCounters();
	}
	
	/**
	 * Parses all Java source files inside this.folder and returns extracted
	 * metrics.
	 * 
	 * @return a map of metrics to another map of metric value and count.
	 */
	public HashMap<String, HashMap<String, MutableInt>> parser() {
		logger.info("Running java parser..");
		searchForJavaFiles(folder);
		try {
			return invokeProcessor();
		} catch (IOException e) {
			throw new ParserException(e.getMessage());