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

Detect method varargs changes #331

Merged
merged 1 commit into from Aug 30, 2022
Merged

Detect method varargs changes #331

merged 1 commit into from Aug 30, 2022

Conversation

Marcono1234
Copy link
Contributor

Changing a method from varargs to non-varargs is most likely a source incompatible change:

void test(int... args) {
}
// to:
void test(int[] args) {
}

Fails with the following source code:

test(1, 2);

Changing a method from non-varargs to varargs is most likely source compatible (unless I am overlooking some corner case with overloads).

Feedback is appreciated!

@@ -265,6 +265,7 @@ private void checkIfConstructorsHaveChangedIncompatible(JApiClass jApiClass, Map
}
}
checkIfAnnotationDeprecatedAdded(constructor);
checkIfVarargsChanged(constructor);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have also added this check for constructors, though the names METHOD_NOW_VARARGS and METHOD_NO_LONGER_VARARGS might be a bit misleading then. Should I rename them?

@siom79 siom79 merged commit 95a4c29 into siom79:master Aug 30, 2022
@siom79
Copy link
Owner

siom79 commented Aug 30, 2022

Released with 0.16.0.

Thanks a lot for the contribution.

@Marcono1234 Marcono1234 deleted the varargs branch September 2, 2022 14:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants