public class Readparam
{
private static String method_name;
public static HashMap<String, Vector<String>> getParameters(String file_name)
{
HashMap temp_map = new HashMap();
String current_dir = System.getProperty("user.dir");
File new_file = new File(current_dir + "\\parameters\\" + file_name);
StringTokenizer stringtok = null;
StringBuffer temp_contents = new StringBuffer();
BufferedReader input = null;
try
{
input = new BufferedReader(new FileReader(new_file));
String current_line = null;
while (((current_line = input.readLine()) != null) && (current_line.length() > 0))
{
stringtok = new StringTokenizer(current_line, "(");
method_name = stringtok.nextToken();
String parsed_parameters = current_line.subSequence(current_line.indexOf("(") + 1, current_line.indexOf(")")).toString();
StringTokenizer paramtok = new StringTokenizer(parsed_parameters, ",");
String[] parsed_string = parsed_parameters.split(", ");
String parsing = method_name + "(";
for (int i = 0; i < parsed_string.length; i++)
{
String[] temp_parse = parsed_string[i].split(" ");
if (i < parsed_string.length - 1)
parsing = parsing + temp_parse[0] + ", ";
else {
parsing = parsing + temp_parse[0];
}
}
parsing = parsing + ")";
Vector temp_vector = new Vector();
for (String s : parsed_string) {
temp_vector.add(s);
}
temp_map.put(parsing, temp_vector);
}
}
catch (FileNotFoundException ex)
{
System.out.println("File not found: " + file_name);
String method_name = null;
return method_name;
}
对此有任何帮助,我有最后一行“返回不编译的方法名我收到错误不兼容的类型,预期 java.util.hashmap 发现 java.lang.String 最后一行返回方法名不编译