Skip to content
This repository has been archived by the owner. It is now read-only.

Commit 5ce917d

Browse files
committed
Fix #312: Improve ExternalHooks API
See ticket for details and discussion.
1 parent d6d5771 commit 5ce917d

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/main/java/xsbti/compile/ExternalHooks.java

+26-7
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
import java.util.Set;
1313

1414
/**
15-
* Define hooks that can be user-defined to modify the behaviour of
15+
* Defines hooks that can be user-defined to modify the behaviour of
1616
* internal components of the incremental compiler.
1717
*/
1818
public interface ExternalHooks {
1919
/**
20-
* Define an interface for a lookup mechanism.
20+
* Defines an interface for a lookup mechanism.
2121
*/
22-
public static interface Lookup {
22+
interface Lookup {
2323

2424
/**
2525
* Used to provide information from external tools into sbt (e.g. IDEs)
@@ -54,17 +54,36 @@ public static interface Lookup {
5454
}
5555

5656
/**
57-
* Return the implementation of a lookup mechanism to be used instead of
57+
* Returns the implementation of a lookup mechanism to be used instead of
5858
* the internal lookup provided by the default implementation.
5959
*/
60-
Optional<Lookup> externalLookup();
60+
Optional<Lookup> getExternalLookup();
6161

6262
/**
63-
* Return the implementation of a {@link ClassFileManager} to be used
63+
* Returns the implementation of a {@link ClassFileManager} to be used
6464
* alongside the internal manager provided by the default implementation.
6565
* <p>
6666
* This class file manager is run after the internal
6767
* {@link ClassFileManager} defined in {@link IncOptions}.
6868
*/
69-
Optional<ClassFileManager> externalClassFileManager();
69+
Optional<ClassFileManager> getExternalClassFileManager();
70+
71+
/**
72+
* Returns an instance of hooks that executes the external passed class file manager.
73+
*
74+
* If several class file manager are passed, they are aggregated and their execution happens
75+
* in the order of invocations of this method.
76+
*
77+
* @return An instance of {@link ExternalHooks} with the aggregated external class file manager.
78+
*/
79+
ExternalHooks withExternalClassFileManager(ClassFileManager externalClassFileManager);
80+
81+
/**
82+
* Returns an instance of hooks with one lookup.
83+
*
84+
* If used several times, only the last lookup instance will be used.
85+
*
86+
* @return An instance of {@link ExternalHooks} with the specified lookup.
87+
*/
88+
ExternalHooks withExternalLookup(Lookup externalLookup);
7089
}

0 commit comments

Comments
 (0)