diff --git a/panda-utilities/src/main/java/org/panda_lang/utilities/commons/ArrayUtils.java b/panda-utilities/src/main/java/org/panda_lang/utilities/commons/ArrayUtils.java index ef9b52492..ccb19ddec 100644 --- a/panda-utilities/src/main/java/org/panda_lang/utilities/commons/ArrayUtils.java +++ b/panda-utilities/src/main/java/org/panda_lang/utilities/commons/ArrayUtils.java @@ -17,6 +17,7 @@ package org.panda_lang.utilities.commons; import org.jetbrains.annotations.Nullable; +import org.panda_lang.utilities.commons.collection.Pair; import org.panda_lang.utilities.commons.function.Option; import org.panda_lang.utilities.commons.function.ThrowingConsumer; @@ -218,15 +219,26 @@ public static Class getDimensionalArrayType(Class type, int dimensions) { * @param arrayClass the array class * @return the base type */ - @SuppressWarnings("IdempotentLoopBody") public static Class getBaseClass(Class arrayClass) { + return getBaseClassWithDimensions(arrayClass).getKey(); + } + + /** + * Get base class of any array, e.g. Integer from Integer[][][][][] + * + * @param arrayClass the array class + * @return the base type + */ + public static Pair, Integer> getBaseClassWithDimensions(Class arrayClass) { Class currentClass = arrayClass; + int dimensions = 0; while (currentClass.isArray()) { currentClass = arrayClass.getComponentType(); + dimensions++; } - return currentClass; + return new Pair<>(currentClass, dimensions); } /** diff --git a/panda-utilities/src/main/java/org/panda_lang/utilities/inject/GeneratedMethodInjector.java b/panda-utilities/src/main/java/org/panda_lang/utilities/inject/GeneratedMethodInjector.java index 9c31b7cc8..a059774cf 100644 --- a/panda-utilities/src/main/java/org/panda_lang/utilities/inject/GeneratedMethodInjector.java +++ b/panda-utilities/src/main/java/org/panda_lang/utilities/inject/GeneratedMethodInjector.java @@ -16,7 +16,10 @@ package org.panda_lang.utilities.inject; +import org.panda_lang.utilities.commons.ArrayUtils; import org.panda_lang.utilities.commons.ObjectUtils; +import org.panda_lang.utilities.commons.StringUtils; +import org.panda_lang.utilities.commons.collection.Pair; import org.panda_lang.utilities.commons.javassist.implementer.FunctionalInterfaceImplementer; import java.lang.reflect.Method; @@ -24,7 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiFunction; -final class GeneratedMethodInjector { +public final class GeneratedMethodInjector { private static final AtomicInteger ID = new AtomicInteger(); private static final FunctionalInterfaceImplementer FUNCTIONAL_INTERFACE_IMPLEMENTER = new FunctionalInterfaceImplementer(); @@ -44,28 +47,48 @@ final class GeneratedMethodInjector { } @SuppressWarnings("unchecked") - public T invoke(Object instance) throws Throwable { - return (T) function.apply(instance, empty ? InjectorProcessor.EMPTY : processor.fetchValues(cache, method)); + public T invoke(Object instance, Object... injectorArgs) throws Throwable { + return (T) function.apply(instance, empty ? InjectorProcessor.EMPTY : processor.fetchValues(cache, method, injectorArgs)); } private static BiFunction generate(Method method) throws Exception { Class[] parameterTypes = method.getParameterTypes(); Class declaringClass = method.getDeclaringClass(); + boolean isVoid = method.getReturnType() == void.class; - StringBuilder body = new StringBuilder("").append(declaringClass.getName()).append(" instance = (").append(declaringClass.getName()).append(") $1;"); - body.append("return instance.").append(method.getName()).append("("); + StringBuilder body = new StringBuilder(""); + body.append(declaringClass.getName()).append(" instance = (").append(declaringClass.getName()).append(") $1;").append(System.lineSeparator()); + body.append(Object.class.getName()).append("[] array = (").append(Object.class.getName()).append("[]) $2;"); + + if (!isVoid) { + body.append("return "); + } + + body.append("instance.").append(method.getName()).append("("); for (int index = 0; index < parameterTypes.length; index++) { - body.append("(").append(parameterTypes[index].getName()).append(") $2[").append(index).append("], "); + Class parameterType = parameterTypes[index]; + String type = parameterType.getName(); + + if (parameterType.isArray()) { + Pair, Integer> baseClass = ArrayUtils.getBaseClassWithDimensions(parameterType); + type = baseClass.getKey().getName() + StringUtils.repeated(baseClass.getValue(), "[]"); + } + + body.append("(").append(type).append(") array[").append(index).append("], ").append(System.lineSeparator()); } if (parameterTypes.length > 0) { - body.setLength(body.length() - 2); + body.setLength(body.length() - (", " + System.lineSeparator()).length()); } body.append(");"); - String name = "PandaDI" + method.getDeclaringClass().getSimpleName() + method.getName(); + if (isVoid) { + body.append("return null;"); + } + + String name = "PandaDI$" + ID.incrementAndGet() + "$" + method.getDeclaringClass().getSimpleName() + method.getName(); Class type = FUNCTIONAL_INTERFACE_IMPLEMENTER.generate(name, BiFunction.class, new LinkedHashMap<>(), body); return ObjectUtils.cast(type.newInstance()); diff --git a/panda-utilities/src/main/java/org/panda_lang/utilities/inject/Injector.java b/panda-utilities/src/main/java/org/panda_lang/utilities/inject/Injector.java index aa7adb9a2..c25d2ac07 100644 --- a/panda-utilities/src/main/java/org/panda_lang/utilities/inject/Injector.java +++ b/panda-utilities/src/main/java/org/panda_lang/utilities/inject/Injector.java @@ -76,7 +76,7 @@ public interface Injector { * @param parameter the parameter invoke * @param type of expected value * @return the associated binding value - * @throws InjectorException if anything happen + * @throws java.lang.Throwable if anything happen */ @Nullable T invokeParameter(Parameter parameter, Object... injectorArgs) throws Throwable; diff --git a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/block/BlockParser.java b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/block/BlockParser.java index 6c7637839..0ad4bb878 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/block/BlockParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/block/BlockParser.java @@ -66,7 +66,7 @@ protected Boolean customHandle(Handler handler, Context context, LocalChannel ch } @Autowired(order = 1) - void parse(Context context, LocalChannel channel, @Ctx Scope parent, @Src("declaration") Snippet declaration) throws Exception { + public void parse(Context context, LocalChannel channel, @Ctx Scope parent, @Src("declaration") Snippet declaration) throws Exception { BlockSubparser blockParser = channel.get("subparser", BlockSubparser.class); Context delegatedContext = channel.allocated("blockContext", context.fork()) @@ -96,7 +96,7 @@ void parse(Context context, LocalChannel channel, @Ctx Scope parent, @Src("decla } @Autowired(order = 2) - void parseContent(@Channel Context blockContext, @Channel Block block, @Nullable @Src("body") Snippet body) throws Exception { + public void parseContent(@Channel Context blockContext, @Channel Block block, @Nullable @Src("body") Snippet body) throws Exception { if (body != null) { SCOPE_PARSER.parse(blockContext, block, body); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapGenerator.java b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapGenerator.java index 5753a92a8..5657bb2c2 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapGenerator.java +++ b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapGenerator.java @@ -19,19 +19,31 @@ import org.panda_lang.framework.design.interpreter.parser.ContextParser; import org.panda_lang.framework.design.interpreter.parser.ParserRepresentation; import org.panda_lang.framework.language.interpreter.parser.pipeline.PandaParserRepresentation; +import org.panda_lang.utilities.inject.DependencyInjection; +import org.panda_lang.utilities.inject.Injector; +import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import java.util.stream.Collectors; final class BootstrapGenerator { - protected ParserRepresentation> generate(BootstrapInitializer initializer, BootstrapContent content) { - List methods = initializer.layers.stream() - .map(BootstrapMethod::new) - .sorted(Comparator.comparingInt(BootstrapMethod::getOrder)) - .collect(Collectors.toList()); + private static final Injector INJECTOR = DependencyInjection.createInjector(new BootstrapInjectorController()); + protected ParserRepresentation> generate(BootstrapInitializer initializer, BootstrapContent content) { + List methods = new ArrayList<>(initializer.layers.size()); + + for (Method layer : initializer.layers) { + try { + methods.add(new BootstrapMethod(INJECTOR.forGeneratedMethod(layer))); + } catch (Exception e) { + e.printStackTrace(); + throw new BootstrapException("Cannot generate bootstrap method", e); + } + } + + methods.sort(Comparator.comparingInt(BootstrapMethod::getOrder)); content.getInitializer().initialize(content); content.getHandler() diff --git a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInitializer.java b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInitializer.java index 6d180212f..caa834741 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInitializer.java +++ b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInitializer.java @@ -36,6 +36,8 @@ public final class BootstrapInitializer { + private static final BootstrapGenerator BOOTSTRAP_GENERATOR = new BootstrapGenerator(); + protected String name; protected Object instance; @@ -130,7 +132,7 @@ protected ParserRepresentation> build(Context context) { initializer = (ctx, channel) -> {}; } - return new BootstrapGenerator().generate(this, new BootstrapContentImpl(name, instance, context, handler, initializer, pattern)); + return BOOTSTRAP_GENERATOR.generate(this, new BootstrapContentImpl(name, instance, context, handler, initializer, pattern)); } } diff --git a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInjectorController.java b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInjectorController.java index 1c38c1d5c..540034f8c 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInjectorController.java +++ b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapInjectorController.java @@ -24,6 +24,7 @@ import org.panda_lang.panda.language.interpreter.parser.context.annotations.Ctx; import org.panda_lang.panda.language.interpreter.parser.context.annotations.Channel; import org.panda_lang.panda.language.interpreter.parser.context.annotations.Src; +import org.panda_lang.utilities.commons.ObjectUtils; import org.panda_lang.utilities.commons.StringUtils; import org.panda_lang.utilities.inject.InjectorController; import org.panda_lang.utilities.inject.InjectorResources; @@ -35,31 +36,25 @@ final class BootstrapInjectorController implements InjectorController { - private final Context context; - - BootstrapInjectorController(Context context) { - this.context = context; - } - @Override public void initialize(InjectorResources resources) { - resources.on(Context.class).assignInstance(() -> context); - resources.on(LocalChannel.class).assignInstance(() -> context.getComponent(Components.CHANNEL)); + resources.on(Context.class).assignHandler((parameter, annotation, injectorArgs) -> context(injectorArgs)); + resources.on(LocalChannel.class).assignHandler((parameter, annotation, injectorArgs) -> channel(context(injectorArgs))); resources.annotatedWith(Ctx.class).assignHandler((required, annotation, injectorArgs) -> { - return findComponent(annotation, required); + return findComponent(context(injectorArgs), annotation, required); }); resources.annotatedWith(Channel.class).assignHandler((required, annotation, injectorArgs) -> { - return findInChannel(annotation, required); + return findInChannel(context(injectorArgs), annotation, required); }); resources.annotatedWith(Src.class).assignHandler((required, annotation, injectorArgs) -> { - return findSource(annotation, required); + return findSource(context(injectorArgs), annotation, required); }); } - private @Nullable Object findComponent(Ctx ctx, Parameter required) { + private @Nullable Object findComponent(Context context, Ctx ctx, Parameter required) { return context.getComponents().entrySet().stream() .filter(entry -> { String value = ctx.value(); @@ -77,14 +72,14 @@ public void initialize(InjectorResources resources) { .orElse(null); } - private @Nullable Object findSource(Src src, Parameter required) { - LocalChannel channel = getChannel(); + private @Nullable Object findSource(Context context, Src src, Parameter required) { + LocalChannel channel = channel(context); if (!channel.contains(Mappings.class)) { throw new BootstrapException("Pattern mappings are not defined for @Redactor"); } - Mappings redactor = getChannel().get(Mappings.class); + Mappings redactor = channel.get(Mappings.class); Object value = redactor.get(src.value()).getOrNull(); Class requiredType = required.getType(); @@ -99,9 +94,9 @@ public void initialize(InjectorResources resources) { return value; } - private @Nullable Object findInChannel(Channel channelAnnotation, Parameter required) { + private @Nullable Object findInChannel(Context context, Channel channelAnnotation, Parameter required) { String name = channelAnnotation.value(); - LocalChannel channel = getChannel(); + LocalChannel channel = channel(context); if (!StringUtils.isEmpty(name)) { return channel.get(name); @@ -110,7 +105,11 @@ public void initialize(InjectorResources resources) { return channel.get(required.getType()); } - private LocalChannel getChannel() { + private Context context(Object[] injectorArgs) { + return Objects.requireNonNull(ObjectUtils.cast(injectorArgs[0])); + } + + private LocalChannel channel(Context context) { return context.getComponent(Components.CHANNEL); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapMethod.java b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapMethod.java index 8021c80ec..7bb813a2d 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapMethod.java +++ b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapMethod.java @@ -17,20 +17,19 @@ package org.panda_lang.panda.language.interpreter.parser.context; import org.panda_lang.panda.language.interpreter.parser.context.annotations.Autowired; - -import java.lang.reflect.Method; +import org.panda_lang.utilities.inject.GeneratedMethodInjector; final class BootstrapMethod { - protected final Method method; protected final Autowired autowired; + protected final GeneratedMethodInjector generatedMethod; - BootstrapMethod(Method method) { - this.method = method; - this.autowired = method.getAnnotation(Autowired.class); + BootstrapMethod(GeneratedMethodInjector generatedMethod) { + this.generatedMethod = generatedMethod; + this.autowired = generatedMethod.getMethod().getAnnotation(Autowired.class); if (autowired == null) { - throw new BootstrapException("Method " + method.getName() + " is not annotated by @Autowired"); + throw new BootstrapException("Method " + generatedMethod.getMethod().getName() + " is not annotated by @Autowired"); } } @@ -46,13 +45,17 @@ protected String getCycle() { return autowired.cycle(); } - protected Method getMethod() { - return method; + protected GeneratedMethodInjector getGeneratedMethod() { + return generatedMethod; + } + + public String getName() { + return generatedMethod.getMethod().getName(); } @Override public String toString() { - return "Bootstrap Method: " + method + " / " + autowired; + return "Bootstrap Method: " + generatedMethod.getMethod() + " / " + autowired; } } diff --git a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapTaskScheduler.java b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapTaskScheduler.java index 3e17e7b28..62b20ac2a 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapTaskScheduler.java +++ b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/BootstrapTaskScheduler.java @@ -23,9 +23,6 @@ import org.panda_lang.framework.design.interpreter.parser.generation.GenerationCycle; import org.panda_lang.framework.design.interpreter.parser.generation.GenerationPhase; import org.panda_lang.framework.design.interpreter.parser.generation.GenerationTask; -import org.panda_lang.utilities.inject.DependencyInjection; -import org.panda_lang.utilities.inject.Injector; -import org.panda_lang.utilities.inject.InjectorController; import java.lang.reflect.InvocationTargetException; import java.util.Stack; @@ -44,19 +41,14 @@ final class BootstrapTaskScheduler { this.methods = methods; } - protected T schedule(Context context) throws Exception { - return schedule(context, new BootstrapInjectorController(context)); - } - - private @Nullable T schedule(Context context, InjectorController controller) throws Exception { - Injector injector = DependencyInjection.createInjector(controller); + protected @Nullable T schedule(Context context) throws Exception { int currentOrder = methods.peek().getOrder(); while (hasNext(currentOrder)) { BootstrapMethod currentMethod = methods.pop(); boolean last = !hasNext(currentOrder); - T value = delegateNext(context, controller, injector, currentMethod, last); + T value = delegateNext(context, currentMethod, last); if (last) { return value; @@ -66,24 +58,24 @@ protected T schedule(Context context) throws Exception { return null; } - private T delegateNext(Context context, InjectorController controller, Injector injector, BootstrapMethod method, boolean last) throws Exception { + private T delegateNext(Context context, BootstrapMethod method, boolean last) throws Exception { GenerationTask callback = (cycle, delegatedContext) -> { T value; try { - value = injector.invokeMethod(method.getMethod(), content.getInstance()); + value = method.getGeneratedMethod().invoke(content.getInstance(), delegatedContext); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof Exception) { throw (Exception) e.getTargetException(); } - throw new BootstrapException("Cannot execute " + method.getMethod() + " -> " + e.getTargetException().getMessage(), e.getTargetException()); + throw new BootstrapException("Cannot execute " + method.getName() + " -> " + e.getTargetException().getMessage(), e.getTargetException()); } catch (Throwable e) { - throw new BootstrapException("Cannot execute " + method.getMethod() + " -> " + e.getMessage(), e); + throw new BootstrapException("Cannot execute " + method.getName() + " -> " + e.getMessage(), e); } if (last && !methods.isEmpty()) { - schedule(delegatedContext.fork(), controller); + schedule(delegatedContext.fork()); } return value; diff --git a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/ParserBootstrap.java b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/ParserBootstrap.java index aa917d597..9a6c453d1 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/ParserBootstrap.java +++ b/panda/src/main/java/org/panda_lang/panda/language/interpreter/parser/context/ParserBootstrap.java @@ -48,7 +48,7 @@ protected ParserRepresentation> get(Context context) { return parser; } - return this.parser = initialize(context, new BootstrapInitializer().instance(this)).build(context); + return (this.parser = initialize(context, new BootstrapInitializer().instance(this)).build(context)); } } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/array/ArrayValueAssignationSubparser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/array/ArrayValueAssignationSubparser.java index ec097a379..ffee403c7 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/array/ArrayValueAssignationSubparser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/array/ArrayValueAssignationSubparser.java @@ -88,7 +88,7 @@ protected Boolean customHandle(Handler handler, Context context, LocalChannel ch } @Autowired(order = 1) - ExpressionResult parse( + public ExpressionResult parse( Context context, LocalChannel channel, @Ctx SourceStream source, diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableAssignationSubparser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableAssignationSubparser.java index 44a20e7f8..865c92c65 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableAssignationSubparser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableAssignationSubparser.java @@ -78,7 +78,7 @@ protected Object customHandle(Handler handler, Context context, LocalChannel cha } @Autowired(order = 1) - ExpressionResult parse(LocalChannel channel, @Ctx Scope block, @Ctx Expression expression, @Channel Location location) { + public ExpressionResult parse(LocalChannel channel, @Ctx Scope block, @Ctx Expression expression, @Channel Location location) { Accessor accessor = channel.get("accessor", AccessorExpression.class).getAccessor(); boolean initialization = block.getFramedScope() instanceof ConstructorScope; Assigner assigner = accessor.toAssigner(location, initialization, expression); diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableDeclarationSubparser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableDeclarationSubparser.java index 7f5c07027..1f05a4b57 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableDeclarationSubparser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/expressions/subparsers/assignation/variable/VariableDeclarationSubparser.java @@ -105,7 +105,7 @@ protected Object customHandle(Handler handler, Context context, LocalChannel cha } @Autowired(order = 1) - ExpressionResult parse( + public ExpressionResult parse( Context context, LocalChannel channel, @Ctx Scope scope, diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ExportParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ExportParser.java index f8b959671..3a2b6262e 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ExportParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ExportParser.java @@ -41,7 +41,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parseImport(Context context, @Ctx PandaScript script, @Src("class") Snippet className) { + public void parseImport(Context context, @Ctx PandaScript script, @Src("class") Snippet className) { script.getModule().add(ConveyanceUtils.fetchType(context, className)); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ImportParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ImportParser.java index 7ed3c210d..f643497e2 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ImportParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ImportParser.java @@ -41,7 +41,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parseImport(Context context, @Ctx Imports imports, @Src("class") Snippet className) { + public void parseImport(Context context, @Ctx Imports imports, @Src("class") Snippet className) { imports.importType(className.toString(), ConveyanceUtils.fetchType(context, className)); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/MainParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/MainParser.java index 2d9cebc9a..2b887570c 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/MainParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/MainParser.java @@ -48,12 +48,12 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1, delegation = Delegation.NEXT_DEFAULT) - void createScope(LocalChannel channel, @Ctx Script script, @Channel Location location) { + public void createScope(LocalChannel channel, @Ctx Script script, @Channel Location location) { script.addStatement(channel.allocated("main", new MainScope(location))); } @Autowired(order = 2, delegation = Delegation.NEXT_AFTER) - void parseScope(Context context, @Channel MainScope main, @Src("body") @Nullable Snippet body) throws Exception { + public void parseScope(Context context, @Channel MainScope main, @Src("body") @Nullable Snippet body) throws Exception { SCOPE_PARSER.parse(context.fork(), main, body); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ModuleParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ModuleParser.java index 7e31e9cde..bfa7fab56 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ModuleParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/ModuleParser.java @@ -48,7 +48,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1, cycle = GenerationCycles.TYPES_LABEL) - void parse(@Ctx Environment environment, @Ctx Imports imports, @Ctx PandaScript script, @Channel Location location, @Src("module") Snippet source) { + public void parse(@Ctx Environment environment, @Ctx Imports imports, @Ctx PandaScript script, @Channel Location location, @Src("module") Snippet source) { if (script.select(ModuleStatement.class).size() > 0) { throw new PandaParserException("Script contains more than one declaration of the group"); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/RequireParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/RequireParser.java index 1244cefb6..218e959ad 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/RequireParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/head/RequireParser.java @@ -66,7 +66,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1, cycle = GenerationCycles.TYPES_LABEL) - void parse(Context context, @Ctx Imports imports, @Src("required") @Nullable Snippetable require, @Src("requiredFile") @Nullable TokenInfo requiredFile) { + public void parse(Context context, @Ctx Imports imports, @Src("required") @Nullable Snippetable require, @Src("requiredFile") @Nullable TokenInfo requiredFile) { if (require != null) { parseModule(context, imports, require.toSnippet()); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LateDeclarationParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LateDeclarationParser.java index 64c7f9815..3b485c433 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LateDeclarationParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LateDeclarationParser.java @@ -51,7 +51,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parse(Context context, @Channel Mappings mappings, @Ctx Scope scope, @Src("type") Snippetable type, @Src("name") Snippetable name) { + public void parse(Context context, @Channel Mappings mappings, @Ctx Scope scope, @Src("type") Snippetable type, @Src("name") Snippetable name) { PandaVariableDataInitializer dataInitializer = new PandaVariableDataInitializer(context, scope); VariableData variableData = dataInitializer.createVariableData(type, name, mappings.has(Keywords.MUT.getValue()), mappings.has(Keywords.NIL.getValue())); scope.createVariable(variableData); diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LogParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LogParser.java index 752f2b58b..e86f9c6a9 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LogParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/LogParser.java @@ -48,7 +48,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parse(Context context, @Ctx ExpressionParser parser, @Ctx Scope scope, @Channel Location location, @Src("arguments") ExpressionTransaction[] transactions) { + public void parse(Context context, @Ctx ExpressionParser parser, @Ctx Scope scope, @Channel Location location, @Src("arguments") ExpressionTransaction[] transactions) { Expression[] expressions = Arrays.stream(transactions) .map(ExpressionTransaction::getExpression) .toArray(Expression[]::new); diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/StandaloneExpressionParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/StandaloneExpressionParser.java index f13e383cf..3751337d4 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/StandaloneExpressionParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/StandaloneExpressionParser.java @@ -68,7 +68,7 @@ protected Object customHandle(Handler handler, Context context, LocalChannel cha } @Autowired(order = 1) - void parseExpression(@Ctx SourceStream source, @Ctx Scope parent, @Ctx LocalChannel channel, @Channel Location location) { + public void parseExpression(@Ctx SourceStream source, @Ctx Scope parent, @Ctx LocalChannel channel, @Channel Location location) { StandaloneExpression statement = new StandaloneExpression(source.getCurrent().getLocation(), channel.get("expression", Expression.class)); parent.addStatement(statement); source.readSilently(channel.get("read", int.class)); diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatch.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatch.java index a7aca2a06..2d63c05a5 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatch.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatch.java @@ -26,7 +26,7 @@ import java.util.HashMap; import java.util.Map; -final class TryCatch extends AbstractExecutableStatement { +public final class TryCatch extends AbstractExecutableStatement { private final Scope tryBlock; private final Scope finallyBlock; diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatchParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatchParser.java index 5cb113841..ccf7ba35f 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatchParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/TryCatchParser.java @@ -51,14 +51,14 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parse(Context context, LocalChannel channel, @Ctx Scope parent, @Channel Location location, @Src("try-body") Snippet tryBody) throws Exception { + public void parse(Context context, LocalChannel channel, @Ctx Scope parent, @Channel Location location, @Src("try-body") Snippet tryBody) throws Exception { Scope tryBlock = SCOPE_PARSER.parse(context, new PandaBlock(parent, location), tryBody); TryCatch tryCatch = channel.allocated("statement", new TryCatch(location, tryBlock, new PandaBlock(parent, location))); parent.addStatement(tryCatch); } @Autowired(order = 2) - void parse(Context context, @Ctx Scope parent, @Channel TryCatch tryCatch, @Src("catch-what") Snippet catchWhat, @Src("catch-body") Snippet catchBody) throws Exception { + public void parse(Context context, @Ctx Scope parent, @Channel TryCatch tryCatch, @Src("catch-what") Snippet catchWhat, @Src("catch-body") Snippet catchBody) throws Exception { Scope catchBlock = new PandaBlock(parent, catchWhat.getLocation()); PandaVariableDataInitializer dataInitializer = new PandaVariableDataInitializer(context, catchBlock); diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/conditional/ConditionalBlockParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/conditional/ConditionalBlockParser.java index 61b7db34b..cdaf2f24b 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/conditional/ConditionalBlockParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/conditional/ConditionalBlockParser.java @@ -64,7 +64,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapI } @Autowired(order = 1) - BlockData parse( + public BlockData parse( Context context, @Ctx Scope parent, @Ctx TypeLoader loader, diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForEachParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForEachParser.java index ed5885a9c..71f896362 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForEachParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForEachParser.java @@ -54,7 +54,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapI } @Autowired(order = 1) - BlockData parseBlock(Context context, @Ctx Scope parent, @Ctx TypeLoader loader, @Ctx ExpressionParser parser, @Src("content") Snippet content) { + public BlockData parseBlock(Context context, @Ctx Scope parent, @Ctx TypeLoader loader, @Ctx ExpressionParser parser, @Src("content") Snippet content) { Snippet[] elements = content.split(Operators.COLON); if (elements.length != 2) { diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForParser.java index f9f4a1e50..0729599bb 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/ForParser.java @@ -55,7 +55,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapI } @Autowired(order = 1) - BlockData parseBlock(Context context, @Ctx Scope parent, @Channel Location location, @Src("content") Snippet content, @Ctx ExpressionParser expressionParser) { + public BlockData parseBlock(Context context, @Ctx Scope parent, @Channel Location location, @Src("content") Snippet content, @Ctx ExpressionParser expressionParser) { Snippet[] forEachElements = content.split(Separators.SEMICOLON); if (forEachElements.length != 3) { diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/LoopParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/LoopParser.java index 2b8b1d560..14dc6dcf6 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/LoopParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/LoopParser.java @@ -44,7 +44,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapI } @Autowired(order = 1) - BlockData parseContent(Context context, @Ctx Scope parent, @Channel Location location, @Src("value") Expression expression) { + public BlockData parseContent(Context context, @Ctx Scope parent, @Channel Location location, @Src("value") Expression expression) { if (!expression.getType().getAssociatedClass().isAssignableTo(Integer.class)) { throw new PandaParserException("Loop requires number as an argument"); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/WhileParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/WhileParser.java index a45e0680c..6dd07ffdc 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/WhileParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/block/looping/WhileParser.java @@ -44,7 +44,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapI } @Autowired(order = 1) - BlockData parseWhile(Context context, @Ctx Scope parent, @Channel Location location, @Src("value") Expression expression) { + public BlockData parseWhile(Context context, @Ctx Scope parent, @Channel Location location, @Src("value") Expression expression) { if (!expression.getType().getAssociatedClass().isAssignableTo(Boolean.class)) { throw new PandaParserFailure(context, "Loop requires boolean as an argument"); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/BreakParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/BreakParser.java index dcb5681d4..1afb1ab2c 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/BreakParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/BreakParser.java @@ -44,7 +44,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parseBreak(Context context, @Ctx Scope scope, @Channel Location location, @Channel Snippet source) { + public void parseBreak(Context context, @Ctx Scope scope, @Channel Location location, @Channel Snippet source) { if (!ScopeUtils.lookFor(scope, ControlledScope.class)) { throw new PandaParserFailure(context, source, "Break cannot be used outside of the looping block"); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ContinueParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ContinueParser.java index 19a59b384..19dffe2d6 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ContinueParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ContinueParser.java @@ -44,7 +44,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parseContinue(Context context, @Ctx Scope scope, @Channel Location location, @Channel Snippet source) { + public void parseContinue(Context context, @Ctx Scope scope, @Channel Location location, @Channel Snippet source) { if (!ScopeUtils.lookFor(scope, ControlledScope.class)) { throw new PandaParserFailure(context, source, "Continue cannot be used outside of the looping block"); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ReturnParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ReturnParser.java index cf5bdfa08..fff1f4924 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ReturnParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ReturnParser.java @@ -43,7 +43,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parse(@Ctx Scope scope, @Channel Location location, @Src("value") @Nullable Expression value) { + public void parse(@Ctx Scope scope, @Channel Location location, @Src("value") @Nullable Expression value) { scope.addStatement(new Return(location, value)); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ThrowParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ThrowParser.java index 18f0bbc07..8fcde39c8 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ThrowParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/scope/branching/ThrowParser.java @@ -42,7 +42,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parse(@Ctx Scope block, @Channel Location location, @Src("value") Expression expression) { + public void parse(@Ctx Scope block, @Channel Location location, @Src("value") Expression expression) { block.addStatement(new Throw(location, expression)); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/BaseCallParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/BaseCallParser.java index ff7e2cc9e..3a19abf01 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/BaseCallParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/BaseCallParser.java @@ -50,7 +50,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parse(Context context, @Ctx Scope parent, @Ctx Type type, @Channel Location location, @Channel Snippet src, @Src("args") Snippet args) { + public void parse(Context context, @Ctx Scope parent, @Ctx Type type, @Channel Location location, @Channel Snippet src, @Src("args") Snippet args) { if (!(parent instanceof ConstructorScope)) { throw new PandaParserFailure(context, src, src, "Cannot use base constructor outside of the constructor"); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/ConstructorParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/ConstructorParser.java index d4ded71a4..e7447b5b3 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/ConstructorParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/ConstructorParser.java @@ -59,7 +59,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1) - void parse(Context context, LocalChannel channel, @Channel Location location, @Ctx TypeScope typeScope, @Src("parameters") @Nullable Snippet parametersSource) { + public void parse(Context context, LocalChannel channel, @Channel Location location, @Ctx TypeScope typeScope, @Src("parameters") @Nullable Snippet parametersSource) { List parameters = PARAMETER_PARSER.parse(context, parametersSource); ConstructorScope constructorScope = channel.allocated("scope", new ConstructorScope(location, parameters)); @@ -84,7 +84,7 @@ void parse(Context context, LocalChannel channel, @Channel Location location, @C } @Autowired(order = 2, delegation = Delegation.NEXT_DEFAULT) - void parse(Context context, @Ctx TypeScope typeScope, @Channel ConstructorScope scope, @Channel TypeConstructor constructor, @Channel Snippet src, @Src("body") @Nullable Snippet body) throws Exception { + public void parse(Context context, @Ctx TypeScope typeScope, @Channel ConstructorScope scope, @Channel TypeConstructor constructor, @Channel Snippet src, @Src("body") @Nullable Snippet body) throws Exception { SCOPE_PARSER.parse(context, scope, body); typeScope.getType().getSuperclass() diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/FieldParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/FieldParser.java index 58af95ac8..2c7684ff5 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/FieldParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/FieldParser.java @@ -64,7 +64,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1, cycle = GenerationCycles.TYPES_LABEL) - void parse(Context context, LocalChannel channel, @Channel Mappings mappings, @Channel Location location, @Src("type") Snippet typeName, @Src("name") TokenInfo name) { + public void parse(Context context, LocalChannel channel, @Channel Mappings mappings, @Channel Location location, @Src("type") Snippet typeName, @Src("name") TokenInfo name) { Type returnType = PandaImportsUtils.getTypeOrThrow(context, typeName.asSource(), typeName); Visibility visibility = Visibility.valueOf(mappings.get("visibility").get().toString().toUpperCase()); @@ -88,7 +88,7 @@ void parse(Context context, LocalChannel channel, @Channel Mappings mappings, @C } @Autowired(order = 2, cycle = GenerationCycles.CONTENT_LABEL) - void parseAssignation(Context context, @Channel Snippet source, @Channel TypeField field, @Src("assignation") @Nullable Expression assignationValue) { + public void parseAssignation(Context context, @Channel Snippet source, @Channel TypeField field, @Src("assignation") @Nullable Expression assignationValue) { if (assignationValue == null) { //throw new PandaParserFailure("Cannot parse expression '" + assignationValue + "'", context, name); return; diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/MethodParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/MethodParser.java index dcfe3ef4e..cd2b88498 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/MethodParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/MethodParser.java @@ -78,7 +78,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 1, cycle = GenerationCycles.TYPES_LABEL) - void parseReturnType(Context context, LocalChannel channel, @Ctx Imports imports, @Src("type") Snippet returnTypeName) { + public void parseReturnType(Context context, LocalChannel channel, @Ctx Imports imports, @Src("type") Snippet returnTypeName) { Option.of(returnTypeName) .map(value -> PandaImportsUtils.getTypeOrThrow(context, returnTypeName, "Unknown type {name}", @@ -89,14 +89,14 @@ void parseReturnType(Context context, LocalChannel channel, @Ctx Imports imports } @Autowired(order = 2, cycle = GenerationCycles.TYPES_LABEL) - void parseParameters(Context context, LocalChannel channel, @Src("name") TokenInfo name, @Src("parameters") Snippet parametersSource) { + public void parseParameters(Context context, LocalChannel channel, @Src("name") TokenInfo name, @Src("parameters") Snippet parametersSource) { List parameters = PARAMETER_PARSER.parse(context, parametersSource); MethodScope methodScope = new MethodScope(name.getLocation(), parameters); channel.allocated("scope", methodScope); } @Autowired(order = 3, cycle = GenerationCycles.TYPES_LABEL) - void verifyData( + public void verifyData( Context context, LocalChannel channel, @Ctx Type type, @@ -140,7 +140,7 @@ void verifyData( } @Autowired(order = 4, cycle = GenerationCycles.TYPES_LABEL) - void declareMethod(LocalChannel channel, @Ctx Type type, @Channel Mappings mappings, @Src("name") TokenInfo name, @Channel Type returnType, @Channel MethodScope scope, @Src("body") Snippet body) { + public void declareMethod(LocalChannel channel, @Ctx Type type, @Channel Mappings mappings, @Src("name") TokenInfo name, @Channel Type returnType, @Channel MethodScope scope, @Src("body") Snippet body) { TypeMethod method = PandaMethod.builder() .type(type) .parameters(scope.getParameters()) @@ -159,7 +159,7 @@ void declareMethod(LocalChannel channel, @Ctx Type type, @Channel Mappings mappi } @Autowired(order = 5, delegation = Delegation.NEXT_DEFAULT) - void parse(Context context, @Channel MethodScope methodScope, @Channel TypeMethod method, @Nullable @Src("body") Snippet body) throws Exception { + public void parse(Context context, @Channel MethodScope methodScope, @Channel TypeMethod method, @Nullable @Src("body") Snippet body) throws Exception { if (!SnippetUtils.isEmpty(body)) { SCOPE_PARSER.parse(context, methodScope, body); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/SelfConstructorParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/SelfConstructorParser.java index 718a6b75d..a082655ca 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/SelfConstructorParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/SelfConstructorParser.java @@ -61,7 +61,7 @@ protected Boolean customHandle(Handler handler, Context context, LocalChannel ch } @Autowired(order = 1) - void parse(Context context, @Ctx Scope parent, @Ctx Type type, @Channel Location location, @Src("args") Snippet args) { + public void parse(Context context, @Ctx Scope parent, @Ctx Type type, @Channel Location location, @Src("args") Snippet args) { if (!(parent instanceof ConstructorScope)) { throw new PandaParserFailure(context, args, "Cannot use constructor call outside of the constructor"); } diff --git a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/TypeParser.java b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/TypeParser.java index 4dbdf8c0e..24390663e 100644 --- a/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/TypeParser.java +++ b/panda/src/main/java/org/panda_lang/panda/language/resource/syntax/type/TypeParser.java @@ -88,7 +88,7 @@ protected BootstrapInitializer initialize(Context context, BootstrapInitia } @Autowired(order = 0, cycle = GenerationCycles.TYPES_LABEL) - void parse(Context context, @Channel Location location, @Channel Mappings mappings, @Ctx Script script, @Src("model") String model, @Src("name") String name) { + public void parse(Context context, @Channel Location location, @Channel Mappings mappings, @Ctx Script script, @Src("model") String model, @Src("name") String name) { Visibility visibility = mappings.get("visibility") .map(Visibility::of) .orElseGet(Visibility.INTERNAL); @@ -115,7 +115,7 @@ void parse(Context context, @Channel Location location, @Channel Mappings mappin } @Autowired(order = 1, cycle = GenerationCycles.TYPES_LABEL, delegation = Delegation.CURRENT_AFTER) - void parseDeclaration(Context context, @Ctx Type type, @Ctx TypeLoader loader, @Nullable @Src("inherited") Collection inherited) { + public void parseDeclaration(Context context, @Ctx Type type, @Ctx TypeLoader loader, @Nullable @Src("inherited") Collection inherited) { if (inherited != null) { inherited.forEach(typeSource -> TypeParserUtils.appendExtended(context, type, typeSource)); } @@ -126,12 +126,12 @@ void parseDeclaration(Context context, @Ctx Type type, @Ctx TypeLoader loader, @ } @Autowired(order = 2, cycle = GenerationCycles.TYPES_LABEL, delegation = Delegation.NEXT_BEFORE) - Object parseBody(Context context, @Ctx Type type, @Src("body") Snippet body) throws Exception { + public Object parseBody(Context context, @Ctx Type type, @Src("body") Snippet body) throws Exception { return TYPE_PIPELINE_PARSER.parse(context, new PandaSourceStream(body)); } @Autowired(order = 3, cycle = GenerationCycles.TYPES_LABEL, delegation = Delegation.CURRENT_AFTER) - void verifyProperties(Context context, @Ctx Type type, @Ctx TypeScope scope) { + public void verifyProperties(Context context, @Ctx Type type, @Ctx TypeScope scope) { if (type.getState() != State.ABSTRACT) { type.getBases().stream() .flatMap(base -> base.getMethods().getProperties().stream()) @@ -159,7 +159,7 @@ void verifyProperties(Context context, @Ctx Type type, @Ctx TypeScope scope) { } @Autowired(order = 4, cycle = GenerationCycles.CONTENT_LABEL, delegation = Delegation.CURRENT_AFTER) - void verifyContent(Context context, @Ctx Type type) { + public void verifyContent(Context context, @Ctx Type type) { for (TypeField field : type.getFields().getDeclaredProperties()) { if (!field.isInitialized() && !(field.isNillable() && field.isMutable())) { throw new PandaParserFailure(context, "Field " + field + " is not initialized");