in sdk/enclave/src/main/java/org/apache/teaclave/javasdk/enclave/EnclaveFeature.java [110:137]
public void duringAnalysis(DuringAnalysisAccess access) {
List<Class<?>> enclaveServices = imageClassLoader.findAnnotatedClasses(EnclaveService.class, true);
enclaveServices.forEach(serviceClazz -> {
reflectionCandidateTypes.putIfAbsent(serviceClazz, false);
byte[] serviceConfig = NativeImageResourceFileSystemUtil.getBytes("META-INF/services/" + serviceClazz.getName(), true);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(serviceConfig), StandardCharsets.UTF_8))) {
while (true) {
String line = reader.readLine();
if (line == null) {
break;
}
Class<?> implementation = imageClassLoader.findClass(line).get();
collectConfigs(implementation, Arrays.stream(implementation.getMethods()).filter(method ->
serviceClazz.isAssignableFrom(method.getDeclaringClass())
).collect(Collectors.toList()));
}
} catch (IOException e) {
VMError.shouldNotReachHere(e);
}
});
List<Method> extraEnclaveMethods = imageClassLoader.findAnnotatedMethods(EnclaveMethod.class);
extraEnclaveMethods.forEach(method -> collectConfigs(method.getDeclaringClass(), List.of(method)));
// Register all newly collected configures
if (registerCollectedConfigs()) {
access.requireAnalysisIteration();
}
}