Skip to content

Commit

Permalink
https://github.com/manifold-systems/manifold/issues/592
Browse files Browse the repository at this point in the history
- set formatter regardless of whether manifold-ext is in use
  • Loading branch information
rsmckinney committed Sep 3, 2024
1 parent 1c8c7f2 commit 67a9de7
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.TreeMaker;
import com.sun.tools.javac.tree.TreeTranslator;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.JCDiagnostic;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.RichDiagnosticFormatter;
import com.sun.tools.javac.util.*;

import java.io.*;
import java.lang.reflect.Modifier;
Expand Down Expand Up @@ -423,6 +420,8 @@ private void tailorJavaCompiler( TaskEvent te )

if( !isExtensionsEnabled() )
{
setDiagnosticFormatter();

// No need to hook up all the extension stuff if it's not enabled
return;
}
Expand All @@ -447,7 +446,7 @@ private void tailorJavaCompiler( TaskEvent te )
ReflectUtil.method( "manifold.internal.javac.ManTypes_" + (JreUtil.isJava17orLater() ? 17 : 8),
"instance", Context.class ).invokeStatic( getContext() );

((Log)ReflectUtil.field( manAttr, "log" ).get()).setDiagnosticFormatter( RichDiagnosticFormatter.instance( _ctx ) );
setDiagnosticFormatter();

if( !JreUtil.isJava8() )
{
Expand Down Expand Up @@ -485,6 +484,14 @@ private void tailorJavaCompiler( TaskEvent te )
notifyCompilerComponents();
}

private void setDiagnosticFormatter()
{
if( Options.instance( getContext() ).isUnset( "diags.legacy" ) )
{
Log.instance( getContext() ).setDiagnosticFormatter( RichDiagnosticFormatter.instance( getContext() ) );
}
}

private void ensureComprehensiveUse()
{
// ensure all compiler components are using the following manifold compiler component overrides
Expand Down

0 comments on commit 67a9de7

Please sign in to comment.