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

Add proper type checking and type refinement for binding variables. #5021

Closed
smillst opened this issue Jan 25, 2022 · 1 comment · Fixed by #5032
Closed

Add proper type checking and type refinement for binding variables. #5021

smillst opened this issue Jan 25, 2022 · 1 comment · Fixed by #5032

Comments

@smillst
Copy link
Member

smillst commented Jan 25, 2022

// @below-java17-jdk-skip-test
import org.checkerframework.checker.tainting.qual.Untainted;

public class TaintingBindingVariable {

  void bar1(@Untainted Object o) {
    if (o instanceof String s) {
      @Untainted String f = s;  // legal
    }
  }
  void bar2( Object o) {
    if (o instanceof @Untainted String s) { // error or warning?
      @Untainted String f = s;
    }
  }
}

There should be no errors in the bar1 method, but there should be an error or waring in the bar2 method.

@Rahulrajak1710
Copy link

I would like to work on this issue:)

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.

2 participants