Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor typos wrt RecorderContext #440

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class BytecodeRecorderImpl implements RecorderContext {
private final Map<Class, ProxyFactory<?>> returnValueProxy = new HashMap<>();
private final IdentityHashMap<Class<?>, String> classProxies = new IdentityHashMap<>();
private final Map<Class<?>, SubstitutionHolder> substitutions = new HashMap<>();
private final Map<Class<?>, NonDefaultConstructorHolder> nonDefaulConstructors = new HashMap<>();
private final Map<Class<?>, NonDefaultConstructorHolder> nonDefaultConstructors = new HashMap<>();
private final String className;


Expand All @@ -121,7 +121,7 @@ public <F, T> void registerSubstitution(Class<F> from, Class<T> to, Class<? exte

@Override
public <T> void registerNonDefaultConstructor(Constructor<T> constructor, Function<T, List<Object>> parameters) {
nonDefaulConstructors.put(constructor.getDeclaringClass(), new NonDefaultConstructorHolder(constructor, (Function<Object, List<Object>>) parameters));
nonDefaultConstructors.put(constructor.getDeclaringClass(), new NonDefaultConstructorHolder(constructor, (Function<Object, List<Object>>) parameters));
}

public <T> T getRecordingProxy(Class<T> theClass) {
Expand Down Expand Up @@ -423,8 +423,8 @@ private ResultHandle loadObjectInstance(MethodCreator method, Object param, Map<
method.writeArrayValue(out, i, component);
}
} else {
if (nonDefaulConstructors.containsKey(param.getClass())) {
NonDefaultConstructorHolder holder = nonDefaulConstructors.get(param.getClass());
if (nonDefaultConstructors.containsKey(param.getClass())) {
NonDefaultConstructorHolder holder = nonDefaultConstructors.get(param.getClass());
List<Object> params = holder.paramGenerator.apply(param);
if (params.size() != holder.constructor.getParameterCount()) {
throw new RuntimeException("Unable to serialize " + param + " as the wrong number of parameters were generated for " + holder.constructor);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/extension-authors-guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ control the order that generated bytecode is run. In the example above we know t
`org.jboss.shamrock.deployment.recording.RecorderContext` provides some convenience methods to enhance bytecode recording,
this includes the ability to register creation functions for classes without no-arg constructors, to register an object
substitution (basically a transformer from a non-serializable object to a serializable one and vice versa), and to create
a class proxy. This interface can be directly injected as a method parameter into any `@Recorder` method.
a class proxy. This interface can be directly injected as a method parameter into any `@Record` method.

Calling `classProxy` with a given class name will create a `Class` that can be passed into template
methods, and at runtime will be substituted with the class whose name was passed in to `classProxy`. This is basically a
Expand Down