public static TestDiagnosticLine fromJavaSourceLine(String filename,String originalLine,long lineNumber){
  final String trimmedLine=originalLine.trim();
  long errorLine=lineNumber + 1;
  if (trimmedLine.startsWith("//::")) {
    String restOfLine=trimmedLine.substring(4);
    String[] diagnosticStrs=restOfLine.split("::");
    List<TestDiagnostic> diagnostics=new ArrayList<>(diagnosticStrs.length);
    for (    String diagnostic : diagnosticStrs) {
      diagnostics.add(fromJavaFileComment(filename,errorLine,diagnostic));
    }
    return new TestDiagnosticLine(filename,errorLine,originalLine,Collections.unmodifiableList(diagnostics));
  }
 else   if (trimmedLine.startsWith("//warning:")) {
    String diagnosticString=trimmedLine.substring(2);
    TestDiagnostic diagnostic=fromJavaFileComment("",0,diagnosticString);
    return new TestDiagnosticLine("",0,originalLine,Collections.singletonList(diagnostic));
  }
 else {
    return new TestDiagnosticLine(filename,errorLine,originalLine,EMPTY);
  }
}

public static TestDiagnosticLine fromJavaSourceLine ( String filename , String originalLine , long lineNumber ) { final String trimmedLine = originalLine . trim ( ) ; long errorLine = lineNumber + 1 ; if ( trimmedLine . startsWith ( "//::" ) ) { String restOfLine = trimmedLine . substring ( 4 ) ; String [ ] diagnosticStrs = restOfLine . split ( "::" ) ; List < TestDiagnostic > diagnostics = new ArrayList < > ( diagnosticStrs . length ) ; for ( String diagnostic : diagnosticStrs ) { diagnostics . add ( fromJavaFileComment ( filename , errorLine , diagnostic ) ) ; } return new TestDiagnosticLine ( filename , errorLine , originalLine , Collections . unmodifiableList ( diagnostics ) ) ; } else if ( trimmedLine . startsWith ( "//warning:" ) ) { String diagnosticString = trimmedLine . substring ( 2 ) ; TestDiagnostic diagnostic = fromJavaFileComment ( "" , 0 , diagnosticString ) ; return new TestDiagnosticLine ( "" , 0 , originalLine , Collections . singletonList ( diagnostic ) ) ; } else { return new TestDiagnosticLine ( filename , errorLine , originalLine , EMPTY ) ; } }
convert a line in a javasource file to a ( possibly empty ) testdiagnosticline
