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

add constructor check utility methods to SootClass #1196

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

stschott
Copy link
Collaborator

No description provided.

Comment on lines +223 to +232
/** @return true if the method is a constructor */
public boolean isConstructor(@Nonnull IdentifierFactory idf) {
return idf.isConstructorSignature(getSignature());
}

/** @return true if the method is the default constructor */
public boolean isDefaultConstructor(@Nonnull IdentifierFactory idf) {
return isConstructor(idf) && getParameterCount() == 0;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

shall we move that into the IdentifierFactory and pass a Signature?

Copy link
Collaborator Author

@stschott stschott Mar 10, 2025

Choose a reason for hiding this comment

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

The IDF already contains the methods for checking singatures. I think it's more intuitive to look for these checks on the SootMethod itself. All the modifier checks are performed on the SootMethod. It seems kinda unintuitive and not obvious for unexperienced users to have to look at the IDF for this info. We might even consider to have a more concrete implementation on the JavaSootMethod that does not even need the IDF as parameter, but directly uses the Java IDF.

@stschott stschott added this pull request to the merge queue Mar 11, 2025
@swissiety swissiety removed this pull request from the merge queue due to the queue being cleared Mar 11, 2025
@swissiety swissiety merged commit d5df408 into develop Mar 11, 2025
7 checks passed
@swissiety swissiety deleted the feature/constructorUtils branch March 11, 2025 15: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.

3 participants