Esempio n. 1
0
 public static String getOrGuessSourceFile(SourceLineAnnotation source) {
   if (source.isSourceFileKnown()) return source.getSourceFile();
   String baseClassName = source.getClassName();
   int i = baseClassName.lastIndexOf('.');
   baseClassName = baseClassName.substring(i + 1);
   int j = baseClassName.indexOf("$");
   if (j >= 0) baseClassName = baseClassName.substring(0, j);
   return baseClassName + ".java";
 }
 private String findSourceFile(
     final Project project,
     final SourceFinder sourceFinder,
     final SourceLineAnnotation sourceLine) {
   try {
     SourceFile sourceFile = sourceFinder.findSourceFile(sourceLine);
     return sourceFile.getFullFileName();
   } catch (IOException exception) {
     StringBuilder sb = new StringBuilder("Can't resolve absolute file name for file ");
     sb.append(sourceLine.getSourceFile());
     if (isFirstError) {
       sb.append(", dir list = ");
       sb.append(project.getSourceDirList());
       isFirstError = false;
     }
     Logger.getLogger(getClass().getName()).log(Level.WARNING, sb.toString());
     return sourceLine.getPackageName().replace(DOT, SLASH) + SLASH + sourceLine.getSourceFile();
   }
 }