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

Bug in code generator with 2 uppercase letters following each other #204

Closed
dainiusfigoras opened this issue May 24, 2019 · 1 comment · Fixed by #210
Closed

Bug in code generator with 2 uppercase letters following each other #204

dainiusfigoras opened this issue May 24, 2019 · 1 comment · Fixed by #210
Labels
Bug Reports and/or fixes a bug Java Java/JVM language support

Comments

@dainiusfigoras
Copy link

Hi,

there was recent update in snapshots that allowed us to use ReflectiveValidatorIndex with "option java_multiple_files = true;" and does work very nice and allows us to save some code.
But for some messages it generates wrong code and fails when trying to compile.

In proto file:

    message AddIDToken {
    ...
    }

It generates code:

public class AddIdTokenValidator implements io.envoyproxy.pgv.ValidatorImpl<AddIDToken>{
public static io.envoyproxy.pgv.ValidatorImpl validatorFor(Class clazz) {
		if (clazz.equals(AddIDToken.class)) return new AddIDTokenValidator();
		return null;
	}
}

and fails because it declares class "public class AddIdTokenValidator" (with camelcased Id)
but tries to create "return new AddIDTokenValidator()" (as in message name with upercase ID).

it checks for right proto class "clazz.equals(AddIDToken.class)" so I guess it doesn't matter much of validator class name, as long as it's consistent.

@rmichela
Copy link
Contributor

Great catch. Looking into it.

@rmichela rmichela added Bug Reports and/or fixes a bug Java Java/JVM language support labels May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reports and/or fixes a bug Java Java/JVM language support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants