Skip to content

[Question] Default parameter values not allowed in overriding method signature #693

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

Open
EotT123 opened this issue Apr 19, 2025 · 0 comments

Comments

@EotT123
Copy link
Contributor

EotT123 commented Apr 19, 2025

It seems that default parameter values cannot be specified in the signature of an overriding method, even though they are allowed in the original interface or superclass. This raises the question of whether there is a technical limitation preventing this behavior, or if it’s just not implemented due to complexity.

public interface FooIntf {
	String test(String foo="foo", String bar);
}

public class Foo implements FooIntf {
	@Override
	public String test(String foo, String bar) { // --> default values cannot be used here
		return foo + bar;
	}
}

Since a class containing the parameters is already generated for the FooIntf interface, would it be feasible to generate a similar class for the Foo class, which extends the first one and includes the default values?

EotT123 pushed a commit to EotT123/manifold-test that referenced this issue Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant