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

Bug with embedded streams #155

Open
khatchad opened this issue Jan 5, 2018 · 6 comments
Open

Bug with embedded streams #155

khatchad opened this issue Jan 5, 2018 · 6 comments
Labels

Comments

@khatchad
Copy link
Member

khatchad commented Jan 5, 2018

There seems to be a bug when a stream is used in a lambda expression that is fed to some intermediate operation. For example:

objects.stream().forEach(o1 -> objects.stream /* ... */).count();

The embedded stream doesn't even seem to have a creation instruction in the IR.

@khatchad khatchad added the bug label Jan 5, 2018
@khatchad
Copy link
Member Author

khatchad commented Jan 5, 2018

There are two cases here:

  1. As above, the tool will assign the same instruction to both stream creations because they appear on the same source line. This is due to Problem with Stream.getInstructionForCreation() #153.
  2. The other case is where they are on different lines, as in:
objects.stream().forEach(o1 -> 
    objects.stream /* ... */).count();

Here, we don't run into #153 because of the line differences. However, since the instruction for the inner stream creation is missing from the IR, we fail.

@khatchad
Copy link
Member Author

khatchad commented Jan 5, 2018

It's likely that the inner stream instruction is in a different IR. Note when I speak of IR above I meant the declaring method IR. The problem though is that there is only one AST. So, our tool thinks that there is a 1-1 and onto correspondence between the IR and the AST, which may not be the case.

@khatchad
Copy link
Member Author

khatchad commented Jan 5, 2018

If this is true, it would seem we would always have an issue when a stream is declared inside of any lambda expression because of the IR differences.

@khatchad
Copy link
Member Author

khatchad commented Jan 5, 2018

Basically what I think is happening here is that we are in a sense declaring a method inside of a method, which completely throws off the tool. Perhaps we can realize that we are dealing with either an AIC or a lambda and thus look up the correct IR.

khatchad added a commit that referenced this issue Jan 5, 2018
khatchad added a commit that referenced this issue Jan 16, 2018
Work on several issues but mainly #155.
@khatchad
Copy link
Member Author

Filed wala/WALA#281. Could be related.

@khatchad
Copy link
Member Author

Could also be related to #162.

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

No branches or pull requests

1 participant