public MethodDefinition( ClassDefinition declaringClass, EnumSet<Access> access, String name, ParameterizedType returnType, Iterable<Parameter> parameters) { checkArgument(Iterables.size(parameters) <= 254, "Too many parameters for method"); this.declaringClass = declaringClass; body = new BytecodeBlock(); this.access = access; this.name = name; if (returnType != null) { this.returnType = returnType; } else { this.returnType = type(void.class); } this.parameters = ImmutableList.copyOf(parameters); this.parameterTypes = Lists.transform(this.parameters, Parameter::getType); this.parameterAnnotations = ImmutableList.copyOf(transform(parameters, input -> new ArrayList<>())); Optional<ParameterizedType> thisType = Optional.empty(); if (!declaringClass.isInterface() && !access.contains(STATIC)) { thisType = Optional.of(declaringClass.getType()); } scope = new Scope(thisType, parameters); }