Module io.github.ascopes.jct
Class LoggingFileManagerProxy
java.lang.Object
io.github.ascopes.jct.filemanagers.LoggingFileManagerProxy
- All Implemented Interfaces:
InvocationHandler
@API(since="0.0.1",
status=STABLE)
public final class LoggingFileManagerProxy
extends Object
implements InvocationHandler
A proxy that wraps a
JctFileManager
in a proxy that can log all interactions with the
JavaFileManager, along with a corresponding stacktrace.
This is useful for diagnosing difficult-to-find errors being produced by javac
during testing, however, it may produce a hefty performance overhead when in use.
All logs are emitted with the DEBUG
logging level.
- Since:
- 0.0.1
- Author:
- Ashley Scopes
-
Method Summary
Modifier and TypeMethodDescriptionInvoke the given call.toString()
static JctFileManager
wrap
(JctFileManager manager, boolean stackTraces) Wrap the givenJctFileManager
in a proxy that logs any calls.
-
Method Details
-
invoke
Invoke the given call.- Specified by:
invoke
in interfaceInvocationHandler
- Parameters:
proxy
- the proxy.method
- the method.args
- the arguments.- Returns:
- the result.
- Throws:
Throwable
- any exception that is thrown.
-
toString
-
wrap
Wrap the givenJctFileManager
in a proxy that logs any calls.- Parameters:
manager
- the manager to wrap.stackTraces
-true
to dump stacktraces on each interception, orfalse
to omit them.- Returns:
- the proxy
JctFileManager
to use.
-