Skip to content

creates two dependencies for one "new" instruction #109

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

Open
NicolasAnquetil opened this issue Oct 7, 2024 · 4 comments · Fixed by #112
Open

creates two dependencies for one "new" instruction #109

NicolasAnquetil opened this issue Oct 7, 2024 · 4 comments · Fixed by #112
Assignees

Comments

@NicolasAnquetil
Copy link
Contributor

take this instruction: new Environnement(graph)

it results in an invocation of the constructor Environnement() + a reference to the type Environnement

So one new results in two dependencies :-(

NicolasAnquetil pushed a commit that referenced this issue Oct 18, 2024
@NicolasAnquetil
Copy link
Contributor Author

Actually, 2 references and one invocation were created for each 'new' !
previous commit removed 1 reference, but there is still another one (+ the invocation)

@NicolasAnquetil
Copy link
Contributor Author

Analyzing:

  • SomeType var = new SomeType(): the new was creating 1 Reference and has been corrected by previous commit
  • someMethod( new SomeType()): was creating 2 References and only one was corrected

@NicolasAnquetil
Copy link
Contributor Author

Re-opening the issue: What association should we create from an instanciation?

Is it:

  • one dependency: the Reference to the class name
  • one dependency: the Invocation of the constructor (possibly, the implicit default constructor)
  • two dependencies: Reference + Invocation

It is worth remembering that in Pharo, we can only create one dependency from AClass new because it would be too difficult to pinpoint all message sends that can end up in calling the instantiate method (the constructor): new could be redefined ; other class side methods could also call instantiate

So do we rollback the change in VerveineJ (considering only the Invocation)?

@badetitou
Copy link
Member

Hello

In my opinion, we should have only the invocation (and not the class reference).
new Blabla() is like a method call. Maybe the declaredType should be Blabla

class reference is for cases such as BlaBla.myVariable

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 a pull request may close this issue.

7 participants