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

fix the print of field signatures #793

Merged
merged 2 commits into from
Jan 4, 2024
Merged

Conversation

stschott
Copy link
Collaborator

@stschott stschott commented Jan 3, 2024

fixes missed escaping + StmtPrinter.typeSignature() to adapt type printing

Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (bc6f0bc) 63.38% compared to head (57ebb6c) 63.52%.

Files Patch % Lines
...n/java/sootup/core/util/printer/JimplePrinter.java 0.00% 5 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #793      +/-   ##
=============================================
+ Coverage      63.38%   63.52%   +0.14%     
- Complexity      3376     3382       +6     
=============================================
  Files            314      314              
  Lines          15074    15072       -2     
  Branches        2557     2558       +1     
=============================================
+ Hits            9555     9575      +20     
+ Misses          4626     4604      -22     
  Partials         893      893              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -196,8 +191,12 @@ public void printTo(SootClass<?> cl, PrintWriter out, LabeledStmtPrinter printer
SootField f = (SootField) fieldIt.next();
printer.newline();
printer.handleIndent();
printer.literal(f.getDeclaration());
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need/use/want .getDeclaration() somewhere else? maybe we can remove it.. I mean its nice to have when needed - but I would not expect to find it and its basically just concatenating two SootField methods which I would do quickly myself before searching for getDeclaration() unless I stumbled over it already.

printer.literal(f.getDeclaration());
printer.literal(";");
if (!f.getModifiers().isEmpty()) {
printer.literal(FieldModifier.toString(f.getModifiers()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Offtopic: FieldModifier.toString(...) already assumes valid Modifier combinations (theoretically its currently possible to assign public+private+protected modifier at the same time) - maybe we should implement a wrapper of EnumSet<...Modifier> to handle only valid combinations and implement toString there?

@stschott stschott merged commit 46cd58a into develop Jan 4, 2024
7 of 8 checks passed
@stschott stschott deleted the fix/fieldSignaturePrinting branch January 4, 2024 09:52
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.

2 participants