Commit fd168fc0 authored by Vít Kabele's avatar Vít Kabele

Fixed GetTarget test

parent 20abe127
Pipeline #3370 passed with stages
in 3 minutes and 27 seconds
......@@ -113,7 +113,7 @@ class ArgProcessorParser extends AbstractParser {
// Parse method annotation and ensure that additional parameter types
// specified in the @ProcessAlso annotation are valid.
//
final AnnotationData data = AnnotationData.parse (method);
final AnnotationData data = new AnnotationData(method);
final ArgProcessorKind defaultType = ArgProcessorKind.forMethod (method);
__ensureValidProcessAlsoTypes (defaultType, data.processAlsoType);
......@@ -197,7 +197,7 @@ class ArgProcessorParser extends AbstractParser {
//
private static class AnnotationData {
private class AnnotationData {
//
// The default values are meant for annotations without defaults.
// These require the user to specify a value when the annotation is
......@@ -209,42 +209,39 @@ class ArgProcessorParser extends AbstractParser {
private Optional <Class <?>> guardClass = Optional.empty ();
//
static AnnotationData parse (final MethodNode method) {
final AnnotationData result = new AnnotationData ();
AnnotationData(final MethodNode methodNode){
new AnnotationMapper ()
.register (Guarded.class, "guard", (n, v) -> {
if (v instanceof Type) {
result.guardClass = Optional.of (__resolveClass ((Type) v));
this.guardClass = Optional.of (__resolveClass ((Type) v));
}
})
.register (ProcessAlso.class, "types", (n, v) -> {
if (v instanceof List <?>) {
@SuppressWarnings ("unchecked")
final List <ProcessAlso.Type> values = (List <ProcessAlso.Type>) v;
result.processAlsoType = __toArgProcessorKindSet (values);
this.processAlsoType = __toArgProcessorKindSet (values);
}
})
.processDefaults ()
.accept (method);
.accept (methodNode);
return result;
}
private static Class <?> __resolveClass (final Type type) {
private Class <?> __resolveClass (final Type type) {
try {
return Class.forName (type.getClassName ());
} catch (final ClassNotFoundException e) {
return ReflectionHelper.resolveClass (type, classLoader);
} catch (final ReflectionException e) {
throw new ParserRuntimeException (e);
}
}
private static EnumSet <ArgProcessorKind> __toArgProcessorKindSet (
private EnumSet <ArgProcessorKind> __toArgProcessorKindSet (
final List <ProcessAlso.Type> types
) {
return EnumSet.copyOf (
......
......@@ -94,6 +94,14 @@ public final class DiSL {
.flatMap (i -> i.allClasses ().stream ())
.collect (Collectors.toList ());
// Load every class, that is not a disl class
Set<String> dislClassNames = classNodes.stream ().map (i -> i.name).collect(Collectors.toSet());
allClasses
.stream ()
.filter ( i -> !dislClassNames.contains ( i.name ) )
.forEach (__classLoader::getClass);
__dislClasses = new IsolatedDislClasses (__codeOptions, classNodes, allClasses, __classLoader);
__transformers = new IsolatedTransformers ( transformerList, __classLoader );
__excludedScopes = ExclusionSetFactory.prepare ( instrumentationJars );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment