1515import java .io .PrintStream ;
1616import java .lang .classfile .ClassModel ;
1717import java .lang .classfile .MethodModel ;
18+ import java .lang .constant .ClassDesc ;
1819import java .nio .file .Files ;
1920import java .nio .file .Path ;
2021
@@ -34,10 +35,21 @@ public MethodAnalyzer analyzeAndReport(final ClassModel model, final MethodModel
3435 }
3536
3637 public MethodAnalyzer analyzeAndReport (final ResolvedMethod resolvedMethod ) throws IOException {
37- try (final PrintStream ps = new PrintStream (Files .newOutputStream (outputDirectory .resolve ("bytecode.yaml" )))) {
38+ try (final var ps = new PrintStream (Files .newOutputStream (outputDirectory .resolve ("bytecode.yaml" )))) {
3839 ps .print (resolvedMethod .methodModel ().toDebugString ());
3940 }
4041
42+ final ClassDesc thisType = resolvedMethod .thisClass ().thisType ().type ();
43+ final String fullQualifiedClassNameOfMethod = thisType .packageName () + "." + thisType .displayName ();
44+ final String sourceFileNameURL = "https://raw.githubusercontent.com/mirkosertic/MetaIR/refs/heads/main/src/test/java/" + fullQualifiedClassNameOfMethod .replace ("." , "/" ) + ".java" ;
45+
46+ try (final PrintStream ps = new PrintStream (Files .newOutputStream (outputDirectory .resolve ("report.html" )))) {
47+ try (final var is = MetaIRTestHelper .class .getResourceAsStream ("/report-template.html" )) {
48+ final String content = new String (is .readAllBytes ());
49+ ps .print (content .replace ("${sourcefileurl}" , sourceFileNameURL ));
50+ }
51+ }
52+
4153 try {
4254 final MethodAnalyzer analyzer = resolvedMethod .analyze ();
4355
@@ -56,7 +68,7 @@ public MethodAnalyzer analyzeAndReport(final ResolvedMethod resolvedMethod) thro
5668 new Sequencer <>(analyzer .ir (), debugStructuredControlflowCodeGenerator );
5769 final PrintStream sequenced = new PrintStream (Files .newOutputStream (outputDirectory .resolve ("sequenced.txt" )));
5870 sequenced .print (debugStructuredControlflowCodeGenerator );
59-
71+
6072 return analyzer ;
6173 } catch (final IllegalParsingStateException ex ) {
6274
0 commit comments