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

remove java_method_typet::final/native #4492

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

kroening
Copy link
Member

@kroening kroening commented Apr 6, 2019

This removes four methods from java_method_typet. They do not belong there,
as neither 'native' nor 'final' are part of the type of the method (they are
field modifiers). They are never read.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Sorry, something went wrong.

@kroening
Copy link
Member Author

kroening commented Apr 6, 2019

The string table test will work again if #4493 is merged before.

@kroening kroening changed the title remove java_method_typet::final/native remove java_method_typet::final/native [depends on: #4493] Apr 6, 2019
smowton
smowton previously requested changes Apr 8, 2019
@@ -431,7 +430,7 @@ void java_bytecode_convert_methodt::convert(
// to the symbol later.
java_method_typet method_type =
to_java_method_type(symbol_table.lookup_ref(method_identifier).type);
method_type.set_is_final(m.is_final);
method_type.set(ID_C_class, class_symbol.name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suspect this is a mis-merge; this is now done by set_declaring_class above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!

@kroening kroening force-pushed the cleanup_java_method_type branch 2 times, most recently from 64cafa2 to d752fcf Compare April 8, 2019 09:19
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: d752fcf).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/107442981
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

@tautschnig tautschnig changed the title remove java_method_typet::final/native [depends on: #4493] remove java_method_typet::final/native Apr 8, 2019
@smowton smowton dismissed their stale review April 8, 2019 13:58

Resolved

@smowton
Copy link
Contributor

smowton commented Apr 8, 2019

Removed my blocking flag but not approved pending @thk123 or similar checking if especially final is relevant to TG

Copy link
Member

@peterschrammel peterschrammel left a comment

Choose a reason for hiding this comment

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

Access, final, native should be attached to symbolt instead of the type.

Copy link
Member

@peterschrammel peterschrammel left a comment

Choose a reason for hiding this comment

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

I'm afraid this requires suggested fix and a goto-binary version bump.

Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

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

I don't think I fully understand the comment "they are field modifiers". Currently methods are not stored as fields, and native and final are method modifiers:

  • A final method is a method that can't be overriden
  • a native method is one whose implementation is not in Java.

I guess they would live on the symbol annotations in the perfect world (like the owning class), but currently these annotations are stored on the method type.

Both these methods are currently used in test-gen, hence adding the tests in CBMC

@peterschrammel peterschrammel assigned kroening and unassigned smowton Apr 10, 2019
@kroening kroening force-pushed the cleanup_java_method_type branch from d752fcf to abc4eac Compare May 1, 2019 15:11
@kroening
Copy link
Member Author

kroening commented May 4, 2019

@peterschrammel No, the access modifiers are not part of the method symbol either. They are properties of the field of the class.

@kroening kroening force-pushed the cleanup_java_method_type branch from abc4eac to 0fcc497 Compare May 4, 2019 14:17
@kroening kroening assigned thk123 and peterschrammel and unassigned kroening May 4, 2019
@kroening kroening force-pushed the cleanup_java_method_type branch from 0fcc497 to 5d1d024 Compare June 18, 2019 20:59
@kroening
Copy link
Member Author

@thk123 @peterschrammel Let me ping you on this one. Note that we do have the methods in the class, including access, final, native. This matches what a JVM would do pretty well.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 5d1d024).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/116035526
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

@codecov-io
Copy link

codecov-io commented Jun 18, 2019

Codecov Report

Merging #4492 into develop will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4492      +/-   ##
===========================================
- Coverage    69.29%   69.29%   -0.01%     
===========================================
  Files         1306     1306              
  Lines       108263   108242      -21     
===========================================
- Hits         75023    75007      -16     
+ Misses       33240    33235       -5
Impacted Files Coverage Δ
...de/java_bytecode_convert_method/convert_method.cpp 100% <ø> (ø) ⬆️
...src/java_bytecode/java_bytecode_convert_method.cpp 97.48% <ø> (-0.01%) ⬇️
jbmc/src/java_bytecode/java_types.h 100% <ø> (ø) ⬆️
src/solvers/flattening/boolbv_get.cpp 78.66% <0%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9643ec2...2c3cb15. Read the comment docs.

@thk123
Copy link
Contributor

thk123 commented Jun 19, 2019

@kroening Happy to discuss this but don't feel like I've got an answer to my question?

As this PR currently stands we lose the ability to know if a particular method is marked as final - which we need in TG. I think I agree that it belongs on the symbol for the method, not on the type itself (both a final and non-final method can be assigned into the interface), but as it stands I don't think we have a way to store this kind of information on the symbol.

Re-read your new comment - I see your suggesting getting this info out of the class type. This could work - I'll have a look how much work it would be.

@kroening
Copy link
Member Author

Note that this would create some consistency in the approach: one would do the same for fields and for methods.
A thing that bugs me is that as of now static fields are not in the class type. I'll separately look into that.

Copy link
Contributor

@jeannielynnmoulton jeannielynnmoulton left a comment

Choose a reason for hiding this comment

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

This information does not appear to be available via java_class_typet methods() yet. methods() is empty.

This line
https://github.com/diffblue/cbmc/pull/4492/files#diff-985ab35118d62c4f1961c30173211fb6L2245
(and this test
https://github.com/diffblue/cbmc/pull/4492/files#diff-4831c2334c252ee2ff67d6334690fb09L172)
contains important information in test-gen for mocking.

@kroening kroening force-pushed the cleanup_java_method_type branch from 5d1d024 to 2c3cb15 Compare July 30, 2019 10:58
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 2c3cb15).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/121239512
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

This removes four methods from java_method_typet.  They do not belong there,
as neither 'native' nor 'final' are part of the type of the method (they are
field modifiers).  They are never read.
@kroening kroening force-pushed the cleanup_java_method_type branch from 2c3cb15 to 6abaf25 Compare August 4, 2019 15:02
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 6abaf25).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/121878421
Status will be re-evaluated on next push.
Common spurious failures include: the cbmc commit has disappeared in the mean time (e.g. in a force-push); the author is not in the list of contributors (e.g. first-time contributors); compatibility was already broken by an earlier merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants