Skip to content

Issue 975 Bugfix TypeAssigner, TypePromotionVisitor filter Constants#985

Merged
stschott merged 6 commits intodevelopfrom
issue-975-typeresolver
Jul 26, 2024
Merged

Issue 975 Bugfix TypeAssigner, TypePromotionVisitor filter Constants#985
stschott merged 6 commits intodevelopfrom
issue-975-typeresolver

Conversation

@sahilagichani14
Copy link
Copy Markdown
Collaborator

run tc using java8 or add new DefaultRTJarAnalysisInputLocation() input location in view

@@ -56,6 +56,13 @@ public static boolean isIntermediateType(Type type) {
}

public void visit(@Nonnull Value value, @Nonnull Type stdType, @Nonnull Stmt stmt) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we be more specific?

Suggested change
public void visit(@Nonnull Value value, @Nonnull Type stdType, @Nonnull Stmt stmt) {
public void visit(@Nonnull Local value, @Nonnull Type stdType, @Nonnull Stmt stmt) {

Copy link
Copy Markdown
Collaborator Author

@sahilagichani14 sahilagichani14 Jul 18, 2024

Choose a reason for hiding this comment

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

we are calling visit function with many different types JInstanceOfExpr, JNewArrayExpr etc so changing in parameter directly won't solve.

  1. if (value instanceof Constant) {return;} I tried this as well instead of [if (!(value instanceof Local))] with different jars but seems like no other special case than Constant so could keep just the check for Constant as well

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

regarding 1st point, I found a TC where if we don't promote just constants, it would lead to an invalid type for int1 type to boolean. so reverted

@sahilagichani14 sahilagichani14 force-pushed the issue-975-typeresolver branch from 1481a7e to 5190cfe Compare July 18, 2024 16:36
@sahilagichani14 sahilagichani14 changed the title Issue 975 Bugfix TypeAssigner Issue 975 Bugfix TypeAssigner, TypePromotionVisitor filter Constants Jul 18, 2024
Comment on lines +59 to +65

/* Note: When visiting function parameters, we may encounter constant values such as strings ("abc") or integers (2).
These constants are not instances of the Local class and should be handled accordingly.
*/
if (!(value instanceof Local)) {
return;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you please make the comment more specific that we are possibly over-approximating here and if things break in future it might be due to this.

@stschott stschott merged commit b7ba8cd into develop Jul 26, 2024
@stschott stschott deleted the issue-975-typeresolver branch July 26, 2024 09:02
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.

[Bug]: TypeResolver AssertionError for String methods expecting CharSequence invoked via String literal

3 participants