if (endline == -1 || endline < startline)
endline = Integer.MAX_VALUE;
ClassOrInterfaceSource source = getSourceFile(method.position().file());
String result = source.getSourcecode(startline, endline);
// the result may still contain the documenation and annotation parts of
// the next method
// so remove everything after the end of the method
int index = result.lastIndexOf('}'); // the end of the method