-
Notifications
You must be signed in to change notification settings - Fork 11
Temporary pull request for experiment with join point hierarchy #217
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
base: staging
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the CxxUnaryOp class to extend directly from CxxOp instead of wrapping an AOp instance, and similarly updates the abstract AUnaryOp class to extend from CxxOp rather than AOp. This simplifies the join point hierarchy by removing an unnecessary delegation layer.
Key Changes:
- Simplified inheritance structure by extending
CxxOpdirectly - Removed instance field and delegation pattern in favor of direct method calls
- Updated method implementations to use
getNode()instead of storing a field reference
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| CxxUnaryOp.java | Refactored to extend from parent's node storage instead of maintaining a separate field; updated method implementations to call getNode() |
| AUnaryOp.java | Changed from wrapping AOp to directly extending CxxOp, removing hundreds of lines of delegation code |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private final UnaryOperator unaryOp; | ||
| public class CxxUnaryOp extends AUnaryOp { | ||
|
|
||
| public CxxUnaryOp(UnaryOperator unaryOp) { |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor accepts UnaryOperator but passes it to a parent constructor expecting Operator. While UnaryOperator likely extends Operator, the type signature is misleading. Consider updating the constructor parameter type to match the parent constructor's expected type for clarity.
| public CxxUnaryOp(UnaryOperator unaryOp) { | |
| public CxxUnaryOp(pt.up.fe.specs.clava.ast.expr.Operator unaryOp) { |
| public AUnaryOp(ClavaNode op) { | ||
| super((Operator) op); |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor accepts ClavaNode but immediately casts it to Operator when calling the parent constructor. This introduces an unsafe cast that could fail at runtime if a non-Operator ClavaNode is passed. Consider changing the parameter type to Operator to make the type requirement explicit and move the type safety check to compile time.
| public AUnaryOp(ClavaNode op) { | |
| super((Operator) op); | |
| public AUnaryOp(Operator op) { | |
| super(op); |
Temporary pull request for experiment with join point hierarchy just to show a possibility, and that it passes the tests