1
0

Add dummy classes to dump all classes loaded as part of packaging modules to ensure javadoc and sources jars are getting created

This commit is contained in:
Balaji Varadarajan
2018-09-17 00:25:24 -07:00
committed by vinoth chandar
parent f44bcc5b03
commit 2728f96505
5 changed files with 125 additions and 1 deletions

View File

@@ -16,12 +16,16 @@
package com.uber.hoodie.common.util;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
import com.uber.hoodie.common.model.HoodieRecordPayload;
import com.uber.hoodie.exception.HoodieException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
public class ReflectionUtils {
@@ -82,4 +86,17 @@ public class ReflectionUtils {
.map(arg -> arg.getClass()).toArray(Class<?>[]::new);
return loadClass(clazz, constructorArgTypes, constructorArgs);
}
/**
* Return stream of top level class names in the same class path as passed-in class
* @param clazz
*/
public static Stream<String> getTopLevelClassesInClasspath(Class clazz) {
try {
ClassPath classPath = ClassPath.from(clazz.getClassLoader());
return classPath.getTopLevelClasses().stream().map(ClassInfo::getName);
} catch (IOException e) {
throw new RuntimeException("Got exception while dumping top level classes", e);
}
}
}