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

Spurious interning error in for-each loop: "found long, required @Interned long" #6371

Open
Calvin-L opened this issue Dec 14, 2023 · 0 comments

Comments

@Calvin-L
Copy link
Contributor

    public void interningLongs(List<Long> list) {
        for (long i : list) {
            long unused = Math.addExact(i, 0L);
        }
    }

For the above code, the Interning Checker reports

error: [argument] incompatible argument for parameter x of Math.addExact.
   found   : long
   required: @Interned long

It is true that the boxed capital-L Long values in the list are not interned, but I believe they should be treated as interned once they are unboxed to primitive lower-case-L long values.

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

No branches or pull requests

1 participant