Skip to content

Detecting direct access to base class state (4th defect type) #48

Merged
nikololiahim merged 20 commits intomasterfrom
direct_access_to_state_defect
May 15, 2022
Merged

Detecting direct access to base class state (4th defect type) #48
nikololiahim merged 20 commits intomasterfrom
direct_access_to_state_defect

Conversation

@Leosimetti
Copy link
Copy Markdown
Contributor

@Leosimetti Leosimetti commented Apr 3, 2022

This PR contains the following changes:

  1. Implementation of the analyzer for the 4th defect type;
  2. Corresponding Unit-tests of the functionality;
  3. API for polystat.

Example of the defect

The proper way to change the state in the subclass b would be:

[] > a
  memory > state
  [self new_state] > update_state
    seq > @
      state.write new_state
      state
[] > b
  a > @
  [self new_state] > change_state_plus_two
    new_state.add 2 > tmp
    seq > @
      self.update_state self tmp
      state

An improper way to achieve the same functionality in subclass bad:

[] > a
  memory > state
  [self new_state] > update_state
    seq > @
      self.state.write new_state
      self.state
[] > bad
  a > @
  [self new_state] > change_state_plus_two
    seq > @
      self.state.write (new_state.add 2) 
      self.state

More detailed information about the problem statement and implementation is available here.

fizruk
fizruk previously approved these changes Apr 4, 2022
@fizruk
Copy link
Copy Markdown
Member

fizruk commented Apr 4, 2022

Please, add example(s) with explanation to the description of the PR.

nikololiahim
nikololiahim previously approved these changes Apr 4, 2022
Comment thread analysis/src/main/scala/org/polystat/odin/analysis/EOOdinAnalyzer.scala Outdated
Comment thread analysis/src/main/scala/org/polystat/odin/analysis/EOOdinAnalyzer.scala Outdated
@Leosimetti Leosimetti force-pushed the direct_access_to_state_defect branch from 690cacc to 3722747 Compare May 8, 2022 19:11
nikololiahim
nikololiahim previously approved these changes May 15, 2022
@nikololiahim nikololiahim merged commit 017746d into master May 15, 2022
@nikololiahim nikololiahim deleted the direct_access_to_state_defect branch May 15, 2022 19:05
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